public static function getInstance($arg = '', $spawn = true)
    {
        if ($arg === 'default') {
            $arg = '';
        }
        $class = static::class;
        if (is_string($arg)) {
            $key = $class . ':' . $arg;
            if (isset(self::$instances[$key])) {
                return self::$instances[$key];
            } elseif (!$spawn) {
                return false;
            }
            $k = '\PHPDaemon\Core\Pool:\\' . $class . ($arg !== '' ? ':' . $arg : '');
            $config = (isset(Daemon::$config->{$k}) && Daemon::$config->{$k} instanceof Config\Section) ? Daemon::$config->{$k} : new Config\Section;
            $obj = self::$instances[$key] = new $class($config);
            $obj->name = $arg;
        } elseif ($arg instanceof Config\Section) {
            $obj = new static($arg);
        } else {
            $obj = new static(new Config\Section($arg));
        }
        $obj->eventLoop = EventLoop::$instance;
        return $obj;
    }
public static function getInstance($arg = '', $spawn = true)
    {
        if ($arg === 'default') {
            $arg = '';
        }
        $class = static::class;
        if (is_string($arg)) {
            $key = $class . ':' . $arg;
            if (isset(self::$instances[$key])) {
                return self::$instances[$key];
            } elseif (!$spawn) {
                return false;
            }
            $k = '\PHPDaemon\Core\Pool:\\' . $class . ($arg !== '' ? ':' . $arg : '');
            $config = (isset(Daemon::$config->{$k}) && Daemon::$config->{$k} instanceof Config\Section) ? Daemon::$config->{$k} : new Config\Section;
            $obj = self::$instances[$key] = new $class($config);
            $obj->name = $arg;
        } elseif ($arg instanceof Config\Section) {
            $obj = new static($arg);
        } else {
            $obj = new static(new Config\Section($arg));
        }
        $obj->eventLoop = EventLoop::$instance;
        return $obj;
    }
public static function getInstance ( $ arg = '' , $ spawn = true ) { if ( $ arg === 'default' ) { $ arg = '' ; } $ class = static :: class ; if ( is_string ( $ arg ) ) { $ key = $ class . ':' . $ arg ; if ( isset ( self :: $ instances [ $ key ] ) ) { return self :: $ instances [ $ key ] ; } elseif ( ! $ spawn ) { return false ; } $ k = '\PHPDaemon\Core\Pool:\\' . $ class . ( $ arg !== '' ? ':' . $ arg : '' ) ; $ config = ( isset ( Daemon :: $ config -> { $ k } ) && Daemon :: $ config -> { $ k } instanceof Config \ Section ) ? Daemon :: $ config -> { $ k } : new Config \ Section ; $ obj = self :: $ instances [ $ key ] = new $ class ( $ config ) ; $ obj -> name = $ arg ; } elseif ( $ arg instanceof Config \ Section ) { $ obj = new static ( $ arg ) ; } else { $ obj = new static ( new Config \ Section ( $ arg ) ) ; } $ obj -> eventLoop = EventLoop :: $ instance ; return $ obj ; }
Returns instance object
@param  string $arg name / array config / ConfigSection
@param  boolean $spawn Spawn? Default is true
@return this
Returns instance object