Completed
Push — 1.x ( d468cb...112be9 )
by Akihito
02:57
created

RequiredParam   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 2
1
<?php
2
/**
3
 * This file is part of the BEAR.Resource package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace BEAR\Resource;
8
9
use BEAR\Resource\Exception\ParameterException;
10
use Ray\Di\InjectorInterface;
11
12
final class RequiredParam implements ParamInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 34
    public function __invoke($varName, array $query, InjectorInterface $injector)
18
    {
19 34
        unset($injector);
20 34
        if (isset($query[$varName])) {
21 29
            return $query[$varName];
22
        }
23
24 5
        throw new ParameterException($varName);
25
    }
26
}
27