<commit_before><?php

namespace Dingo\Api\Providers;

use RuntimeException;
use Dingo\Api\Dispatcher;
use Dingo\Api\Http\Response;
use Dingo\Api\Auth\Authenticator;
use League\Fractal\Manager as Fractal;
use Illuminate\Support\ServiceProvider;
use Dingo\Api\Console\ApiRoutesCommand;
use Dingo\Api\Http\RateLimit\RateLimiter;
use Dingo\Api\Transformer\FractalTransformer;
use Dingo\Api\Http\Response\Factory as ResponseFactory;
use Illuminate\Support\Facades\Response as ResponseFacade;

class ApiServiceProvider extends ServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('dingo/api', 'api', __DIR__.'/../');

        $this->app->bind('Dingo\Api\Dispatcher', function ($app) {
            return $app['api.dispatcher'];
        });

        $this->app->bind('Dingo\Api\Auth\Shield', function ($app) {
            return $app['api.auth'];
        });

        $this->app->bind('Dingo\Api\Http\Response\Builder', function ($app) {
            return $app['api.response'];
        });

        ResponseFacade::macro('api', function () {
            return $this->app['api.response'];
        });

        Response::setTransformer($this->app['api.transformer']);

        $this->prepareResponseFormats();
    }

    /**
     * Boot the response formats.
     *
     * @return array
     * @throws \RuntimeException
     */
    protected function prepareResponseFormats()
    {
        $formats = $this->prepareConfigInstances($this->app['config']['api::formats']);

        if (empty($formats)) {<commit_msg>Added in alias for L4.3 compatibility. Fixes #171.<commit_after><?php

namespace Dingo\Api\Providers;

use RuntimeException;
use Dingo\Api\Dispatcher;
use Dingo\Api\Http\Response;
use Dingo\Api\Auth\Authenticator;
use Illuminate\Foundation\AliasLoader;
use League\Fractal\Manager as Fractal;
use Illuminate\Support\ServiceProvider;
use Dingo\Api\Console\ApiRoutesCommand;
use Dingo\Api\Http\RateLimit\RateLimiter;
use Dingo\Api\Transformer\FractalTransformer;
use Dingo\Api\Http\Response\Factory as ResponseFactory;
use Illuminate\Support\Facades\Response as ResponseFacade;

class ApiServiceProvider extends ServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('dingo/api', 'api', __DIR__.'/../');

        $this->app->bind('Dingo\Api\Dispatcher', function ($app) {
            return $app['api.dispatcher'];
        });

        $this->app->bind('Dingo\Api\Auth\Shield', function ($app) {
            return $app['api.auth'];
        });

        $this->app->bind('Dingo\Api\Http\Response\Builder', function ($app) {
            return $app['api.response'];
        });

        ResponseFacade::macro('api', function () {
            return $this->app['api.response'];
        });

        Response::setTransformer($this->app['api.transformer']);

        $this->prepareCompatibility();

        $this->prepareResponseFormats();
    }

    /**
     * Prepare any compatibility for earlier or later versions of Laravel.
     * 
     * @return void
     */
    protected function prepareCompatibility()
    {
        // Laravel 4.3 moved the "RoutesCommand" to "RouteListCommand" so we'll alias the command
        // for users that are using Laravel 4.3. This allows us to continue to extend the
        // "RoutesCommand" in the "ApiRoutesCommand".
        if (class_exists('Illuminate\Foundation\Console\RouteListCommand')) {
            $loader = AliasLoader::getInstance();

            $loader->alias('Illuminate\Foundation\Console\RoutesCommand', 'Illuminate\Foundation\Console\RouteListCommand');
        }
    }

    /**
     * Boot the response formats.
     *
     * @return array
     * @throws \RuntimeException
     */
    protected function prepareResponseFormats()
    {
        $formats = $this->prepareConfigInstances($this->app['config']['api::formats']);

        if (empty($formats)) {
{'fraction_non_alphanumeric': 0.14196606786427146, 'fraction_numerical': 0.002245508982035928, 'mean_word_length': 2.8363636363636364, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '7303453', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1162, 'n_words': 228}