Implemented echoarea/filearea security

This commit is contained in:
2023-07-29 13:17:36 +10:00
parent f1ccca25ea
commit cd140971e2
22 changed files with 548 additions and 58 deletions

View File

@@ -0,0 +1,29 @@
<?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);
}
}