strata-mvc/strata

View on GitHub

Showing 146 of 158 total issues

Method remove has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function remove(array $data, $path)
    {
        if (strpos($path, '[') === false) {
            $tokens = explode('.', $path);
        } else {
Severity: Minor
Found in src/Utility/Hash.php - About 1 hr to fix

    Method generateCommand has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function generateCommand()
        {
            $namespace = Strata::getNamespace() . "\\Shell\\Command";
            $destination = implode(DIRECTORY_SEPARATOR, array("src", "Shell", "Command", "{$this->classname}.php"));
    
    
    Severity: Minor
    Found in src/Shell/Command/Generator/CommandGenerator.php - About 1 hr to fix

      Method debug has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function debug()
          {
              if (!WP_DEBUG) {
                  return;
              }
      Severity: Minor
      Found in src/Utility/Toolset.php - About 1 hr to fix

        Function breakpoint has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            function breakpoint()
            {
                if (!WP_DEBUG) {
                    return;
                }
        Severity: Minor
        Found in src/Utility/Toolset.php - About 55 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 load has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function load()
            {
                // Even though we can't confirm the entity has
                // been loaded, we should still inform the user.
                $this->logAutoloadedEntities();
        Severity: Minor
        Found in src/Model/CustomPostType/CustomPostTypeLoader.php - About 55 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 insert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function insert($str, $data, $options = array())
            {
                $defaults = array(
                    'before' => ':', 'after' => null, 'escape' => '\\', 'format' => null, 'clean' => false
                );
        Severity: Minor
        Found in src/Utility/StringUtility.php - About 55 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 canCatchTheError has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function canCatchTheError($triggerFilePath = '')
            {
                if (function_exists("is_admin") && is_admin()) {
                    if (!class_exists("\Strata\Router\Router")) {
                        return false;
        Severity: Minor
        Found in src/Error/BaseErrorHandler.php - About 55 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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function parse()
            {
                // Fetch the basic values from possible user defined values.
                if ($this->entity->hasConfig("labels")) {
                    if ($this->entity->hasConfig("labels.singular_name")) {
        Severity: Minor
        Found in src/Model/CustomPostType/LabelParser.php - About 55 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 format has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function format(array $data, array $paths, $format)
            {
                $extracted = array();
                $count = count($paths);
        
        
        Severity: Minor
        Found in src/Utility/Hash.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 highlight has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function highlight($text, $phrase, $options = array())
            {
                if (empty($phrase)) {
                    return $text;
                }
        Severity: Minor
        Found in src/Utility/StringUtility.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 maxDimensions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function maxDimensions(array $data)
            {
                $depth = array();
                if (is_array($data) && reset($data) !== false) {
                    foreach ($data as $value) {
        Severity: Minor
        Found in src/Utility/Hash.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function create($mixed = null, $options = array())
            {
                $this->request = Strata::router()->getCurrentController()->request;
        
                if (!is_null($mixed) && !in_array('Strata\\Model\\CustomPostType\\ModelEntity', class_parents($mixed))) {
        Severity: Minor
        Found in src/View/Helper/FormHelper.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 createStarterFiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function createStarterFiles()
            {
                $this->output->writeLn("Ensuring project files are present.");
        
                $count = 0;
        Severity: Minor
        Found in src/Shell/Command/EnvCommand.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 input has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function input($name, $options = array())
            {
                $options += array(
                    "type"  => "text",
                    "id"    => $this->id($name),
        Severity: Minor
        Found in src/View/Helper/FormHelper.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 createDirectoryStructure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function createDirectoryStructure()
            {
                $this->output->writeLn("Ensuring correct directory structure.");
        
                $count = 0;
        Severity: Minor
        Found in src/Shell/Command/EnvCommand.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 getType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getType($var)
            {
                if (is_object($var)) {
                    return get_class($var);
                }
        Severity: Minor
        Found in src/Logger/Debugger.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

        Method handleError has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function handleError($code, $description, $file = null, $line = null, $context = null)
        Severity: Minor
        Found in src/Error/BaseErrorHandler.php - About 35 mins to fix

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

              public function figureOutLength($value)
              {
                  $length = 0;
          
                  if (is_array($value)) {
          Severity: Minor
          Found in src/Model/Validator/LengthValidator.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 _squash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function _squash($data, $key = null)
              {
                  $stack = array();
                  foreach ($data as $k => $r) {
                      $id = $k;
          Severity: Minor
          Found in src/Utility/Hash.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function validate(array $requestData)
              {
                  $ourData = Hash::extract($requestData, $this->getInputName());
          
                  foreach ($this->getAttributeNames() as $name) {
          Severity: Minor
          Found in src/Model/CustomPostType/ModelEntity.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

          Severity
          Category
          Status
          Source
          Language