Completed
Push — 1.x ( 11c8ea...1f4201 )
by Akihito
04:53
created

VoidParameterHandler::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 2
crap 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\Aop\WeavedInterface;
11
12
class VoidParameterHandler implements ParameterHandlerInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     *
17
     * @throws ParameterException
18
     */
19 5
    public function handle(\ReflectionParameter $parameter, array $query)
20
    {
21 5
        unset($query);
22 5
        $class = $parameter->getDeclaringClass();
23 5
        $className = $class->implementsInterface(WeavedInterface::class) ? $class->getParentClass()->getName() : $class->name;
24 5
        $method = $parameter->getDeclaringFunction()->name;
25 5
        $msg = sprintf('$%s in %s::%s()', $parameter->name, $className, $method);
26
27 5
        throw new ParameterException($msg, Code::BAD_REQUEST);
28
    }
29
}
30