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

MetaTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 36
ccs 6
cts 9
cp 0.6667
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setMeta() 0 4 1
A setMetaItem() 0 4 1
A removeMetaItem() 0 4 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