actionData[$action] ?? Table::LEVEL_NO; } /** * Get a 'read' level. */ public function getRead(): string { return $this->get(Table::ACTION_READ); } /** * Get an 'edit' level. */ public function getEdit(): string { return $this->get(Table::ACTION_EDIT); } /** * Create from a raw table value. */ public static function fromRaw(stdClass $raw): self { $obj = new self(); $obj->actionData = get_object_vars($raw); foreach ($obj->actionData as $item) { if (!is_string($item)) { throw new RuntimeException("Bad raw scope data."); } } $obj->raw = $raw; return $obj; } }