當前位置: 首頁>>代碼示例>>PHP>>正文


PHP felpado\get函數代碼示例

本文整理匯總了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');
 }
開發者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


注:本文中的felpado\get函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。