apparat/object

View on GitHub

Showing 60 of 170 total issues

Function deleteRecursive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function deleteRecursive($directory)
    {
        $this->tmpFiles[] = $directory;
        foreach (scandir($directory) as $item) {
            if (!preg_match('%^\.+$%', $item)) {
Severity: Minor
Found in src/Object/Tests/AbstractObjectTest.php - About 35 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(array $data, ObjectInterface $object)
    {
        parent::__construct($data, $object);

        // Run through all registered relation type collections
Severity: Minor
Found in src/Object/Domain/Model/Properties/Relations.php - About 35 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(array $data, ObjectInterface $object)
    {
        parent::__construct($data, $object);

        // Initialize the title
Severity: Minor
Found in src/Object/Domain/Model/Properties/MetaProperties.php - About 35 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 composeFullName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function composeFullName($propertyName, $propertyValue)
    {
        $nameProperties = [
            Contact::HONORIFIC_PREFIX => '',
            Contact::GIVEN_NAME => '',

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

    public function processDocument(Document $document)
    {
        $walker = $document->walker();
        while ($event = $walker->next()) {
            $node = $event->getNode();
Severity: Minor
Found in src/Object/Infrastructure/Utilities/CommonMarkPayloadProcessor.php - About 35 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

Avoid too many return statements within this method.
Open

        return true;
Severity: Major
Found in src/Object/Domain/Model/Uri/Url.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return false;
    Severity: Major
    Found in src/Object/Domain/Model/Uri/ObjectUrl.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return false;
      Severity: Major
      Found in src/Object/Domain/Model/Uri/Url.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return false;
        Severity: Major
        Found in src/Object/Domain/Model/Uri/Url.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return false;
          Severity: Major
          Found in src/Object/Domain/Model/Uri/Url.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return true;
            Severity: Major
            Found in src/Object/Domain/Model/Uri/ObjectUrl.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return false;
              Severity: Major
              Found in src/Object/Domain/Model/Uri/Url.php - About 30 mins to fix

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

                    public function persist()
                    {
                        // If there are entries in the persistence queue
                        if (count($this->persistQueue)) {
                            $adapterStrategy = $this->object->getRepositoryLocator()->getRepository()->getAdapterStrategy();
                Severity: Minor
                Found in src/Object/Infrastructure/Utilities/BinaryPayloadProcessor.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 setPropertyValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function setPropertyValue(
                        &$property,
                        $value,
                        array $propertyPath = null,
                        PropertyModel $propertyModel = 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

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

                    public function createObjectResource(\Closure $creator)
                    {
                        $sizeDescriptor = null;
                
                        try {
                Severity: Minor
                Found in src/Object/Infrastructure/Repository/FileAdapterStrategy.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct($url, $remote = false, RepositoryInterface $contextRepository = null)
                    {
                        parent::__construct($url, $remote);
                
                        // If it's an absolute URL
                Severity: Minor
                Found in src/Object/Domain/Model/Uri/ApparatUrl.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 createFromParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function createFromParams(array $params)
                    {
                        $datePrecision = intval(getenv('OBJECT_DATE_PRECISION'));
                
                        // Object visibility
                Severity: Minor
                Found in src/Object/Ports/Factory/SelectorFactory.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct(array $objects = [])
                    {
                        foreach ($objects as $object) {
                            // If it's an object
                            if ($object instanceof ObjectInterface) {
                Severity: Minor
                Found in src/Object/Domain/Model/Object/Collection.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 initializeRepository has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function initializeRepository()
                    {
                        // Successively create the repository directories
                        $repoDirectories = [$this->config['root'], $this->config['root'].DIRECTORY_SEPARATOR.'.repo'];
                        foreach ($repoDirectories as $repoDirectory) {
                Severity: Minor
                Found in src/Object/Infrastructure/Repository/FileAdapterStrategy.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 findPropertyNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function &findPropertyNode(
                        array $propertyPath,
                        array &$propertyTree,
                        &$created,
                        PropertyModel &$propertyModel = 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

                Severity
                Category
                Status
                Source
                Language