fucongcong/framework

View on GitHub
core/Group/Console/Command/SqlRollBackCommand.php

Summary

Maintainability
A
1 hr
Test Coverage

Showing 10 of 10 total issues

Function ListSql has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

private function ListSql($sqlDir)
{
$files = [];
if (is_dir($sqlDir)) {
$dir = opendir($sqlDir);
Severity: Minor
Found in core/Group/Console/Command/SqlRollBackCommand.php - About 1 hr to fix

Missing class import via use statement (line '21', column '26').
Open

$this->dao = new \Dao();

The method doSql has a boolean flag argument $needOutput, which is a certain sign of a Single Responsibility Principle violation.
Open

private function doSql($sql, $needOutput = true)

Method name "SqlRollBackCommand::ListSql" is not in camel caps format
Open

private function ListSql($sqlDir)

Inline control structures are not allowed
Open

if ($needOutput) $this->outPut($sql);

Inline control structures are not allowed
Open

if (!in_array($this->toVersion, $this->versions)) $this->error('找不到指定的版本');

Whitespace found at end of line
Open

{

Whitespace found at end of line
Open

{

Whitespace found at end of line
Open

$files[] = $fileName;

The method ListSql is not named in camelCase.
Open

private function ListSql($sqlDir)
{
$files = [];
if (is_dir($sqlDir)) {
$dir = opendir($sqlDir);
Category
Status