reverseTransform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace DoS\ResourceBundle\Form\DataTransformer;
4
5
use Doctrine\Common\Collections\Collection;
6
use Symfony\Component\Form\DataTransformerInterface;
7
8
/**
9
 * Transform object collection to array.
10
 *
11
 * @author Liverbool <[email protected]>
12
 */
13
class ObjectCollectionToArrayTransformer implements DataTransformerInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function transform($value)
19
    {
20
        if ($value instanceof Collection) {
21
            return $value->toArray();
22
        }
23
24
        return $value;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function reverseTransform($value)
31
    {
32
        return $value;
33
    }
34
}
35