• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP felpado\get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Graph\Graph类代码示例发布时间:2022-05-23
下一篇:
PHP Core\Utils类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap