Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
CRAP | |
0.00% |
0 / 1 |
| NumberLiteralExpression | |
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
5.20 | |
0.00% |
0 / 1 |
| getRegularExpression | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toTypescript | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toJavascript | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| providesDefinitions | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| needsDefinitions | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\TypescriptCodeBuilder\Dto\Expressions; |
| 3 | |
| 4 | use Apie\Core\ValueObjects\Interfaces\HasRegexValueObjectInterface; |
| 5 | use Apie\Core\ValueObjects\IsStringWithRegexValueObject; |
| 6 | use Apie\TypescriptCodeBuilder\Lists\JavascriptIdentifierList; |
| 7 | use Apie\TypescriptCodeBuilder\TypescriptFileExpressionInterface; |
| 8 | |
| 9 | class NumberLiteralExpression implements TypescriptFileExpressionInterface, HasRegexValueObjectInterface |
| 10 | { |
| 11 | use IsStringWithRegexValueObject; |
| 12 | |
| 13 | public static function getRegularExpression(): string |
| 14 | { |
| 15 | return '/^(0[xX][0-9a-fA-F]+|0[bB][01]+|0[oO][0-7]+|(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?)$/D'; |
| 16 | } |
| 17 | |
| 18 | public function toTypescript(): string |
| 19 | { |
| 20 | return $this->toNative(); |
| 21 | } |
| 22 | public function toJavascript(): string |
| 23 | { |
| 24 | return $this->toNative(); |
| 25 | } |
| 26 | public function providesDefinitions(): JavascriptIdentifierList |
| 27 | { |
| 28 | return new JavascriptIdentifierList(); |
| 29 | } |
| 30 | public function needsDefinitions(): JavascriptIdentifierList |
| 31 | { |
| 32 | return new JavascriptIdentifierList(); |
| 33 | } |
| 34 | } |