Open n2ref opened 11 months ago
Warning: Undefined property: stdClass::$items in
/vendor/alaouy/youtube/src/Youtube.php on line 644
Now
public function decodeSingle(&$apiData) { $resObj = json_decode($apiData); if (isset($resObj->error)) { $msg = "Error " . $resObj->error->code . " " . $resObj->error->message; if (isset($resObj->error->errors[0])) { $msg .= " : " . $resObj->error->errors[0]->reason; } throw new \Exception($msg); } else { $itemsArray = $resObj->items; if (!is_array($itemsArray) || count($itemsArray) == 0) { return false; } else { return $itemsArray[0]; } } }
Need
public function decodeSingle(&$apiData) { $resObj = json_decode($apiData); if (isset($resObj->error)) { $msg = "Error " . $resObj->error->code . " " . $resObj->error->message; if (isset($resObj->error->errors[0])) { $msg .= " : " . $resObj->error->errors[0]->reason; } throw new \Exception($msg); } else { $itemsArray = isset($resObj->items) ? $resObj->items : null; if ( ! is_array($itemsArray) || count($itemsArray) == 0) { return false; } else { return isset($itemsArray[0]) ? $itemsArray[0] : false; } } }
@shabuninil Pull requests with tests are always welcome ;)
Is this a change in the API, should I downgrade or something until a fix is in place?
Warning: Undefined property: stdClass::$items in
/vendor/alaouy/youtube/src/Youtube.php on line 644
Now
Need