|
7 | 7 | use alsvanzelf\jsonapi\helpers\Validator; |
8 | 8 | use alsvanzelf\jsonapi\objects\AbstractObject; |
9 | 9 | use alsvanzelf\jsonapi\objects\LinkObject; |
10 | | -use alsvanzelf\jsonapi\objects\LinksArray; |
11 | 10 |
|
12 | 11 | class LinksObject extends AbstractObject { |
13 | 12 | /** @var array with string|LinkObject */ |
@@ -55,32 +54,6 @@ public function add($key, $href, array $meta=[]) { |
55 | 54 | } |
56 | 55 | } |
57 | 56 |
|
58 | | - /** |
59 | | - * appends a link to an array of links under a specific key |
60 | | - * |
61 | | - * @see LinksArray for use cases |
62 | | - * |
63 | | - * @deprecated array links are not supported anymore {@see ->add()} |
64 | | - * |
65 | | - * @param string $key |
66 | | - * @param string $href |
67 | | - * @param array $meta optional, if given a LinkObject is added, otherwise a link string is added |
68 | | - * |
69 | | - * @throws DuplicateException if another link is already using that $key but is not an array |
70 | | - */ |
71 | | - public function append($key, $href, array $meta=[]) { |
72 | | - Validator::checkMemberName($key); |
73 | | - |
74 | | - if (isset($this->links[$key]) === false) { |
75 | | - $this->addLinksArray($key, new LinksArray()); |
76 | | - } |
77 | | - elseif ($this->links[$key] instanceof LinksArray === false) { |
78 | | - throw new DuplicateException('can not add to key "'.$key.'", it is not an array of links'); |
79 | | - } |
80 | | - |
81 | | - $this->links[$key]->add($href, $meta); |
82 | | - } |
83 | | - |
84 | 57 | /** |
85 | 58 | * spec api |
86 | 59 | */ |
@@ -117,45 +90,6 @@ public function addLinkObject($key, LinkObject $linkObject) { |
117 | 90 | $this->links[$key] = $linkObject; |
118 | 91 | } |
119 | 92 |
|
120 | | - /** |
121 | | - * @deprecated array links are not supported anymore {@see ->addLinkObject()} |
122 | | - * |
123 | | - * @param string $key |
124 | | - * @param LinksArray $linksArray |
125 | | - * |
126 | | - * @throws DuplicateException if another link is already using that $key |
127 | | - */ |
128 | | - public function addLinksArray($key, LinksArray $linksArray) { |
129 | | - Validator::checkMemberName($key); |
130 | | - |
131 | | - if (isset($this->links[$key])) { |
132 | | - throw new DuplicateException('link with key "'.$key.'" already set'); |
133 | | - } |
134 | | - |
135 | | - $this->links[$key] = $linksArray; |
136 | | - } |
137 | | - |
138 | | - /** |
139 | | - * @deprecated array links are not supported anymore {@see ->addLinkObject()} |
140 | | - * |
141 | | - * @param string $key |
142 | | - * @param LinkObject $linkObject |
143 | | - * |
144 | | - * @throws DuplicateException if another link is already using that $key but is not an array |
145 | | - */ |
146 | | - public function appendLinkObject($key, LinkObject $linkObject) { |
147 | | - Validator::checkMemberName($key); |
148 | | - |
149 | | - if (isset($this->links[$key]) === false) { |
150 | | - $this->addLinksArray($key, new LinksArray()); |
151 | | - } |
152 | | - elseif ($this->links[$key] instanceof LinksArray === false) { |
153 | | - throw new DuplicateException('can not add to key "'.$key.'", it is not an array of links'); |
154 | | - } |
155 | | - |
156 | | - $this->links[$key]->addLinkObject($linkObject); |
157 | | - } |
158 | | - |
159 | 93 | /** |
160 | 94 | * ObjectInterface |
161 | 95 | */ |
@@ -188,9 +122,6 @@ public function toArray() { |
188 | 122 | if ($link instanceof LinkObject && $link->isEmpty() === false) { |
189 | 123 | $array[$key] = $link->toArray(); |
190 | 124 | } |
191 | | - elseif ($link instanceof LinksArray && $link->isEmpty() === false) { // @phpstan-ignore method.deprecatedClass |
192 | | - $array[$key] = $link->toArray(); // @phpstan-ignore method.deprecatedClass |
193 | | - } |
194 | 125 | elseif ($link instanceof LinkObject && $link->isEmpty()) { |
195 | 126 | $array[$key] = null; |
196 | 127 | } |
|
0 commit comments