php-yaoi/php-yaoi

View on GitHub

Showing 203 of 203 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if (!$this->count) {
            $this->minX = $this->maxX = $x;
            $this->minY = $this->maxY = $y;
        } else {
            $this->minX = min($this->minX, $x);
Severity: Major
Found in src/View/HighCharts/Series.php and 1 other location - About 2 hrs to fix
src/View/HighCharts/Series.php on lines 79..87

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 126.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if (!$this->count) {
            $this->minX = $this->maxX = $x;
            $this->minY = $this->maxY = $y;
        } else {
            $this->minX = min($this->minX, $x);
Severity: Major
Found in src/View/HighCharts/Series.php and 1 other location - About 2 hrs to fix
src/View/HighCharts/Series.php on lines 56..64

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 126.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

HighCharts has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class HighCharts extends BaseClass implements Renderer
{

    public function isEmpty()
    {
Severity: Minor
Found in src/View/HighCharts.php - About 2 hrs to fix

    Method makeExpression has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function makeExpression(Parsed $parsed, &$binds, &$index) {
            $statement = '';
    
            foreach ($parsed->tokens as $token) {
                if ($token instanceof Token) {
    Severity: Major
    Found in src/String/Lexer/Renderer.php - About 2 hrs to fix

      Method findOrCreateInstance has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function findOrCreateInstance($serviceClassName, $identifier, $idIsSettings = false) {
              //var_dump('=-=-=-=-=-=-=-=-=-=-=-=-=-=',$serviceClassName, $identifier, $idIsSettings);
      
              if ($identifier instanceof Closure) {
                  $identifier = self::resolveClosure($identifier);
      Severity: Major
      Found in src/Service.php - About 2 hrs to fix

        Method varExportString has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function varExportString($string, $usePhpEol = true) {
                static $specialChars = array(
                    "\r" => '\r',
                    "\n" => '\n',
                    "\t" => '\t',
        Severity: Major
        Found in src/Test/PHPUnit/TestCase.php - About 2 hrs to fix

          Function parseLines has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              private function parseLines() {
                  $this->columns = new \stdClass();
                  $this->indexes = array();
                  $this->foreignKeys = array();
          
          
          Severity: Minor
          Found in src/Database/Mysql/CreateTableReader.php - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function castField has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function castField($value, $columnFlags, $import = true)
              {
                  if (!($columnFlags & self::NOT_NULL) && $value === null) {
                      return null;
                  }
          Severity: Minor
          Found in src/Database/Definition/Column.php - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function backTrace has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function backTrace($skip = 0, $return = self::TRACE_HTML)
              {
                  //if (!self::$isActive) {
          //            return '';
          //        }
          Severity: Minor
          Found in src/Debug.php - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method apply has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function apply()
              {
                  if (self::$enableStateCache && isset(self::$applied[$this->table->entityClassName])) {
                      if ($this->log) {
                          $this->log->push(Expression::create(
          Severity: Minor
          Found in src/Database/Entity/Migration.php - About 1 hr to fix

            Method build has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function build(Quoter $quoter = null) {
                    if ($this->binds) {
                        if ($quoter === null && $this->quoter !== null) {
                            $quoter = $this->quoter;
                        }
            Severity: Minor
            Found in src/String/Expression.php - About 1 hr to fix

              Function perform has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function perform(Migration $migration, $action = Migration::APPLY)
                  {
                      if ($action === Migration::SKIP) {
                          return $this;
                      }
              Severity: Minor
              Found in src/Migration/Manager.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function quote has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function quote($value)
                  {
                      if (null === $value) {
                          return 'NULL';
                      } elseif (is_int($value)) {
              Severity: Minor
              Found in src/Database/Driver.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function processToken has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function processToken()
                  {
                      $optionFound = null;
                      if (($optionName = $this->token->afterStarts(Runner::OPTION_NAME)) && isset($this->def->byName[$optionName])) {
                          $optionFound = $this->def->byName[$optionName];
              Severity: Minor
              Found in src/Cli/Command/RequestMapper.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function read has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function read(Request $request, array $options)
                  {
                      $this->def = new PrepareDefinition($options);
              
                      $tokens = $request->server()->argv;
              Severity: Minor
              Found in src/Cli/Command/RequestMapper.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method __construct has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct($options)
                  {
                      $this->optionsArray = $options;
              
                      /** @var Option $hasVariadicArgument */
              Severity: Minor
              Found in src/Cli/Command/PrepareDefinition.php - About 1 hr to fix

                Method findSaved has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function findSaved()
                    {
                        $table = $this->table();
                        $statement = self::statement();
                        $data = $this->toArray(true);
                Severity: Minor
                Found in src/Database/Entity.php - About 1 hr to fix

                  Method fetchAll has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function fetchAll($keyField = null, $valueField = null)
                      {
                          if (!$this->executed) {
                              $this->execute();
                          }
                  Severity: Minor
                  Found in src/Database/Query.php - About 1 hr to fix

                    Method getByColumn has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getByColumn(Column $column)
                        {
                            $flags = $column->flags;
                    
                            $typeString = $this->getBaseType($column);
                    Severity: Minor
                    Found in src/Database/Mysql/TypeString.php - About 1 hr to fix

                      Method parseLines has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function parseLines() {
                              $this->columns = new \stdClass();
                              $this->indexes = array();
                              $this->foreignKeys = array();
                      
                      
                      Severity: Minor
                      Found in src/Database/Mysql/CreateTableReader.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language