src/Standard/View/CollectionType.php 1 location
|
@@ 24-29 (lines=6) @@
|
| 21 |
|
|
| 22 |
|
public function createView(ViewFactory $factory, $data, array $options): ViewInterface |
| 23 |
|
{ |
| 24 |
|
if (!is_array($data) && !$data instanceof \Traversable) { |
| 25 |
|
throw new \InvalidArgumentException(sprintf( |
| 26 |
|
'Data must be traversable or an array, got: "%s"', |
| 27 |
|
is_object($data) ? get_class($data) : gettype($data) |
| 28 |
|
)); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
if (is_array($data)) { |
| 32 |
|
$data = new \ArrayIterator($data); |
src/Standard/View/ScalarType.php 1 location
|
@@ 18-23 (lines=6) @@
|
| 15 |
|
{ |
| 16 |
|
public function createView(ViewFactory $factory, $data, array $options): ViewInterface |
| 17 |
|
{ |
| 18 |
|
if (null !== $data && !is_scalar($data)) { |
| 19 |
|
throw new \InvalidArgumentException(sprintf( |
| 20 |
|
'Scalar view only accepts scalar values! Got "%s"', |
| 21 |
|
is_object($data) ? get_class($data) : gettype($data) |
| 22 |
|
)); |
| 23 |
|
} |
| 24 |
|
|
| 25 |
|
return new ScalarView($options['template'], $data); |
| 26 |
|
} |