Passed
Push — master ( 19eefc...9f50d2 )
by Shiyu
02:25
created

Dumps   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A failure() 0 11 2
1
<?php
2
/**
3
 * Dumps (failure)
4
 * User: moyo
5
 * Date: Jul 25, 2019
6
 * Time: 11:06
7
 */
8
9
namespace Carno\Console\Chips;
10
11
use Symfony\Component\Console\Input\ArgvInput;
12
use Symfony\Component\Console\Output\ConsoleOutput;
13
use Symfony\Component\Console\Style\SymfonyStyle;
14
use Throwable;
15
16
trait Dumps
17
{
18
    /**
19
     * @param Throwable $e
20
     * @param int $c
21
     */
22
    protected function failure(Throwable $e, int $c = null) : void
23
    {
24
        $styled = (new SymfonyStyle(new ArgvInput(), new ConsoleOutput()));
25
26
        $styled->title(get_class($e));
27
        $styled->error($e->getMessage());
28
        $styled->note(sprintf('%s:%d', $e->getFile(), $e->getLine()));
29
30
        dump($e);
31
32
        is_null($c) || exit($c);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
33
    }
34
}
35