3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Mvc\Service
;
12 use Zend\Console\Console
;
13 use Zend\Console\Response
as ConsoleResponse
;
14 use Zend\Http\PhpEnvironment\Response
as HttpResponse
;
15 use Zend\ServiceManager\FactoryInterface
;
16 use Zend\ServiceManager\ServiceLocatorInterface
;
18 class ResponseFactory
implements FactoryInterface
21 * Create and return a response instance, according to current environment.
23 * @param ServiceLocatorInterface $serviceLocator
24 * @return \Zend\Stdlib\Message
26 public function createService(ServiceLocatorInterface
$serviceLocator)
28 if (Console
::isConsole()) {
29 return new ConsoleResponse();
32 return new HttpResponse();