jkphl/micrometa

View on GitHub

Showing 11 of 38 total issues

Method testAliasedItemProperty has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testAliasedItemProperty()
    {
        $itemFactory = new ItemFactory(0);
        $rawItem     = (object)[
            'type'       => ['test'],
Severity: Major
Found in src/Micrometa/Tests/Application/ItemFactoryTest.php - About 2 hrs to fix

    Method getItems has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getItems()
        {
            $items = ItemFactory::createFromApplicationItems(
                [
                    // Stylesheet link item
    Severity: Major
    Found in src/Micrometa/Tests/Ports/ItemObjectModelTest.php - About 2 hrs to fix

      Method getProfiledNames has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getProfiledNames()
          {
              $schemaOrgProfile = 'http://schema.org/';
              $feedObject       = (object)['name' => 'h-feed', 'profile' => MicroformatsFactory::MF2_PROFILE_URI];
              $eventObject      = (object)['name' => 'Event', 'profile' => $schemaOrgProfile];
      Severity: Minor
      Found in src/Micrometa/Tests/Infrastructure/ProfiledNameFactoryTest.php - About 1 hr to fix

        Method creationArgumentProvider has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function creationArgumentProvider()
            {
                $item  = new Item('test');
                $testT = $this->typ('test');
                $nvP   = $this->prp('name1', 'value1');
        Severity: Minor
        Found in src/Micrometa/Tests/Domain/ItemTest.php - About 1 hr to fix

          Method renderItem has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function renderItem(ItemInterface $item)
          {
              $types = array_map(
                  function ($type) {
                      return '<abbr title="'.htmlspecialchars($type->profile.$type->name).'">'.
          Severity: Minor
          Found in demo/demo.inc.php - About 1 hr to fix

            Method testItemCreation has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    $type,
                    array $properties,
                    $itemId,
                    $itemLanguage,
                    array $expectedTypes,
            Severity: Major
            Found in src/Micrometa/Tests/Domain/ItemTest.php - About 1 hr to fix

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

                      $format,
                      PropertyListFactoryInterface $propertyListFactory,
                      $type,
                      array $properties = [],
                      array $children = [],
              Severity: Major
              Found in src/Micrometa/Application/Item/Item.php - About 1 hr to fix

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

                        $type,
                        array $properties = [],
                        $itemId = null,
                        $itemLanguage = null,
                        PropertyListFactoryInterface $propertyListFactory = null
                Severity: Minor
                Found in src/Micrometa/Domain/Item/Item.php - About 35 mins to fix

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

                          PropertyListFactoryInterface $propertyListFactory,
                          array $type,
                          array $properties,
                          $itemId,
                          $itemLanguage
                  Severity: Minor
                  Found in src/Micrometa/Domain/Item/ItemSetupTrait.php - About 35 mins to fix

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

                        protected function getPropertyCursor($name): int
                        {
                            // Run through all property names
                            foreach ($this->names as $cursor => $iri) {
                                foreach ($this->aliases[strval($iri)] as $alias) {
                    Severity: Minor
                    Found in src/Micrometa/Application/Item/PropertyList.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 renderItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function renderItem(ItemInterface $item)
                    {
                        $types = array_map(
                            function ($type) {
                                return '<abbr title="'.htmlspecialchars($type->profile.$type->name).'">'.
                    Severity: Minor
                    Found in demo/demo.inc.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

                    Severity
                    Category
                    Status
                    Source
                    Language