yeephp/yeephp

View on GitHub

Showing 52 of 52 total issues

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

    private function __construct($settings = null)
    {
        if ($settings) {
            $this->properties = $settings;
        } else {
Severity: Minor
Found in Yee/Environment.php - About 1 hr to fix

    Method write has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function write($object, $level)
        {
            //Determine label
            $label = 'DEBUG';
            switch ($level) {
    Severity: Minor
    Found in Yee/Log/FileLogger.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

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

          public function get($key = null, $default = null)
          {
              if (!isset($this->env['yee.request.query_hash'])) {
                  $output = array();
                  if (function_exists('mb_parse_str') && !isset($this->env['yee.tests.ignore_multibyte'])) {
      Severity: Minor
      Found in Yee/Http/Request.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 matches has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function matches($resourceUri)
          {
              //Convert URL params into regex patterns, construct a regex for this route, init params
              $patternAsRegex = preg_replace_callback(
                  '#:([\w]+)\+?#',
      Severity: Minor
      Found in Yee/Route.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 serializeCookies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function serializeCookies(\Yee\Http\Headers &$headers, \Yee\Http\Cookies $cookies, array $config)
          {
              if ($config['cookies.encrypt']) {
                  foreach ($cookies as $name => $settings) {
                      if (is_string($settings['expires'])) {
      Severity: Minor
      Found in Yee/Http/Util.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 deleteCookieHeader has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function deleteCookieHeader(&$header, $name, $value = array())
          {
              //Remove affected cookies from current response header
              $cookiesOld = array();
              $cookiesNew = array();
      Severity: Minor
      Found in Yee/Http/Util.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 __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private function __construct($settings = null)
          {
              if ($settings) {
                  $this->properties = $settings;
              } else {
      Severity: Minor
      Found in Yee/Environment.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 renderBody has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function renderBody(&$env, $exception)
          {
              $title = 'Yee Application Error';
              $code = $exception->getCode();
              $message = $exception->getMessage();
      Severity: Minor
      Found in Yee/Middleware/PrettyExceptions.php - About 1 hr to fix

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

            public function post($key = null, $default = null)
            {
                if (!isset($this->env['yee.input'])) {
                    throw new \RuntimeException('Missing Yee.input in environment variables');
                }
        Severity: Minor
        Found in Yee/Http/Request.php - About 1 hr to fix

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

              function __construct($options = array())
              {
                  $tmp = preg_split('|/vendor/|', __DIR__);
                  $this->rootDir = $tmp[0] . "/";
                  if(!isset($options['cache'])){
          Severity: Minor
          Found in Yee/Managers/RoutingCacheManager.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

          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 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

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

                          if ($this->isFormData() && is_string($this->env['yee.input'])) {
                              $output = array();
                              if (function_exists('mb_parse_str') && !isset($this->env['yee.tests.ignore_multibyte'])) {
                                  mb_parse_str($this->env['yee.input'], $output);
                              } else {
              Severity: Minor
              Found in Yee/Http/Request.php and 1 other location - About 45 mins to fix
              Yee/Http/Request.php on lines 219..227

              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 96.

              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

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

                      if (!isset($this->env['yee.request.query_hash'])) {
                          $output = array();
                          if (function_exists('mb_parse_str') && !isset($this->env['yee.tests.ignore_multibyte'])) {
                              mb_parse_str($this->env['QUERY_STRING'], $output);
                          } else {
              Severity: Minor
              Found in Yee/Http/Request.php and 1 other location - About 45 mins to fix
              Yee/Http/Request.php on lines 257..267

              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 96.

              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

              Function setMiddleware has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function setMiddleware($middleware)
                  {
                      if (is_callable($middleware)) {
                          $this->middleware[] = $middleware;
                      } elseif (is_array($middleware)) {
              Severity: Minor
              Found in Yee/Route.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 decodeSecureCookie has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function decodeSecureCookie($value, $secret, $algorithm, $mode)
                  {
                      if ($value) {
                          $value = explode('|', $value);
                          if (count($value) === 3 && ((int) $value[0] === 0 || (int) $value[0] > time())) {
              Severity: Minor
              Found in Yee/Http/Util.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 write has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function write($object, $level)
                  {
                      //Determine label
                      $label = 'DEBUG';
                      switch ($level) {
              Severity: Minor
              Found in Yee/Log/FileLogger.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 setData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function setData()
                  {
                      $args = func_get_args();
                      if (count($args) === 1 && is_array($args[0])) {
                          $this->data->replace($args[0]);
              Severity: Minor
              Found in Yee/View.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 extract has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function extract($data)
                  {
                      $results = array();
                      foreach ($data as $key => $value) {
                          $key = strtoupper($key);
              Severity: Minor
              Found in Yee/Http/Headers.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

              Severity
              Category
              Status
              Source
              Language