$shouldCache = true,
$compiledExtension = 'php',
$shouldCheckTimestamps = true,
) {
if (! $cachePath) {
throw new InvalidArgumentException('Please provide a valid cache path.');
}
$this->files = $files;
$this->cachePath = $cachePath;
$this->basePath = $basePath;
* @return void
*/
public function registerBladeCompiler()
{
$this->app->singleton('blade.compiler', function ($app) {
return tap(new BladeCompiler(
$app['files'],
$app['config']['view.compiled'],
$app['config']->get('view.relative_hash', false) ? $app->basePath() : '',
$app['config']->get('view.cache', true),
$app['config']->get('view.compiled_extension', 'php'),
// used as resolvers for more fine-tuned resolution of these objects.
if ($concrete instanceof Closure) {
$this->buildStack[] = spl_object_hash($concrete);
try {
return $concrete($this, $this->getLastParameterOverride());
} finally {
array_pop($this->buildStack);
}
}
// We're ready to instantiate an instance of the concrete type registered for
// the binding. This will instantiate the types, as well as resolve any of
// its "nested" dependencies recursively until all have gotten resolved.
$object = $this->isBuildable($concrete, $abstract)
? $this->build($concrete)
: $this->make($concrete);
// If we defined any extenders for this type, we'll need to spin through them
// and apply them to the object being built. This allows for the extension
// of services, such as changing configuration or decorating the object.
*/
protected function resolve($abstract, $parameters = [], $raiseEvents = true)
{
$this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract));
return parent::resolve($abstract, $parameters, $raiseEvents);
}
/**
* Load the deferred provider if the given type is a deferred service and the instance has not been loaded.
*
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function make($abstract, array $parameters = [])
{
return $this->resolve($abstract, $parameters);
}
/**
* {@inheritdoc}
*
*/
public function make($abstract, array $parameters = [])
{
$this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract));
return parent::make($abstract, $parameters);
}
/**
* Resolve the given type from the container.
*
}
try {
return $parameter->isVariadic()
? $this->resolveVariadicClass($parameter)
: $this->make($className);
}
// If we can not resolve the class instance, we will check to see if the value
// is variadic. If it is, we will return an empty array as the value of the
// dependency similarly to how we handle scalar values in this situation.
// If the class is null, it means the dependency is a string or some other
// primitive type which we can not resolve since it is not a class and
// we will just bomb out with an error since we have no-where to go.
$result ??= is_null(Util::getParameterClassName($dependency))
? $this->resolvePrimitive($dependency)
: $this->resolveClass($dependency);
$this->fireAfterResolvingAttributeCallbacks($dependency->getAttributes(), $result);
if ($dependency->isVariadic()) {
$results = array_merge($results, $result);
// Once we have all the constructor's parameters we can create each of the
// dependency instances and then use the reflection instances to make a
// new instance of this class, injecting the created dependencies in.
try {
$instances = $this->resolveDependencies($dependencies);
} catch (BindingResolutionException $e) {
array_pop($this->buildStack);
throw $e;
}
// We're ready to instantiate an instance of the concrete type registered for
// the binding. This will instantiate the types, as well as resolve any of
// its "nested" dependencies recursively until all have gotten resolved.
$object = $this->isBuildable($concrete, $abstract)
? $this->build($concrete)
: $this->make($concrete);
// If we defined any extenders for this type, we'll need to spin through them
// and apply them to the object being built. This allows for the extension
// of services, such as changing configuration or decorating the object.
*/
protected function resolve($abstract, $parameters = [], $raiseEvents = true)
{
$this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract));
return parent::resolve($abstract, $parameters, $raiseEvents);
}
/**
* Load the deferred provider if the given type is a deferred service and the instance has not been loaded.
*
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function make($abstract, array $parameters = [])
{
return $this->resolve($abstract, $parameters);
}
/**
* {@inheritdoc}
*
*/
public function make($abstract, array $parameters = [])
{
$this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract));
return parent::make($abstract, $parameters);
}
/**
* Resolve the given type from the container.
*
return new Renderer(
$app->make(Factory::class),
$app->make(Listener::class),
$errorRenderer,
$app->make(BladeMapper::class),
$app->basePath(),
);
});
$this->app->singleton(Listener::class);
// used as resolvers for more fine-tuned resolution of these objects.
if ($concrete instanceof Closure) {
$this->buildStack[] = spl_object_hash($concrete);
try {
return $concrete($this, $this->getLastParameterOverride());
} finally {
array_pop($this->buildStack);
}
}
// We're ready to instantiate an instance of the concrete type registered for
// the binding. This will instantiate the types, as well as resolve any of
// its "nested" dependencies recursively until all have gotten resolved.
$object = $this->isBuildable($concrete, $abstract)
? $this->build($concrete)
: $this->make($concrete);
// If we defined any extenders for this type, we'll need to spin through them
// and apply them to the object being built. This allows for the extension
// of services, such as changing configuration or decorating the object.
*/
protected function resolve($abstract, $parameters = [], $raiseEvents = true)
{
$this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract));
return parent::resolve($abstract, $parameters, $raiseEvents);
}
/**
* Load the deferred provider if the given type is a deferred service and the instance has not been loaded.
*
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function make($abstract, array $parameters = [])
{
return $this->resolve($abstract, $parameters);
}
/**
* {@inheritdoc}
*
*/
public function make($abstract, array $parameters = [])
{
$this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract));
return parent::make($abstract, $parameters);
}
/**
* Resolve the given type from the container.
*
try {
if (config('app.debug')) {
if (app()->has(ExceptionRenderer::class)) {
return $this->renderExceptionWithCustomRenderer($e);
} elseif ($this->container->bound(Renderer::class)) {
return $this->container->make(Renderer::class)->render(request(), $e);
}
}
return $this->renderExceptionWithSymfony($e, config('app.debug'));
} catch (Throwable $e) {
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function convertExceptionToResponse(Throwable $e)
{
return new SymfonyResponse(
$this->renderExceptionContent($e),
$this->isHttpException($e) ? $e->getStatusCode() : 500,
$this->isHttpException($e) ? $e->getHeaders() : []
);
}
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/
protected function prepareResponse($request, Throwable $e)
{
if (! $this->isHttpException($e) && config('app.debug')) {
return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e)->prepare($request);
}
if (! $this->isHttpException($e)) {
$e = new HttpException(500, $e->getMessage(), $e);
}
*/
protected function renderExceptionResponse($request, Throwable $e)
{
return $this->shouldReturnJson($request, $e)
? $this->prepareJsonResponse($request, $e)
: $this->prepareResponse($request, $e);
}
/**
* Convert an authentication exception into a response.
*
return $this->finalizeRenderedResponse($request, match (true) {
$e instanceof HttpResponseException => $e->getResponse(),
$e instanceof AuthenticationException => $this->unauthenticated($request, $e),
$e instanceof ValidationException => $this->convertValidationExceptionToResponse($e, $request),
default => $this->renderExceptionResponse($request, $e),
}, $e);
}
/**
* Prepare the final, rendered response to be returned to the browser.
* @param \Throwable $e
* @return void
*/
protected function renderHttpResponse(Throwable $e)
{
$this->getExceptionHandler()->render(static::$app['request'], $e)->send();
}
/**
* Handle the PHP shutdown event.
*
if ($exceptionHandlerFailed ?? false) {
exit(1);
}
} else {
$this->renderHttpResponse($e);
}
}
/**
* Render an exception to the console.
* @return callable
*/
protected function forwardsTo($method)
{
return fn (...$arguments) => static::$app
? $this->{$method}(...$arguments)
: false;
}
/**
* Determine if the error level is a deprecation.
InvalidArgumentException
|
---|
InvalidArgumentException: Please provide a valid cache path. at /workspace/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php:75 at Illuminate\View\Compilers\Compiler->__construct(object(Filesystem), false, '', true, 'php', true) (/workspace/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php:97) at Illuminate\View\ViewServiceProvider->Illuminate\View\{closure}(object(Application), array()) (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:1010) at Illuminate\Container\Container->build(object(Closure)) (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:890) at Illuminate\Container\Container->resolve('blade.compiler', array(), true) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1077) at Illuminate\Foundation\Application->resolve('blade.compiler', array()) (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:821) at Illuminate\Container\Container->make('blade.compiler', array()) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1057) at Illuminate\Foundation\Application->make('blade.compiler') (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:1202) at Illuminate\Container\Container->resolveClass(object(ReflectionParameter)) (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:1101) at Illuminate\Container\Container->resolveDependencies(array(object(ReflectionParameter), object(ReflectionParameter))) (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:1052) at Illuminate\Container\Container->build('Illuminate\\Foundation\\Exceptions\\Renderer\\Mappers\\BladeMapper') (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:890) at Illuminate\Container\Container->resolve('Illuminate\\Foundation\\Exceptions\\Renderer\\Mappers\\BladeMapper', array(), true) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1077) at Illuminate\Foundation\Application->resolve('Illuminate\\Foundation\\Exceptions\\Renderer\\Mappers\\BladeMapper', array()) (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:821) at Illuminate\Container\Container->make('Illuminate\\Foundation\\Exceptions\\Renderer\\Mappers\\BladeMapper', array()) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1057) at Illuminate\Foundation\Application->make('Illuminate\\Foundation\\Exceptions\\Renderer\\Mappers\\BladeMapper') (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php:271) at Illuminate\Foundation\Providers\FoundationServiceProvider->Illuminate\Foundation\Providers\{closure}(object(Application), array()) (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:1010) at Illuminate\Container\Container->build(object(Closure)) (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:890) at Illuminate\Container\Container->resolve('Illuminate\\Foundation\\Exceptions\\Renderer\\Renderer', array(), true) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1077) at Illuminate\Foundation\Application->resolve('Illuminate\\Foundation\\Exceptions\\Renderer\\Renderer', array()) (/workspace/vendor/laravel/framework/src/Illuminate/Container/Container.php:821) at Illuminate\Container\Container->make('Illuminate\\Foundation\\Exceptions\\Renderer\\Renderer', array()) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1057) at Illuminate\Foundation\Application->make('Illuminate\\Foundation\\Exceptions\\Renderer\\Renderer') (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:850) at Illuminate\Foundation\Exceptions\Handler->renderExceptionContent(object(UnexpectedValueException)) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:831) at Illuminate\Foundation\Exceptions\Handler->convertExceptionToResponse(object(UnexpectedValueException)) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:810) at Illuminate\Foundation\Exceptions\Handler->prepareResponse(object(Request), object(UnexpectedValueException)) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:709) at Illuminate\Foundation\Exceptions\Handler->renderExceptionResponse(object(Request), object(UnexpectedValueException)) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:597) at Illuminate\Foundation\Exceptions\Handler->render(object(Request), object(UnexpectedValueException)) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:219) at Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse(object(UnexpectedValueException)) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:196) at Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(object(UnexpectedValueException)) (/workspace/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:256) at Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}(object(UnexpectedValueException)) |