From ced43af95d87bbb320df07cc56cac09135eca3ce Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Thu, 26 Nov 2015 19:48:37 +1100 Subject: [PATCH 1/3] More style violations in controllers fixed Signed-off-by: Madhura Jayaratne --- .../server/ServerDatabasesController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/controllers/server/ServerDatabasesController.php b/libraries/controllers/server/ServerDatabasesController.php index e0a5fa946c..b798173523 100644 --- a/libraries/controllers/server/ServerDatabasesController.php +++ b/libraries/controllers/server/ServerDatabasesController.php @@ -451,12 +451,12 @@ class ServerDatabasesController extends Controller * Builds the HTML for one database to display in the list * of databases from server_databases.php * - * @param array $current current database - * @param string $url_query url query - * @param array $column_order column order - * @param array $replication_types replication types - * @param array $replication_info replication info - * @param string $tr_class HTMl class for the row + * @param array $current current database + * @param string $url_query url query + * @param array $column_order column order + * @param array $replication_types replication types + * @param array $replication_info replication info + * @param string $tr_class HTMl class for the row * * @return array $column_order, $out */ @@ -484,8 +484,8 @@ class ServerDatabasesController extends Controller if (/*overload*/mb_strlen($key) > 0 || (isset($replication_info[$type]['Do_DB'][0]) - && $replication_info[$type]['Do_DB'][0] == "" - && count($replication_info[$type]['Do_DB']) == 1) + && $replication_info[$type]['Do_DB'][0] == "" + && count($replication_info[$type]['Do_DB']) == 1) ) { // if ($key != null) did not work for index "0" $out = Util::getIcon( From 1cffd63940e656bf6417bfc07d879f7b8864f7da Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Thu, 26 Nov 2015 19:54:39 +1100 Subject: [PATCH 2/3] More coding style fixes Signed-off-by: Madhura Jayaratne --- libraries/server_privileges.lib.php | 4 ++-- user_password.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 2aef72a122..d8758ff86f 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -2047,8 +2047,8 @@ function PMA_updatePassword($err_url, $username, $hostname) if (empty($message)) { $hashing_function = 'PASSWORD'; $serverType = Util::getServerType(); - $authentication_plugin = - (isset($_REQUEST['authentication_plugin']) + $authentication_plugin + = (isset($_REQUEST['authentication_plugin']) ? $_REQUEST['authentication_plugin'] : PMA_getCurrentAuthenticationPlugin( 'change', diff --git a/user_password.php b/user_password.php index 32912bd5d1..380cf29727 100644 --- a/user_password.php +++ b/user_password.php @@ -212,12 +212,12 @@ function PMA_changePassHashingFunction() /** * Generate the error url and submit the query * - * @param string $username Username - * @param string $hostname Hostname - * @param string $password Password - * @param string $sql_query SQL query - * @param string $hashing_function Hashing function - * @param string $orig_auth_plugin Original Authentication Plugin + * @param string $username Username + * @param string $hostname Hostname + * @param string $password Password + * @param string $sql_query SQL query + * @param string $hashing_function Hashing function + * @param string $orig_auth_plugin Original Authentication Plugin * * @return void */ From b8c992035e66c00c671cf9d9f0d461251664dcae Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Thu, 26 Nov 2015 19:59:12 +1100 Subject: [PATCH 3/3] Prefix private variables with underscore Signed-off-by: Madhura Jayaratne --- .../DatabaseStructureControllerTest.php | 12 ++++++------ .../controllers/TableRelationControllerTest.php | 14 +++++++------- .../controllers/TableSearchControllerTest.php | 8 ++++---- .../controllers/TableStructureControllerTest.php | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/test/classes/controllers/DatabaseStructureControllerTest.php b/test/classes/controllers/DatabaseStructureControllerTest.php index 6b5d52a410..a2fc4e73df 100644 --- a/test/classes/controllers/DatabaseStructureControllerTest.php +++ b/test/classes/controllers/DatabaseStructureControllerTest.php @@ -31,7 +31,7 @@ class DatabaseStructureControllerTest extends PHPUnit_Framework_TestCase /** * @var \PMA\Test\Stubs\Response */ - private $response; + private $_response; /** * Prepares environment for the test. @@ -84,8 +84,8 @@ class DatabaseStructureControllerTest extends PHPUnit_Framework_TestCase $container->set('db', 'db'); $container->set('table', 'table'); $container->set('dbi', $GLOBALS['dbi']); - $this->response = new \PMA\Test\Stubs\Response(); - $container->set('PMA\libraries\Response', $this->response); + $this->_response = new \PMA\Test\Stubs\Response(); + $container->set('PMA\libraries\Response', $this->_response); $container->alias('response', 'PMA\libraries\Response'); } @@ -368,7 +368,7 @@ class DatabaseStructureControllerTest extends PHPUnit_Framework_TestCase ); $method->invokeArgs($ctrl, array($fav_instance, $user, $favorite_table)); - $json = $this->response->getJSONResult(); + $json = $this->_response->getJSONResult(); $this->assertEquals(json_encode($favorite_table), $json['favorite_tables']); $this->assertArrayHasKey('list', $json); @@ -395,7 +395,7 @@ class DatabaseStructureControllerTest extends PHPUnit_Framework_TestCase ); $ctrl->handleRealRowCountRequestAction(); - $json = $this->response->getJSONResult(); + $json = $this->_response->getJSONResult(); $this->assertEquals( 6, $json['real_row_count'] @@ -409,7 +409,7 @@ class DatabaseStructureControllerTest extends PHPUnit_Framework_TestCase ) ); $ctrl->handleRealRowCountRequestAction(); - $json = $this->response->getJSONResult(); + $json = $this->_response->getJSONResult(); $expected_result = array( array( diff --git a/test/classes/controllers/TableRelationControllerTest.php b/test/classes/controllers/TableRelationControllerTest.php index 4932024261..a942019e81 100644 --- a/test/classes/controllers/TableRelationControllerTest.php +++ b/test/classes/controllers/TableRelationControllerTest.php @@ -28,7 +28,7 @@ class TableRelationControllerTest extends PHPUnit_Framework_TestCase /** * @var \PMA\Test\Stubs\Response */ - private $response; + private $_response; /** * Configures environment @@ -60,8 +60,8 @@ class TableRelationControllerTest extends PHPUnit_Framework_TestCase $container->set('db', 'db'); $container->set('table', 'table'); $container->set('dbi', $GLOBALS['dbi']); - $this->response = new \PMA\Test\Stubs\Response(); - $container->set('PMA\libraries\Response', $this->response); + $this->_response = new \PMA\Test\Stubs\Response(); + $container->set('PMA\libraries\Response', $this->_response); $container->alias('response', 'PMA\libraries\Response'); } @@ -104,7 +104,7 @@ class TableRelationControllerTest extends PHPUnit_Framework_TestCase $ctrl = $container->get('TableRelationController'); $ctrl->getDropdownValueForTableAction(); - $json = $this->response->getJSONResult(); + $json = $this->_response->getJSONResult(); $this->assertEquals( $viewColumns, $json['columns'] @@ -147,7 +147,7 @@ class TableRelationControllerTest extends PHPUnit_Framework_TestCase $ctrl = $container->get('TableRelationController'); $ctrl->getDropdownValueForTableAction(); - $json = $this->response->getJSONResult(); + $json = $this->_response->getJSONResult(); $this->assertEquals( $indexedColumns, $json['columns'] @@ -193,7 +193,7 @@ class TableRelationControllerTest extends PHPUnit_Framework_TestCase $_REQUEST['foreign'] = 'true'; $ctrl->getDropdownValueForDbAction(); - $json = $this->response->getJSONResult(); + $json = $this->_response->getJSONResult(); $this->assertEquals( array('table'), $json['tables'] @@ -239,7 +239,7 @@ class TableRelationControllerTest extends PHPUnit_Framework_TestCase $_REQUEST['foreign'] = 'false'; $ctrl->getDropdownValueForDbAction(); - $json = $this->response->getJSONResult(); + $json = $this->_response->getJSONResult(); $this->assertEquals( array('table'), $json['tables'] diff --git a/test/classes/controllers/TableSearchControllerTest.php b/test/classes/controllers/TableSearchControllerTest.php index 1bf87c0969..0343f42202 100644 --- a/test/classes/controllers/TableSearchControllerTest.php +++ b/test/classes/controllers/TableSearchControllerTest.php @@ -26,7 +26,7 @@ class TableSearchControllerTest extends PHPUnit_Framework_TestCase /** * @var PMA\Test\Stubs\Response */ - private $response; + private $_response; /** * Setup function for test cases @@ -96,13 +96,13 @@ class TableSearchControllerTest extends PHPUnit_Framework_TestCase $GLOBALS['dbi'] = $dbi; - $this->response = new PMA\Test\Stubs\Response(); + $this->_response = new PMA\Test\Stubs\Response(); $container = Container::getDefaultContainer(); $container->set('db', 'PMA'); $container->set('table', 'PMA_BookMark'); $container->set('dbi', $GLOBALS['dbi']); - $container->set('response', $this->response); + $container->set('response', $this->_response); $container->set('searchType', 'replace'); } @@ -380,7 +380,7 @@ class TableSearchControllerTest extends PHPUnit_Framework_TestCase ); $ctrl->getDataRowAction(); - $json = $this->response->getJSONResult(); + $json = $this->_response->getJSONResult(); $this->assertEquals( $expected, $json['row_info'] diff --git a/test/classes/controllers/TableStructureControllerTest.php b/test/classes/controllers/TableStructureControllerTest.php index 96e11f7473..b3c2b8a13c 100644 --- a/test/classes/controllers/TableStructureControllerTest.php +++ b/test/classes/controllers/TableStructureControllerTest.php @@ -29,7 +29,7 @@ class TableStructureControllerTest extends PHPUnit_Framework_TestCase /** * @var \PMA\Test\Stubs\Response */ - private $response; + private $_response; /** * Prepares environment for the test. @@ -77,8 +77,8 @@ class TableStructureControllerTest extends PHPUnit_Framework_TestCase $container->set('db', 'db'); $container->set('table', 'table'); $container->set('dbi', $GLOBALS['dbi']); - $this->response = new \PMA\Test\Stubs\Response(); - $container->set('PMA\libraries\Response', $this->response); + $this->_response = new \PMA\Test\Stubs\Response(); + $container->set('PMA\libraries\Response', $this->_response); $container->alias('response', 'PMA\libraries\Response'); }