kegi/netscape-cookie-file-handler

View on GitHub

Showing 14 of 14 total issues

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

    public function delete(
        string $cookieName,
        string $domain = null
    ) : CookieCollectionInterface {
        if ($domain === null) {
Severity: Minor
Found in src/NetscapeCookieFileHandler/Cookie/CookieCollection.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 persist has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function persist(
        CookieCollectionInterface $cookies,
        string $filename
    ) : PersisterInterface {
        if (empty($this->getConfiguration()->getCookieDir())) {
Severity: Minor
Found in src/NetscapeCookieFileHandler/Persister/Persister.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 generateFileOutput has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function generateFileOutput(
        CookieCollectionInterface $cookies
    ) {
        $output = '';

Severity: Minor
Found in src/NetscapeCookieFileHandler/Persister/Persister.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 persist has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function persist(
        CookieCollectionInterface $cookies,
        string $filename
    ) : PersisterInterface {
        if (empty($this->getConfiguration()->getCookieDir())) {
Severity: Minor
Found in src/NetscapeCookieFileHandler/Persister/Persister.php - About 1 hr to fix

    Method generateFileOutput has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function generateFileOutput(
            CookieCollectionInterface $cookies
        ) {
            $output = '';
    
    
    Severity: Minor
    Found in src/NetscapeCookieFileHandler/Persister/Persister.php - About 1 hr to fix

      Function parseContent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function parseContent(string $filecontent
          ) : CookieCollectionInterface {
              $cookies = new CookieCollection();
      
              foreach (explode("\n", $filecontent) as $line) {
      Severity: Minor
      Found in src/NetscapeCookieFileHandler/Parser/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

      Method parseContent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function parseContent(string $filecontent
          ) : CookieCollectionInterface {
              $cookies = new CookieCollection();
      
              foreach (explode("\n", $filecontent) as $line) {
      Severity: Minor
      Found in src/NetscapeCookieFileHandler/Parser/Parser.php - About 1 hr to fix

        Function setCookies has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function setCookies(array $cookies) : CookieCollectionInterface
            {
                $this->cookies = [];
        
                foreach ($cookies as $cookie) {
        Severity: Minor
        Found in src/NetscapeCookieFileHandler/Cookie/CookieCollection.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 setCookies has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function setCookies(array $cookies) : CookieCollectionInterface
            {
                $this->cookies = [];
        
                foreach ($cookies as $cookie) {
        Severity: Minor
        Found in src/NetscapeCookieFileHandler/Cookie/CookieCollection.php - About 1 hr to fix

          Method parseFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function parseFile(string $file) : CookieCollectionInterface
              {
                  if (!($this->getConfiguration() instanceof ConfigurationInterface)) {
                      throw new ParserException(
                          'You need to inject configurations in order to parse a file'
          Severity: Minor
          Found in src/NetscapeCookieFileHandler/Parser/Parser.php - About 1 hr to fix

            Function add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function add(
                    CookieInterface $cookie
                ) : CookieCollectionInterface {
                    $cookieDomain = $cookie->getDomain();
                    $cookieName = $cookie->getName();
            Severity: Minor
            Found in src/NetscapeCookieFileHandler/Cookie/CookieCollection.php - About 45 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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function get(string $cookieName, string $domain = null)
                {
                    if ($domain === null) {
            
                        /*find the first occurence on any domain*/
            Severity: Minor
            Found in src/NetscapeCookieFileHandler/Cookie/CookieCollection.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 getAll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getAll(string $domain = null) : CookieCollectionInterface
                {
                    if ($domain === null) {
                        return $this;
                    } else {
            Severity: Minor
            Found in src/NetscapeCookieFileHandler/Cookie/CookieCollection.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 has has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function has(string $cookieName, string $domain = null) : bool
                {
                    if ($domain === null) {
            
                        /*find this cookie for all domains*/
            Severity: Minor
            Found in src/NetscapeCookieFileHandler/Cookie/CookieCollection.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

            Severity
            Category
            Status
            Source
            Language