1 | <?php |
||
23 | class ArrayToDelimitedStringTransformer implements DataTransformerInterface |
||
24 | { |
||
25 | private $delimiter; |
||
26 | private $paddingLeft; |
||
27 | private $paddingRight; |
||
28 | |||
29 | /** |
||
30 | * Constructor |
||
31 | * |
||
32 | * @param string $delimiter The delimiter to use when transforming from |
||
33 | * a string to an array and vice-versa |
||
34 | * @param integer Number of spaces before each transformed array element |
||
35 | * @param integer Number of spaces after each transformed array element |
||
36 | */ |
||
37 | public function __construct($delimiter = ',', $paddingLeft = 0, $paddingRight = 1) |
||
43 | |||
44 | /** |
||
45 | * Transforms an array into a delimited string |
||
46 | * |
||
47 | * @param array $array Array to transform |
||
48 | * |
||
49 | * @return string |
||
50 | * |
||
51 | * @throws TransformationFailedException If the given value is not an array |
||
52 | */ |
||
53 | public function transform($array) |
||
75 | |||
76 | /** |
||
77 | * Transforms a delimited string into an array |
||
78 | * |
||
79 | * @param string $string String to transform |
||
80 | * |
||
81 | * @return array |
||
82 | * |
||
83 | * @throws TransformationFailedException If the given value is not a string |
||
84 | */ |
||
85 | public function reverseTransform($string) |
||
108 | } |
||
109 |