Completed
Pull Request — master (#119)
by Toby
04:16
created

MetaTrait::setMetaItem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * This file is part of JSON-API.
5
 *
6
 * (c) Toby Zerner <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Tobscure\JsonApi;
13
14
trait MetaTrait
15
{
16
    private $meta = [];
17
18
    /**
19
     * Set the meta data.
20
     *
21
     * @param array $meta
22
     */
23 9
    public function setMeta(array $meta)
24
    {
25 9
        $this->meta = $meta;
26 9
    }
27
28
    /**
29
     * Set a piece of meta data.
30
     *
31
     * @param string $key
32
     * @param mixed $value
33
     */
34 3
    public function setMetaItem($key, $value)
35
    {
36 3
        $this->meta[$key] = $value;
37 3
    }
38
39
    /**
40
     * Remove a piece of meta data.
41
     *
42
     * @param string $key
43
     * @param mixed $value
0 ignored issues
show
Bug introduced by
There is no parameter named $value. 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...
44
     */
45
    public function removeMetaItem($key)
46
    {
47
        unset($this->meta[$key]);
48
    }
49
}
50