Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
CRAP | |
0.00% |
0 / 1 |
| TypeGuardDefinition | |
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
5.20 | |
0.00% |
0 / 1 |
| __construct | |
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\Typehints; |
| 3 | |
| 4 | use Apie\TypescriptCodeBuilder\Lists\JavascriptIdentifierList; |
| 5 | use Apie\TypescriptCodeBuilder\TypescriptTypeDeclarationInterface; |
| 6 | use Apie\TypescriptCodeBuilder\ValueObjects\JavascriptIdentifier; |
| 7 | |
| 8 | class TypeGuardDefinition implements TypescriptTypeDeclarationInterface |
| 9 | { |
| 10 | public function __construct( |
| 11 | public JavascriptIdentifier $value, |
| 12 | public TypescriptTypeDeclarationInterface $type, |
| 13 | ) { |
| 14 | } |
| 15 | |
| 16 | public function toTypescript(): string |
| 17 | { |
| 18 | return $this->value->toNative() . ' is ' . $this->type->toTypescript(); |
| 19 | } |
| 20 | |
| 21 | public function toJavascript(): string |
| 22 | { |
| 23 | return ''; |
| 24 | } |
| 25 | |
| 26 | public function providesDefinitions(): JavascriptIdentifierList |
| 27 | { |
| 28 | return new JavascriptIdentifierList(); |
| 29 | } |
| 30 | |
| 31 | public function needsDefinitions(): JavascriptIdentifierList |
| 32 | { |
| 33 | return $this->type->needsDefinitions(); |
| 34 | } |
| 35 | } |