PHPDaemon\Core\Pool::init PHP Method

init() protected method

Constructor.
protected init ( ) : void
return void
    protected function init()
    {
        if ($this->isEnabled()) {
            list($class, $name) = explode(':', $this->name . ':');
            $realclass = ClassFinder::find($class);
            $e = explode('\\', $realclass);
            if ($e[sizeof($e) - 1] !== 'Pool' && class_exists($realclass . '\\Pool')) {
                $realclass .= '\\Pool';
            }
            if ($realclass !== $class) {
                $base = '\\PHPDaemon\\Core\\Pool:';
                Daemon::$config->renameSection($base . $class . ($name !== '' ? ':' . $name : ''), $base . $realclass . ($name !== '' ? ':' . $name : ''));
            }
            if (!class_exists($realclass)) {
                Daemon::log($realclass . ' class not exists.');
                return;
            }
            $func = [$realclass, 'getInstance'];
            $this->pool = $func($name);
            $this->pool->appInstance = $this;
        }
    }