netglue/prismic-php-kit

View on GitHub

Showing 316 of 316 total issues

Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        ?string $name = null,
        string  $method,
        ?string $rel = null,
        string  $enctype,
        string  $action,
Severity: Minor
Found in src/Prismic/Form.php - About 45 mins to fix

    The class Document has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
    Open

    class Document implements DocumentInterface
    {
    
        /** @var string */
        protected $id;
    Severity: Minor
    Found in src/Prismic/Document.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    The class FragmentCollection has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13.
    Open

    class FragmentCollection implements CompositeFragmentInterface
    {
    
        /** @var FragmentInterface[] */
        protected $fragments = [];

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    The class Api has a coupling between objects value of 30. Consider to reduce the number of dependencies under 13.
    Open

    class Api
    {
    
        /**
         * Kit version number
    Severity: Minor
    Found in src/Prismic/Api.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    The class SearchForm has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13.
    Open

    class SearchForm
    {
    
        /**
         * @var Api
    Severity: Minor
    Found in src/Prismic/SearchForm.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    Each class must be in a file by itself
    Open

        class Finder

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            string $id,
            string $ref,
            string $label,
            bool   $isMasterRef,
            ?int   $maybeScheduledAt = null
    Severity: Minor
    Found in src/Prismic/Ref.php - About 35 mins to fix

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

          public function refFromCookie(?string $cookie) :? string
          {
              if (empty($cookie)) {
                  return null;
              }
      Severity: Minor
      Found in src/Prismic/Experiments.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 submit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function submit() : Response
          {
              if ($this->form->getMethod() !== 'GET' ||
                  $this->form->getEnctype() !== 'application/x-www-form-urlencoded' ||
                  ! $this->form->getAction()
      Severity: Minor
      Found in src/Prismic/SearchForm.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 recentDocs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              private function recentDocs(int $count = 10) : array
              {
                  /** @var SearchForm $form */
                  $form = $this->api->forms()->everything;
                  $form = $form->ref($this->api->ref());
      Severity: Minor
      Found in samples/document-explorer.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 factory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function factory($value, LinkResolver $linkResolver) : self
          {
              $image = new static();
              $value = isset($value->value) ? $value->value : $value;
      
      
      Severity: Minor
      Found in src/Prismic/Document/Fragment/Image.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;
      Severity: Major
      Found in src/Prismic/Document/Fragment/FragmentCollection.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return;
        Severity: Major
        Found in src/Prismic/Document/Fragment/FragmentCollection.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return;
          Severity: Major
          Found in src/Prismic/Document/Fragment/FragmentCollection.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return;
            Severity: Major
            Found in src/Prismic/Document/Fragment/FragmentCollection.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return;
              Severity: Major
              Found in src/Prismic/Document/Fragment/FragmentCollection.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return;
                Severity: Major
                Found in src/Prismic/Document/Fragment/FragmentCollection.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return;
                  Severity: Major
                  Found in src/Prismic/Document/Fragment/FragmentCollection.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return;
                    Severity: Major
                    Found in src/Prismic/Document/Fragment/FragmentCollection.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return;
                      Severity: Major
                      Found in src/Prismic/Document/Fragment/FragmentCollection.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language