/** * 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; } } }
/** * 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; } }