Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Literal | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | /** |
| 4 | * Pop PHP Framework (https://www.popphp.org/) |
| 5 | * |
| 6 | * @link https://github.com/popphp/popphp-framework |
| 7 | * @author Nick Sagona, III <dev@noladev.com> |
| 8 | * @copyright Copyright (c) 2009-2027 NOLA Interactive, LLC. |
| 9 | * @license https://www.popphp.org/license New BSD License |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * @namespace |
| 14 | */ |
| 15 | namespace Pop\Code\Generator; |
| 16 | |
| 17 | /** |
| 18 | * Literal value class |
| 19 | * |
| 20 | * Wraps a raw PHP-source expression (e.g. 'self::FOO', 'Status::Active', 'new Foo()') that must be |
| 21 | * emitted verbatim wherever a generator would otherwise quote/escape a plain PHP value. |
| 22 | * |
| 23 | * @category Pop |
| 24 | * @package Pop\Code |
| 25 | * @author Nick Sagona, III <dev@noladev.com> |
| 26 | * @copyright Copyright (c) 2009-2027 NOLA Interactive, LLC. |
| 27 | * @license https://www.popphp.org/license New BSD License |
| 28 | * @version 6.0.0 |
| 29 | */ |
| 30 | class Literal |
| 31 | { |
| 32 | |
| 33 | /** |
| 34 | * The raw source expression |
| 35 | * @var string |
| 36 | */ |
| 37 | protected string $value; |
| 38 | |
| 39 | /** |
| 40 | * Constructor |
| 41 | * |
| 42 | * @param string $value |
| 43 | */ |
| 44 | public function __construct(string $value) |
| 45 | { |
| 46 | $this->value = $value; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Get the raw source expression |
| 51 | * |
| 52 | * @return string |
| 53 | */ |
| 54 | public function getValue(): string |
| 55 | { |
| 56 | return $this->value; |
| 57 | } |
| 58 | |
| 59 | } |