Author: Vasily Zorin (maintainer@daemon.io)
Inheritance: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog
Exemple #1
0
 /**
  * Constructor
  * @param hash
  * @return object
  */
 public function __construct($arr = [])
 {
     foreach ($arr as $k => $v) {
         if (!is_object($v)) {
             $e = new Generic();
             $e->setHumanValue($v);
             $this->{$k} = $e;
         } else {
             $this->{$k} = $v;
         }
     }
 }
Exemple #2
0
 /**
  * Constructor
  * @return object
  */
 public function __construct()
 {
     static $sizes = ['maxmemoryusage'];
     static $times = ['maxidle', 'autoreload', 'mpmdelay', 'eiosetmaxpolltime', 'lambdacachettl'];
     static $numbers = ['maxrequests', 'autogc', 'startworkers', 'workerpriority', 'minworkers', 'maxworkers', 'minspareworkers', 'maxspareworkers', 'masterpriority', 'ipcthreadpriority', 'eiosetmaxidle', 'eiosetmaxparallel', 'eiosetmaxpollreqs', 'eiosetminparallel', 'verbose', 'verbosetty', 'lambdacachemaxsize', 'lambdacachecapwindow'];
     foreach ($this as $name => $value) {
         if (in_array($name, $sizes)) {
             $entry = new Size();
         } elseif (in_array($name, $times)) {
             $entry = new Time();
         } elseif (in_array($name, $numbers)) {
             $entry = new Number();
         } elseif ($name === 'configfile') {
             $entry = new ConfigFile();
         } else {
             $entry = new Entry\Generic();
         }
         if ($name === 'addincludepath') {
             $entry->setStackable();
         }
         $entry->setDefaultValue($value);
         $entry->setHumanValue($value);
         $this->{$name} = $entry;
     }
 }