make() public method

Create a new object instance
public make ( array $config = [] ) : Dispatcher
$config array The config parameters which override the fof.xml information
return FOF30\Dispatcher\Dispatcher A new Dispatcher object
コード例 #1
0
ファイル: DispatcherFactoryTest.php プロジェクト: Joal01/fof
 /**
  * @covers          FOF30\Factory\Magic\DispatcherFactory::make
  * @dataProvider    getTestMake
  */
 public function testMake($test, $check)
 {
     $msg = 'DispatcherFactory::make %s - Case: ' . $check['case'];
     $config['componentName'] = $test['component'];
     if ($test['backend_path']) {
         $config['backEndPath'] = $test['backend_path'];
     }
     $container = new TestContainer($config);
     // Required so we force FOF to read the fof.xml file
     $dummy = $container->appConfig;
     $factory = new DispatcherFactory($container);
     $result = $factory->make(array());
     $this->assertEquals($check['result'], get_class($result), sprintf($msg, 'Returned the wrong result'));
 }
コード例 #2
0
ファイル: MagicSwitchFactory.php プロジェクト: akeeba/fof
 /**
  * Creates a new Dispatcher
  *
  * @param   array  $config  The configuration values for the Dispatcher object
  *
  * @return  Dispatcher
  */
 public function dispatcher(array $config = array())
 {
     $dispatcherClass = $this->container->getNamespacePrefix($this->getSection()) . 'Dispatcher\\Dispatcher';
     try {
         return $this->createDispatcher($dispatcherClass, $config);
     } catch (DispatcherNotFound $e) {
         // Not found. Let's go on.
     }
     $dispatcherClass = $this->container->getNamespacePrefix('inverse') . 'Dispatcher\\Dispatcher';
     try {
         return $this->createDispatcher($dispatcherClass, $config);
     } catch (DispatcherNotFound $e) {
         // Not found. Return the magically created Dispatcher
         $magic = new DispatcherFactory($this->container);
         // Let's pass the section override (if any)
         $magic->setSection($this->getSection());
         return $magic->make($config);
     }
 }
コード例 #3
0
ファイル: MagicFactory.php プロジェクト: akeeba/fof
 public function dispatcher(array $config = array())
 {
     $dispatcherClass = $this->container->getNamespacePrefix() . 'Dispatcher\\Dispatcher';
     try {
         return $this->createDispatcher($dispatcherClass, $config);
     } catch (DispatcherNotFound $e) {
         // Not found. Return the magically created Dispatcher
         $magic = new DispatcherFactory($this->container);
         return $magic->make($config);
     }
 }