| Total Complexity | 6 |
| Total Lines | 72 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 12 | class Symbol implements SymbolInterface |
||
| 13 | { |
||
| 14 | /** @var SplFileInfo */ |
||
| 15 | private $file; |
||
| 16 | |||
| 17 | /** @var Name */ |
||
| 18 | private $node; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Constructor. |
||
| 22 | * |
||
| 23 | * @param SplFileInfo $file |
||
| 24 | * @param Name $node |
||
| 25 | */ |
||
| 26 | 1 | public function __construct(SplFileInfo $file, Name $node) |
|
| 27 | { |
||
| 28 | 1 | $this->file = $file; |
|
| 29 | 1 | $this->node = $node; |
|
| 30 | 1 | } |
|
| 31 | |||
| 32 | /** |
||
| 33 | * Get the name of the symbol. |
||
| 34 | * |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | 1 | public function getName(): string |
|
| 38 | { |
||
| 39 | 1 | return $this->node->__toString(); |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get the path of the file in which the symbol is encountered. |
||
| 44 | * |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | 1 | public function getFile(): string |
|
| 48 | { |
||
| 49 | 1 | return $this->file->getRealPath(); |
|
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Get the line on which the symbol is encountered. |
||
| 54 | * |
||
| 55 | * @return int |
||
| 56 | */ |
||
| 57 | 1 | public function getLine(): int |
|
| 58 | { |
||
| 59 | 1 | return $this->node->getLine(); |
|
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Specify data that should be serialized to JSON. |
||
| 64 | * |
||
| 65 | * @return array |
||
| 66 | */ |
||
| 67 | 1 | public function jsonSerialize(): array |
|
| 73 | ]; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Convert the symbol to a string. |
||
| 78 | * |
||
| 79 | * @return string |
||
| 80 | */ |
||
| 81 | 1 | public function __toString(): string |
|
| 84 | } |
||
| 85 | } |
||
| 86 |