Skip to content

Commit b8170b3

Browse files
author
Michael Babker
committed
Reformat to Joomla CS
1 parent 8ff2949 commit b8170b3

File tree

14 files changed

+496
-363
lines changed

14 files changed

+496
-363
lines changed
Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,26 @@
11
<?php
22
/**
3-
* @package PatchTester
4-
* @copyright Copyright (C) 2011 Ian MacLennan, Inc. All rights reserved.
5-
* @license GNU General Public License version 2 or later; see LICENSE.txt
3+
* @package PatchTester
4+
*
5+
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later
67
*/
78

8-
// No direct access
99
defined('_JEXEC') or die;
1010

1111
/**
1212
* PatchTester Controller
1313
*
1414
* @package PatchTester
15+
* @since 1.0
1516
*/
1617
class PatchTesterController extends JControllerLegacy
1718
{
18-
protected $default_view = 'Pulls';
19-
2019
/**
21-
* Method to display a view.
20+
* The default view for the display method.
2221
*
23-
* @param boolean $cachable If true, the view output will be cached
24-
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
25-
*
26-
* @return JController This object to support chaining.
27-
* @since 1.5
22+
* @var string
23+
* @since 1.0
2824
*/
29-
public function display($cachable = false, $urlparams = false)
30-
{
31-
parent::display();
32-
33-
return $this;
34-
}
25+
protected $default_view = 'pulls';
3526
}
Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,68 @@
11
<?php
22
/**
3-
* @package PatchTester
4-
* @copyright Copyright (C) 2011 Ian MacLennan, Inc. All rights reserved.
5-
* @license GNU General Public License version 2 or later; see LICENSE.txt
3+
* @package PatchTester
4+
*
5+
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later
67
*/
78

8-
// No direct access
99
defined('_JEXEC') or die;
1010

1111
/**
1212
* Pull controller class
1313
*
14-
* @package PatchTester
14+
* @package PatchTester
15+
* @since 1.0
1516
*/
1617
class PatchtesterControllerPull extends JControllerLegacy
1718
{
19+
/**
20+
* Method to apply a patch
21+
*
22+
* @return void
23+
*
24+
* @since 1.0
25+
*/
1826
public function apply()
1927
{
2028
try
2129
{
22-
$this->getModel('pull')
23-
->apply(JFactory::getApplication()->input->getInt('pull_id'));
30+
$this->getModel('pull')->apply(JFactory::getApplication()->input->getInt('pull_id'));
2431

25-
$msg = JText::_('COM_PATCHTESTER_APPLY_OK');
32+
$msg = JText::_('COM_PATCHTESTER_APPLY_OK');
2633
$type = 'message';
2734
}
2835
catch (Exception $e)
2936
{
30-
$msg = $e->getMessage();
37+
$msg = $e->getMessage();
3138
$type = 'error';
3239
}
3340

3441
$this->setRedirect(JRoute::_('index.php?option=com_patchtester&view=pulls', false), $msg, $type);
3542
}
3643

44+
/**
45+
* Method to revert a patch
46+
*
47+
* @return void
48+
*
49+
* @since 1.0
50+
*/
3751
public function revert()
3852
{
3953
try
4054
{
41-
$this->getModel('pull')
42-
->revert(JFactory::getApplication()->input->getInt('pull_id'));
55+
$this->getModel('pull')->revert(JFactory::getApplication()->input->getInt('pull_id'));
4356

44-
$msg = JText::_('COM_PATCHTESTER_REVERT_OK');
57+
$msg = JText::_('COM_PATCHTESTER_REVERT_OK');
4558
$type = 'message';
4659
}
4760
catch (Exception $e)
4861
{
49-
$msg = $e->getMessage();
62+
$msg = $e->getMessage();
5063
$type = 'error';
5164
}
5265

5366
$this->setRedirect(JRoute::_('index.php?option=com_patchtester&view=pulls', false), $msg, $type);
5467
}
55-
5668
}
Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,50 @@
11
<?php
22
/**
3-
* User: elkuku
4-
* Date: 08.09.12
5-
* Time: 19:08
3+
* @package PatchTester
4+
*
5+
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later
7+
*/
8+
9+
defined('_JEXEC') or die;
10+
11+
/**
12+
* Extended JGithub class allowing additional JGithubObject instances to be used
613
*
714
* @property-read PTGithubRepos $repos GitHub API object for repos.
15+
*
16+
* @package PatchTester
17+
* @since 2.0
818
*/
919
class PTGithub extends JGithub
1020
{
11-
/**
12-
* @var PTGithubRepos
13-
*/
14-
protected $repos;
21+
/**
22+
* @var PTGithubRepos
23+
* @since 2.0
24+
*/
25+
protected $repos;
1526

16-
public function __get($name)
17-
{
18-
if ($name == 'repos')
19-
{
20-
if ($this->repos == null)
21-
{
22-
$this->repos = new PTGithubRepos($this->options, $this->client);
23-
}
27+
/**
28+
* Magic method to lazily create API objects
29+
*
30+
* @param string $name Name of property to retrieve
31+
*
32+
* @return JGithubObject GitHub API object (gists, issues, pulls, etc).
33+
*
34+
* @since 2.0
35+
*/
36+
public function __get($name)
37+
{
38+
if ($name == 'repos')
39+
{
40+
if ($this->repos == null)
41+
{
42+
$this->repos = new PTGithubRepos($this->options, $this->client);
43+
}
2444

25-
return $this->repos;
26-
}
45+
return $this->repos;
46+
}
2747

28-
return parent::__get($name);
29-
}
48+
return parent::__get($name);
49+
}
3050
}
Lines changed: 44 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,53 @@
11
<?php
22
/**
3-
* User: elkuku
4-
* Date: 08.09.12
5-
* Time: 18:54
3+
* @package PatchTester
4+
*
5+
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later
67
*/
78

