NotFoundException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Todd Burry <[email protected]>
4
 * @copyright 2009-2014 Vanilla Forums Inc.
5
 * @license MIT
6
 */
7
8
namespace Garden\Exception;
9
10
/**
11
 * Represents a 404 not found error.
12
 */
13
class NotFoundException extends ClientException {
14
    /**
15
     * Initialize a {@link NotFoundException}.
16
     *
17
     * @param string $message The error message or a one word resource name.
18
     * @param string $description A longer description for the error.
19
     */
20 16
    public function __construct($message = 'Page', $description = null) {
21 16
        if (strpos($message, ' ') === false) {
22 16
            $message = sprintf('%s not found.', $message);
23 16
        }
24
25 16
        parent::__construct($message, 404, ['description' => $description]);
26 16
    }
27
}
28