public function __construct(TokenGeneratorInterface $tokenGenerator, $params)
 {
     $this->tokenGenerator = $tokenGenerator;
     f\validate_coll_or_throw($params, ['type' => f\required(['v' => 'is_string']), 'lifetime' => f\required(['v' => 'is_int'])]);
     $this->type = $params['type'];
     $this->lifetime = $params['lifetime'];
 }
 public function __construct(Storage $storage, $params)
 {
     $this->storage = $storage;
     f\validate_coll_or_throw($params, ['lifetime' => f\required(['v' => 'is_scalar']), 'resource_processor' => f\required(['v' => 'is_callable'])]);
     $this->lifetime = $params['lifetime'];
     $this->resourceProcessor = $params['resource_processor'];
     $this->scopesObtainer = new ScopesObtainer();
     $this->tokenGenerator = new BearerTokenGenerator(new ArrayRandRandomGenerator());
     $this->clientObtainer = $this->createClientObtainer();
     $this->tokenCreator = $this->createTokenCreator();
 }
/**
 * f\fill_validating_or_throw($coll, $paramRules)
 *
 * Combines filling and validation, throwing if validation fails.
 */
function fill_validating_or_throw($coll, $paramRules)
{
    f\validate_coll_or_throw($coll, $paramRules);
    return f\fill($coll, $paramRules);
}
/**
 * f\fill_validating_normalizing_or_throw($coll, $paramRules)
 *
 * Combines filling, validating and normalization, throwing if validation fails.
 */
function fill_validating_normalizing_or_throw($coll, $paramRules)
{
    f\validate_coll_or_throw($coll, $paramRules);
    $filled = f\fill($coll, $paramRules);
    return f\normalize_coll($filled, $paramRules);
}
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testItThrowsCustomException()
 {
     f\validate_coll_or_throw(array('a' => 1), array('a' => f\optional(array('v' => 'is_float'))), 'InvalidArgumentException');
 }