| @@ 13-32 (lines=20) @@ | ||
| 10 | * |
|
| 11 | * @package Mikemirten\Component\JsonApi\Document\Exception |
|
| 12 | */ |
|
| 13 | class LinkOverrideException extends DocumentException |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * LinkNotFoundException constructor. |
|
| 17 | * |
|
| 18 | * @param LinksAwareInterface $container |
|
| 19 | * @param string $name |
|
| 20 | * @param \Exception | null $previous |
|
| 21 | */ |
|
| 22 | public function __construct(LinksAwareInterface $container, string $name, \Exception $previous = null) |
|
| 23 | { |
|
| 24 | $info = method_exists($container, '__toString') |
|
| 25 | ? (string) $container |
|
| 26 | : get_class($container); |
|
| 27 | ||
| 28 | $message = sprintf('Link "%s" already exists inside of [%s]. To set new one, the old one must be removed.', $name, $info); |
|
| 29 | ||
| 30 | parent::__construct($message, 0, $previous); |
|
| 31 | } |
|
| 32 | } |
|
| @@ 13-32 (lines=20) @@ | ||
| 10 | * |
|
| 11 | * @package Mikemirten\Component\JsonApi\Document\Exception |
|
| 12 | */ |
|
| 13 | class MetadataAttributeOverrideException extends DocumentException |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * MetadataAttributeOverrideException constructor. |
|
| 17 | * |
|
| 18 | * @param MetadataAwareInterface $container |
|
| 19 | * @param string $name |
|
| 20 | * @param \Exception | null $previous |
|
| 21 | */ |
|
| 22 | public function __construct(MetadataAwareInterface $container, string $name, \Exception $previous = null) |
|
| 23 | { |
|
| 24 | $info = method_exists($container, '__toString') |
|
| 25 | ? (string) $container |
|
| 26 | : get_class($container); |
|
| 27 | ||
| 28 | $message = sprintf('Attribute "%s" of metadata already exists inside of [%s]. To set new one, the old one must be removed.', $name, $info); |
|
| 29 | ||
| 30 | parent::__construct($message, 0, $previous); |
|
| 31 | } |
|
| 32 | } |
|
| @@ 13-32 (lines=20) @@ | ||
| 10 | * |
|
| 11 | * @package Mikemirten\Component\JsonApi\Exception |
|
| 12 | */ |
|
| 13 | class RelationshipOverrideException extends DocumentException |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * RelationshipOverrideException constructor. |
|
| 17 | * |
|
| 18 | * @param RelationshipsAwareInterface $container |
|
| 19 | * @param string $name |
|
| 20 | * @param \Exception | null $previous |
|
| 21 | */ |
|
| 22 | public function __construct(RelationshipsAwareInterface $container, string $name, \Exception $previous = null) |
|
| 23 | { |
|
| 24 | $info = method_exists($container, '__toString') |
|
| 25 | ? (string) $container |
|
| 26 | : get_class($container); |
|
| 27 | ||
| 28 | $message = sprintf('Relationship "%s" already exists inside of [%s]. To set new one, the old one must be removed.', $name, $info); |
|
| 29 | ||
| 30 | parent::__construct($message, 0, $previous); |
|
| 31 | } |
|
| 32 | } |
|