@@ 13-69 (lines=57) @@ | ||
10 | * |
|
11 | * @package Mikemirten\Component\JsonApi\Document\Exception |
|
12 | */ |
|
13 | class LinkNotFoundException extends DocumentException |
|
14 | { |
|
15 | /** |
|
16 | * Name of not found link |
|
17 | * |
|
18 | * @var string |
|
19 | */ |
|
20 | protected $name; |
|
21 | ||
22 | /** |
|
23 | * Container inside of which a link has not been found |
|
24 | * |
|
25 | * @var LinksAwareInterface |
|
26 | */ |
|
27 | protected $container; |
|
28 | ||
29 | /** |
|
30 | * LinkNotFoundException constructor. |
|
31 | * |
|
32 | * @param LinksAwareInterface $container |
|
33 | * @param string $name |
|
34 | * @param \Exception | null $previous |
|
35 | */ |
|
36 | public function __construct(LinksAwareInterface $container, string $name, \Exception $previous = null) |
|
37 | { |
|
38 | $this->name = $name; |
|
39 | $this->container = $container; |
|
40 | ||
41 | $info = method_exists($container, '__toString') |
|
42 | ? (string) $container |
|
43 | : get_class($container); |
|
44 | ||
45 | $message = sprintf('Link "%s" not found inside of [%s].', $name, $info); |
|
46 | ||
47 | parent::__construct($message, 0, $previous); |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * Get name of not found link |
|
52 | * |
|
53 | * @return string |
|
54 | */ |
|
55 | public function getName(): string |
|
56 | { |
|
57 | return $this->name; |
|
58 | } |
|
59 | ||
60 | /** |
|
61 | * Get container inside of which a link has not been found |
|
62 | * |
|
63 | * @return LinksAwareInterface |
|
64 | */ |
|
65 | public function getContainer(): LinksAwareInterface |
|
66 | { |
|
67 | return $this->container; |
|
68 | } |
|
69 | } |
@@ 13-69 (lines=57) @@ | ||
10 | * |
|
11 | * @package Mikemirten\Component\JsonApi\Document\Exception |
|
12 | */ |
|
13 | class MetadataAttributeNotFoundException extends DocumentException |
|
14 | { |
|
15 | /** |
|
16 | * Name of not found attribute of metadata |
|
17 | * |
|
18 | * @var string |
|
19 | */ |
|
20 | protected $name; |
|
21 | ||
22 | /** |
|
23 | * Container inside of which an attribute of metadata has not been found |
|
24 | * |
|
25 | * @var MetadataAwareInterface |
|
26 | */ |
|
27 | protected $container; |
|
28 | ||
29 | /** |
|
30 | * MetadataAttributeNotFoundException constructor. |
|
31 | * |
|
32 | * @param MetadataAwareInterface $container |
|
33 | * @param string $name |
|
34 | * @param \Exception | null $previous |
|
35 | */ |
|
36 | public function __construct(MetadataAwareInterface $container, string $name, \Exception $previous = null) |
|
37 | { |
|
38 | $this->name = $name; |
|
39 | $this->container = $container; |
|
40 | ||
41 | $info = method_exists($container, '__toString') |
|
42 | ? (string) $container |
|
43 | : get_class($container); |
|
44 | ||
45 | $message = sprintf('Attribute "%s" of metadata not found inside of [%s].', $name, $info); |
|
46 | ||
47 | parent::__construct($message, 0, $previous); |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * Get name of not found attribute of metadata |
|
52 | * |
|
53 | * @return string |
|
54 | */ |
|
55 | public function getName(): string |
|
56 | { |
|
57 | return $this->name; |
|
58 | } |
|
59 | ||
60 | /** |
|
61 | * Get container inside of which an attribute of metadata has not been found |
|
62 | * |
|
63 | * @return MetadataAwareInterface |
|
64 | */ |
|
65 | public function getContainer(): MetadataAwareInterface |
|
66 | { |
|
67 | return $this->container; |
|
68 | } |
|
69 | } |
@@ 13-69 (lines=57) @@ | ||
10 | * |
|
11 | * @package Mikemirten\Component\JsonApi\Exception |
|
12 | */ |
|
13 | class RelationshipNotFoundException extends DocumentException |
|
14 | { |
|
15 | /** |
|
16 | * Name of not found relationship |
|
17 | * |
|
18 | * @var string |
|
19 | */ |
|
20 | protected $name; |
|
21 | ||
22 | /** |
|
23 | * Container inside of which a relationship has not been found |
|
24 | * |
|
25 | * @var RelationshipsAwareInterface |
|
26 | */ |
|
27 | protected $container; |
|
28 | ||
29 | /** |
|
30 | * RelationshipNotFoundException constructor. |
|
31 | * |
|
32 | * @param RelationshipsAwareInterface $container |
|
33 | * @param string $name |
|
34 | * @param \Exception | null $previous |
|
35 | */ |
|
36 | public function __construct(RelationshipsAwareInterface $container, string $name, \Exception $previous = null) |
|
37 | { |
|
38 | $this->name = $name; |
|
39 | $this->container = $container; |
|
40 | ||
41 | $info = method_exists($container, '__toString') |
|
42 | ? (string) $container |
|
43 | : get_class($container); |
|
44 | ||
45 | $message = sprintf('Relationship "%s" not found inside of [%s].', $name, $info); |
|
46 | ||
47 | parent::__construct($message, 0, $previous); |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * Get name of not found relationship |
|
52 | * |
|
53 | * @return string |
|
54 | */ |
|
55 | public function getName(): string |
|
56 | { |
|
57 | return $this->name; |
|
58 | } |
|
59 | ||
60 | /** |
|
61 | * Get container inside of which a relationship has not been found |
|
62 | * |
|
63 | * @return RelationshipsAwareInterface |
|
64 | */ |
|
65 | public function getContainer(): RelationshipsAwareInterface |
|
66 | { |
|
67 | return $this->container; |
|
68 | } |
|
69 | } |