ClassMetadata::addGraphMetadata()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
namespace Novaway\Component\OpenGraph\Metadata;
4
5
use Metadata\MergeableClassMetadata;
6
use Novaway\Component\OpenGraph\Annotation\GraphNode;
7
use Novaway\Component\OpenGraph\Annotation\NamespaceNode;
8
9
class ClassMetadata extends MergeableClassMetadata
10
{
11
    /** @var NamespaceNode[] */
12
    public $namespaces;
13
14
    /** @var GraphMetadataInterface[] */
15
    public $nodes;
16
17
18
    /**
19
     * Constructor
20
     *
21
     * @param string $name
22
     */
23
    public function __construct($name)
24
    {
25
        parent::__construct($name);
26
27
        $this->namespaces = [];
28
        $this->nodes      = [];
29
    }
30
31
    /**
32
     * Add OpenGraph namespace
33
     *
34
     * @param NamespaceNode $namespace
35
     * @return ClassMetadata
36
     */
37
    public function addGraphNamespace(NamespaceNode $namespace)
38
    {
39
        $this->namespaces[] = $namespace;
40
41
        return $this;
42
    }
43
44
    /**
45
     * Add OpenGraph metadata
46
     *
47
     * @param GraphNode              $type
0 ignored issues
show
Bug introduced by
There is no parameter named $type. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
48
     * @param GraphMetadataInterface $data
49
     * @return ClassMetadata
50
     */
51
    public function addGraphMetadata(GraphNode $node, GraphMetadataInterface $data)
52
    {
53
        $this->nodes[] = [
54
            'node'   => $node,
55
            'object' => $data,
56
        ];
57
58
        return $this;
59
    }
60
}
61