Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Octane Prep #36777

Merged
merged 17 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Illuminate/Auth/Access/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -800,4 +800,17 @@ public function policies()
{
return $this->policies;
}

/**
* Set the container instance used by the gate.
*
* @param \Illuminate\Contracts\Container\Container $container
* @return $this
*/
public function setContainer(Container $container)
{
$this->container = $container;

return $this;
}
}
25 changes: 25 additions & 0 deletions src/Illuminate/Auth/AuthManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,31 @@ public function hasResolvedGuards()
return count($this->guards) > 0;
}

/**
* Forget all of the resolved guard instances.
*
* @return $this
*/
public function forgetGuards()
{
$this->guards = [];

return $this;
}

/**
* Set the application instance used by the manager.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return $this
*/
public function setApplication($app)
{
$this->app = $app;

return $this;
}

/**
* Dynamically call the default driver instance.
*
Expand Down
36 changes: 12 additions & 24 deletions src/Illuminate/Auth/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ public function register()
protected function registerAuthenticator()
{
$this->app->singleton('auth', function ($app) {
// Once the authentication service has actually been requested by the developer
// we will set a variable in the application indicating such. This helps us
// know that we need to set any queued cookies in the after event later.
$app['auth.loaded'] = true;

return new AuthManager($app);
});

Expand All @@ -55,11 +50,9 @@ protected function registerAuthenticator()
*/
protected function registerUserResolver()
{
$this->app->bind(
AuthenticatableContract::class, function ($app) {
return call_user_func($app['auth']->userResolver());
}
);
$this->app->bind(AuthenticatableContract::class, function ($app) {
return call_user_func($app['auth']->userResolver());
});
}

/**
Expand All @@ -83,15 +76,13 @@ protected function registerAccessGate()
*/
protected function registerRequirePassword()
{
$this->app->bind(
RequirePassword::class, function ($app) {
return new RequirePassword(
$app[ResponseFactory::class],
$app[UrlGenerator::class],
$app['config']->get('auth.password_timeout')
);
}
);
$this->app->bind(RequirePassword::class, function ($app) {
return new RequirePassword(
$app[ResponseFactory::class],
$app[UrlGenerator::class],
$app['config']->get('auth.password_timeout')
);
});
}

/**
Expand All @@ -116,11 +107,8 @@ protected function registerRequestRebindHandler()
protected function registerEventRebindHandler()
{
$this->app->rebinding('events', function ($app, $dispatcher) {
if (! $app->resolved('auth')) {
return;
}

if ($app['auth']->hasResolvedGuards() === false) {
if (! $app->resolved('auth') ||
$app['auth']->hasResolvedGuards() === false) {
return;
}

Expand Down
35 changes: 35 additions & 0 deletions src/Illuminate/Broadcasting/BroadcastManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,41 @@ public function extend($driver, Closure $callback)
return $this;
}

/**
* Get the application instance used by the manager.
*
* @return \Illuminate\Contracts\Foundation\Application
*/
public function getApplication()
{
return $this->app;
}

/**
* Set the application instance used by the manager.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return $this
*/
public function setApplication($app)
{
$this->app = $app;

return $this;
}

/**
* Forget all of the resolved driver instances.
*
* @return $this
*/
public function forgetDrivers()
{
$this->drivers = [];

return $this;
}

/**
* Dynamically call the default driver instance.
*
Expand Down
12 changes: 12 additions & 0 deletions src/Illuminate/Cookie/CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,16 @@ public function getQueuedCookies()
{
return Arr::flatten($this->queued);
}

/**
* Flush the cookies which have been queued for the next request.
*
* @return $this
*/
public function flushQueuedCookies()
{
$this->queued = [];

return $this;
}
}
13 changes: 13 additions & 0 deletions src/Illuminate/Foundation/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,4 +445,17 @@ public function getApplication()
{
return $this->app;
}

/**
* Set the Laravel application instance.
*
* @param \Illuminate\Contracts\Foundation\Application
* @return $this
*/
public function setApplication(Application $app)
{
$this->app = $app;

return $this;
}
}
35 changes: 35 additions & 0 deletions src/Illuminate/Mail/MailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,41 @@ public function extend($driver, Closure $callback)
return $this;
}

/**
* Get the application instance used by the manager.
*
* @return \Illuminate\Contracts\Foundation\Application
*/
public function getApplication()
{
return $this->app;
}

/**
* Set the application instance used by the manager.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return $this
*/
public function setApplication($app)
{
$this->app = $app;

return $this;
}

/**
* Forget all of the resolved mailer instances.
*
* @return $this
*/
public function forgetMailers()
{
$this->mailers = [];

return $this;
}

/**
* Dynamically call the default driver instance.
*
Expand Down
22 changes: 1 addition & 21 deletions src/Illuminate/Pagination/PaginationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,6 @@ public function boot()
*/
public function register()
{
Paginator::viewFactoryResolver(function () {
return $this->app['view'];
});

Paginator::currentPathResolver(function () {
return $this->app['request']->url();
});

Paginator::currentPageResolver(function ($pageName = 'page') {
$page = $this->app['request']->input($pageName);

if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) {
return (int) $page;
}

return 1;
});

Paginator::queryStringResolver(function () {
return $this->app['request']->query();
});
PaginationState::resolveUsing($this->app);
}
}
37 changes: 37 additions & 0 deletions src/Illuminate/Pagination/PaginationState.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Illuminate\Pagination;

class PaginationState
{
/**
* Bind the pagination state resolvers using the given application container as a base.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public static function resolveUsing($app)
{
Paginator::viewFactoryResolver(function () use ($app) {
return $app['view'];
});

Paginator::currentPathResolver(function () use ($app) {
return $app['request']->url();
});

Paginator::currentPageResolver(function ($pageName = 'page') use ($app) {
$page = $app['request']->input($pageName);

if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) {
return (int) $page;
}

return 1;
});

Paginator::queryStringResolver(function () use ($app) {
return $app['request']->query();
});
}
}
23 changes: 23 additions & 0 deletions src/Illuminate/Pipeline/Hub.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,27 @@ public function pipe($object, $pipeline = null)
$this->pipelines[$pipeline], new Pipeline($this->container), $object
);
}

/**
* Get the container instance used by the hub.
*
* @return \Illuminate\Contracts\Container\Container
*/
public function getContainer()
{
return $this->container;
}

/**
* Set the container instance used by the hub.
*
* @param \Illuminate\Contracts\Container\Container $container
* @return $this
*/
public function setContainer(Container $container)
{
$this->container = $container;

return $this;
}
}
10 changes: 10 additions & 0 deletions src/Illuminate/Queue/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@ public function setConnectionName($name)
return $this;
}

/**
* Get the container instance being used by the connection.
*
* @return \Illuminate\Container\Container
*/
public function getContainer()
{
return $this->container;
}

/**
* Set the IoC container instance.
*
Expand Down
27 changes: 27 additions & 0 deletions src/Illuminate/Queue/QueueManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,33 @@ public function getName($connection = null)
return $connection ?: $this->getDefaultDriver();
}

/**
* Get the application instance used by the manager.
*
* @return \Illuminate\Contracts\Foundation\Application
*/
public function getApplication()
{
return $this->app;
}

/**
* Set the application instance used by the manager.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return $this
*/
public function setApplication($app)
{
$this->app = $app;

foreach ($this->connections as $connection) {
$connection->setContainer($app);
}

return $this;
}

/**
* Dynamically pass calls to the default connection.
*
Expand Down
Loading