clrghouz/app/Traits/AreaSecurity.php

29 lines
524 B
PHP

<?php
/**
* Return the area security information
*/
namespace App\Traits;
trait AreaSecurity
{
public function getSecReadAttribute(): int
{
return ($this->security>>3) & 0x7;
}
public function getSecWriteAttribute(): int
{
return $this->security & 0x7;
}
public function setRead(int $security): void
{
$this->security = ($this->security & ~(0x7<<3)) | (($security & 0x7) << 3);
}
public function setWrite(int $security): void
{
$this->security = ($this->security & ~(0x7)) | ($security & 0x7);
}
}