clrghouz/app/Traits/AreaSecurity.php

29 lines
524 B
PHP
Raw Normal View History

2023-07-29 03:17:36 +00:00
<?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);
}
}