public function setPermission($key, $value)
    {
        if (empty($value)) {
            $value = self::GUEST;
        }

        if ($key == 'access') {
            $this->access = $value;
        } else {
            $permission = clone $this->permissions;
            $permission[$key] = $value;
            $this->set('permissions', $permission);
        }

        return $this;
    }
public function setPermission($key, $value)
    {
        if (empty($value)) {
            $value = self::GUEST;
        }

        if ($key == 'access') {
            $this->access = $value;
        } else {
            $permission = clone $this->permissions;
            $permission[$key] = $value;
            $this->set('permissions', $permission);
        }

        return $this;
    }
public function setPermission ( $ key , $ value ) { if ( empty ( $ value ) ) { $ value = self :: GUEST ; } if ( $ key == 'access' ) { $ this -> access = $ value ; } else { $ permission = clone $ this -> permissions ; $ permission [ $ key ] = $ value ; $ this -> set ( 'permissions' , $ permission ) ; } return $ this ; }
Sets a permission for a resource.

@param string     $key   The name of the resource
@param int|string $value The value of the permission. Can be string or integer

@return LibBaseDomainBehaviorPrivatable
Sets a permission for a resource .