Completed
Push — master ( c59138...74df60 )
by Beniamin
04:20
created

InvalidStageException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 2
1
<?php
2
3
/**
4
 * This file is part of phuria/pipolino package.
5
 *
6
 * Copyright (c) 2017 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\Pipolino;
13
14
/**
15
 * @author Beniamin Jonatan Šimko <[email protected]>
16
 */
17
class InvalidStageException extends \RuntimeException
18
{
19
    /**
20
     * @param mixed $stage
21
     *
22
     * @return InvalidStageException
23
     */
24 3
    public static function create($stage)
25
    {
26 3
        if (is_object($stage)) {
27 1
            return new self(sprintf(
28 1
                'Object [%s] is not valid stage. Please check __invoke() implementation.',
29 1
                get_class($stage)
30 1
            ));
31
        }
32
33 2
        return new self(sprintf('Invalid stage implementation detected. Probably stage is not callable.'));
34
    }
35
}
36