for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bgy\OAuth2\Storage\InMemory;
use Bgy\OAuth2\Storage\ClientNotFound;
use Bgy\OAuth2\Storage\ClientStorage;
use Bgy\OAuth2\Client as ClientModel;
/**
* @author Boris Guéry <[email protected]>
*/
class InMemoryClientStorage implements ClientStorage
{
private $clients = [];
public function save(ClientModel $client)
$this->clients[$client->getId()] = $client;
}
public function delete(ClientModel $client)
if (!isset($this->clients[$client->getId()])) {
throw new ClientNotFound($client->getId());
unset($this->clients[$client->getId()]);
public function findById($clientId)
if (!isset($this->clients[$clientId])) {
throw new ClientNotFound($clientId);
return $this->clients[$clientId];