| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace ModulesGarden\Servers\ZimbraEmail\Core\CommandLine;
- use ModulesGarden\Servers\ZimbraEmail\Core\FileReader\Reader;
- use ModulesGarden\Servers\ZimbraEmail\Core\ModuleConstants;
- /**
- * Description of AbstractReaderYml
- *
- * @author Rafał Ossowski <rafal.os@modulesgarden.com>
- */
- class ReaderCronTask
- {
- /**
- * @var array
- */
- protected $data = [];
- public function __construct()
- {
- if (count($this->data) == 0)
- {
- $this->load();
- }
- }
- public function getData()
- {
- return $this->data;
- }
- protected function readYml($name)
- {
- return Reader::read($name)->get();
- }
- public static function get()
- {
- $instance = new static;
- return $instance->getData();
- }
- protected function load()
- {
- $this->data = $this->rebuildData($this->readYml(ModuleConstants::getFullPath('app', 'Config', 'cron.yml')));
- }
-
- protected function rebuildData($data)
- {
- $return = [];
- foreach ($data['list'] as $name => $isRun)
- {
- if ((bool)$isRun)
- {
- $return[] = $name;
- }
- }
-
- return $return;
- }
-
- }
|