89
/**
9-
* A.
10+
* GitHub API Repos class.
11+
*
12+
* @package PatchTester
13+
* @since 2.0
1014
*/
1115
class PTGithubRepos extends JGithubObject
1216
{
13-
public function get($user, $repo)
14-
{
15-
$path = '/repos/'.$user.'/'.$repo;
16-
17-
// Send the request.
18-
$response = $this->client->get($this->fetchUrl($path));
19-
20-
// Validate the response code.
21-
if($response->code != 200)
22-
{
23-
// Decode the error response and throw an exception.
24-
$error = json_decode($response->body);
25-
26-
throw new DomainException($error->message, $response->code);
27-
}
28-
29-
return json_decode($response->body);
30-
}
31-
32-
/**
33-
* @param string $user
34-
* @param string $type all, owner, public, private, member. Default: all.
35-
* @param string $sort created, updated, pushed, full_name, default: full_name.
36-
* @param string $direction asc or desc, default: when using full_name: asc, otherwise desc.
37-
*
38-
* @return mixed
39-
* @throws DomainException
40-
*/
41-
public function getPublicRepos($user, $type = 'all', $sort = 'full_name', $direction = 'desc')
42-
{
43-
$path = '/users/'.$user.'/repos';
44-
45-
// Send the request.
46-
$response = $this->client->get($this->fetchUrl($path));
47-
48-
// Validate the response code.
49-
if($response->code != 200)
50-
{
51-
// Decode the error response and throw an exception.
52-
$error = json_decode($response->body);
53-
throw new DomainException($error->message, $response->code);
54-
}
55-
56-
return json_decode($response->body);
57-
}
17+
/**
18+
* Retrieve information about the specified repository
19+
*
20+
* @param string $user The username or organization name of the repository owner
21+
* @param string $repo The repository to retrieve
22+
*
23+
* @return object
24+
*
25+
* @since 2.0
26+
* @throws DomainException
27+
*/
28+
public function get($user, $repo)
29+
{
30+
$path = '/repos/' . $user . '/' . $repo;
31+
32+
// Send the request.
33+
return $this->processResponse($this->client->get($this->fetchUrl($path)));
34+
}
35+
36+
/**
37+
* List public repositories for the specified user.
38+
*
39+
* @param string $user The username to retrieve repositories for
40+
*
41+
* @return object
42+
*
43+
* @since 2.0
44+
* @throws DomainException
45+
*/
46+
public function getPublicRepos($user)
47+
{
48+
$path = '/users/' . $user . '/repos';
49+
50+
// Send the request.
51+
return $this->processResponse($this->client->get($this->fetchUrl($path)));
52+
}
5853
}
Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
COM_PATCHTESTER="Patch Tester"
2-
COM_PATCHTESTER_CONFIGURATION="Patch Tester Settings"
3-
COM_PATCHTESTER_NOT_APPLIED="Not Applied"
1+
; Joomla! Project
2+
; Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
3+
; License GNU General Public License version 2 or later
4+
; Note : All ini files need to be saved as UTF-8
5+
6+
COM_PATCHTESTER="Joomla! Patch Tester"
7+
COM_PATCHTESTER_API_LIMIT_ACTION="The GitHub API rate limit has been reached for this resource, could not connect to GitHub to perform the requested action. The rate limit will reset at %s"
8+
COM_PATCHTESTER_API_LIMIT_LIST="The GitHub API rate limit has been reached for this resource, could not connect to GitHub for updated data. The rate limit will reset at %s"
49
COM_PATCHTESTER_APPLIED="Applied"
5-
COM_PATCHTESTER_REVERT_PATCH="Revert Patch"
10+
COM_PATCHTESTER_APPLY_OK="Patch successfully applied"
611
COM_PATCHTESTER_APPLY_PATCH="Apply Patch"
7-
COM_PATCHTESTER_TEST_THIS_PATCH="Test This Patch"
8-
COM_PATCHTESTER_COMPONENT_LABEL="Patch Tester"
9-
COM_PATCHTESTER_COMPONENT_DESC="Patch Tester Configuration Values"
12+
COM_PATCHTESTER_COMPONENT_DESC="Joomla! Patch Tester Configuration Values"
13+
COM_PATCHTESTER_COMPONENT_LABEL="Joomla! Patch Tester"
14+
COM_PATCHTESTER_CONFIGURATION="Joomla! Patch Tester Settings"
15+
COM_PATCHTESTER_CONFLICT_S="The patch could not be applied because it conflicts with a previously applied patch: %s"
16+
COM_PATCHTESTER_FIELD_GH_PASSWORD_LABEL="GitHub Account Password"
17+
COM_PATCHTESTER_FIELD_GH_PASSWORD_DESC="Password for the account entered in the "_QQ_"GitHub Account"_QQ_" field"
18+
COM_PATCHTESTER_FIELD_GH_USER_LABEL="GitHub Account"
19+
COM_PATCHTESTER_FIELD_GH_USER_DESC="Name of account on GitHub of which to authenticate to the API with"
1020
COM_PATCHTESTER_FIELD_ORG_LABEL="GitHub Username"
1121
COM_PATCHTESTER_FIELD_ORG_DESC="Name of account on GitHub of which to monitor pull requests"
1222
COM_PATCHTESTER_FIELD_REPO_LABEL="GitHub Repository"
1323
COM_PATCHTESTER_FIELD_REPO_DESC="Name of repository on GitHub of which to monitor pull requests"
14-
COM_PATCHTESTER_FIELD_GH_USER_LABEL="GitHub Account"
15-
COM_PATCHTESTER_FIELD_GH_USER_DESC="Name of account on GitHub of which to authenticate to the API with"
16-
COM_PATCHTESTER_FIELD_GH_PASSWORD_LABEL="GitHub Account Password"
17-
COM_PATCHTESTER_FIELD_GH_PASSWORD_DESC="Password for the account entered in the "_QQ_"GitHub Account"_QQ_" field"
18-
COM_PATCHTESTER_JOOMLACODE_ISSUE="Joomlacode Issue"
19-
COM_PATCHTESTER_PULL_ID="Pull ID"
20-
COM_PATCHTESTER_SEARCH_IN_PULL_ID="Pull ID"
21-
COM_PATCHTESTER_SEARCH_IN_TITLE="Pull title"
22-
COM_PATCHTESTER_SORT="Sort:"
23-
24-
;messages
25-
COM_PATCHTESTER_REPO_IS_GONE="The patch could not be applied because the repository is missing"
26-
COM_PATCHTESTER_CONFLICT_S="The patch could not be applied because it conflicts with a previously applied patch: %s"
2724
COM_PATCHTESTER_FILE_DELETED_DOES_NOT_EXIST_S="The file marked for deletion does not exist: %s"
2825
COM_PATCHTESTER_FILE_MODIFIED_DOES_NOT_EXIST_S="The file marked for modification does not exist: %s"
29-
COM_PATCHTESTER_API_LIMIT_ACTION="The GitHub API rate limit has been reached for this resource, could not connect to GitHub to perform the requested action. The rate limit will reset at %s"
30-
COM_PATCHTESTER_API_LIMIT_LIST="The GitHub API rate limit has been reached for this resource, could not connect to GitHub for updated data. The rate limit will reset at %s"
26+
COM_PATCHTESTER_JOOMLACODE_ISSUE="Joomlacode Issue"
27+
COM_PATCHTESTER_PULL_ID="Pull ID"
3128
COM_PATCHTESTER_NO_CREDENTIALS="No user credentials are saved, this will allow only 60 requests to the GitHub API per hour. Saving user credentials will allow 5,000 requests per hour."
32-
29+
COM_PATCHTESTER_NOT_APPLIED="Not Applied"
3330
COM_PATCHTESTER_OPEN_IN_GITHUB="Open in GitHub"
3431
COM_PATCHTESTER_OPEN_IN_JOOMLACODE="Open in JoomlaCode"
35-
COM_PATCHTESTER_APPLY_OK="Patch successfully applied"
32+
COM_PATCHTESTER_REPO_IS_GONE="The patch could not be applied because the repository is missing"
3633
COM_PATCHTESTER_REVERT_OK="Patch successfully reverted"
34+
COM_PATCHTESTER_REVERT_PATCH="Revert Patch"
35+
COM_PATCHTESTER_SEARCH_IN_PULL_ID="Pull ID"
36+
COM_PATCHTESTER_SEARCH_IN_TITLE="Pull title"
37+
COM_PATCHTESTER_SORT="Sort:"
38+
COM_PATCHTESTER_TEST_THIS_PATCH="Test This Patch"
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
COM_PATCHTESTER="Patch Tester"
1+
; Joomla! Project
2+
; Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
3+
; License GNU General Public License version 2 or later
4+
; Note : All ini files need to be saved as UTF-8
5+
6+
COM_PATCHTESTER="Joomla! Patch Tester"
27
COM_PATCHTESTER_XML_DESCRIPTION="Component for pull request management testing"
38

0 commit comments

Comments
 (0)