for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Arcanedev\Settings\Http\Middleware;
use Arcanedev\Settings\Contracts\Store as Settings;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Class SettingsMiddleware
*
* @package Arcanedev\Settings\Http\Middleware
* @author ARCANEDEV <[email protected]>
*/
class SettingsMiddleware
{
/* ------------------------------------------------------------------------------------------------
| Constructor
| ------------------------------------------------------------------------------------------------
* Create a new save settings middleware
* @param \Arcanedev\Settings\Contracts\Store $settings
public function __construct(Settings $settings)
$this->settings = $settings;
settings
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
| Main Functions
* Handle an incoming request.
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
public function handle(Request $request, Closure $next)
return $next($request);
* Perform any final actions for the request lifecycle.
* @param \Symfony\Component\HttpFoundation\Response $response
public function terminate(Request $request, Response $response)
$request
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$response
$this->settings->save();
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: