Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • AbstractResourceIteratorFactory
  • CompositeResourceIteratorFactory
  • MapResourceIteratorFactory
  • Model
  • ResourceIterator
  • ResourceIteratorApplyBatched
  • ResourceIteratorClassFactory

Interfaces

  • ResourceIteratorFactoryInterface
  • ResourceIteratorInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: namespace Guzzle\Service\Resource;
 4: 
 5: use Guzzle\Common\Exception\InvalidArgumentException;
 6: use Guzzle\Service\Command\CommandInterface;
 7: 
 8: /**
 9:  * Abstract resource iterator factory implementation
10:  */
11: abstract class AbstractResourceIteratorFactory implements ResourceIteratorFactoryInterface
12: {
13:     /**
14:      * {@inheritdoc}
15:      */
16:     public function build(CommandInterface $command, array $options = array())
17:     {
18:         if (!$this->canBuild($command)) {
19:             throw new InvalidArgumentException('Iterator was not found for ' . $command->getName());
20:         }
21: 
22:         $className = $this->getClassName($command);
23: 
24:         return new $className($command, $options);
25:     }
26: 
27:     /**
28:      * {@inheritdoc}
29:      */
30:     public function canBuild(CommandInterface $command)
31:     {
32:         return (bool) $this->getClassName($command);
33:     }
34: 
35:     /**
36:      * Get the name of the class to instantiate for the command
37:      *
38:      * @param CommandInterface $command Command that is associated with the iterator
39:      *
40:      * @return string
41:      */
42:     abstract protected function getClassName(CommandInterface $command);
43: }
44: 
php-coveralls API documentation generated by ApiGen 2.8.0