/bootstrap/compiled.php
PHP | 10600 lines | 10510 code | 90 blank | 0 comment | 815 complexity | 256ff71a41db89c2226051e6eb6926ab MD5 | raw file
Possible License(s): BSD-3-Clause
Large files files are truncated, but you can click here to view the full file
- <?php
- namespace Illuminate\Support;
- class ClassLoader
- {
- protected static $directories = array();
- protected static $registered = false;
- public static function load($class)
- {
- $class = static::normalizeClass($class);
- foreach (static::$directories as $directory) {
- if (file_exists($path = $directory . DIRECTORY_SEPARATOR . $class)) {
- require_once $path;
- return true;
- }
- }
- return false;
- }
- public static function normalizeClass($class)
- {
- if ($class[0] == '\\') {
- $class = substr($class, 1);
- }
- return str_replace(array('\\', '_'), DIRECTORY_SEPARATOR, $class) . '.php';
- }
- public static function register()
- {
- if (!static::$registered) {
- static::$registered = spl_autoload_register(array('\\Illuminate\\Support\\ClassLoader', 'load'));
- }
- }
- public static function addDirectories($directories)
- {
- static::$directories = array_merge(static::$directories, (array) $directories);
- static::$directories = array_unique(static::$directories);
- }
- public static function removeDirectories($directories = null)
- {
- if (is_null($directories)) {
- static::$directories = array();
- } else {
- $directories = (array) $directories;
- static::$directories = array_filter(static::$directories, function ($directory) use($directories) {
- return !in_array($directory, $directories);
- });
- }
- }
- public static function getDirectories()
- {
- return static::$directories;
- }
- }
- namespace Illuminate\Container;
- use Closure;
- use ArrayAccess;
- use ReflectionClass;
- use ReflectionParameter;
- class BindingResolutionException extends \Exception
- {
-
- }
- class Container implements ArrayAccess
- {
- protected $resolved = array();
- protected $bindings = array();
- protected $instances = array();
- protected $aliases = array();
- protected $reboundCallbacks = array();
- protected $resolvingCallbacks = array();
- protected $globalResolvingCallbacks = array();
- protected function resolvable($abstract)
- {
- return $this->bound($abstract) || $this->isAlias($abstract);
- }
- public function bound($abstract)
- {
- return isset($this[$abstract]) || isset($this->instances[$abstract]);
- }
- public function isAlias($name)
- {
- return isset($this->aliases[$name]);
- }
- public function bind($abstract, $concrete = null, $shared = false)
- {
- if (is_array($abstract)) {
- list($abstract, $alias) = $this->extractAlias($abstract);
- $this->alias($abstract, $alias);
- }
- $this->dropStaleInstances($abstract);
- if (is_null($concrete)) {
- $concrete = $abstract;
- }
- if (!$concrete instanceof Closure) {
- $concrete = $this->getClosure($abstract, $concrete);
- }
- $bound = $this->bound($abstract);
- $this->bindings[$abstract] = compact('concrete', 'shared');
- if ($bound) {
- $this->rebound($abstract);
- }
- }
- protected function getClosure($abstract, $concrete)
- {
- return function ($c, $parameters = array()) use($abstract, $concrete) {
- $method = $abstract == $concrete ? 'build' : 'make';
- return $c->{$method}($concrete, $parameters);
- };
- }
- public function bindIf($abstract, $concrete = null, $shared = false)
- {
- if (!$this->bound($abstract)) {
- $this->bind($abstract, $concrete, $shared);
- }
- }
- public function singleton($abstract, $concrete = null)
- {
- return $this->bind($abstract, $concrete, true);
- }
- public function share(Closure $closure)
- {
- return function ($container) use($closure) {
- static $object;
- if (is_null($object)) {
- $object = $closure($container);
- }
- return $object;
- };
- }
- public function bindShared($abstract, Closure $closure)
- {
- return $this->bind($abstract, $this->share($closure), true);
- }
- public function extend($abstract, Closure $closure)
- {
- if (!isset($this->bindings[$abstract])) {
- throw new \InvalidArgumentException("Type {$abstract} is not bound.");
- }
- if (isset($this->instances[$abstract])) {
- $this->instances[$abstract] = $closure($this->instances[$abstract], $this);
- $this->rebound($abstract);
- } else {
- $extender = $this->getExtender($abstract, $closure);
- $this->bind($abstract, $extender, $this->isShared($abstract));
- }
- }
- protected function getExtender($abstract, Closure $closure)
- {
- $resolver = $this->bindings[$abstract]['concrete'];
- return function ($container) use($resolver, $closure) {
- return $closure($resolver($container), $container);
- };
- }
- public function instance($abstract, $instance)
- {
- if (is_array($abstract)) {
- list($abstract, $alias) = $this->extractAlias($abstract);
- $this->alias($abstract, $alias);
- }
- unset($this->aliases[$abstract]);
- $bound = $this->bound($abstract);
- $this->instances[$abstract] = $instance;
- if ($bound) {
- $this->rebound($abstract);
- }
- }
- public function alias($abstract, $alias)
- {
- $this->aliases[$alias] = $abstract;
- }
- protected function extractAlias(array $definition)
- {
- return array(key($definition), current($definition));
- }
- public function rebinding($abstract, Closure $callback)
- {
- $this->reboundCallbacks[$abstract][] = $callback;
- if ($this->bound($abstract)) {
- return $this->make($abstract);
- }
- }
- public function refresh($abstract, $target, $method)
- {
- return $this->rebinding($abstract, function ($app, $instance) use($target, $method) {
- $target->{$method}($instance);
- });
- }
- protected function rebound($abstract)
- {
- $instance = $this->make($abstract);
- foreach ($this->getReboundCallbacks($abstract) as $callback) {
- call_user_func($callback, $this, $instance);
- }
- }
- protected function getReboundCallbacks($abstract)
- {
- if (isset($this->reboundCallbacks[$abstract])) {
- return $this->reboundCallbacks[$abstract];
- } else {
- return array();
- }
- }
- public function make($abstract, $parameters = array())
- {
- $abstract = $this->getAlias($abstract);
- $this->resolved[$abstract] = true;
- if (isset($this->instances[$abstract])) {
- return $this->instances[$abstract];
- }
- $concrete = $this->getConcrete($abstract);
- if ($this->isBuildable($concrete, $abstract)) {
- $object = $this->build($concrete, $parameters);
- } else {
- $object = $this->make($concrete, $parameters);
- }
- if ($this->isShared($abstract)) {
- $this->instances[$abstract] = $object;
- }
- $this->fireResolvingCallbacks($abstract, $object);
- return $object;
- }
- protected function getConcrete($abstract)
- {
- if (!isset($this->bindings[$abstract])) {
- if ($this->missingLeadingSlash($abstract) && isset($this->bindings['\\' . $abstract])) {
- $abstract = '\\' . $abstract;
- }
- return $abstract;
- } else {
- return $this->bindings[$abstract]['concrete'];
- }
- }
- protected function missingLeadingSlash($abstract)
- {
- return is_string($abstract) && strpos($abstract, '\\') !== 0;
- }
- public function build($concrete, $parameters = array())
- {
- if ($concrete instanceof Closure) {
- return $concrete($this, $parameters);
- }
- $reflector = new ReflectionClass($concrete);
- if (!$reflector->isInstantiable()) {
- $message = "Target [{$concrete}] is not instantiable.";
- throw new BindingResolutionException($message);
- }
- $constructor = $reflector->getConstructor();
- if (is_null($constructor)) {
- return new $concrete();
- }
- $dependencies = $constructor->getParameters();
- $parameters = $this->keyParametersByArgument($dependencies, $parameters);
- $instances = $this->getDependencies($dependencies, $parameters);
- return $reflector->newInstanceArgs($instances);
- }
- protected function getDependencies($parameters, array $primitives = array())
- {
- $dependencies = array();
- foreach ($parameters as $parameter) {
- $dependency = $parameter->getClass();
- if (array_key_exists($parameter->name, $primitives)) {
- $dependencies[] = $primitives[$parameter->name];
- } elseif (is_null($dependency)) {
- $dependencies[] = $this->resolveNonClass($parameter);
- } else {
- $dependencies[] = $this->resolveClass($parameter);
- }
- }
- return (array) $dependencies;
- }
- protected function resolveNonClass(ReflectionParameter $parameter)
- {
- if ($parameter->isDefaultValueAvailable()) {
- return $parameter->getDefaultValue();
- } else {
- $message = "Unresolvable dependency resolving [{$parameter}].";
- throw new BindingResolutionException($message);
- }
- }
- protected function resolveClass(ReflectionParameter $parameter)
- {
- try {
- return $this->make($parameter->getClass()->name);
- } catch (BindingResolutionException $e) {
- if ($parameter->isOptional()) {
- return $parameter->getDefaultValue();
- } else {
- throw $e;
- }
- }
- }
- protected function keyParametersByArgument(array $dependencies, array $parameters)
- {
- foreach ($parameters as $key => $value) {
- if (is_numeric($key)) {
- unset($parameters[$key]);
- $parameters[$dependencies[$key]->name] = $value;
- }
- }
- return $parameters;
- }
- public function resolving($abstract, Closure $callback)
- {
- $this->resolvingCallbacks[$abstract][] = $callback;
- }
- public function resolvingAny(Closure $callback)
- {
- $this->globalResolvingCallbacks[] = $callback;
- }
- protected function fireResolvingCallbacks($abstract, $object)
- {
- if (isset($this->resolvingCallbacks[$abstract])) {
- $this->fireCallbackArray($object, $this->resolvingCallbacks[$abstract]);
- }
- $this->fireCallbackArray($object, $this->globalResolvingCallbacks);
- }
- protected function fireCallbackArray($object, array $callbacks)
- {
- foreach ($callbacks as $callback) {
- call_user_func($callback, $object, $this);
- }
- }
- public function isShared($abstract)
- {
- if (isset($this->bindings[$abstract]['shared'])) {
- $shared = $this->bindings[$abstract]['shared'];
- } else {
- $shared = false;
- }
- return isset($this->instances[$abstract]) || $shared === true;
- }
- protected function isBuildable($concrete, $abstract)
- {
- return $concrete === $abstract || $concrete instanceof Closure;
- }
- protected function getAlias($abstract)
- {
- return isset($this->aliases[$abstract]) ? $this->aliases[$abstract] : $abstract;
- }
- public function getBindings()
- {
- return $this->bindings;
- }
- protected function dropStaleInstances($abstract)
- {
- unset($this->instances[$abstract]);
- unset($this->aliases[$abstract]);
- }
- public function forgetInstance($abstract)
- {
- unset($this->instances[$abstract]);
- }
- public function forgetInstances()
- {
- $this->instances = array();
- }
- public function offsetExists($key)
- {
- return isset($this->bindings[$key]);
- }
- public function offsetGet($key)
- {
- return $this->make($key);
- }
- public function offsetSet($key, $value)
- {
- if (!$value instanceof Closure) {
- $value = function () use($value) {
- return $value;
- };
- }
- $this->bind($key, $value);
- }
- public function offsetUnset($key)
- {
- unset($this->bindings[$key]);
- unset($this->instances[$key]);
- }
- }
- namespace Symfony\Component\HttpKernel;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\Response;
- interface HttpKernelInterface
- {
- const MASTER_REQUEST = 1;
- const SUB_REQUEST = 2;
- public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true);
- }
- namespace Symfony\Component\HttpKernel;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\Response;
- interface TerminableInterface
- {
- public function terminate(Request $request, Response $response);
- }
- namespace Illuminate\Support\Contracts;
- interface ResponsePreparerInterface
- {
- public function prepareResponse($value);
- public function readyForResponses();
- }
- namespace Illuminate\Foundation;
- use Closure;
- use Illuminate\Http\Request;
- use Illuminate\Http\Response;
- use Illuminate\Config\FileLoader;
- use Illuminate\Container\Container;
- use Illuminate\Filesystem\Filesystem;
- use Illuminate\Support\Facades\Facade;
- use Illuminate\Events\EventServiceProvider;
- use Illuminate\Routing\RoutingServiceProvider;
- use Illuminate\Exception\ExceptionServiceProvider;
- use Illuminate\Config\FileEnvironmentVariablesLoader;
- use Symfony\Component\HttpKernel\HttpKernelInterface;
- use Symfony\Component\HttpKernel\TerminableInterface;
- use Symfony\Component\HttpKernel\Exception\HttpException;
- use Symfony\Component\Debug\Exception\FatalErrorException;
- use Illuminate\Support\Contracts\ResponsePreparerInterface;
- use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
- use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
- use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
- class Application extends Container implements HttpKernelInterface, TerminableInterface, ResponsePreparerInterface
- {
- const VERSION = '4.2.4';
- protected $booted = false;
- protected $bootingCallbacks = array();
- protected $bootedCallbacks = array();
- protected $finishCallbacks = array();
- protected $shutdownCallbacks = array();
- protected $middlewares = array();
- protected $serviceProviders = array();
- protected $loadedProviders = array();
- protected $deferredServices = array();
- protected static $requestClass = 'Illuminate\\Http\\Request';
- public function __construct(Request $request = null)
- {
- $this->registerBaseBindings($request ?: $this->createNewRequest());
- $this->registerBaseServiceProviders();
- $this->registerBaseMiddlewares();
- }
- protected function createNewRequest()
- {
- return forward_static_call(array(static::$requestClass, 'createFromGlobals'));
- }
- protected function registerBaseBindings($request)
- {
- $this->instance('request', $request);
- $this->instance('Illuminate\\Container\\Container', $this);
- }
- protected function registerBaseServiceProviders()
- {
- foreach (array('Event', 'Exception', 'Routing') as $name) {
- $this->{"register{$name}Provider"}();
- }
- }
- protected function registerExceptionProvider()
- {
- $this->register(new ExceptionServiceProvider($this));
- }
- protected function registerRoutingProvider()
- {
- $this->register(new RoutingServiceProvider($this));
- }
- protected function registerEventProvider()
- {
- $this->register(new EventServiceProvider($this));
- }
- public function bindInstallPaths(array $paths)
- {
- $this->instance('path', realpath($paths['app']));
- foreach (array_except($paths, array('app')) as $key => $value) {
- $this->instance("path.{$key}", realpath($value));
- }
- }
- public static function getBootstrapFile()
- {
- return 'C:\\xampp\\htdocs\\laravel\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation' . '/start.php';
- }
- public function startExceptionHandling()
- {
- $this['exception']->register($this->environment());
- $this['exception']->setDebug($this['config']['app.debug']);
- }
- public function environment()
- {
- if (count(func_get_args()) > 0) {
- return in_array($this['env'], func_get_args());
- } else {
- return $this['env'];
- }
- }
- public function isLocal()
- {
- return $this['env'] == 'local';
- }
- public function detectEnvironment($envs)
- {
- $args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null;
- return $this['env'] = with(new EnvironmentDetector())->detect($envs, $args);
- }
- public function runningInConsole()
- {
- return php_sapi_name() == 'cli';
- }
- public function runningUnitTests()
- {
- return $this['env'] == 'testing';
- }
- public function forceRegister($provider, $options = array())
- {
- return $this->register($provider, $options, true);
- }
- public function register($provider, $options = array(), $force = false)
- {
- if ($registered = $this->getRegistered($provider) && !$force) {
- return $registered;
- }
- if (is_string($provider)) {
- $provider = $this->resolveProviderClass($provider);
- }
- $provider->register();
- foreach ($options as $key => $value) {
- $this[$key] = $value;
- }
- $this->markAsRegistered($provider);
- if ($this->booted) {
- $provider->boot();
- }
- return $provider;
- }
- public function getRegistered($provider)
- {
- $name = is_string($provider) ? $provider : get_class($provider);
- if (array_key_exists($name, $this->loadedProviders)) {
- return array_first($this->serviceProviders, function ($key, $value) use($name) {
- return get_class($value) == $name;
- });
- }
- }
- public function resolveProviderClass($provider)
- {
- return new $provider($this);
- }
- protected function markAsRegistered($provider)
- {
- $this['events']->fire($class = get_class($provider), array($provider));
- $this->serviceProviders[] = $provider;
- $this->loadedProviders[$class] = true;
- }
- public function loadDeferredProviders()
- {
- foreach ($this->deferredServices as $service => $provider) {
- $this->loadDeferredProvider($service);
- }
- $this->deferredServices = array();
- }
- protected function loadDeferredProvider($service)
- {
- $provider = $this->deferredServices[$service];
- if (!isset($this->loadedProviders[$provider])) {
- $this->registerDeferredProvider($provider, $service);
- }
- }
- public function registerDeferredProvider($provider, $service = null)
- {
- if ($service) {
- unset($this->deferredServices[$service]);
- }
- $this->register($instance = new $provider($this));
- if (!$this->booted) {
- $this->booting(function () use($instance) {
- $instance->boot();
- });
- }
- }
- public function make($abstract, $parameters = array())
- {
- $abstract = $this->getAlias($abstract);
- if (isset($this->deferredServices[$abstract])) {
- $this->loadDeferredProvider($abstract);
- }
- return parent::make($abstract, $parameters);
- }
- public function before($callback)
- {
- return $this['router']->before($callback);
- }
- public function after($callback)
- {
- return $this['router']->after($callback);
- }
- public function finish($callback)
- {
- $this->finishCallbacks[] = $callback;
- }
- public function shutdown($callback = null)
- {
- if (is_null($callback)) {
- $this->fireAppCallbacks($this->shutdownCallbacks);
- } else {
- $this->shutdownCallbacks[] = $callback;
- }
- }
- public function useArraySessions(Closure $callback)
- {
- $this->bind('session.reject', function () use($callback) {
- return $callback;
- });
- }
- public function isBooted()
- {
- return $this->booted;
- }
- public function boot()
- {
- if ($this->booted) {
- return;
- }
- array_walk($this->serviceProviders, function ($p) {
- $p->boot();
- });
- $this->bootApplication();
- }
- protected function bootApplication()
- {
- $this->fireAppCallbacks($this->bootingCallbacks);
- $this->booted = true;
- $this->fireAppCallbacks($this->bootedCallbacks);
- }
- public function booting($callback)
- {
- $this->bootingCallbacks[] = $callback;
- }
- public function booted($callback)
- {
- $this->bootedCallbacks[] = $callback;
- if ($this->isBooted()) {
- $this->fireAppCallbacks(array($callback));
- }
- }
- public function run(SymfonyRequest $request = null)
- {
- $request = $request ?: $this['request'];
- $response = with($stack = $this->getStackedClient())->handle($request);
- $response->send();
- $stack->terminate($request, $response);
- }
- protected function getStackedClient()
- {
- $sessionReject = $this->bound('session.reject') ? $this['session.reject'] : null;
- $client = with(new \Stack\Builder())->push('Illuminate\\Cookie\\Guard', $this['encrypter'])->push('Illuminate\\Cookie\\Queue', $this['cookie'])->push('Illuminate\\Session\\Middleware', $this['session'], $sessionReject);
- $this->mergeCustomMiddlewares($client);
- return $client->resolve($this);
- }
- protected function mergeCustomMiddlewares(\Stack\Builder $stack)
- {
- foreach ($this->middlewares as $middleware) {
- list($class, $parameters) = array_values($middleware);
- array_unshift($parameters, $class);
- call_user_func_array(array($stack, 'push'), $parameters);
- }
- }
- protected function registerBaseMiddlewares()
- {
-
- }
- public function middleware($class, array $parameters = array())
- {
- $this->middlewares[] = compact('class', 'parameters');
- return $this;
- }
- public function forgetMiddleware($class)
- {
- $this->middlewares = array_filter($this->middlewares, function ($m) use($class) {
- return $m['class'] != $class;
- });
- }
- public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
- {
- try {
- $this->refreshRequest($request = Request::createFromBase($request));
- $this->boot();
- return $this->dispatch($request);
- } catch (\Exception $e) {
- if ($this->runningUnitTests()) {
- throw $e;
- }
- return $this['exception']->handleException($e);
- }
- }
- public function dispatch(Request $request)
- {
- if ($this->isDownForMaintenance()) {
- $response = $this['events']->until('illuminate.app.down');
- if (!is_null($response)) {
- return $this->prepareResponse($response, $request);
- }
- }
- if ($this->runningUnitTests() && !$this['session']->isStarted()) {
- $this['session']->start();
- }
- return $this['router']->dispatch($this->prepareRequest($request));
- }
- public function terminate(SymfonyRequest $request, SymfonyResponse $response)
- {
- $this->callFinishCallbacks($request, $response);
- $this->shutdown();
- }
- protected function refreshRequest(Request $request)
- {
- $this->instance('request', $request);
- Facade::clearResolvedInstance('request');
- }
- public function callFinishCallbacks(SymfonyRequest $request, SymfonyResponse $response)
- {
- foreach ($this->finishCallbacks as $callback) {
- call_user_func($callback, $request, $response);
- }
- }
- protected function fireAppCallbacks(array $callbacks)
- {
- foreach ($callbacks as $callback) {
- call_user_func($callback, $this);
- }
- }
- public function prepareRequest(Request $request)
- {
- if (!is_null($this['config']['session.driver']) && !$request->hasSession()) {
- $request->setSession($this['session']->driver());
- }
- return $request;
- }
- public function prepareResponse($value)
- {
- if (!$value instanceof SymfonyResponse) {
- $value = new Response($value);
- }
- return $value->prepare($this['request']);
- }
- public function readyForResponses()
- {
- return $this->booted;
- }
- public function isDownForMaintenance()
- {
- return file_exists($this['config']['app.manifest'] . '/down');
- }
- public function down(Closure $callback)
- {
- $this['events']->listen('illuminate.app.down', $callback);
- }
- public function abort($code, $message = '', array $headers = array())
- {
- if ($code == 404) {
- throw new NotFoundHttpException($message);
- } else {
- throw new HttpException($code, $message, null, $headers);
- }
- }
- public function missing(Closure $callback)
- {
- $this->error(function (NotFoundHttpException $e) use($callback) {
- return call_user_func($callback, $e);
- });
- }
- public function error(Closure $callback)
- {
- $this['exception']->error($callback);
- }
- public function pushError(Closure $callback)
- {
- $this['exception']->pushError($callback);
- }
- public function fatal(Closure $callback)
- {
- $this->error(function (FatalErrorException $e) use($callback) {
- return call_user_func($callback, $e);
- });
- }
- public function getConfigLoader()
- {
- return new FileLoader(new Filesystem(), $this['path'] . '/config');
- }
- public function getEnvironmentVariablesLoader()
- {
- return new FileEnvironmentVariablesLoader(new Filesystem(), $this['path.base']);
- }
- public function getProviderRepository()
- {
- $manifest = $this['config']['app.manifest'];
- return new ProviderRepository(new Filesystem(), $manifest);
- }
- public function getLoadedProviders()
- {
- return $this->loadedProviders;
- }
- public function setDeferredServices(array $services)
- {
- $this->deferredServices = $services;
- }
- public function isDeferredService($service)
- {
- return isset($this->deferredServices[$service]);
- }
- public static function requestClass($class = null)
- {
- if (!is_null($class)) {
- static::$requestClass = $class;
- }
- return static::$requestClass;
- }
- public function setRequestForConsoleEnvironment()
- {
- $url = $this['config']->get('app.url', 'http://localhost');
- $parameters = array($url, 'GET', array(), array(), array(), $_SERVER);
- $this->refreshRequest(static::onRequest('create', $parameters));
- }
- public static function onRequest($method, $parameters = array())
- {
- return forward_static_call_array(array(static::requestClass(), $method), $parameters);
- }
- public function getLocale()
- {
- return $this['config']->get('app.locale');
- }
- public function setLocale($locale)
- {
- $this['config']->set('app.locale', $locale);
- $this['translator']->setLocale($locale);
- $this['events']->fire('locale.changed', array($locale));
- }
- public function registerCoreContainerAliases()
- {
- $aliases = array('app' => 'Illuminate\\Foundation\\Application', 'artisan' => 'Illuminate\\Console\\Application', 'auth' => 'Illuminate\\Auth\\AuthManager', 'auth.reminder.repository' => 'Illuminate\\Auth\\Reminders\\ReminderRepositoryInterface', 'blade.compiler' => 'Illuminate\\View\\Compilers\\BladeCompiler', 'cache' => 'Illuminate\\Cache\\CacheManager', 'cache.store' => 'Illuminate\\Cache\\Repository', 'config' => 'Illuminate\\Config\\Repository', 'cookie' => 'Illuminate\\Cookie\\CookieJar', 'encrypter' => 'Illuminate\\Encryption\\Encrypter', 'db' => 'Illuminate\\Database\\DatabaseManager', 'events' => 'Illuminate\\Events\\Dispatcher', 'files' => 'Illuminate\\Filesystem\\Filesystem', 'form' => 'Illuminate\\Html\\FormBuilder', 'hash' => 'Illuminate\\Hashing\\HasherInterface', 'html' => 'Illuminate\\Html\\HtmlBuilder', 'translator' => 'Illuminate\\Translation\\Translator', 'log' => 'Illuminate\\Log\\Writer', 'mailer' => 'Illuminate\\Mail\\Mailer', 'paginator' => 'Illuminate\\Pagination\\Factory', 'auth.reminder' => 'Illuminate\\Auth\\Reminders\\PasswordBroker', 'queue' => 'Illuminate\\Queue\\QueueManager', 'redirect' => 'Illuminate\\Routing\\Redirector', 'redis' => 'Illuminate\\Redis\\Database', 'request' => 'Illuminate\\Http\\Request', 'router' => 'Illuminate\\Routing\\Router', 'session' => 'Illuminate\\Session\\SessionManager', 'session.store' => 'Illuminate\\Session\\Store', 'remote' => 'Illuminate\\Remote\\RemoteManager', 'url' => 'Illuminate\\Routing\\UrlGenerator', 'validator' => 'Illuminate\\Validation\\Factory', 'view' => 'Illuminate\\View\\Factory');
- foreach ($aliases as $key => $alias) {
- $this->alias($key, $alias);
- }
- }
- public function __get($key)
- {
- return $this[$key];
- }
- public function __set($key, $value)
- {
- $this[$key] = $value;
- }
- }
- namespace Illuminate\Foundation;
- use Closure;
- class EnvironmentDetector
- {
- public function detect($environments, $consoleArgs = null)
- {
- if ($consoleArgs) {
- return $this->detectConsoleEnvironment($environments, $consoleArgs);
- } else {
- return $this->detectWebEnvironment($environments);
- }
- }
- protected function detectWebEnvironment($environments)
- {
- if ($environments instanceof Closure) {
- return call_user_func($environments);
- }
- foreach ($environments as $environment => $hosts) {
- foreach ((array) $hosts as $host) {
- if ($this->isMachine($host)) {
- return $environment;
- }
- }
- }
- return 'production';
- }
- protected function detectConsoleEnvironment($environments, array $args)
- {
- if (!is_null($value = $this->getEnvironmentArgument($args))) {
- return head(array_slice(explode('=', $value), 1));
- } else {
- return $this->detectWebEnvironment($environments);
- }
- }
- protected function getEnvironmentArgument(array $args)
- {
- return array_first($args, function ($k, $v) {
- return starts_with($v, '--env');
- });
- }
- public function isMachine($name)
- {
- return str_is($name, gethostname());
- }
- }
- namespace Illuminate\Http;
- use Symfony\Component\HttpFoundation\ParameterBag;
- use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
- class Request extends SymfonyRequest
- {
- protected $json;
- protected $sessionStore;
- public function instance()
- {
- return $this;
- }
- public function method()
- {
- return $this->getMethod();
- }
- public function root()
- {
- return rtrim($this->getSchemeAndHttpHost() . $this->getBaseUrl(), '/');
- }
- public function url()
- {
- return rtrim(preg_replace('/\\?.*/', '', $this->getUri()), '/');
- }
- public function fullUrl()
- {
- $query = $this->getQueryString();
- return $query ? $this->url() . '?' . $query : $this->url();
- }
- public function path()
- {
- $pattern = trim($this->getPathInfo(), '/');
- return $pattern == '' ? '/' : $pattern;
- }
- public function decodedPath()
- {
- return rawurldecode($this->path());
- }
- public function segment($index, $default = null)
- {
- return array_get($this->segments(), $index - 1, $default);
- }
- public function segments()
- {
- $segments = explode('/', $this->path());
- return array_values(array_filter($segments, function ($v) {
- return $v != '';
- }));
- }
- public function is()
- {
- foreach (func_get_args() as $pattern) {
- if (str_is($pattern, urldecode($this->path()))) {
- return true;
- }
- }
- return false;
- }
- public function ajax()
- {
- return $this->isXmlHttpRequest();
- }
- public function secure()
- {
- return $this->isSecure();
- }
- public function exists($key)
- {
- $keys = is_array($key) ? $key : func_get_args();
- $input = $this->all();
- foreach ($keys as $value) {
- if (!array_key_exists($value, $input)) {
- return false;
- }
- }
- return true;
- }
- public function has($key)
- {
- $keys = is_array($key) ? $key : func_get_args();
- foreach ($keys as $value) {
- if ($this->isEmptyString($value)) {
- return false;
- }
- }
- return true;
- }
- protected function isEmptyString($key)
- {
- $boolOrArray = is_bool($this->input($key)) || is_array($this->input($key));
- return !$boolOrArray && trim((string) $this->input($key)) === '';
- }
- public function all()
- {
- return array_merge_recursive($this->input(), $this->files->all());
- }
- public function input($key = null, $default = null)
- {
- $input = $this->getInputSource()->all() + $this->query->all();
- return array_get($input, $key, $default);
- }
- public function only($keys)
- {
- $keys = is_array($keys) ? $keys : func_get_args();
- return array_only($this->input(), $keys) + array_fill_keys($keys, null);
- }
- public function except($keys)
- {
- $keys = is_array($keys) ? $keys : func_get_args();
- $results = $this->input();
- foreach ($keys as $key) {
- array_forget($results, $key);
- }
- return $results;
- }
- public function query($key = null, $default = null)
- {
- return $this->retrieveItem('query', $key, $default);
- }
- public function hasCookie($key)
- {
- return !is_null($this->cookie($key));
- }
- public function cookie($key = null, $default = null)
- {
- return $this->retrieveItem('cookies', $key, $default);
- }
- public function file($key = null, $default = null)
- {
- return array_get($this->files->all(), $key, $default);
- }
- public function hasFile($key)
- {
- if (is_array($file = $this->file($key))) {
- $file = head($file);
- }
- return $file instanceof \SplFileInfo && $file->getPath() != '';
- }
- public function header($key = null, $default = null)
- {
- return $this->retrieveItem('headers', $key, $default);
- }
- public function server($key = null, $default = null)
- {
- return $this->retrieveItem('server', $key, $default);
- }
- public function old($key = null, $default = null)
- {
- return $this->session()->getOldInput($key, $default);
- }
- public function flash($filter = null, $keys = array())
- {
- $flash = !is_null($filter) ? $this->{$filter}($keys) : $this->input();
- $this->session()->flashInput($flash);
- }
- public function flashOnly($keys)
- {
- $keys = is_array($keys) ? $keys : func_get_args();
- return $this->flash('only', $keys);
- }
- public function flashExcept($keys)
- {
- $keys = is_array($keys) ? $keys : func_get_args();
- return $this->flash('except', $keys);
- }
- public function flush()
- {
- $this->session()->flashInput(array());
- }
- protected function retrieveItem($source, $key, $default)
- {
- if (is_null($key)) {
- return $this->{$source}->all();
- } else {
- return $this->{$source}->get($key, $default, true);
- }
- }
- public function merge(array $input)
- {
- $this->getInputSource()->add($input);
- }
- public function replace(array $input)
- {
- $this->getInputSource()->replace($input);
- }
- public function json($key = null, $default = null)
- {
- if (!isset($this->json)) {
- $this->json = new ParameterBag((array) json_decode($this->getContent(), true));
- }
- if (is_null($key)) {
- return $this->json;
- }
- return array_get($this->json->all(), $key, $default);
- }
- protected function getInputSource()
- {
- if ($this->isJson()) {
- return $this->json();
- }
- return $this->getMethod() == 'GET' ? $this->query : $this->request;
- }
- public function isJson()
- {
- return str_contains($this->header('CONTENT_TYPE'), '/json');
- }
- public function wantsJson()
- {
- $acceptable = $this->getAcceptableContentTypes();
- return isset($acceptable[0]) && $acceptable[0] == 'application/json';
- }
- public function format($default = 'html')
- {
- foreach ($this->getAcceptableContentTypes() as $type) {
- if ($format = $this->getFormat($type)) {
- return $format;
- }
- }
- return $default;
- }
- public static function createFromBase(SymfonyRequest $request)
- {
- if ($request instanceof static) {
- return $request;
- }
- return with(new static())->duplicate($request->query->all(), $request->request->all(), $request->attributes->all(), $request->cookies->all(), $request->files->all(), $request->server->all());
- }
- public function session()
- {
- if (!$this->hasSession()) {
- throw new \RuntimeException('Session store not set on request.');
- }
- return $this->getSession();
- }
- }
- namespace Illuminate\Http;
- use Symfony\Component\HttpKernel\HttpKernelInterface;
- use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
- class FrameGuard implements HttpKernelInterface
- {
- protected $app;
- public function __construct(HttpKernelInterface $app)
- {
- $this->app = $app;
- }
- public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
- {
- $response = $this->app->handle($request, $type, $catch);
- $response->headers->set('X-Frame-Options', 'SAMEORIGIN', false);
- return $response;
- }
- }
- namespace Symfony\Component\HttpFoundation;
- use Symfony\Component\HttpFoundation\Session\SessionInterface;
- class Request
- {
- const HEADER_CLIENT_IP = 'client_ip';
- const HEADER_CLIENT_HOST = 'client_host';
- const HEADER_CLIENT_PROTO = 'client_proto';
- const HEADER_CLIENT_PORT = 'client_port';
- protected static $trustedProxies = array();
- protected static $trustedHostPatterns = array();
- protected static $trustedHosts = array();
- protected static $trustedHeaders = array(self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR', self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST', self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO', self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT');
- protected static $httpMethodParameterOverride = false;
- public $attributes;
- public $request;
- public $query;
- public $server;
- public $files;
- public $cookies;
- public $headers;
- protected $content;
- protected $languages;
- protected $charsets;
- protected $encodings;
- protected $acceptableContentTypes;
- protected $pathInfo;
- protected $requestUri;
- protected $baseUrl;
- protected $basePath;
- protected $method;
- protected $format;
- protected $session;
- protected $locale;
- protected $defaultLocale = 'en';
- protected static $formats;
- protected static $requestFactory;
- public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
- {
- $this->initialize($query, $request, $attributes, $cookies, $files, $server, $content);
- }
- public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
- {
- $this->request = new ParameterBag($request);
- $this->query = new ParameterBag($query);
- $this->attributes = new ParameterBag($attributes);
- $this->cookies = new ParameterBag($cookies);
- $this->files = new FileBag($files);
- $this->server = new ServerBag($server);
- $this->headers = new HeaderBag($this->server->getHeaders());
- $this->content = $content;
- $this->languages = null;
- $this->charsets = null;
- $this->encodings = null;
- $this->acceptableContentTypes = null;
- $this->pathInfo = null;
- $this->requestUri = null;
- $this->baseUrl = null;
- $this->basePath = null;
- $this->method = null;
- $this->format = null;
- }
- public static function createFromGlobals()
- {
- $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
- if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH'))) {
- parse_str($request->getContent(), $data);
- $request->request = new ParameterBag($data);
- }
- return $request;
- }
- public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null)
- {
- $server = array_replace(array('SERVER_NAME' => 'localhost', 'SERVER_PORT' => 80, 'HTTP_HOST' => 'localhost', 'HTTP_USER_AGENT' => 'Symfony/2.X', 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'REMOTE_ADDR' => '127.0.0.1', 'SCRIPT_NAME' => '', 'SCRIPT_FILENAME' => '', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_TIME' => time()), $server);
- $server['PATH_INFO'] = '';
- $server['REQUEST_METHOD'] = strtoupper($method);
- $components = parse_url($uri);
- if (isset($components['host'])) {
- $server['SERVER_NAME'] = $components['host'];
- $server['HTTP_HOST'] = $components['host'];
- }
- if (isset($components['scheme'])) {
- if ('https' === $components['scheme']) {
- $server['HTTPS'] = 'on';
- $server['SERVER_PORT'] = 443;
- } else {
- unset($server['HTTPS']);
- $server['SERVER_PORT'] = 80;
- }
- }
- if (isset($components['port'])) {
- $server['SERVER_PORT'] = $components['port'];
- $server['HTTP_HOST'] = $server['HTTP_HOST'] . ':' . $components['port'];
- }
- if (isset($components['user'])) {
- $server['PHP_AUTH_USER'] = $components['user'];
- }
- if (isset($components['pass'])) {
- $server['PHP_AUTH_PW'] = $components['pass'];
- }
- if (!isset($components['path'])) {
- $components['path'] = '/';
- }
- switch (strtoupper($method)) {
- case 'POST':
- case 'PUT':
- case 'DELETE':
- if (!isset($server['CONTENT_TYPE'])) {
- $server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
- }
- case 'PATCH':
- $request = $parameters;
- $query = array();
- break;
- default:
- $request = array();
- $query = $parameters;
- break;
- }
- $queryString = '';
- if (isset($components['query'])) {
- parse_str(html_entity_decode($components['query']), $qs);
- if ($query) {
- $query = array_replace($qs, $query);
- $queryString = http_build_query($query, '', '&');
- } else {
- $query = $qs;
- $queryString = $components['query'];
- }
- } elseif ($query) {
- $queryString = http_build_query($query, '', '&');
- }
- $server['REQUEST_URI'] = $components['path'] . ('' !== $queryString ? '?' . $queryString : '');
- $server['QUERY_STRING'] = $queryString;
- return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content);
- }
- public static function setFactory($callable)
- {
- self::$requestFactory = $callable;
- }
- public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)
- {
- $dup = clone $this;
- if ($query !== null) {
- $dup->query = new ParameterBag($query);
- }
- if ($request !== null) {
- $dup->request = new ParameterBag($request);
- }
- if ($attributes !== null) {
- $dup->attributes = new ParameterBag($attributes);
- }
- if ($cookies !== null) {
- $dup->cookies = new ParameterBag($cookies);
- }
- if ($files !== null) {
- $dup->files = new FileBag($files);
- }
- if ($server !== null) {
- $dup->server = new ServerBag($server);
- $dup->headers = new HeaderBag($dup->server->getHeaders());
- }
- $dup->languages = null;
- $dup->charsets = null;
- $dup->encodings = null;
- $dup->acceptableContentTypes = null;
- $dup->pathInfo = null;
- $dup->requestUri = null;
- $dup->baseUrl = null;
- $dup->basePath = null;
- $dup->method = null;
- $dup->format = null;
- if (!$dup->get('_format') && $this->get('_format')) {
- $dup->attributes->set('_format', $this->get('_format'));
- }
- if (!$dup->getRequestFormat(null)) {
- $dup->setRequestFormat($format = $this->getRequestFormat(null));
- }
- return $dup;
- }
- public function __clone()
- {
- $this->query = clone $this->query;
- $this->request = clone $this->request;
- $this->attributes = clone $this->attributes;
- $this->cookies = clone $this->cookies;
- $this->files = clone $this->files;
- $this->server = clone $this->server;
- $this->headers = clone $this->headers;
- }
- public function __toString()
- {
- return sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL')) . '
- ' . $this->headers . '
- ' . $this->getContent();
- }
- public function overrideGlobals()
- {
- $_GET = $this->query->all();
- $_POST = $this->request->all();
- $_SERVER = $this->server->all();
- $_COOKIE = $this->cookies->all();
- foreach ($this->headers->all() as $key => $value) {
- $key = strtoupper(str_replace('-', '_', $key));
- if (in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) {
- $_SERVER[$key] = implode(', ', $value);
- } else {
- $_SERVER['HTTP_' . $key] = implode(', ', $value);
- }
- }
- $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE);
- $requestOrder = ini_get('request_order') ?: ini_get('variables_order');
- $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp';
- $_REQUEST = array();
- foreach (str_split($requestOrder) as $order) {
- $_REQUEST = array_merge($_REQUEST, $request[$order]);
- }
- }
- public static function setTrustedProxies(array $proxies)
- {
- self::$trustedProxies = $proxies;
- }
- public static function getTrustedProxies()
- {
- return self::$trustedProxies;
- }
- public static function setTrustedHosts(array $hostPatterns)
- {
- self::$trustedHostPatterns = array_map(function ($hostPattern) {
- return sprintf('{%s}i', str_replace('}', '\\}', $hostPattern));
- }, $hostPatterns);
- self::$trustedHosts = array();
- }
- public static function getTrustedHosts()
- {
- return self::$trustedHostPatterns;
- }
- public static function setTrustedHeaderName($key, $value)
- {
- if (!array_key_exists($key, self::$trustedHeaders)) {
- throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
- }
- self::$trustedHeaders[$key] = $value;
- }
- public static function getTrustedHeaderName($key)
- {
- if (!array_key_exists($key, self::$trustedHeaders)) {
- throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key));
- }
- return self::$trustedHeaders[$key];
- }
- public static function normalizeQueryString($qs)
- {
- if ('' == $qs) {
- return '';
- }
- $parts = array();
- $order = array();
- foreach (explode('&', $qs) as $param) {
- if ('' === $param || '=' === $param[0]) {
- continue;
- }
- $keyValuePair = explode('=', $param, 2);
- $parts[] = isset($keyValuePair[1]) ? rawurlencode(urldecode($keyValuePair[0])) . '=' . rawurlencode(urldecode($keyValuePair[1])) : rawurlencode(urldecode($keyValuePair[0]));
- $order[] = urldecode($keyValuePair[0]);
- }
- array_multisort($order, SORT_ASC, $p…
Large files files are truncated, but you can click here to view the full file