We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 615e0aa commit 62c4e23Copy full SHA for 62c4e23
src/Model/OneRoster.php
@@ -143,11 +143,14 @@ protected static function httpGet($route)
143
* @param $class the type of the object wanted
144
* @return mixed
145
*/
146
- protected static function get($route, $class) {
+ protected static function get($route, $class = null) {
147
$header = self::generateHeader();
148
+ if ($class == null) {
149
+ $class = get_called_class();
150
+ }
151
$json = OpenLRW::httpGet(self::PREFIX . $route, $header);
152
if (count($json) < 2 ) {
- return new static ((array)$json[0]);
153
+ return new $class((array)$json[0]);
154
} else {
155
$results = [];
156
foreach ($json as $item) {
0 commit comments