Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
40.00% covered (danger)
40.00%
2 / 5
40.00% covered (danger)
40.00%
2 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
StringLiteralExpression
40.00% covered (danger)
40.00%
2 / 5
40.00% covered (danger)
40.00%
2 / 5
10.40
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toTypescript
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toJavascript
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 providesDefinitions
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 needsDefinitions
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2namespace Apie\TypescriptCodeBuilder\Dto\Expressions;
3
4use Apie\TypescriptCodeBuilder\Lists\JavascriptIdentifierList;
5use Apie\TypescriptCodeBuilder\TypescriptFileExpressionInterface;
6
7class StringLiteralExpression implements TypescriptFileExpressionInterface
8{
9    public function __construct(public string $value)
10    {
11    }
12
13    public function toTypescript(): string
14    {
15        return json_encode($this->value, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
16    }
17    public function toJavascript(): string
18    {
19        return $this->toTypescript();
20    }
21    public function providesDefinitions(): JavascriptIdentifierList
22    {
23        return new JavascriptIdentifierList();
24    }
25    public function needsDefinitions(): JavascriptIdentifierList
26    {
27        return new JavascriptIdentifierList();
28    }
29}