NotFoundError   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
1
<?php
2
/**
3
 * Author: Nil Portugués Calderó <[email protected]>
4
 * Date: 11/28/15
5
 * Time: 1:24 AM.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace NilPortugues\Api\JsonApi\Server\Errors;
11
12
/**
13
 * Class NotFoundError.
14
 */
15
class NotFoundError extends Error
16
{
17
    /**
18
     * @param string $type
19
     * @param string $id
20
     */
21
    public function __construct($type, $id)
22
    {
23
        $type = ucwords(str_replace('_', ' ', $type));
24
25
        parent::__construct(
26
            sprintf('%s Not Found', $type),
27
            sprintf('%s with id %s was not found.', $type, $id),
28
            'resource_not_found'
29
        );
30
    }
31
}
32