When::when()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
/*
3
 * This file is part of the Respect\Rest package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Respect\Rest\Routines;
10
11
use Respect\Rest\Request;
12
13
/** Generic routine executed before route matching */
14
class When extends AbstractSyncedRoutine implements ProxyableWhen
15
{
16 5
    public function when(Request $request, $params)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
17
    {
18 5
        $valid = $this->execute($request, $params);
19
20 5
        if (!$valid) {
21 2
            header('HTTP/1.1 400');
22
        }
23
24 5
        return $valid;
25
    }
26
}
27