<commit_before><?php

namespace Hermes\Api;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class ClientFactory implements FactoryInterface
{
    /**
     * {@inheritdoc}
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');
        $clientConfig = $config['hermes'];

        $client = new \Zend\Http\Client($clientConfig['uri'], $clientConfig['http_client']['options']);
        $client->getRequest()->getHeaders()->addHeaders($clientConfig['headers']);

        $hermes = new Client($client, isset($clientConfig['service_name']) ? $clientConfig['service_name'] : null, $clientConfig['depth']);
        if (isset($clientConfig['append_path'])) {
            $hermes->setAppendPath($clientConfig['append_path']);
        }
        return $hermes;
    }
}<commit_msg>Updating to new factoryinterface but keeping previous compatibility<commit_after><?php

namespace Hermes\Api;

use Zend\ServiceManager\Factory\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class ClientFactory implements FactoryInterface
{
    /**
     * {@inheritDoc}
     * @see \Zend\ServiceManager\Factory\FactoryInterface::__invoke()
     */
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $config = $container->get('config');
        $clientConfig = $config['hermes'];

        $client = new \Zend\Http\Client($clientConfig['uri'], $clientConfig['http_client']['options']);
        $client->getRequest()->getHeaders()->addHeaders($clientConfig['headers']);

        $hermes = new Client($client, isset($clientConfig['service_name']) ? $clientConfig['service_name'] : null, $clientConfig['depth']);
        if (isset($clientConfig['append_path'])) {
            $hermes->setAppendPath($clientConfig['append_path']);
        }
        return $hermes;
    }

    /**
     * {@inheritdoc}
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        return $this($serviceLocator, ClientFactory::class);
    }
}
{'fraction_non_alphanumeric': 0.14922571562646644, 'fraction_numerical': 0.0, 'mean_word_length': 4.052132701421801, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1429800', 'n_tokens_mistral': 576, 'n_tokens_neox': 569, 'n_words': 95}