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

MissingRequiredParameterException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 26
ccs 0
cts 5
cp 0
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
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