RuntimeException::commandExecutionFailed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 12
rs 10
1
<?php
2
3
namespace Cherrypulp\LaravelPackageGenerator\Exceptions;
4
5
class RuntimeException extends \RuntimeException
6
{
7
    /**
8
     * @param string $command
9
     * @param int $exitStatusCode
10
     * @param int $code
11
     * @param \Exception|\Throwable|null $previous
12
     * @return static
13
     */
14
    public static function commandExecutionFailed(
15
        $command,
16
        $exitStatusCode,
17
        $code = 0,
18
        $previous = null
19
    ) {
20
        $message = sprintf(
21
            "\"$command\" exited with %s status code",
22
            $exitStatusCode
23
        );
24
25
        return new static($message, $code, $previous);
26
    }
27
28
    /**
29
     * @param string $path
30
     * @param int $code
31
     * @param \Exception|\Throwable|null $previous
32
     * @return static
33
     */
34
    public static function noAccessTo(
35
        $path,
36
        $code = 0,
37
        $previous = null
38
    ) {
39
        return new static("No access to [$path]", $code, $previous);
40
    }
41
}
42