DumpFailed   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A processDidNotEndSuccessfully() 0 4 1
A dumpfileWasNotCreated() 0 4 1
A dumpfileWasEmpty() 0 4 1
1
<?php
2
3
namespace Spatie\DbDumper\Exceptions;
4
5
use Exception;
6
use Symfony\Component\Process\Process;
7
8
class DumpFailed extends Exception
9
{
10
    /**
11
     * @param \Symfony\Component\Process\Process $process
12
     *
13
     * @return \Spatie\DbDumper\Exceptions\DumpFailed
14
     */
15
    public static function processDidNotEndSuccessfully(Process $process)
16
    {
17
        return new static("The dump process failed with exitcode {$process->getExitCode()} : {$process->getExitCodeText()} : {$process->getErrorOutput()}");
18
    }
19
20
    /**
21
     * @return \Spatie\DbDumper\Exceptions\DumpFailed
22
     */
23
    public static function dumpfileWasNotCreated()
24
    {
25
        return new static('The dumpfile could not be created');
26
    }
27
28
    /**
29
     * @return \Spatie\DbDumper\Exceptions\DumpFailed
30
     */
31
    public static function dumpfileWasEmpty()
32
    {
33
        return new static('The created dumpfile is empty');
34
    }
35
}
36