public function __construct(ServiceFactory $serviceFactory = null) { if (null === $serviceFactory) { // Create the service factory $serviceFactory = new ServiceFactory(); } $this->_serviceFactory = $serviceFactory; }