ParameterException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 37
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidInput() 0 4 1
A missinglogic() 0 3 1
A invalidArrtibuteType() 0 3 1
1
<?php
2
namespace Sender\ExceptionClass;
3
4
/**
5
 * This class for Parameter Exception
6
 *
7
 * @package    Sender\ExceptionClass\ParameterException
8
 * @author     VenkatS <[email protected]>
9
 * @link       https://github.com/tesark/msg91-php
10
 * @license    MIT
11
 */
12
13
class ParameterException extends \Exception
14
{
15
    /**
16
     * This function throw invalid exceptin without message
17
     * @param string $arrName Arrtibute name
18
     * @param string $arrtype Arrtibute type
19
     * @param string $value   Acually given value
20
     *
21
     * @return string Exception message
22
     */
23 21
    public static function invalidArrtibuteType($arrName, $arrtype, $value)
24
    {
25 21
        return new static("Invalid Input expect type:\t".$arrtype."\tgiven:\t".gettype($value)."\tparams:".$arrName);
26
    }
27
    /**
28
     * This function throw invalid exceptin with message
29
     * @param string $arrName Arrtibute name
30
     * @param string $arrtype Arrtibute type
31
     * @param string $value   Acually given value
32
     * @param string $message Exception message
33
     *
34
     * @return string Exception message
35
     */
36 65
    public static function invalidInput($arrName, $arrtype, $value, $message)
37
    {
38 65
        $message = $arrtype."\tparams:\t".$arrName."\tgiven:\t".gettype($value)."\tReason:\t".$message;
39 65
        return new static("Invalid Input expect type:\t".$message);
40
    }
41
    /**
42
     * This function throw message
43
     * @param string $message
44
     *
45
     * @return string Exception message
46
     */
47 14
    public static function missinglogic($message)
48
    {
49 14
        return new static("Error exception:\t".$message);
50
    }
51
}
52