Skip to content

Commit

Permalink
Update GroupedOptions.php
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyir committed Feb 14, 2023
1 parent 86a662e commit e63d330
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/GroupedOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,43 @@

class GroupedOptions
{
private $config = [];

private $groupName = "";

private $groupData = [];


public function __construct($groupName)
{
$this->groupName = $groupName;

$this->buildGroupDataArray();

}

public function get($key, $default = null)
{
return $this->groupData[$key] ?? $default;
}

public function getAll()
{
return $this->groupData;
}

public function set($key, $value)
{

$this->groupData[$key] = $value;

Options::set($this->databaseGroupKey(), json_encode($this->groupData));
}

public function setAll($data)
{
Options::set($this->databaseGroupKey(), json_encode($data));
}

private function buildGroupDataArray()
{

$data = $this->getDatabaseGroupData();

$this->groupData = $data;

}



private function databaseGroupKey()
{
return "grouped-" . $this->groupName;
Expand Down

0 comments on commit e63d330

Please sign in to comment.