for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ElasticsearchModule\Service;
use Elasticsearch\Serializers\SerializerInterface;
use ElasticsearchModule\Container\EndpointsInterface;
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
* @author Pedro Alves <[email protected]>
*/
class EndpointFactory extends AbstractFactory
{
use InvalidTypeExceptionTrait;
* {@inheritDoc}
protected function create(ServiceLocatorInterface $serviceLocator, $config)
$serializer = $this->getServiceOrClassObject($serviceLocator, $config['serializer']);
if (!$serializer instanceof SerializerInterface) {
throw $this->getException(
'serializer',
SerializerInterface::class,
ServiceNotCreatedException::class,
$serializer
);
}
$transport = $serviceLocator->get($config['transport']);
$container = $config['container'];
$container = new $container($transport, $serializer);
if (!$container instanceof EndpointsInterface) {
'container',
EndpointsInterface::class,
$container
return $container;
public function getServiceType()
return 'endpoint';