/** * @inheritdoc */ public function create($ownerType, $ownerId, $clientId, $clientRedirectUri = null) { $client = Client::findByKey($clientId); if ($client === null) { throw new ClientNotFound(); } $session = new Session(['clientId' => $client->getKey(), 'ownerType' => $ownerType, 'ownerId' => $ownerId, 'clientRedirectUri' => $clientRedirectUri]); $session->setId(ShortId::create()->generate()); $session->save(); return $session->getKey(); }