| | |
| | | |
| | | |
| | | class Options { |
| | | protected static options $instance; |
| | | protected static Options $instance; |
| | | protected array $resetFields = []; |
| | | protected string $resetInterval = 'daily'; |
| | | protected Fields $fields; |
| | |
| | | public function getConfig(string $fieldName):?array |
| | | { |
| | | $allFields = $this->fields->getFields(); |
| | | if (str_contains($fieldName, '|')) { |
| | | $fieldName = strtok($fieldName, '|'); |
| | | }elseif(str_contains($fieldName, ':')) { |
| | | $fieldName = strtok($fieldName, ':'); |
| | | } |
| | | if (array_key_exists($fieldName, $allFields)) { |
| | | return $allFields[$fieldName]->getConfig(); |
| | | } |
| | |
| | | return self::$values[$fieldName]; |
| | | } |
| | | |
| | | public static function getAll():array |
| | | public static function getAll(array $fields = []):array |
| | | { |
| | | $meta = Meta::forOptions(); |
| | | return $meta->getAll(); |
| | | return $meta->getAll($fields); |
| | | } |
| | | public static function delete(string $fieldName):void |
| | | { |
| | |
| | | $this->fields->getFields() |
| | | ); |
| | | } |
| | | |
| | | public static function clear():void |
| | | { |
| | | self::$values = []; |
| | | } |
| | | } |