<commit_before><?php

/*
 * This file is part of Laravel Facebook.
 *
 * (c) Schimpanz Solutions AB <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Schimpanz\Facebook;

use Facebook\Facebook;

/**
 * This is the Facebook facade class.
 *
 * @author <NAME> <<EMAIL>>
 */
class FacebookFactory
{
    /**
     * Make a new Facebook client.
     *
     * @param array $config
     *
     * @return \Facebook\Facebook
     */
    public function make(array $config)
    {
        $config = $this->getConfig($config);

        return $this->getClient($config);
    }

    /**
     * Get the configuration data.
     *
     * @param string[] $config
     *
     * @throws \InvalidArgumentException
     *
     * @return array
     */
    protected function getConfig(array $config)
    {
        $keys = ['app_id', 'app_secret', 'default_graph_version'];

        foreach ($keys as $key) {
            if (!array_key_exists($key, $config)) {
                throw new \InvalidArgumentException('The Facebook client requires configuration.');
            }
        }

        return array_only($config, $keys);
    }

    /**
     * Get the Facebook client.
     *
     * @param string[] $config
     *
     * @return \Facebook\Facebook
     */<commit_msg>Don't require default_graph_version<commit_after><?php

/*
 * This file is part of Laravel Facebook.
 *
 * (c) Schimpanz Solutions AB <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Schimpanz\Facebook;

use Facebook\Facebook;
use InvalidArgumentException;

/**
 * This is the Facebook facade class.
 *
 * @author <NAME> <<EMAIL>>
 */
class FacebookFactory
{
    /**
     * Make a new Facebook client.
     *
     * @param array $config
     *
     * @return \Facebook\Facebook
     */
    public function make(array $config)
    {
        $config = $this->getConfig($config);

        return $this->getClient($config);
    }

    /**
     * Get the configuration data.
     *
     * @param string[] $config
     *
     * @throws \InvalidArgumentException
     *
     * @return array
     */
    protected function getConfig(array $config)
    {
        if (!array_key_exists('app_id', $config) || !array_key_exists('app_secret', $config)) {
            throw new InvalidArgumentException('The Facebook client requires configuration.');
        }

        $keys = ['app_id', 'app_secret', 'default_graph_version', 'default_access_token'];

        return array_only($config, $keys);
    }

    /**
     * Get the Facebook client.
     *
     * @param string[] $config
     *
     * @return \Facebook\Facebook
     */
{'fraction_non_alphanumeric': 0.12315448325531149, 'fraction_numerical': 0.0, 'mean_word_length': 2.3550724637681157, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '777381', 'n_tokens_mistral': 810, 'n_tokens_neox': 784, 'n_words': 223}