@@ -69,9 +69,9 @@ trait CollectionTrait
6969 */
7070 protected $ filter ;
7171
72- abstract public function getCollectionName (): string ;
72+ abstract public static function getCollectionName (): string ;
7373
74- abstract public function getCollectionPath (): string ;
74+ abstract public static function getCollectionPath (): string ;
7575
7676 /**
7777 * @param $data
@@ -84,7 +84,7 @@ abstract public function hydrateEntity($data, $id);
8484 */
8585 public function current ()
8686 {
87- return $ this ->hydrateEntity ($ this ->page ['_embedded ' ][$ this -> getCollectionName ()][$ this ->current ], $ this ->key ());
87+ return $ this ->hydrateEntity ($ this ->page ['_embedded ' ][static :: getCollectionName ()][$ this ->current ], $ this ->key ());
8888 }
8989
9090 /**
@@ -103,8 +103,8 @@ public function next(): void
103103 public function key ()
104104 {
105105 return
106- $ this ->page ['_embedded ' ][$ this -> getCollectionName ()][$ this ->current ]['id ' ] ??
107- $ this ->page ['_embedded ' ][$ this -> getCollectionName ()][$ this ->current ]['uuid ' ] ??
106+ $ this ->page ['_embedded ' ][static :: getCollectionName ()][$ this ->current ]['id ' ] ??
107+ $ this ->page ['_embedded ' ][static :: getCollectionName ()][$ this ->current ]['uuid ' ] ??
108108 $ this ->current ;
109109 }
110110
@@ -119,12 +119,12 @@ public function valid(): bool
119119 }
120120
121121 //all hal collections have an `_embedded` object, we expect there to be a property matching the collection name
122- if (!isset ($ this ->page ['_embedded ' ][$ this -> getCollectionName ()])) {
122+ if (!isset ($ this ->page ['_embedded ' ][static :: getCollectionName ()])) {
123123 return false ;
124124 }
125125
126126 //if we have a page with no items, we've gone beyond the end of the collection
127- if (!count ($ this ->page ['_embedded ' ][$ this -> getCollectionName ()])) {
127+ if (!count ($ this ->page ['_embedded ' ][static :: getCollectionName ()])) {
128128 return false ;
129129 }
130130
@@ -134,7 +134,7 @@ public function valid(): bool
134134 }
135135
136136 //if our current index is past the current page, fetch the next page if possible and reset the index
137- if (!isset ($ this ->page ['_embedded ' ][$ this -> getCollectionName ()][$ this ->current ])) {
137+ if (!isset ($ this ->page ['_embedded ' ][static :: getCollectionName ()][$ this ->current ])) {
138138 if (isset ($ this ->page ['_links ' ]['next ' ])) {
139139 $ this ->fetchPage ($ this ->page ['_links ' ]['next ' ]['href ' ]);
140140 $ this ->current = 0 ;
@@ -153,7 +153,7 @@ public function valid(): bool
153153 */
154154 public function rewind (): void
155155 {
156- $ this ->fetchPage ($ this -> getCollectionPath ());
156+ $ this ->fetchPage (static :: getCollectionPath ());
157157 }
158158
159159 /**
0 commit comments