Completed
Push — master ( 887cf7...2ea773 )
by Emily
02:13
created

MissingRequiredParameterException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 15
ccs 0
cts 5
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 9
nc 1
nop 3
crap 2
1
<?php
2
/**
3
 * This file is part of the Composite Utils package.
4
 *
5
 * (c) Emily Shepherd <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the
8
 * LICENSE.md file that was distributed with this source code.
9
 *
10
 * @package spaark/composite-utils
11
 * @author Emily Shepherd <[email protected]>
12
 * @license MIT
13
 */
14
15
namespace Spaark\CompositeUtils\Exception;
16
17
use \Exception;
18
use \Throwable;
19
20
/**
21
 * Thrown when a required arguement was not passed to a method
22
 */
23
class MissingRequiredParameterException extends Exception
24
{
25
    /**
26
     * Creates the exception, populating its error message from class
27
     * and property names
28
     *
29
     * @param string $class The classname of the method
30
     * @param string $parameter The name of the missing parameter
31
     * @param Throwable The exception which caused this
32
     */
33
    public function __construct
34
    (
35
        string $class,
36
        string $parameter,
37
        Throwable $previous = null
38
    )
39
    {
40
        parent::__construct
41
        (
42
              'Missing required parameter in constructor. '
43
            . $class . ' requires a value for ' . $parameter,
44
            0,
45
            $previous
46
        );
47
    }
48
}
49