本文整理汇总了PHP中felpado\get函数的典型用法代码示例。如果您正苦于以下问题:PHP get函数的具体用法?PHP get怎么用?PHP get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserId
private function getUserId(array $inputData)
{
if (f\not($inputData, 'user_id')) {
throw new UserNotFoundException();
}
return f\get($inputData, 'user_id');
}
示例2: findProcessor
/**
* @return TokenGrantTypeProcessorInterface
*/
private function findProcessor($grantType)
{
if (f\contains($this->processors, $grantType)) {
return f\get($this->processors, $grantType);
}
throw new UnsupportedGrantTypeOAuthErrorException();
}
示例3: findUser
private function findUser($username)
{
$isUser = function ($user) use($username) {
return f\get($user, 'username') === $username;
};
return f\find($isUser, $this->users);
}
示例4: process
public function process(Client $client, array $inputData)
{
$userId = f\get($client, 'id');
$scopes = $this->scopesObtainer->getScopes($inputData);
$context = new Context($client, $userId, $scopes);
return $this->tokenCreator->create($context);
}
示例5: getToken
private function getToken($data)
{
$token = f\get($data, 'token');
if (f\not(is_string($token))) {
throw new \InvalidArgumentException('Token must be a strong.');
}
return $token;
}
示例6: testFind
public function testFind()
{
$accessToken = $this->createAccessToken();
$key = f\get($accessToken, 'token');
$value = $accessToken->getParams();
$this->cache->shouldReceive('fetch')->once()->with($key)->andReturn($value);
$this->assertEquals($accessToken, $this->repository->find(f\get($accessToken, 'token')));
}
示例7: testFindAllShouldReturnAllClients
public function testFindAllShouldReturnAllClients()
{
$newClient1 = new Client('foo');
$newClient2 = new Client('bar');
$addedClient1 = $this->repository->add($newClient1);
$addedClient2 = $this->repository->add($newClient2);
$this->assertEquals([f\get($addedClient1, 'id') => $addedClient1, f\get($addedClient2, 'id') => $addedClient2], $this->repository->findAll());
}
示例8: testCreate
public function testCreate()
{
$context = $this->createContextMock();
$accessToken = $this->createAccessToken();
$this->accessTokenCreator->shouldReceive('create')->once()->with($context)->andReturn($accessToken);
$response = $this->tokenCreator->create($context);
$this->assertSame(['access_token' => f\get($accessToken, 'token'), 'token_type' => f\get($accessToken, 'type'), 'expires_in' => f\get($accessToken, 'lifetime'), 'scope' => f\get($accessToken, 'scope')], $response);
}
示例9: get_in
/**
* f\get_in($coll, $in)
*
* Returns a element of a collection in a nested structure in.
* An InvalidArgumentException is thrown if the in does not exist.
*
* f\get_in(array('a' => array('a1' => 'foo'), array('a', 'a1');
* => 'foo'
*/
function get_in($coll, $in)
{
$arrayIn = f\_coll_in($coll, $in);
if ($arrayIn === false) {
return $default;
}
return f\get($arrayIn, f\last($in));
}
示例10: testItThrowsAnExceptionIfThereAccessTokenDoesNotExist
/**
* @expectedException \Akamon\OAuth2\Server\Domain\Exception\OAuthError\InvalidRefreshTokenOAuthErrorException
*/
public function testItThrowsAnExceptionIfThereAccessTokenDoesNotExist()
{
$refreshToken = $this->createRefreshToken();
$this->refreshTokenRepository->shouldReceive('find')->with(f\get($refreshToken, 'token'))->once()->andReturn($refreshToken)->ordered();
$this->accessTokenRepository->shouldReceive('find')->with(f\get($refreshToken, 'accessTokenToken'))->andReturnNull()->ordered();
$this->refreshTokenRepository->shouldReceive('remove')->with($refreshToken)->once()->ordered();
$this->processor->process($this->createClient(), ['refresh_token' => f\get($refreshToken, 'token')]);
}
示例11: resolve
public function resolve(Context $context)
{
if (f\not($context->getScopes()->isEmpty())) {
return $context;
}
$defaultScopes = ScopeCollection::createFromString(f\get($context->getClient(), 'defaultScope'));
return new Context($context->getClient(), $context->getUserId(), $defaultScopes);
}
示例12: getUserCredentialsFromInputData
private function getUserCredentialsFromInputData($inputData)
{
if ($this->hasNoUserCredentialsInInputData($inputData)) {
throw new UserCredentialsNotFoundException();
}
$username = f\get($inputData, 'username');
$password = f\get($inputData, 'password');
return new UserCredentials($username, $password);
}
示例13: testRemoveShouldRemoveAToken
public function testRemoveShouldRemoveAToken()
{
$token1 = $this->createAccessToken();
$token2 = $this->createAccessToken();
$this->repository->add($token1);
$this->repository->add($token2);
$this->repository->remove($token2);
$this->assertEquals($token1, $this->repository->find(f\get($token1->getParams(), 'token')));
$this->assertNull($this->repository->find(f\get($token2->getParams(), 'token')));
}
示例14: testRemoveShouldRemoveAToken
public function testRemoveShouldRemoveAToken($value = '')
{
$token1 = $this->createRefreshToken();
$token2 = $this->createRefreshToken();
$this->repository->add($token1);
$this->repository->add($token2);
$this->repository->remove($token2);
$this->assertEquals($token1, $this->repository->find(f\get($token1, 'token')));
$this->assertNull($this->repository->find(f\get($token2, 'token')));
}
示例15: testOk
public function testOk()
{
$refreshToken = $this->createRefreshToken();
$params = ['access_token' => 'foo', 'token_type' => 'bar', 'lifetime' => 20];
$context = $this->createContextMock();
$this->delegate->shouldReceive('create')->with($context)->once()->andReturn($params)->ordered();
$this->refreshTokenCreator->shouldReceive('create')->with($params['access_token'])->once()->andReturn($refreshToken);
$expected = array_merge($params, ['refresh_token' => f\get($refreshToken, 'token')]);
$this->assertSame($expected, $this->creator->create($context));
}