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