Exemplo n.º 1
0
 /**
  * Select ComicVine requests for client.
  *
  * @param array   $options    Options for connection
  * @param CI|null $connection Connection instance
  *
  * @return \ComicAPI\Http\Request\RequestComicVine
  */
 public function fromComicVine($options = [], CI $connection = null)
 {
     $this->validConn($connection);
     if ($this->keys->isValid() === true) {
         return new RequestComicVine($this->keys, $connection, $options);
     }
 }
Exemplo n.º 2
0
 /**
  * Validate and merge array of connection settings
  * and filters for request.
  *
  * @param array $filters Array of filters
  *
  * @return array
  */
 protected function mergeFilter(array &$filters)
 {
     $filters['api_key'] = $this->keys->retrieve(static::SOURCE_TYPE)->getToken();
     $validFilters = new Rules\OneOf(new Rules\Instance(SI::class), new Rules\AllOf(new Rules\ArrayType(), new Rules\NotEmpty()));
     if ($validFilters->validate($this->options) === true) {
         return $this->options + ['query' => $filters];
     }
     return ['query' => $filters];
 }
Exemplo n.º 3
0
 /**
  * @test
  * @expectedException \ComicAPI\Exceptions\ComicApiException
  * @expectedExceptionMessage The token marvel is invalid.
  */
 public function invalidTokens()
 {
     $container = new TokenContainer();
     $container->createAndStore('lorem-ipsum', 'marvel');
     $container->isValid();
 }