Completed
Push — master ( d34cec...faecd8 )
by Augusto
02:22
created

When::when()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
cc 2
eloc 5
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 2
        }
23
24 5
        return $valid;
25
    }
26
}
27