Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Pagekit\User\Model; use Pagekit\Application as App; trait AccessModelTr..
Decoded Output download
<?php
namespace Pagekit\User\Model;
use Pagekit\Application as App;
trait AccessModelTrait
{
/** @Column(type="simple_array") */
public $roles = [];
/**
* @param int $role
* @return bool
*/
public function hasRole($role)
{
return in_array($role, $this->roles);
}
/**
* @param User $user
* @return bool
*/
public function hasAccess(User $user)
{
return !$this->roles or array_intersect($user->roles, $this->roles);
}
/**
* @param Role|int $role
* @return int
*/
public static function removeRole($role)
{
if ($role instanceof Role) {
$role = $role->id;
}
$db = self::getConnection();
$platform = $db->getDatabasePlatform();
return $db->executeUpdate('UPDATE '.self::getMetadata()->getTable().' SET roles = NULLIF('.$platform->getTrimExpression("REPLACE (".$platform->getConcatExpression($db->quote(','), 'roles', $db->quote(',')).", ',{$role},', ',')", 3, $db->quote(',')). ", '')");
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Pagekit\User\Model;
use Pagekit\Application as App;
trait AccessModelTrait
{
/** @Column(type="simple_array") */
public $roles = [];
/**
* @param int $role
* @return bool
*/
public function hasRole($role)
{
return in_array($role, $this->roles);
}
/**
* @param User $user
* @return bool
*/
public function hasAccess(User $user)
{
return !$this->roles or array_intersect($user->roles, $this->roles);
}
/**
* @param Role|int $role
* @return int
*/
public static function removeRole($role)
{
if ($role instanceof Role) {
$role = $role->id;
}
$db = self::getConnection();
$platform = $db->getDatabasePlatform();
return $db->executeUpdate('UPDATE '.self::getMetadata()->getTable().' SET roles = NULLIF('.$platform->getTrimExpression("REPLACE (".$platform->getConcatExpression($db->quote(','), 'roles', $db->quote(',')).", ',{$role},', ',')", 3, $db->quote(',')). ", '')");
}
}
Function Calls
None |
Stats
MD5 | b7eefe453e51eb21e3587c9b35a1e97f |
Eval Count | 0 |
Decode Time | 75 ms |