src/Extractors/PlainExtractors/DateTimeExtractor.php 1 location
|
@@ 28-41 (lines=14) @@
|
| 25 |
|
use V8\Value; |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
class DateTimeExtractor implements PlainExtractorInterface |
| 29 |
|
{ |
| 30 |
|
/** |
| 31 |
|
* {@inheritdoc} |
| 32 |
|
*/ |
| 33 |
|
public function extract(Context $context, Value $value, PlainExtractorDefinitionInterface $definition, ExtractorInterface $extractor) |
| 34 |
|
{ |
| 35 |
|
if ($value instanceof DateObject) { |
| 36 |
|
return new DateTime($value->valueOf() / 1000); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
throw new ExtractorException('Value must be of the type date, ' . $value->typeOf()->value() . ' given'); |
| 40 |
|
} |
| 41 |
|
} |
| 42 |
|
|
src/Extractors/PlainExtractors/NullExtractor.php 1 location
|
@@ 27-40 (lines=14) @@
|
| 24 |
|
use V8\Value; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
class NullExtractor implements PlainExtractorInterface |
| 28 |
|
{ |
| 29 |
|
/** |
| 30 |
|
* {@inheritdoc} |
| 31 |
|
*/ |
| 32 |
|
public function extract(Context $context, Value $value, PlainExtractorDefinitionInterface $definition, ExtractorInterface $extractor) |
| 33 |
|
{ |
| 34 |
|
if ($value instanceof NullValue) { |
| 35 |
|
return $value->value(); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
throw new ExtractorException('Value must be of the type null, ' . $value->typeOf()->value() . ' given'); |
| 39 |
|
} |
| 40 |
|
} |
| 41 |
|
|
src/Extractors/PlainExtractors/UndefinedExtractor.php 1 location
|
@@ 27-40 (lines=14) @@
|
| 24 |
|
use V8\Value; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
class UndefinedExtractor implements PlainExtractorInterface |
| 28 |
|
{ |
| 29 |
|
/** |
| 30 |
|
* {@inheritdoc} |
| 31 |
|
*/ |
| 32 |
|
public function extract(Context $context, Value $value, PlainExtractorDefinitionInterface $definition, ExtractorInterface $extractor) |
| 33 |
|
{ |
| 34 |
|
if ($value instanceof UndefinedValue) { |
| 35 |
|
return $value->value(); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
throw new ExtractorException('Value must of the type undefined, ' . $value->typeOf()->value() . ' given'); |
| 39 |
|
} |
| 40 |
|
} |
| 41 |
|
|
src/Extractors/PlainExtractors/DateExtractor.php 1 location
|
@@ 27-40 (lines=14) @@
|
| 24 |
|
use V8\Value; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
class DateExtractor implements PlainExtractorInterface |
| 28 |
|
{ |
| 29 |
|
/** |
| 30 |
|
* {@inheritdoc} |
| 31 |
|
*/ |
| 32 |
|
public function extract(Context $context, Value $value, PlainExtractorDefinitionInterface $definition, ExtractorInterface $extractor) |
| 33 |
|
{ |
| 34 |
|
if ($value instanceof DateObject) { |
| 35 |
|
return $value->valueOf(); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
throw new ExtractorException('Value must be of the type date, ' . $value->typeOf()->value() . ' given'); |
| 39 |
|
} |
| 40 |
|
} |
| 41 |
|
|
src/Extractors/PlainExtractors/FunctionExtractor.php 1 location
|
@@ 27-40 (lines=14) @@
|
| 24 |
|
use V8\Value; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
class FunctionExtractor implements PlainExtractorInterface |
| 28 |
|
{ |
| 29 |
|
/** |
| 30 |
|
* {@inheritdoc} |
| 31 |
|
*/ |
| 32 |
|
public function extract(Context $context, Value $value, PlainExtractorDefinitionInterface $definition, ExtractorInterface $extractor) |
| 33 |
|
{ |
| 34 |
|
if ($value instanceof FunctionObject) { |
| 35 |
|
return $value; |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
throw new ExtractorException('Value must be of the type function, ' . $value->typeOf()->value() . ' given'); |
| 39 |
|
} |
| 40 |
|
} |
| 41 |
|
|