tomaj/meta-scraper

View on GitHub

Showing 8 of 8 total issues

Function parse has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public function parse(string $content): Meta
    {
        $meta = new Meta();

        $matches = [];
Severity: Minor
Found in src/Parser/SchemaParser.php - About 5 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

Meta has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class Meta
{
    private $title;

    private $description;
Severity: Minor
Found in src/Meta.php - About 3 hrs to fix

    Function merge has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function merge(Meta $meta): Meta
        {
            if (!$this->getTitle() && $meta->getTitle()) {
                $this->setTitle($meta->getTitle());
            }
    Severity: Minor
    Found in src/Meta.php - About 3 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 parse has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function parse(string $content): Meta
        {
            $meta = new Meta();
    
            $matches = [];
    Severity: Major
    Found in src/Parser/SchemaParser.php - About 2 hrs to fix

      Method parse has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function parse(string $content): Meta
          {
              $meta = new Meta();
      
              $matches = [];
      Severity: Major
      Found in src/Parser/OgParser.php - About 2 hrs to fix

        Method merge has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function merge(Meta $meta): Meta
            {
                if (!$this->getTitle() && $meta->getTitle()) {
                    $this->setTitle($meta->getTitle());
                }
        Severity: Minor
        Found in src/Meta.php - About 1 hr to fix

          Function parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function parse(string $content): Meta
              {
                  $meta = new Meta();
          
                  $matches = [];
          Severity: Minor
          Found in src/Parser/OgParser.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 fixMetaTag has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function fixMetaTag(\DOMElement &$metaTag, array $allowedAttributeNames): void
              {
                  if (!$metaTag->attributes->length) {
                      return;
                  }
          Severity: Minor
          Found in src/Parser/OgDomParser.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

          Severity
          Category
          Status
          Source
          Language