1 | <?php |
||
22 | class ResponseFormatter |
||
23 | { |
||
24 | /** |
||
25 | * @var FormatterInterface[] |
||
26 | */ |
||
27 | protected $formatterClasses = []; |
||
28 | |||
29 | /** |
||
30 | * @var \Fuel\Dependency\Container |
||
31 | */ |
||
32 | protected $dependencyContainer; |
||
33 | |||
34 | /** |
||
35 | * ResponseFormatter constructor. |
||
36 | * |
||
37 | * @param string[] $formatters List of class names or DIC instance names |
||
38 | * @param \Fuel\Dependency\Container $dependencyContainer |
||
39 | */ |
||
40 | 6 | public function __construct($formatters, $dependencyContainer) |
|
55 | |||
56 | /** |
||
57 | * @return FormatterInterface[] |
||
58 | */ |
||
59 | 1 | public function getFormatters() |
|
63 | |||
64 | /** |
||
65 | * @param mixed $data Result returned by the controller. |
||
66 | * |
||
67 | * @return FormatterInterface |
||
68 | */ |
||
69 | 4 | public function getFormatter($data) |
|
79 | |||
80 | /** |
||
81 | * Attempts to run a registered formatter on the given data. |
||
82 | * |
||
83 | * @param mixed $data |
||
84 | */ |
||
85 | 2 | public function format($data) |
|
95 | } |
||
96 |