for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Lab404\Impersonate\Models;
use Illuminate\Database\Eloquent\Model;
use Lab404\Impersonate\Services\ImpersonateManager;
trait Impersonate
{
/**
* Return true or false if the user can impersonate an other user.
*
* @param void
* @return bool
*/
public function canImpersonate()
return true;
}
* Return true or false if the user can be impersonate.
* @param Model $user
$user
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
public function canBeImpersonated()
* Impersonate the given user.
public function impersonate(Model $user)
return app(ImpersonateManager::class)->take($this, $user);
* Check if the current user is impersonated.
public function isImpersonated()
return app(ImpersonateManager::class)->isImpersonating();
* Leave the current impersonation.
public function leaveImpersonation()
if ($this->isImpersonated())
return app(ImpersonateManager::class)->leave();
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.