honeybee/trellis

View on GitHub
src/Sham/DataGenerator.php

Summary

Maintainability
D
2 days
Test Coverage

File DataGenerator.php has 397 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Trellis\Sham;

use Trellis\Common\Error\BadValueException;
Severity: Minor
Found in src/Sham/DataGenerator.php - About 5 hrs to fix

    DataGenerator has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DataGenerator
    {
        protected $faker;
    
        protected $locale;
    Severity: Minor
    Found in src/Sham/DataGenerator.php - About 3 hrs to fix

      Function createComplexValue has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function createComplexValue(AttributeInterface $attribute, array $options = array())
          {
              $values = array();
              $value_holder = $attribute->createValueHolder();
              $value_type = $value_holder->getValueType();
      Severity: Minor
      Found in src/Sham/DataGenerator.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 fake has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function fake(EntityInterface $entity, array $options = array())
          {
              if (!empty($options[self::OPTION_LOCALE])) {
                  $loc = $options[self::OPTION_LOCALE];
                  if (!is_string($loc) || !preg_match('#[a-z]{2,6}_[A-Z]{2,6}#', $loc)) {
      Severity: Minor
      Found in src/Sham/DataGenerator.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 createComplexValue has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function createComplexValue(AttributeInterface $attribute, array $options = array())
          {
              $values = array();
              $value_holder = $attribute->createValueHolder();
              $value_type = $value_holder->getValueType();
      Severity: Minor
      Found in src/Sham/DataGenerator.php - About 1 hr to fix

        Method fake has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function fake(EntityInterface $entity, array $options = array())
            {
                if (!empty($options[self::OPTION_LOCALE])) {
                    $loc = $options[self::OPTION_LOCALE];
                    if (!is_string($loc) || !preg_match('#[a-z]{2,6}_[A-Z]{2,6}#', $loc)) {
        Severity: Minor
        Found in src/Sham/DataGenerator.php - About 1 hr to fix

          Function addTextList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function addTextList(
                  EntityInterface $entity,
                  AttributeInterface $attribute,
                  array $options = array()
              ) {
          Severity: Minor
          Found in src/Sham/DataGenerator.php - About 35 mins 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 setValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function setValue(
                  EntityInterface $entity,
                  AttributeInterface $attribute,
                  $default_value,
                  array $options = array()
          Severity: Minor
          Found in src/Sham/DataGenerator.php - About 35 mins 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

          There are no issues that match your filters.

          Category
          Status