<commit_before><?php
/**
 * PHP-DI
 *
 * @link http://mnapoli.github.io/PHP-DI/
 * @copyright <NAME> (http://mnapoli.fr/)
 * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
 */

namespace DI\ZendFramework2\Service;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use DI\ContainerBuilder;;

/**
 * Abstract factory responsible of trying to build services from the PHP DI container
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME>
 */
class DIContainerFactory implements FactoryInterface
{

    /**
     * Create service
     *
     * @param ServiceLocatorInterface $serviceLocator
     * @return mixed
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $builder = new ContainerBuilder();
        $configFile = __DIR__ . '/../../../../../../../config/php-di.config.php';

        if (file_exists($configFile)) {
            $builder->addDefinitions($configFile);
        }

        return $builder->build();
    }
}<commit_msg>DI\Container has Zend ServiceLocator as fallback/wrap container<commit_after><?php
/**
 * PHP-DI
 *
 * @link http://mnapoli.github.io/PHP-DI/
 * @copyright <NAME> (http://mnapoli.fr/)
 * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
 */

namespace DI\ZendFramework2\Service;

use Acclimate\Container\ContainerAcclimator;
use DI\Container;
use DI\ContainerBuilder;;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

/**
 * Abstract factory responsible of trying to build services from the PHP DI container
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME>
 */
class DIContainerFactory implements FactoryInterface
{

    /**
     * @var Container
     */
    private $container;

    /**
     * Create service
     *
     * @param ServiceLocatorInterface $serviceLocator
     * @return Container
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if ($this->container !== null) {
            return $this->container;
        }

        $builder = new ContainerBuilder();
        $configFile = __DIR__ . '/../../../../../../../config/php-di.config.php';

        if (file_exists($configFile)) {
            $builder->addDefinitions($configFile);
        }

        $builder->useAnnotations(true);

        $acclimator = new ContainerAcclimator();
        $zfContainer = $acclimator->acclimate($serviceLocator);
        $builder->wrapContainer($zfContainer);

        $this->container = $builder->build();

        return $this->container;
    }
}
{'fraction_non_alphanumeric': 0.1420952380952381, 'fraction_numerical': 0.0007619047619047619, 'mean_word_length': 2.901931649331352, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2886317', 'n_tokens_mistral': 759, 'n_tokens_neox': 745, 'n_words': 160}