Fakerino/Fakerino

View on GitHub

Showing 12 of 12 total issues

Method fakeColumn has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function fakeColumn($fakeName, $fakeType, $maxLength)
    {
        switch ($fakeType) {
            case self::NUMERIC:
                $result = $this->faker->fake(array('Integer' => array('length' => mt_rand(6, 8))))->num(1);
Severity: Minor
Found in src/Fakerino/Core/Filler/DbFiller.php - About 1 hr to fix

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

        private function fakeColumn($fakeName, $fakeType, $maxLength)
        {
            switch ($fakeType) {
                case self::NUMERIC:
                    $result = $this->faker->fake(array('Integer' => array('length' => mt_rand(6, 8))))->num(1);
    Severity: Minor
    Found in src/Fakerino/Core/Filler/DbFiller.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 run has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function run()
        {
            if ($this->help) {
    
                return $this->showHelp();
    Severity: Minor
    Found in src/Fakerino/Core/Console/FakeConsole.php - About 1 hr to fix

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

          final public function __construct($options = null)
          {
              if (is_array($this->getDefaultOptions())) {
                  $defaultOptions = $templateOptions = array_merge(array('generatedBy' => null), $this->getDefaultOptions());
              } else {
      Severity: Minor
      Found in src/Fakerino/FakeData/AbstractFakeData.php - About 1 hr to fix

        Function __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            final public function __construct($options = null)
            {
                if (is_array($this->getDefaultOptions())) {
                    $defaultOptions = $templateOptions = array_merge(array('generatedBy' => null), $this->getDefaultOptions());
                } else {
        Severity: Minor
        Found in src/Fakerino/FakeData/AbstractFakeData.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function run()
            {
                if ($this->help) {
        
                    return $this->showHelp();
        Severity: Minor
        Found in src/Fakerino/Core/Console/FakeConsole.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 generate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function generate()
            {
                $chars = self::CHARS;
                $addChars = $this->getOption('addChar');
                if ($addChars !== null) {
        Severity: Minor
        Found in src/Fakerino/FakeData/Generator/TextGenerator.php - About 45 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 xml2array has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function xml2array($xmlObject, $out = array())
            {
                foreach ($xmlObject->attributes() as $attr => $val) {
                    $out['@attributes'][$attr] = (string)$val;
                }
        Severity: Minor
        Found in src/Fakerino/Configuration/ConfigurationFile/XmlConfigurationFile.php - About 45 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 fill has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function fill()
            {
                $totalColumn = $this->db->getTotalColumns();
                $rows = array();
                for ($n = 0; $n < $this->num; $n++) {
        Severity: Minor
        Found in src/Fakerino/Core/Filler/DbFiller.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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function process($data)
            {
                /**
                 * When an element in the configuration is not present,
                 * FakerinoConf returns an exception.
        Severity: Minor
        Found in src/Fakerino/Core/FakeHandler/ConfFakerClass.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 generateIntegerFrom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function generateIntegerFrom($type, $length, $negative)
            {
                $fakeInteger = 0;
                switch ($type) {
                    case Integer::DECIMAL:
        Severity: Minor
        Found in src/Fakerino/FakeData/Generator/IntegerGenerator.php - About 25 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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function process($data)
            {
                $elementName = $data->getName();
                $options = $data->getOptions();
                $expr = null;
        Severity: Minor
        Found in src/Fakerino/Core/FakeHandler/RegExFakerClass.php - About 25 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

        Severity
        Category
        Status
        Source
        Language