InvalidParameter   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 50
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A sourceDoesNotExist() 0 4 1
A directoryDoesNotExist() 0 4 1
A fileDoesNotExist() 0 4 1
A directoryIsRequired() 0 4 1
A wrongDestinationDirectory() 0 4 1
A destinationDirectoryIsSource() 0 4 1
A destinationExist() 0 4 1
1
<?php
2
3
namespace Spatie\Php7to5\Exceptions;
4
5
use Exception;
6
7
class InvalidParameter extends Exception
8
{
9
    public static function sourceDoesNotExist($sourceName)
10
    {
11
        return new static("Source file or directory `{$sourceName}` does not exist");
12
    }
13
14
    /**
15
     * @param string $directoryName
16
     *
17
     * @return \Spatie\Php7to5\Exceptions\InvalidParameter
18
     */
19
    public static function directoryDoesNotExist($directoryName)
20
    {
21
        return new static("Directory `{$directoryName}` does not exist");
22
    }
23
24
    /**
25
     * @param string $fileName
26
     *
27
     * @return \Spatie\Php7to5\Exceptions\InvalidParameter
28
     */
29
    public static function fileDoesNotExist($fileName)
30
    {
31
        return new static("File `{$fileName}` does not exist");
32
    }
33
34
    /**
35
     * @return \Spatie\Php7to5\Exceptions\InvalidParameter
36
     */
37
    public static function directoryIsRequired()
38
    {
39
        return new static('A directory must be specified');
40
    }
41
42
    public static function wrongDestinationDirectory()
43
    {
44
        return new static("A destination directory can't be inside of a source directory!");
45
    }
46
47
    public static function destinationDirectoryIsSource()
48
    {
49
        return new static('A destination directory is a source directory. If you want to overwrite it, you must specify that as an option.');
50
    }
51
52
    public static function destinationExist()
53
    {
54
        return new static('A destination directory or file with a given name already exists. If you want to overwrite it, you must specify that as an option.');
55
    }
56
}
57