atelierspierrot/library

View on GitHub

Showing 159 of 159 total issues

Cookie has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

class Cookie
{
    
    /**
     * Transform array values as flatten string (`serialize` like)
Severity: Minor
Found in src/Library/HttpFundamental/Cookie.php - About 4 hrs to fix

    Function _treatOptions has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _treatOptions()
        {
            $this->params = self::getopt();
            $this->debugWrite( ">> Command line arguments are [".var_export($this->params,1)."]" );
    
    
    Severity: Minor
    Found in src/Library/CommandLine/AbstractCommandLineController.php - About 3 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 purge has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function purge($path = null, array &$logs = array())
        {
            if (is_null($path)) {
                return null;
            }
    Severity: Minor
    Found in src/Library/Helper/Directory.php - About 3 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 parse has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function parse($node)
        {
            $output = array();
            switch ($node->nodeType) {
                case XML_CDATA_SECTION_NODE:
    Severity: Minor
    Found in src/Library/Converter/Xml2Array.php - About 3 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 remove has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function remove($path = null, array &$logs = array())
        {
            if (is_null($path)) {
                return null;
            }
    Severity: Minor
    Found in src/Library/Helper/Directory.php - About 3 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 __construct has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct(array $options = array())
        {
    //        if (!isset($this->options)) $this->options = array();
            $this
                ->_initOptions()
    Severity: Minor
    Found in src/Library/CommandLine/AbstractCommandLineController.php - About 3 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 getHelpInfo has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getHelpInfo(array $options = array(), Formater $formater, $caller)
        {
            if (!is_object($caller) || !($caller instanceof CommandLineControllerInterface)) {
                throw new InvalidArgumentException(
                    sprintf('Argument 3 for method "%s::getHelpInfo" must be an object and implement the "CommandLineControllerInterface" interface!', __CLASS__)
    Severity: Major
    Found in src/Library/CommandLine/Helper.php - About 3 hrs to fix

      Response has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Response
          implements ResponseInterface
      {
      
          /**
      Severity: Minor
      Found in src/Library/HttpFundamental/Response.php - About 3 hrs to fix

        File Factory.php has 297 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * This file is part of the Library package.
         *
         * Copyleft (ↄ) 2013-2016 Pierre Cassat <me@e-piwi.fr> and contributors
        Severity: Minor
        Found in src/Library/Factory.php - About 3 hrs to fix

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

          echo 'interface MyInterface {'."\n"
              ."\t".'public function mustImplement();'."\n"
              .'}'."\n"
              .'class MyClass implements MyInterface {'."\n"
              ."\t".'public function mustImplement()'."\n"
          Severity: Major
          Found in demo/pages/home.md.php and 1 other location - About 2 hrs to fix
          demo/pages/home.md.php on lines 556..568

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

          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

          echo 'class DefaultConfig implements \Library\StaticConfiguration\ConfiguratorInterface {'."\n"
              ."\t".'public static function getDefaults() {'."\n"
              ."\t\t".'return array('."\n"
              ."\t\t\t".'"entry1" => array( "library-assets" ),'."\n"
              ."\t\t\t".'"entry2" => "test",'."\n"
          Severity: Major
          Found in demo/pages/home.md.php and 1 other location - About 2 hrs to fix
          demo/pages/home.md.php on lines 236..249

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

          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 _parseTableSizes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _parseTableSizes($reset = false)
              {
                  if ($reset) $this->_resetSizes();
                  $this->line_size = count($this->tbody);
                  foreach (self::$_table_parts as $part) {
          Severity: Minor
          Found in src/Library/Tool/Table.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 generateUrl has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              public function generateUrl($route_infos, $base_uri = null, $hash = null, $separator = '&amp;')
              {
                  $url_args = $this->getArgumentsMap()->getCollection();
          
                  $url = $base_uri;
          Severity: Minor
          Found in src/Library/Router.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 organizeArguments has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function organizeArguments($method_name = null, $arguments = null, $class_name = null, &$logs = array())
              {
                  if (empty($method_name)) {
                      return;
                  }
          Severity: Major
          Found in src/Library/Helper/Code.php - About 2 hrs to fix

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

                private function __getMethods($object)
                {
                    $reflection = new ReflectionClass($object);
                    
                    //get all methods
            Severity: Minor
            Found in src/Library/CodeParser.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 findBuilder has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function findBuilder($name, $flag = self::ERROR_ON_FAILURE, array &$logs = array())
                {
                    $this->flag($flag);
                    $cc_name = array(TextHelper::toCamelCase($name));
                    if (!$this->_findClasses($cc_name)) {
            Severity: Major
            Found in src/Library/Factory.php - About 2 hrs to fix

              Method build has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function build($name, array $parameters = null, $flag = self::ERROR_ON_FAILURE, array &$logs = array())
                  {
                      $this->flag($flag);
                      $object = null;
                      $builder_class_name = $this->findBuilder($name, $flag, $logs);
              Severity: Major
              Found in src/Library/Factory.php - About 2 hrs to fix

                Pagination has 24 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Pagination
                    implements \Iterator
                {
                
                    /**
                Severity: Minor
                Found in src/Library/Tool/Pagination.php - About 2 hrs to fix

                  Function getRequestUrl has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getRequestUrl($entities = false, $base = false, $no_file = false, $no_rewrite = false)
                      {
                          $protocol = self::getHttpProtocol();
                          if ($no_rewrite) {
                              $url = $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
                  Severity: Minor
                  Found in src/Library/Helper/Url.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

                  File Cookie.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * This file is part of the Library package.
                   *
                   * Copyleft (ↄ) 2013-2016 Pierre Cassat <me@e-piwi.fr> and contributors
                  Severity: Minor
                  Found in src/Library/HttpFundamental/Cookie.php - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language