Event/SlugEvent.php 1 location
|
@@ 26-30 (lines=5) @@
|
| 23 |
|
*/ |
| 24 |
|
public function __construct($entity, $property) |
| 25 |
|
{ |
| 26 |
|
if (!is_object($entity)) { |
| 27 |
|
throw new \InvalidArgumentException('The "$entity" parameter must be an object.'); |
| 28 |
|
} elseif (!empty($property) && is_string($property)) { |
| 29 |
|
throw new \InvalidArgumentException('The "$property" parameter must be a non empty string.'); |
| 30 |
|
} |
| 31 |
|
|
| 32 |
|
$this->entity = $entity; |
| 33 |
|
$this->property = $property; |
Twig/Extension/TranslationExtension.php 1 location
|
@@ 73-77 (lines=5) @@
|
| 70 |
|
|
| 71 |
|
public function translationSourceProperty($object, $property) |
| 72 |
|
{ |
| 73 |
|
if (!is_object($object)) { |
| 74 |
|
throw new \InvalidArgumentException('The "$object" parameter must be an object.'); |
| 75 |
|
} elseif (empty($property) || !is_string($property)) { |
| 76 |
|
throw new \InvalidArgumentException('The "$property" parameter must be a non empty string.'); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
if ($this->isTranslatable($object) && $object->getTranslationSource() !== null) { |
| 80 |
|
$object = $object->getTranslationSource(); |