public function resolve(Context $context)
 {
     $scopeExists = [$this->repository, 'find'];
     $scopeNames = $context->getScopes()->getNames();
     if (f\some(f\not_fn($scopeExists), $scopeNames)) {
         throw new ScopeNotFoundOAuthErrorException();
     }
     return $context;
 }
 public function resolve(Context $context)
 {
     $isScopeAllowed = [$context->getClient(), 'hasAllowedScope'];
     $scopeNames = $context->getScopes()->getNames();
     if (f\some(f\not_fn($isScopeAllowed), $scopeNames)) {
         throw new UnauthorizedClientForScopeOAuthErrorException();
     }
     return $context;
 }
示例#3
0
 public function testIt()
 {
     $constFalse = f\not_fn(function () {
         return true;
     });
     $constTrue = f\not_fn(function () {
         return false;
     });
     $invert = f\not_fn(function ($bool) {
         return $bool;
     });
     $nand = f\not_fn(f\operator('&&'));
     $this->assertEquals(false, $constFalse());
     $this->assertEquals(true, $constTrue());
     $this->assertEquals(false, $invert(true));
     $this->assertEquals(true, $invert(false));
     $this->assertEquals(false, $nand(true, true));
     $this->assertEquals(true, $nand(true, false));
 }