Completed
Branch master (738bd6)
by Pablo
88:01 queued 83:16
created

ToolHandler::writeOutputError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace PhpGitHooks\Infrastructure\Common;
4
5
use PhpGitHooks\Command\OutputHandlerInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
/**
9
 * Class ToolHandler.
10
 */
11
abstract class ToolHandler
12
{
13
    /** @var OutputHandlerInterface  */
14
    protected $outputHandler;
15
    /** @var  OutputInterface */
16
    protected $output;
17
18
    /**
19
     * @param OutputHandlerInterface $outputHandler
20
     */
21
    public function __construct(OutputHandlerInterface $outputHandler)
22
    {
23
        $this->outputHandler = $outputHandler;
24
    }
25
26
    /**
27
     * @param OutputInterface $outputInterface
28
     */
29
    public function setOutput(OutputInterface $outputInterface)
30
    {
31
        $this->output = $outputInterface;
32
    }
33
34
    /**
35
     * @param \Exception $exceptionClass
36
     * @param string     $errorText
37
     */
38
    protected function writeOutputError(\Exception $exceptionClass, $errorText)
39
    {
40
        ErrorOutput::write($errorText);
41
        throw new $exceptionClass();
42
    }
43
}
44