for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Terranet\Administrator\Providers\Handlers;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Routing\Events\RouteMatched;
use Illuminate\Support\Arr;
use Terranet\Administrator\Traits\SessionGuardHelper;
class PasswordsManager
{
use SessionGuardHelper;
/**
* @var Repository
*/
private $config;
* PasswordsManager constructor.
*
* @param Repository $config
public function __construct(Repository $config)
$this->config = $config;
}
public function handle()
app('router')->matched(function (RouteMatched $event) {
app
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
/** @scrutinizer ignore-call */
if (!$this->isAdminArea($event)) {
return false;
if ($manage = $this->config->get('administrator.manage_passwords')) {
$manage
if ($model = $this->fetchModel($this->config)) {
$model::saving(function ($user) {
if (!empty($user->password) && $user->isDirty('password')) {
$user->password = bcrypt($user->password);
bcrypt
$user->password = /** @scrutinizer ignore-call */ bcrypt($user->password);
});
* Check if running under admin area.
* @param RouteMatched $event
* @return bool
protected function isAdminArea(RouteMatched $event)
if ($action = $event->route->getAction()) {
return config('administrator.prefix') === Arr::get($action, 'prefix');
config
return /** @scrutinizer ignore-call */ config('administrator.prefix') === Arr::get($action, 'prefix');