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

  • AliasFactory
  • CompositeFactory
  • ConcreteClassFactory
  • MapFactory
  • ServiceDescriptionFactory

Interfaces

  • FactoryInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: namespace Guzzle\Service\Command\Factory;
 4: 
 5: /**
 6:  * Command factory used when explicitly mapping strings to command classes
 7:  */
 8: class MapFactory implements FactoryInterface
 9: {
10:     /**
11:      * @var array Associative array mapping command names to classes
12:      */
13:     protected $map;
14: 
15:     /**
16:      * @param array $map Associative array mapping command names to classes
17:      */
18:     public function __construct(array $map)
19:     {
20:         $this->map = $map;
21:     }
22: 
23:     /**
24:      * {@inheritdoc}
25:      */
26:     public function factory($name, array $args = array())
27:     {
28:         if (isset($this->map[$name])) {
29:             $class = $this->map[$name];
30: 
31:             return new $class($args);
32:         }
33:     }
34: }
35: 
php-coveralls API documentation generated by ApiGen 2.8.0