notAllowedTransition()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
nc 2
nop 3
dl 0
loc 15
ccs 9
cts 9
cp 1
crap 2
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
0 ignored issues
show
Coding Style introduced by
This file is missing a doc comment.
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Filename "InvalidStateTransitionException.php" doesn't match the expected filename "invalidstatetransitionexception.php"
Loading history...
2
/**
0 ignored issues
show
Coding Style introduced by
Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
Loading history...
Coding Style introduced by
Block comments must be started with /*
Loading history...
3
 * This file is part of the php-state project.
4
 *
5
 * (c) Yannick Voyer <[email protected]> (http://github.com/yvoyer)
6
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
7
8
namespace Star\Component\State;
9
10
final class InvalidStateTransitionException extends \Exception
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
11
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class InvalidStateTransitionException
Loading history...
12
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
13
     * @param string $transition
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 8 spaces after parameter type; 1 found
Loading history...
14
     * @param string|object $context
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
15
     * @param string $currentState
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 8 spaces after parameter type; 1 found
Loading history...
16
     *
17
     * @return static
18
     */
19 11
    public static function notAllowedTransition(
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
20
        string $transition,
21
        $context,
22
        string $currentState
23
    ): self {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
24 11
        if (\is_object($context)) {
25 2
            $context = \get_class($context);
26
        }
27
28 11
        return new static(
29 11
            \sprintf(
30 11
                "The transition '%s' is not allowed when context '%s' is in state '%s'.",
31 11
                $transition,
32 11
                $context,
33 11
                $currentState
34
            )
35
        );
36
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end notAllowedTransition()
Loading history...
37
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
38