Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Provider/Apple.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public function __construct(array $options = [], array $collaborators = [])
throw new InvalidArgumentException('Required option not passed: "keyFileId"');
}

if (empty($options['keyFilePath'])) {
throw new InvalidArgumentException('Required option not passed: "keyFilePath"');
if (empty($options['keyFilePath']) && empty($options['keyFileContent'])) {
throw new InvalidArgumentException('Required option not passed: "keyFilePath" or "keyFileContent"');
}

parent::__construct($options, $collaborators);
Expand Down Expand Up @@ -199,10 +199,7 @@ protected function getDefaultScopes()
protected function checkResponse(ResponseInterface $response, $data)
{
if ($response->getStatusCode() >= 400) {
$message = $response->getReasonPhrase();
if (array_key_exists('error', $data)) {
$message = $data['error'];
}
$message = array_key_exists('error', $data) ? $data['error'] : $response->getReasonPhrase();
if (array_key_exists('error_description', $data)) {
$message .= ': ' . $data['error_description'];
}
Expand Down Expand Up @@ -336,6 +333,9 @@ public function getConfiguration()
*/
public function getLocalKey()
{
if (property_exists($this, 'keyFileContent')) {
return InMemory::plainText($this->keyFileContent);
}
return InMemory::file($this->keyFilePath);
}
}