Commit 72630fa2 authored by abkrim's avatar abkrim 😀
Browse files

Correct PHPCS PSR2 faillures

parent d4ce1808
Pipeline #194 failed with stages
in 55 seconds
......@@ -77,7 +77,6 @@ class HelpSchema extends Command
$data = [$key, $value];
array_push($this->body, $data);
}
}
/**
......
......@@ -7,7 +7,6 @@ use Abkrim\DbSchema\Schema\Helper;
use Abkrim\DbSchema\DbSchema;
use Symfony\Component\Console\Input\InputOption;
class ListSchema extends Command
{
use Helper;
......
......@@ -74,7 +74,7 @@ class MonitorSchema extends Command
$timeInterval = $this->option('i');
}
for ($i = 1; ; $i++) {
for ($i = 1;; $i++) {
$this->info("Fetching ($i):");
$this->table($this->headers, $this->dbschema->databaseWrapper->showDatabaseStatus($timeInterval));
$this->line('');
......@@ -88,5 +88,4 @@ class MonitorSchema extends Command
['c', 'c', InputOption::VALUE_OPTIONAL, 'Connection name']
];
}
}
......@@ -6,7 +6,6 @@ use Abkrim\DbSchema\DbSchema;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
class QuerySchema extends Command
{
/**
......@@ -73,6 +72,4 @@ class QuerySchema extends Command
['c', 'c', InputOption::VALUE_OPTIONAL, 'Connection name'],
];
}
}
......@@ -2,7 +2,6 @@
namespace Abkrim\DbSchema\Console\Commands;
use Abkrim\DbSchema\DbSchema;
use Abkrim\DbSchema\Schema\Helper;
use Illuminate\Console\Command;
......
......@@ -2,7 +2,6 @@
namespace Abkrim\DbSchema\Console\Commands;
use Abkrim\DbSchema\DbSchema;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
......@@ -74,5 +73,4 @@ class SimpleSchema extends Command
['c', 'c', InputOption::VALUE_OPTIONAL, 'Connection name'],
];
}
}
......@@ -2,7 +2,6 @@
namespace Abkrim\DbSchema\Console\Commands;
use Abkrim\DbSchema\DbSchema;
use Abkrim\DbSchema\Schema\Helper;
use Illuminate\Console\Command;
......@@ -101,8 +100,9 @@ class TableSchema extends Command
if (!$select) {
$headers[] = $column['Field'];
} else {
if (($selected == $column['Field']))
if (($selected == $column['Field'])) {
$headers[] = $column['Field'];
}
}
}
}
......@@ -122,7 +122,8 @@ class TableSchema extends Command
}
if (!in_array($attributeName, $headers)) {
$this->warn("There is no column named '$attributeName'. Please provide a correct column name for ordering!");
$this->warn("There is no column named '$attributeName'.
Please provide a correct column name for ordering!");
return false;
}
......@@ -176,5 +177,4 @@ class TableSchema extends Command
['s', 's', InputOption::VALUE_OPTIONAL, 'Selected columns name'],
];
}
}
......@@ -27,11 +27,9 @@ class DbSchemaServiceProvider extends ServiceProvider
// $this->loadRoutesFrom(__DIR__.'/routes.php');
if ($this->app->runningInConsole()) {
$this->commands([
ShowSchema::class,
ListSchema::class,
]);
$this->publishes([
......
......@@ -36,7 +36,7 @@ trait Helper
* @param $bytes
* @return string
*/
function formatBytes($bytes)
public function formatBytes($bytes)
{
$bytes = floatval($bytes);
$arBytes = array(
......@@ -62,12 +62,13 @@ trait Helper
),
);
foreach($arBytes as $arItem)
foreach ($arBytes as $arItem)
{
if($bytes >= $arItem["VALUE"])
if ($bytes >= $arItem["VALUE"])
{
$result = $bytes / $arItem["VALUE"];
$result = str_replace(".", "," , strval(round($result, 2)))." ".$arItem["UNIT"];
$result = str_replace(".", ",", strval(round($result, 2))) . " " . $arItem["UNIT"];
break;
}
}
......
......@@ -198,7 +198,8 @@ class MySQLWrapper implements WrapperContract
],
['', '', '', '', '', '', '', ''],
[
'Payload received', $this->formatBytes(round(($endByteReceived - $startByteReceived) / $timeSpan)) . '/s',
'Payload received',
$this->formatBytes(round(($endByteReceived - $startByteReceived) / $timeSpan)) . '/s',
'Table', round(($endCreateTable - $startCreateTable) / $timeSpan) . ' PS',
'Procedure', round(($endAlterProcedure - $startAlterProcedure) / $timeSpan) . ' PS',
'Server', round(($endDropServer - $startDropServer) / $timeSpan) . ' PS'
......
......@@ -16,7 +16,8 @@ class PostgresWrapper implements WrapperContract
public function getTables()
{
$tables = $this->BaseDbSchema->database->select("SELECT table_name FROM information_schema.tables WHERE table_schema='public'");
$tables = $this->BaseDbSchema->database
->select("SELECT table_name FROM information_schema.tables WHERE table_schema='public'");
return array_map(function ($table) {
return $table->table_name;
}, $tables);
......@@ -24,7 +25,9 @@ class PostgresWrapper implements WrapperContract
public function getColumns($tableName)
{
return $this->transformColumns($this->BaseDbSchema->database->select("SELECT ordinal_position, column_name, data_type, is_nullable, column_default FROM information_schema.columns WHERE table_name ='$tableName'"));
return $this->transformColumns($this->BaseDbSchema->database
->select("SELECT ordinal_position, column_name, data_type, is_nullable, column_default
FROM information_schema.columns WHERE table_name ='$tableName'"));
}
public function getSchema()
......
......@@ -17,7 +17,9 @@ class SqlServerWrapper implements WrapperContract
public function getTables()
{
$databaseName = $this->BaseDbSchema->getDatabaseName();
$tables = $this->BaseDbSchema->database->select("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_CATALOG='$databaseName'");
$tables = $this->BaseDbSchema->database
->select("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_CATALOG='$databaseName'");
return array_map(function ($table) {
return $table->TABLE_NAME;
}, $tables);
......@@ -25,7 +27,9 @@ class SqlServerWrapper implements WrapperContract
public function getColumns($tableName)
{
return $this->transformColumns($this->BaseDbSchema->database->select("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$tableName'ORDER BY ORDINAL_POSITION"));
return $this->transformColumns($this->BaseDbSchema->database
->select("SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = '$tableName'ORDER BY ORDINAL_POSITION"));
}
public function getSchema()
......@@ -35,6 +39,7 @@ class SqlServerWrapper implements WrapperContract
$this->dbSchema[$table]['attributes'] = $columns;
$this->dbSchema[$table]['rowsCount'] = $this->BaseDbSchema->getTableRowCount($table);
}
return $this->dbSchema;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment