Total Complexity | 5 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class TagsToJsonTransformer implements DataTransformerInterface |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * @var EntityManagerInterface |
||
14 | */ |
||
15 | private $em; |
||
16 | |||
17 | public function __construct(EntityManagerInterface $em) |
||
21 | } |
||
22 | |||
23 | public function transform($tagsArray) |
||
24 | { |
||
25 | $jsonTags = []; |
||
26 | /** |
||
27 | * @var $tag Tag |
||
28 | */ |
||
29 | foreach ($tagsArray as $tag) { |
||
30 | array_push($jsonTags, $tag->getName()); |
||
31 | } |
||
32 | return json_encode($jsonTags); |
||
33 | |||
34 | } |
||
35 | |||
36 | public function reverseTransform($jsonTags) |
||
53 | |||
54 | } |
||
57 | } |