Navigation Menu

Skip to content

Commit

Permalink
Improve coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
madhuracj committed Mar 18, 2012
1 parent 0c5b25b commit 4cb5bcd
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 178 deletions.
50 changes: 30 additions & 20 deletions libraries/Index.class.php
Expand Up @@ -86,7 +86,7 @@ class PMA_Index
/**
* Constructor
*
* @param array $params
* @param array $params parameters
*/
public function __construct($params = array())
{
Expand All @@ -111,9 +111,10 @@ static public function singleton($schema, $table, $index_name = '')
/**
* returns an array with all indexes from the given table
*
* @param string $table
* @param string $schema
* @return array
* @param string $table table
* @param string $schema schema
*
* @return array array of indexes
*/
static public function getFromTable($table, $schema)
{
Expand All @@ -129,8 +130,9 @@ static public function getFromTable($table, $schema)
/**
* return primary if set, false otherwise
*
* @param string $table
* @param string $schema
* @param string $table table
* @param string $schema schema
*
* @return mixed primary index or false if no one exists
*/
static public function getPrimary($table, $schema)
Expand All @@ -147,9 +149,10 @@ static public function getPrimary($table, $schema)
/**
* Load index data for table
*
* @param string $table
* @param string $schema
* @return boolean
* @param string $table table
* @param string $schema schema
*
* @return boolean whether loading was successful
*/
static protected function _loadIndexes($table, $schema)
{
Expand Down Expand Up @@ -177,6 +180,8 @@ static protected function _loadIndexes($table, $schema)
* Add column to index
*
* @param array $params column params
*
* @return void
*/
public function addColumn($params)
{
Expand Down Expand Up @@ -216,8 +221,9 @@ public function addColumns($columns)
/**
* Returns true if $column indexed in this index
*
* @param string $column
* @return boolean
* @param string $column the column
*
* @return boolean true if $column indexed in this index
*/
public function hasColumn($column)
{
Expand Down Expand Up @@ -324,8 +330,9 @@ public function generateIndexSelector()

foreach (PMA_Index::getIndexChoices() as $each_index_choice) {
if ($each_index_choice === 'PRIMARY'
&& $this->_choice !== 'PRIMARY'
&& PMA_Index::getPrimary($this->_table, $this->_schema)) {
&& $this->_choice !== 'PRIMARY'
&& PMA_Index::getPrimary($this->_table, $this->_schema)
) {
// skip PRIMARY if there is already one in the table
continue;
}
Expand Down Expand Up @@ -403,12 +410,13 @@ public function getColumns()
/**
* Show index data
*
* @param string $table The tablename
* @param array $indexes_info Referenced info array
* @param array $indexes_data Referenced data array
* @param boolean $print_mode
* @param string $table The table name
* @param string $schema The schema name
* @param boolean $print_mode Whether the output is for the print mode
*
* @return array Index collection array
*
* @access public
* @return array Index collection array
*/
static public function getView($table, $schema, $print_mode = false)
{
Expand Down Expand Up @@ -543,9 +551,11 @@ public function getCompareData()
/**
* Function to check over array of indexes and look for common problems
*
* @param string $table table name
* @param string $schema schema name
*
* @return string Output HTML
* @access public
* @param string name of table
* @return string Output HTML
*/
static public function findDuplicates($table, $schema)
{
Expand Down
28 changes: 18 additions & 10 deletions libraries/List_Database.class.php
Expand Up @@ -56,8 +56,8 @@
/**
* Constructor
*
* @param mixed $db_link_user user database link resource|object
* @param mixed $db_link_control control database link resource|object
* @param mixed $db_link_user user database link resource|object
* @param mixed $db_link_control control database link resource|object
*/
public function __construct($db_link_user = null, $db_link_control = null)
{
Expand Down Expand Up @@ -88,9 +88,10 @@ protected function _checkHideDatabase()
/**
* retrieves database list from server
*
* @todo we could also search mysql tables if all fail?
* @param string $like_db_name usally a db_name containing wildcards
* @param string $like_db_name usally a db_name containing wildcards
*
* @return array
* @todo we could also search mysql tables if all fail?
*/
protected function _retrieve($like_db_name = null)
{
Expand All @@ -101,8 +102,10 @@ protected function _retrieve($like_db_name = null)
if (null !== $like_db_name) {
$command = "SHOW DATABASES LIKE '" . $like_db_name . "'";
} elseif (null === $this->_command) {
$command = str_replace('#user#', $GLOBALS['cfg']['Server']['user'],
$GLOBALS['cfg']['Server']['ShowDatabasesCommand']);
$command = str_replace(
'#user#', $GLOBALS['cfg']['Server']['user'],
$GLOBALS['cfg']['Server']['ShowDatabasesCommand']
);
$this->_command = $command;
} else {
$command = $this->_command;
Expand Down Expand Up @@ -161,7 +164,8 @@ public function build()
protected function _checkOnlyDatabase()
{
if (is_string($GLOBALS['cfg']['Server']['only_db'])
&& strlen($GLOBALS['cfg']['Server']['only_db'])) {
&& strlen($GLOBALS['cfg']['Server']['only_db'])
) {
$GLOBALS['cfg']['Server']['only_db'] = array(
$GLOBALS['cfg']['Server']['only_db']
);
Expand All @@ -176,8 +180,9 @@ protected function _checkOnlyDatabase()
foreach ($GLOBALS['cfg']['Server']['only_db'] as $each_only_db) {
if ($each_only_db === '*' && ! $this->_show_databases_disabled) {
// append all not already listed dbs to the list
$items = array_merge($items,
array_diff($this->_retrieve(), $items));
$items = array_merge(
$items, array_diff($this->_retrieve(), $items)
);
// there can only be one '*', and this can only be last
break;
}
Expand Down Expand Up @@ -222,14 +227,16 @@ public function getDefault()
*
* @param integer $offset
* @param integer $count
*
* @return array db list
*/
public function getGroupedDetails($offset, $count)
{
$dbgroups = array();

if ($GLOBALS['cfg']['ShowTooltip']
&& $GLOBALS['cfgRelation']['commwork']) {
&& $GLOBALS['cfgRelation']['commwork']
) {
$db_tooltips = PMA_getDbComments();
}

Expand Down Expand Up @@ -299,6 +306,7 @@ public function getGroupedDetails($offset, $count)
*
* @param integer $offset
* @param integer $count
*
* @return array some items
*/
public function getLimitedItems($offset, $count)
Expand Down
6 changes: 3 additions & 3 deletions libraries/iconv_wrapper.lib.php
Expand Up @@ -40,9 +40,9 @@
* Wrapper around IBM AIX iconv(), whose character set naming differs
* from the GNU version of iconv().
*
* @param string input character set
* @param string output character set
* @param string the string to convert
* @param string $in_charset input character set
* @param string $out_charset output character set
* @param string $str the string to convert
*
* @return mixed converted string or false on failure
*
Expand Down

0 comments on commit 4cb5bcd

Please sign in to comment.