Params::__construct()   A
last analyzed

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 1
crap 1
1
<?php
2
3
namespace PhpJsonRpc\Server\Request;
4
5
class Params
6
{
7
    /**
8
     * @var \stdClass|array $params
9
     */
10
    protected $params;
11
12
    /**
13
     * @param \stdClass|array $params
14
     */
15 33
    public function __construct($params)
16
    {
17 33
        $this->params = $params;
18 33
    }
19
20
    /**
21
     * @param string|int $identifier
22
     *
23
     * @return mixed
24
     */
25 30
    public function get($identifier)
26
    {
27 30
        if (is_array($this->params)) {
28
            return $this->params[$identifier];
29
        }
30
31 30
        return $this->params->{$identifier};
32
    }
33
34
    /**
35
     * @return array|\stdClass
36
     */
37
    public function all()
38
    {
39
        return $this->params;
40
    }
41
}
42