apparat/object

View on GitHub

Showing 170 of 170 total issues

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

    protected function deleteObject(ObjectInterface $object)
    {
        // Hide object directory
        $objContainerDir = dirname(dirname($this->getAbsoluteResourcePath($object->getRepositoryLocator())));
        $objContainerName = $object->getId()->getId().'-'.$object->getObjectType()->getType();
Severity: Major
Found in src/Object/Infrastructure/Repository/FileAdapterStrategy.php and 1 other location - About 5 hrs to fix
src/Object/Infrastructure/Repository/FileAdapterStrategy.php on lines 516..540

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

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

    protected function undeleteObject(ObjectInterface $object)
    {
        // Hide object directory
        $objContainerDir = dirname(dirname($this->getAbsoluteResourcePath($object->getRepositoryLocator())));
        $objContainerName = $object->getId()->getId().'-'.$object->getObjectType()->getType();
Severity: Major
Found in src/Object/Infrastructure/Repository/FileAdapterStrategy.php and 1 other location - About 5 hrs to fix
src/Object/Infrastructure/Repository/FileAdapterStrategy.php on lines 445..469

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

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 $proxyRelationTypes = [
        ContributesRelation::TYPE => ContributesProxyRelation::class,
        ContributedByRelation::TYPE => ContributedByProxyRelation::class,
        EmbedsRelation::TYPE => EmbedsProxyRelation::class,
        EmbeddedByRelation::TYPE => EmbeddedByProxyRelation::class,
Severity: Major
Found in src/Object/Domain/Factory/RelationFactory.php and 1 other location - About 3 hrs to fix
src/Object/Domain/Factory/RelationFactory.php on lines 113..128

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

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 $relationTypes = [
        ContributesRelation::TYPE => ContributesRelation::class,
        ContributedByRelation::TYPE => ContributedByRelation::class,
        EmbedsRelation::TYPE => EmbedsRelation::class,
        EmbeddedByRelation::TYPE => EmbeddedByRelation::class,
Severity: Major
Found in src/Object/Domain/Factory/RelationFactory.php and 1 other location - About 3 hrs to fix
src/Object/Domain/Factory/RelationFactory.php on lines 134..149

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

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

File FileAdapterStrategy.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * apparat-object
 *
Severity: Minor
Found in src/Object/Infrastructure/Repository/FileAdapterStrategy.php - About 3 hrs to fix

    The class Url has an overall complexity of 80 which is very high. The configured complexity threshold is 50.
    Open

    class Url extends Uri implements UriInterface, SerializablePropertyInterface
    {
        /**
         * Use PSR-7 method
         */
    Severity: Minor
    Found in src/Object/Domain/Model/Uri/Url.php by phpmd

    The class FileAdapterStrategy has an overall complexity of 67 which is very high. The configured complexity threshold is 50.
    Open

    class FileAdapterStrategy extends AbstractAdapterStrategy
    {
        /**
         * Adapter strategy type
         *

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

    <?php
    
    /**
     * apparat/object
     *
    Severity: Major
    Found in src/Object/Application/Contract/ObjectTypesInterface.php and 1 other location - About 2 hrs to fix
    src/Object/Domain/Contract/ObjectTypesInterface.php on lines 1..173

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

    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

    <?php
    
    /**
     * apparat/object
     *
    Severity: Major
    Found in src/Object/Domain/Contract/ObjectTypesInterface.php and 1 other location - About 2 hrs to fix
    src/Object/Application/Contract/ObjectTypesInterface.php on lines 1..173

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

    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

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

    class SystemProperties extends AbstractProperties
    {
        /**
         * Collection name
         *
    Severity: Minor
    Found in src/Object/Domain/Model/Properties/SystemProperties.php - About 2 hrs to fix

      Method findObjectResourceLocators has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function findObjectResourceLocators(SelectorInterface $selector, RepositoryInterface $repository)
          {
              chdir($this->root);
      
              // Build a glob string from the selector
      Severity: Major
      Found in src/Object/Infrastructure/Repository/FileAdapterStrategy.php - About 2 hrs to fix

        File ObjectProxyTrait.php has 268 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * apparat-object
         *
        Severity: Minor
        Found in src/Object/Domain/Model/Object/Traits/ObjectProxyTrait.php - About 2 hrs to fix

          File RepositoryTest.php has 268 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * apparat-object
           *
          Severity: Minor
          Found in src/Object/Tests/RepositoryTest.php - About 2 hrs to fix

            RepositoryTest has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class RepositoryTest extends AbstractDisabledAutoconnectorTest
            {
                /**
                 * Temporary glob directory
                 *
            Severity: Minor
            Found in src/Object/Tests/RepositoryTest.php - About 2 hrs to fix

              Url has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Url extends Uri implements UriInterface, SerializablePropertyInterface
              {
                  /**
                   * Use PSR-7 method
                   */
              Severity: Minor
              Found in src/Object/Domain/Model/Uri/Url.php - About 2 hrs to fix

                Method getUrlInternal has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function getUrlInternal(array &$override = [])
                    {
                        // Prepare the URL scheme
                        $scheme = !empty($this->urlParts['scheme']) ? $this->getScheme().'://' : '';
                        if (isset($override['scheme'])) {
                Severity: Major
                Found in src/Object/Domain/Model/Uri/Url.php - About 2 hrs to fix

                  Function getUrlInternal has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function getUrlInternal(array &$override = [])
                      {
                          // Prepare the URL scheme
                          $scheme = !empty($this->urlParts['scheme']) ? $this->getScheme().'://' : '';
                          if (isset($override['scheme'])) {
                  Severity: Minor
                  Found in src/Object/Domain/Model/Uri/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

                  Method setUpBeforeClass has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function setUpBeforeClass()
                      {
                          parent::setUpBeforeClass();
                          self::$globDirs[] =
                          self::$globBase = sys_get_temp_dir().DIRECTORY_SEPARATOR.'glob';
                  Severity: Minor
                  Found in src/Object/Tests/RepositoryTest.php - About 1 hr to fix

                    Function parseRelationString has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected static function parseRelationString($relation, RepositoryInterface $contextRepository)
                        {
                            $parsed = [
                                self::PARSE_URL => null,
                                self::PARSE_LABEL => null,
                    Severity: Minor
                    Found in src/Object/Domain/Factory/RelationFactory.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 configureDependencyInjection has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function configureDependencyInjection(DependencyInjectionContainerInterface $diContainer)
                        {
                            parent::configureDependencyInjection($diContainer);
                    
                            // Configure the repository service
                    Severity: Minor
                    Found in src/Object/Module.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language