本文整理汇总了PHP中felpado\get函数的典型用法代码示例。如果您正苦于以下问题:PHP get函数的具体用法?PHP get怎么用?PHP get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getUserId
private function getUserId(array $inputData)
{
if (f\not($inputData, 'user_id')) {
throw new UserNotFoundException();
}
return f\get($inputData, 'user_id');
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:7,代码来源:DirectTokenGrantTypeProcessor.php
示例2: findProcessor
/**
* @return TokenGrantTypeProcessorInterface
*/
private function findProcessor($grantType)
{
if (f\contains($this->processors, $grantType)) {
return f\get($this->processors, $grantType);
}
throw new UnsupportedGrantTypeOAuthErrorException();
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:10,代码来源:TokenGranterByGrantType.php
示例3: findUser
private function findUser($username)
{
$isUser = function ($user) use($username) {
return f\get($user, 'username') === $username;
};
return f\find($isUser, $this->users);
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:7,代码来源:IterableUserCredentialsChecker.php
示例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);
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:7,代码来源:ClientCredentialsTokenGrantTypeProcessor.php
示例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;
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:8,代码来源:AccessTokenObtainer.php
示例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')));
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:8,代码来源:DoctrineCacheAccessTokenRepositoryTest.php
示例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());
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:8,代码来源:ClientRepositoryTestCase.php
示例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);
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:8,代码来源:TokenCreatorTest.php
示例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));
}
开发者ID:pablodip,项目名称:felpado,代码行数:17,代码来源:get_in.php
示例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')]);
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:11,代码来源:RefreshTokenGrantTypeProcessorTest.php
示例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);
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:8,代码来源:DefaultClientScopeContextResolver.php
示例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);
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:9,代码来源:PasswordTokenGrantTypeProcessor.php
示例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')));
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:10,代码来源:AccessTokenRepositoryTestCase.php
示例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')));
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:10,代码来源:RefreshTokenRepositoryTestCase.php
示例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));
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:10,代码来源:RefreshingTokenCreatorTest.php
示例16: findUser
private function findUser($username)
{
$getUser = function ($user) use($username) {
return f\get($user, 'username') === $username;
};
$user = f\find($getUser, $this->users);
if (f\not($user)) {
throw new UserNotFoundException();
}
return $user;
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:11,代码来源:IterableUserIdObtainer.php
示例17: testCreateShouldCreateAnAccessToken
public function testCreateShouldCreateAnAccessToken()
{
$token = sha1('foo');
$this->tokenGenerator->shouldReceive('generate')->once()->andReturn($token);
$client = new Client(['id' => 'ups', 'name' => 'pablodip']);
$userId = 'bar';
$scopes = new ScopeCollection([new Scope('foo'), new Scope('bar')]);
$context = new Context($client, $userId, $scopes);
$accessToken = $this->creator->create($context);
$this->assertInstanceOf('Akamon\\OAuth2\\Server\\Domain\\Model\\AccessToken\\AccessToken', $accessToken);
$this->assertSame(array('token' => $token, 'type' => 'bearer', 'clientId' => f\get($client, 'id'), 'userId' => $userId, 'createdAt' => time(), 'lifetime' => $this->lifetime, 'scope' => 'foo bar'), $accessToken->getParams());
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:12,代码来源:AccessTokenCreatorTest.php
示例18: testShouldCheckUniqueness
public function testShouldCheckUniqueness()
{
$accessTokenToken = 'ups';
$refreshToken1 = $this->createRefreshToken();
$refreshToken2 = $this->createRefreshToken();
$this->delegate->shouldReceive('create')->with($accessTokenToken)->once()->andReturn($refreshToken1)->globally()->ordered();
$this->repository->shouldReceive('find')->with(f\get($refreshToken1, 'token'))->once()->andReturn($refreshToken1)->globally()->ordered();
$this->delegate->shouldReceive('create')->with($accessTokenToken)->once()->andReturn($refreshToken2)->globally()->ordered();
$this->repository->shouldReceive('find')->with(f\get($refreshToken2, 'token'))->once()->andReturnNull()->globally()->ordered();
$this->repository->shouldReceive('add')->once()->with($refreshToken2)->globally()->ordered();
$this->assertSame($refreshToken2, $this->creator->create($accessTokenToken));
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:12,代码来源:PersistentRefreshTokenCreatorTest.php
示例19: testCreateShouldCheckUniqueness
public function testCreateShouldCheckUniqueness()
{
$context = $this->createContextMock();
$accessToken1 = $this->createAccessToken();
$accessToken2 = $this->createAccessToken();
$this->creator->shouldReceive('create')->with($context)->once()->andReturn($accessToken1)->globally()->ordered();
$this->repository->shouldReceive('find')->with(f\get($accessToken1, 'token'))->once()->andReturn($accessToken1)->globally()->ordered();
$this->creator->shouldReceive('create')->with($context)->once()->andReturn($accessToken2)->globally()->ordered();
$this->repository->shouldReceive('find')->with(f\get($accessToken2, 'token'))->once()->andReturnNull()->globally()->ordered();
$this->repository->shouldReceive('add')->with($accessToken2)->once();
$this->assertSame($accessToken2, $this->persistentCreator->create($context));
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:12,代码来源:PersistentAccessTokenCreatorTest.php
示例20: testOk
public function testOk()
{
$client = $this->createClient();
$userId = f\get($client, 'id');
$scope = 'foo';
$scopes = new ScopeCollection([new Scope($scope)]);
$context = new Context($client, $userId, $scopes);
$inputData = ['scope' => $scope];
$returnData = new \stdClass();
$this->scopesObtainer->shouldReceive('getScopes')->with($inputData)->once()->andReturn($scopes);
$this->tokenCreator->shouldReceive('create')->with(\Mockery::mustBe($context))->once()->andReturn($returnData);
$this->assertSame($returnData, $this->processor->process($client, $inputData));
}
开发者ID:akamon,项目名称:oauth2-server,代码行数:13,代码来源:ClientCredentialsTokenGrantTypeProcessorTest.php
注:本文中的felpado\get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论