DerDu/MOC-Framework-Mark-V

View on GitHub

Showing 88 of 88 total issues

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

        if ($this->getFileParameter()->getFileInfo()->isFile()) {
            if ($RewriteBase === null) {
                $this->Instance->add($Location->getFile(), PCLZIP_OPT_TEMP_FILE_OFF);
            } else if ($RewriteBase === false) {
                $this->Instance->add($Location->getFile(), PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_TEMP_FILE_OFF);
Severity: Major
Found in Component/Packer/Component/Bridge/Repository/PclZip.php and 1 other location - About 1 hr to fix
Component/Packer/Component/Bridge/Repository/PclZip.php on lines 69..77

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

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

    public function read($sFileName)
    {
        // Check if file exists and is readable
        if (!is_readable($sFileName)) {
            throw new \Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");

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 11 (exceeds 5 allowed). Consider refactoring.
Open

    function __construct(Tokenizer $Tokenizer)
    {

        /** @var Token $Token */
        foreach ((array)$Tokenizer->getResult() as $Token) {
Severity: Minor
Found in Component/Document/Vendor/UniversalXml/Source/Parser.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 getStream has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStream($stream)
    {
        if ($stream === null) {
            return null;
        }

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 buildConnectionParameter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function buildConnectionParameter(
        UsernameParameter $Username,
        PasswordParameter $Password,
        DatabaseParameter $Database,
        DriverParameter $Driver,
Severity: Minor
Found in Component/Database/Component/Bridge/Repository/Doctrine2DBAL.php - About 1 hr to fix

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

        function __construct(Tokenizer $Tokenizer)
        {
    
            /** @var Token $Token */
            foreach ((array)$Tokenizer->getResult() as $Token) {
    Severity: Minor
    Found in Component/Document/Vendor/UniversalXml/Source/Parser.php - About 1 hr to fix

      Method getStream has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getStream($stream)
          {
              if ($stream === null) {
                  return null;
              }

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

            public function testAddFromString()
            {
                $expectedPath = 'file.test';
                $expectedContent = 'Content';
        
        
        Component/Document/Vendor/PhpOfficeCommon/0.2.6/tests/Common/Tests/Adapter/Zip/PclZipAdapterTest.php on lines 41..53

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

        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

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

            public function testAddFromString()
            {
                $expectedPath = 'file.test';
                $expectedContent = 'Content';
        
        
        Component/Document/Vendor/PhpOfficeCommon/0.2.6/tests/Common/Tests/Adapter/Zip/ZipArchiveAdapterTest.php on lines 43..55

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

        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

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

            private function getWriterType(\SplFileInfo $Info)
            {
        
                $WriterList = array(
                    'Excel2007' => array(
        Severity: Minor
        Found in Component/Document/Component/Bridge/Repository/PhpExcel/File.php - About 1 hr to fix

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

              public static function getExcelDocument($Location)
              {
          
                  $Document = new Document(
                      new Vendor(
          Severity: Minor
          Found in Component/Document/Document.php and 1 other location - About 1 hr to fix
          Component/Document/Document.php on lines 150..167

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

          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

              public static function getWordDocument($Location)
              {
          
                  $Document = new Document(
                      new Vendor(
          Severity: Minor
          Found in Component/Document/Document.php and 1 other location - About 1 hr to fix
          Component/Document/Document.php on lines 126..143

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

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

              public function __construct()
              {
          
                  if (null === self::$Instance) {
                      if (!isset($_GET)) {
          Severity: Minor
          Found in Core/GlobalsKernel/Component/Bridge/Repository/UniversalGlobals.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 extractFiles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function extractFiles()
              {
                  if ($this->getFileParameter()->getFileInfo()->isFile()) {
                      $TmpDirectory = sys_get_temp_dir();
                      $SubDirectory = uniqid(sha1(__METHOD__), true);
          Severity: Minor
          Found in Component/Packer/Component/Bridge/Repository/PclZip.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 loadClass has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function loadClass($ClassName)
              {
          
                  if ($this->checkExists($ClassName)) {
                      return true;
          Severity: Minor
          Found in Core/AutoLoader/Vendor/Multiton/NamespaceLoader.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 registerConnection has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  UsernameParameter $Username,
                  PasswordParameter $Password,
                  DatabaseParameter $Database,
                  DriverParameter $Driver,
                  HostParameter $Host,
          Severity: Major
          Found in Component/Database/Component/IBridgeInterface.php - About 50 mins to fix

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

                    UsernameParameter $Username,
                    PasswordParameter $Password,
                    DatabaseParameter $Database,
                    DriverParameter $Driver,
                    HostParameter $Host,
            Severity: Major
            Found in Component/Database/Component/Bridge/Repository/Doctrine2DBAL.php - About 50 mins to fix

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

                      UsernameParameter $Username,
                      PasswordParameter $Password,
                      DatabaseParameter $Database,
                      DriverParameter $Driver,
                      HostParameter $Host,
              Severity: Major
              Found in Component/Database/Component/Bridge/Repository/Doctrine2DBAL.php - About 50 mins to fix

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

                        $Username,
                        $Password,
                        $Database,
                        $Driver,
                        $Host,
                Severity: Major
                Found in Component/Database/Database.php - About 50 mins to fix

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

                      public static function getDatabase($Username, $Password, $Database, $Driver, $Host, $Port = null, $Timeout = 5)
                  Severity: Major
                  Found in Component/Database/Database.php - About 50 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language