public function __construct($arr = array()) { foreach ($arr as $k => $v) { if (!is_object($v)) { $e = new Daemon_ConfigEntry(); $e->setHumanValue($v); $this->{$k} = $e; } else { $this->{$k} = $v; } } }
public function __construct() { static $sizes = array('maxmemoryusage'); static $times = array('maxidle', 'autoreload', 'mpmdelay'); static $numbers = array('maxrequests', 'autogc', 'minworkers', 'maxworkers', 'minspareworkers', 'maxspareworkers', 'masterpriority'); foreach ($this as $name => $value) { if (in_array($name, $sizes)) { $entry = new Daemon_ConfigEntrySize(); } elseif (in_array($name, $times)) { $entry = new Daemon_ConfigEntryTime(); } elseif (in_array($name, $numbers)) { $entry = new Daemon_ConfigEntryNumber(); } elseif ($name === 'configfile') { $entry = new Daemon_ConfigEntryConfigFile(); } else { $entry = new Daemon_ConfigEntry(); } $entry->setDefaultValue($value); $entry->setHumanValue($value); $this->{$name} = $entry; } }