Overview

Namespaces

  • NetBazzlineZfLocatorGenerator
    • Controller
      • Console
    • Service

Classes

  • NetBazzlineZfLocatorGenerator\Controller\Console\IndexController
  • NetBazzlineZfLocatorGenerator\Controller\Console\IndexControllerFactory
  • NetBazzlineZfLocatorGenerator\Service\ProcessPipeFactory
  • Overview
  • Namespace
  • Class
 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 
<?php
/**
 * @author stev leibelt <artodeto@bazzline.net>
 * @since 2015-06-04
 */

namespace NetBazzlineZfLocatorGenerator\Controller\Console;

use Net\Bazzline\Component\ProcessPipe\PipeInterface;
use Zend\ServiceManager\Exception\InvalidArgumentException;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZfConsoleHelper\Controller\Console\AbstractConsoleControllerFactory;

class IndexControllerFactory extends AbstractConsoleControllerFactory
{
    /**
     * Create service
     *
     * @param ServiceLocatorInterface $serviceLocator
     *
     * @return mixed|IndexController
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $controller     = new IndexController();
        $serviceLocator = $this->transformIntoServiceManager($serviceLocator);

        /** @var array|\Zend\Config\Config $configuration */
        $configuration  = $serviceLocator->get('Config');
        $key            = 'net_bazzline_zf_locator_generator';

        if (!isset($configuration[$key])) {
            throw new InvalidArgumentException (
                'expected configuration key "' . $key . '" not found'
            );
        }

        $configuration  = $configuration[$key];
        /** @var PipeInterface $pipe */
        $pipe           = $serviceLocator->get('NetBazzlineLocatorGeneratorProcessPipe');

        $controller->setConfiguration($configuration);
        $controller->setProcessPipe($pipe);

        return $controller;
    }
}
PHP Locator Generator Module for Zend Framework 2 by bazzline.net API documentation generated by ApiGen