<commit_before><?php

namespace Michaeljennings\Laralastica;

use Elastica\Client;
use Illuminate\Support\Manager;
use Michaeljennings\Laralastica\Drivers\ArrayDriver;
use Michaeljennings\Laralastica\Drivers\ElasticaDriver;
use Michaeljennings\Laralastica\Drivers\NullDriver;
use Michaeljennings\Laralastica\Exceptions\DriverNotSetException;

class ClientManager extends Manager
{
    /**
     * The laralastica config.
     *
     * @var array
     */
    protected $config;

    public function __construct(array $config)
    {
        $this->config = $config;
    }

    /**
     * Create the elastica driver.
     *
     * @return Client
     */
    protected function createElasticaDriver()
    {
        $config = isset($this->config['drivers']['elastica']) ? $this->config['drivers']['elastica'] : [];
        $client = new Client($config);
        $index = $client->getIndex($this->config['index']);

        return new ElasticaDriver($client, $index, $config);
    }

    /**
     * Create the null driver.
     *
     * @return ArrayDriver
     */
    protected function createNullDriver()
    {
        return new NullDriver();
    }

    /**
     * Get the default driver name.
     *
     * @return string
     * @throws DriverNotSetException
     */
    public function getDefaultDriver()
    {
        if ( ! isset($this->config['driver'])) {
            throw new DriverNotSetException("You must set the default driver to connect to in the laralastica config.");
        }

        return $this->config['driver'];
    }
}<commit_msg>Fix getting the null driver from the config<commit_after><?php

namespace Michaeljennings\Laralastica;

use Elastica\Client;
use Illuminate\Support\Manager;
use Michaeljennings\Laralastica\Drivers\ArrayDriver;
use Michaeljennings\Laralastica\Drivers\ElasticaDriver;
use Michaeljennings\Laralastica\Drivers\NullDriver;
use Michaeljennings\Laralastica\Exceptions\DriverNotSetException;

class ClientManager extends Manager
{
    /**
     * The laralastica config.
     *
     * @var array
     */
    protected $config;

    public function __construct(array $config)
    {
        $this->config = $config;
    }

    /**
     * Create the elastica driver.
     *
     * @return Client
     */
    protected function createElasticaDriver()
    {
        $config = isset($this->config['drivers']['elastica']) ? $this->config['drivers']['elastica'] : [];
        $client = new Client($config);
        $index = $client->getIndex($this->config['index']);

        return new ElasticaDriver($client, $index, $config);
    }

    /**
     * Create the null driver.
     *
     * @return ArrayDriver
     */
    protected function createNullDriver()
    {
        return new NullDriver();
    }

    /**
     * Get the default driver name.
     *
     * @return string
     * @throws DriverNotSetException
     */
    public function getDefaultDriver()
    {
        if ( ! isset($this->config['driver']) && ! is_null($this->config['driver'])) {
            throw new DriverNotSetException("You must set the default driver to connect to in the laralastica config.");
        }

        if (is_null($this->config['driver'])) {
            $this->config['driver'] = 'null';
        }

        return $this->config['driver'];
    }
}
{'fraction_non_alphanumeric': 0.12595536533170285, 'fraction_numerical': 0.0, 'mean_word_length': 2.6764044943820227, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '7519110', 'n_tokens_mistral': 982, 'n_tokens_neox': 947, 'n_words': 206}