yeephp/yeephp

View on GitHub
Yee/Yee.php

Summary

Maintainability
F
4 days
Test Coverage

File Yee.php has 608 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Yee - a tiny PHP 5 framework
 *
 * @author      Andreas Maier <info@yeephp.com>
Severity: Major
Found in Yee/Yee.php - About 1 day to fix

    Yee has 65 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Yee
    {
        /**
         * @const string
         */
    Severity: Major
    Found in Yee/Yee.php - About 1 day to fix

      Function call has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function call()
          {
              try {
                  if (isset($this->environment['yee.flash'])) {
                      $this->view()->setData('flash', $this->environment['yee.flash']);
      Severity: Minor
      Found in Yee/Yee.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 __construct has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct(array $userSettings = array())
          {
              // Setup IoC container
              $this->container = new \Yee\Helper\Set();
              $this->container['settings'] = array_merge(static::getDefaultSettings(), $userSettings);
      Severity: Major
      Found in Yee/Yee.php - About 2 hrs to fix

        Function applyHook has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function applyHook($name, $hookArg = null)
            {
                if (!isset($this->hooks[$name])) {
                    $this->hooks[$name] = array(array());
                }
        Severity: Minor
        Found in Yee/Yee.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 call has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function call()
            {
                try {
                    if (isset($this->environment['yee.flash'])) {
                        $this->view()->setData('flash', $this->environment['yee.flash']);
        Severity: Minor
        Found in Yee/Yee.php - About 1 hr to fix

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

              public function execute()
              {
                  set_error_handler(array('\Yee\Yee', 'handleErrors'));
          
                  //Apply final outer middleware layers
          Severity: Minor
          Found in Yee/Yee.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 setEncryptedCookie has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function setEncryptedCookie($name, $value, $expires = null, $path = null, $domain = null, $secure = false, $httponly = false)
          Severity: Major
          Found in Yee/Yee.php - About 50 mins to fix

            Method setCookie has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function setCookie($name, $value, $time = null, $path = null, $domain = null, $secure = null, $httponly = null)
            Severity: Major
            Found in Yee/Yee.php - About 50 mins to fix

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

                  public function deleteCookie($name, $path = null, $domain = null, $secure = null, $httponly = null)
              Severity: Minor
              Found in Yee/Yee.php - About 35 mins to fix

                Avoid too many return statements within this method.
                Open

                            return is_object($logWriter) ? $logWriter : new \Yee\LogWriter($c['environment']['yee.errors']);
                Severity: Major
                Found in Yee/Yee.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return $mode;
                  Severity: Major
                  Found in Yee/Yee.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $view;
                    Severity: Major
                    Found in Yee/Yee.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return $log;
                      Severity: Major
                      Found in Yee/Yee.php - About 30 mins to fix

                        Function config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function config($name, $value = null)
                            {
                                $c = $this->container;
                        
                                if (is_array($name)) {
                        Severity: Minor
                        Found in Yee/Yee.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 etag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function etag($value, $type = 'strong')
                            {
                                //Ensure type is correct
                                if (!in_array($type, array('strong', 'weak'))) {
                                    throw new \InvalidArgumentException('Invalid Yee::etag type. Expected "strong" or "weak".');
                        Severity: Minor
                        Found in Yee/Yee.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

                        There are no issues that match your filters.

                        Category
                        Status