CallException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 25
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
1
<?php
2
/*
3
 * Copyright (C) 2017 by TEQneers GmbH & Co. KG
4
 *
5
 * Permission is hereby granted, free of charge, to any person obtaining a copy
6
 * of this software and associated documentation files (the "Software"), to deal
7
 * in the Software without restriction, including without limitation the rights
8
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 * copies of the Software, and to permit persons to whom the Software is
10
 * furnished to do so, subject to the following conditions:
11
 *
12
 * The above copyright notice and this permission notice shall be included in
13
 * all copies or substantial portions of the Software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
 * THE SOFTWARE.
22
 */
23
24
/**
25
 * Git Stream Wrapper for PHP
26
 *
27
 * @category   TQ
28
 * @package    TQ_VCS
29
 * @subpackage VCS
30
 * @copyright  Copyright (C) 2018 by TEQneers GmbH & Co. KG
31
 */
32
33
namespace TQ\Vcs\Cli;
34
use TQ\Vcs\Exception;
35
36
/**
37
 * Exception thrown when an error occurred executing a CLI call
38
 *
39
 * @author     Stefan Gehrig <gehrigteqneers.de>
40
 * @category   TQ
41
 * @package    TQ_VCS
42
 * @subpackage VCS
43
 * @copyright  Copyright (C) 2018 by TEQneers GmbH & Co. KG
44
 */
45
class CallException extends \RuntimeException implements Exception
46
{
47
    /**
48
     * The call result that caused the exception
49
     *
50
     * @var CallResult
51
     */
52
    protected $cliCallResult;
53
54
    /**
55
     * Creates a new exception
56
     *
57
     * @param string        $message        The exception message
58
     * @param CallResult    $cliCallResult  The call result that caused the exception
59
     */
60
    public function __construct($message, CallResult $cliCallResult)
61
    {
62
        $this->cliCallResult    = $cliCallResult;
63
64
        parent::__construct(
65
            sprintf($message.' [%s]', $cliCallResult->getStdErr()),
66
            $cliCallResult->getReturnCode()
67
        );
68
    }
69
}
70