for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Spatie\DemoMode;
use Closure;
use Illuminate\Config\Repository;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class DemoMode
{
/** @var array */
protected $config;
public function __construct(Repository $config)
$this->config = $config->get('demo-mode');
$config->get('demo-mode')
*
array
$config
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
}
/**
* Handle an incoming request.
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
if (! $this->config['enabled']) {
return $next($request);
if ($this->protectedByDemoMode($request)) {
if (! (new DemoGuard())->hasDemoAccess($request)) {
return new RedirectResponse($this->config['redirect_unauthorized_users_to_url']);
protected function protectedByDemoMode(Request $request): bool
$request
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
return true;
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..