예제 #1
0
 /**
  * @return ConfigInterface
  */
 public function create()
 {
     $files = $this->fs->files('', true, '#(' . $this->patternExt() . ')$#si');
     $config = [];
     foreach ($files as $file) {
         $ext = $file['extension'];
         $contents = $this->fs->read($file['path']);
         if ($ext === 'php') {
             $data = (require "data://text/plain;base64," . base64_encode($contents));
         } else {
             $data = $this->parsers[$ext]->decode($contents);
         }
         $config = array_merge($config, $data);
     }
     return new Config($config);
 }
예제 #2
0
 /**
  * @return string[][]
  * @throws IoReadException
  */
 private function selectFromStorage()
 {
     if (!$this->fs->exists($this->fsPath)) {
         return [];
     }
     $processes = [];
     $data = json_decode($this->fs->read($this->fsPath), true);
     foreach ($data as $alias => $record) {
         if ($this->system->existsPid($record['pid'])) {
             $processes[$alias] = ['pid' => $record['pid'], 'name' => $record['name'], 'verified' => false];
         }
     }
     return $processes;
 }