| Total Complexity | 4 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | final class IndentationIssue extends AbstractIssue |
||
| 9 | { |
||
| 10 | private const ALLOWED_INDENTATION_CHARS = [' ', "\t"]; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var int |
||
| 14 | */ |
||
| 15 | private $amountOfIndentChars; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | private $indentationCharacter; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * IndentationIssue constructor. |
||
| 24 | * |
||
| 25 | * @param int $line |
||
| 26 | * @param int $amountOfIndentChars |
||
| 27 | * @param string $indentationCharacter |
||
| 28 | */ |
||
| 29 | public function __construct(int $line, int $amountOfIndentChars, string $indentationCharacter = ' ') |
||
| 30 | { |
||
| 31 | parent::__construct($line); |
||
| 32 | |||
| 33 | $this->amountOfIndentChars = $amountOfIndentChars; |
||
| 34 | |||
| 35 | if (!in_array($indentationCharacter, self::ALLOWED_INDENTATION_CHARS)) { |
||
| 36 | throw new InvalidIndentationCharacterException('Given indentation character ' . $indentationCharacter . ' is invalid!'); |
||
| 37 | } |
||
| 38 | |||
| 39 | $this->indentationCharacter = $indentationCharacter; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return int |
||
| 44 | */ |
||
| 45 | public function amountOfIndentChars(): int |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public function indentationCharacter(): string |
||
| 58 |