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 Interop\Container\ContainerInterface;
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
/**
* @author Pedro Alves <[email protected]>
*/
class EndpointFactory extends AbstractFactory
{
use InvalidTypeExceptionTrait;
* {@inheritDoc}
protected function create(ContainerInterface $container, $config)
$serializer = $this->getServiceOrClassObject($container, $config['serializer']);
if (!$serializer instanceof SerializerInterface) {
throw $this->getException(
'serializer',
SerializerInterface::class,
ServiceNotCreatedException::class,
$serializer
);
}
$transport = $container->get($config['transport']);
$endpointContainer = $config['container'];
$endpointContainer = new $endpointContainer($transport, $serializer);
if (!$endpointContainer instanceof EndpointsInterface) {
'container',
EndpointsInterface::class,
$endpointContainer
return $endpointContainer;
public function getServiceType()
return 'endpoint';