Skip to content

Commit

Permalink
Minor coding standards fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk authored and ifsnop committed Dec 1, 2018
1 parent 1a4c418 commit 4de8e01
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/Ifsnop/Mysqldump/Mysqldump.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ private function getDatabaseStructureEvents()
* @param $arr array with strings or patterns
* @return bool
*/
private function matches($table, $arr) {
private function matches($table, $arr)
{
$match = false;

foreach ($arr as $pattern) {
Expand Down Expand Up @@ -584,7 +585,7 @@ private function exportTables()
$this->getTableStructure($table);
if (false === $this->dumpSettings['no-data']) { // don't break compatibility with old trigger
$this->listValues($table);
} else if (true === $this->dumpSettings['no-data']
} elseif (true === $this->dumpSettings['no-data']
|| $this->matches($table, $this->dumpSettings['no-data'])) {
continue;
} else {
Expand Down Expand Up @@ -698,7 +699,8 @@ private function getTableStructure($tableName)
* @return array type column types detailed
*/

private function getTableColumnTypes($tableName) {
private function getTableColumnTypes($tableName)
{
$columnTypes = array();
$columns = $this->dbHandler->query(
$this->typeAdapter->show_columns($tableName)
Expand Down Expand Up @@ -758,7 +760,8 @@ private function getViewStructureTable($viewName)
* @param string $viewName Name of view to export
* @return string create statement
*/
function createStandInTable($viewName) {
public function createStandInTable($viewName)
{
$ret = array();
foreach ($this->tableColumnTypes[$viewName] as $k => $v) {
$ret[] = "`${k}` ${v['type_sql']}";
Expand Down Expand Up @@ -985,7 +988,6 @@ private function listValues($tableName)
foreach ($resultSet as $row) {
$vals = $this->prepareColumnValues($tableName, $row);
if ($onlyOnce || !$this->dumpSettings['extended-insert']) {

if ($this->dumpSettings['complete-insert']) {
$lineSize += $this->compressManager->write(
"INSERT$ignore INTO `$tableName` (".
Expand Down Expand Up @@ -1023,7 +1025,7 @@ private function listValues($tableName)
*
* @return null
*/
function prepareListValues($tableName)
public function prepareListValues($tableName)
{
if (!$this->dumpSettings['skip-comments']) {
$this->compressManager->write(
Expand Down Expand Up @@ -1071,7 +1073,7 @@ function prepareListValues($tableName)
*
* @return null
*/
function endListValues($tableName)
public function endListValues($tableName)
{
if ($this->dumpSettings['disable-keys']) {
$this->compressManager->write(
Expand Down Expand Up @@ -1112,15 +1114,15 @@ function endListValues($tableName)
*
* @return array SQL sentence with columns for select
*/
function getColumnStmt($tableName)
public function getColumnStmt($tableName)
{
$colStmt = array();
foreach ($this->tableColumnTypes[$tableName] as $colName => $colType) {
if ($colType['type'] == 'bit' && $this->dumpSettings['hex-blob']) {
$colStmt[] = "LPAD(HEX(`${colName}`),2,'0') AS `${colName}`";
} else if ($colType['is_blob'] && $this->dumpSettings['hex-blob']) {
} elseif ($colType['is_blob'] && $this->dumpSettings['hex-blob']) {
$colStmt[] = "HEX(`${colName}`) AS `${colName}`";
} else if ($colType['is_virtual']) {
} elseif ($colType['is_virtual']) {
$this->dumpSettings['complete-insert'] = true;
continue;
} else {
Expand All @@ -1138,10 +1140,10 @@ function getColumnStmt($tableName)
*
* @return array columns for sql sentence for insert
*/
function getColumnNames($tableName)
public function getColumnNames($tableName)
{
$colNames = array();
foreach($this->tableColumnTypes[$tableName] as $colName => $colType) {
foreach ($this->tableColumnTypes[$tableName] as $colName => $colType) {
if ($colType['is_virtual']) {
$this->dumpSettings['complete-insert'] = true;
continue;
Expand Down Expand Up @@ -1678,7 +1680,7 @@ public function create_view($row)
{
$ret = "";
if (!isset($row['Create View'])) {
throw new Exception("Error getting view structure, unknown output");
throw new Exception("Error getting view structure, unknown output");
}

$viewStmt = $row['Create View'];
Expand Down Expand Up @@ -1868,7 +1870,6 @@ public function lock_table()
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
$args = func_get_args();
return $this->dbHandler->exec("LOCK TABLES `${args[0]}` READ LOCAL");

}

public function unlock_table()
Expand Down Expand Up @@ -1968,7 +1969,7 @@ public function parseColumnType($colType)
if ($fparen = strpos($colParts[0], "(")) {
$colInfo['type'] = substr($colParts[0], 0, $fparen);
$colInfo['length'] = str_replace(")", "", substr($colParts[0], $fparen + 1));
$colInfo['attributes'] = isset($colParts[1]) ? $colParts[1] : NULL;
$colInfo['attributes'] = isset($colParts[1]) ? $colParts[1] : null;
} else {
$colInfo['type'] = $colParts[0];
}
Expand Down

0 comments on commit 4de8e01

Please sign in to comment.