1 | <?php |
||
17 | class TranslatableToDefaultStringTransformer implements DataTransformerInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var I18nUtils |
||
21 | */ |
||
22 | private $utils; |
||
23 | |||
24 | /** |
||
25 | * @param I18nUtils $utils i18n utils for various needs |
||
26 | */ |
||
27 | public function __construct(I18nUtils $utils) |
||
31 | |||
32 | /** |
||
33 | * return as array |
||
34 | * |
||
35 | * the value returned here will be translated by the i18n listener later on |
||
36 | * |
||
37 | * @param Translatable|null $translatable value from model |
||
38 | * |
||
39 | * @return array |
||
|
|||
40 | */ |
||
41 | public function transform($translatable) |
||
51 | |||
52 | /** |
||
53 | * return simple string |
||
54 | * |
||
55 | * all we want to store after going through a for is a simple string. If there |
||
56 | * are any other languages being sent, this is where they get stored. |
||
57 | * |
||
58 | * @param array $default value from client |
||
59 | * |
||
60 | * @return string |
||
61 | * |
||
62 | * @throws TransformationFailedException |
||
63 | */ |
||
64 | public function reverseTransform($default) |
||
73 | } |
||
74 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.