Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
66.67% |
4 / 6 |
|
50.00% |
2 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Type_Any | |
66.67% |
4 / 6 |
|
50.00% |
2 / 4 |
4.59 | |
0.00% |
0 / 1 |
| parse | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| __toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| jsonSerialize | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| schema | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\Jetpack\Schema\Types; |
| 4 | |
| 5 | use Automattic\Jetpack\Schema\Parser; |
| 6 | |
| 7 | /** |
| 8 | * ! USE WITH CAUTION ! |
| 9 | * This schema will not parse values. Use only when you're sure that the data can be trusted. |
| 10 | * For example - this can be used to deliver readonly data to the client. |
| 11 | */ |
| 12 | class Type_Any implements Parser { |
| 13 | |
| 14 | public function parse( $value, $_context ) { |
| 15 | return $value; |
| 16 | } |
| 17 | |
| 18 | public function __toString() { |
| 19 | return 'any'; |
| 20 | } |
| 21 | |
| 22 | #[\ReturnTypeWillChange] |
| 23 | public function jsonSerialize() { |
| 24 | return $this->schema(); |
| 25 | } |
| 26 | public function schema() { |
| 27 | return array( |
| 28 | 'type' => (string) $this, |
| 29 | ); |
| 30 | } |
| 31 | } |