@@ -69,9 +69,9 @@ trait CollectionTrait
69
69
*/
70
70
protected $ filter ;
71
71
72
- abstract public function getCollectionName (): string ;
72
+ abstract public static function getCollectionName (): string ;
73
73
74
- abstract public function getCollectionPath (): string ;
74
+ abstract public static function getCollectionPath (): string ;
75
75
76
76
/**
77
77
* @param $data
@@ -84,7 +84,7 @@ abstract public function hydrateEntity($data, $id);
84
84
*/
85
85
public function current ()
86
86
{
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 ());
88
88
}
89
89
90
90
/**
@@ -103,8 +103,8 @@ public function next(): void
103
103
public function key ()
104
104
{
105
105
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 ' ] ??
108
108
$ this ->current ;
109
109
}
110
110
@@ -119,12 +119,12 @@ public function valid(): bool
119
119
}
120
120
121
121
//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 ()])) {
123
123
return false ;
124
124
}
125
125
126
126
//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 ()])) {
128
128
return false ;
129
129
}
130
130
@@ -134,7 +134,7 @@ public function valid(): bool
134
134
}
135
135
136
136
//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 ])) {
138
138
if (isset ($ this ->page ['_links ' ]['next ' ])) {
139
139
$ this ->fetchPage ($ this ->page ['_links ' ]['next ' ]['href ' ]);
140
140
$ this ->current = 0 ;
@@ -153,7 +153,7 @@ public function valid(): bool
153
153
*/
154
154
public function rewind (): void
155
155
{
156
- $ this ->fetchPage ($ this -> getCollectionPath ());
156
+ $ this ->fetchPage (static :: getCollectionPath ());
157
157
}
158
158
159
159
/**
0 commit comments