1: <?php
 2: 
 3: namespace PHPFastCGI\FastCGIDaemon;
 4: 
 5: use PHPFastCGI\FastCGIDaemon\Command\DaemonRunCommand;
 6: use Symfony\Component\Console\Application;
 7:  8:  9: 
10: class ApplicationFactory implements ApplicationFactoryInterface
11: {
12:     13: 14: 
15:     private $daemonFactory;
16: 
17:     18: 19: 20: 21: 
22:     public function __construct(DaemonFactoryInterface $daemonFactory = null)
23:     {
24:         $this->daemonFactory = $daemonFactory;
25:     }
26: 
27:     28: 29: 
30:     public function createApplication($kernel, $commandName = null, $commandDescription = null)
31:     {
32:         $command = $this->createCommand($kernel, $commandName, $commandDescription);
33: 
34:         $application = new Application;
35:         $application->add($command);
36: 
37:         return $application;
38:     }
39: 
40:     41: 42: 
43:     public function createCommand($kernel, $commandName = null, $commandDescription = null)
44:     {
45:         return new DaemonRunCommand($kernel, $this->daemonFactory, $commandName, $commandDescription);
46:     }
47: }
48: