Open Journal Systems  3.3.0
MapFactory.php
1 <?php
2 
4 
8 class MapFactory implements FactoryInterface
9 {
11  protected $map;
12 
14  public function __construct(array $map)
15  {
16  $this->map = $map;
17  }
18 
19  public function factory($name, array $args = array())
20  {
21  if (isset($this->map[$name])) {
22  $class = $this->map[$name];
23 
24  return new $class($args);
25  }
26  }
27 }
Guzzle\Service\Command\Factory\MapFactory\$map
$map
Definition: MapFactory.php:14
Guzzle\Service\Command\Factory\MapFactory\__construct
__construct(array $map)
Definition: MapFactory.php:17
Guzzle\Service\Command\Factory\MapFactory
Definition: MapFactory.php:8
Guzzle\Service\Command\Factory
Definition: AliasFactory.php:3
Guzzle\Service\Command\Factory\MapFactory\factory
factory($name, array $args=array())
Definition: MapFactory.php:22
Guzzle\Service\Command\Factory\FactoryInterface
Definition: FactoryInterface.php:10