获取实例
@return $this
514307
final public static function getInstance()
    {
        $className = get_called_class();
        if (!isset(self::$_instances[$className])) {
            $instance = new $className();
            /* @var SingleTon $instance */
            $instance->init();
            self::$_instances[$className] = $instance;
        }
        return self::$_instances[$className];
    }
1314616
public function overload(): self
    {
        $this->loader = new Loader($this->files);
        $this->loader->load();

        return $this;
    }
1179769
public function setActive() {
		if (! $this->_active) {
			$this->addClass(self::CLASS_ACTIVE);
			$this->_active = true;
		}
		
		return $this;
	}
622202
public function delete()
    {
        $this->eventsManager->fireEvent('model:beforeDelete', $this);

        static::query(null, $this)->where($this->_getPrimaryKeyValuePairs())->delete();

        $this->eventsManager->fireEvent('model:afterDelete', $this);

        return $this;
    }
885285
public function start()
    {
        if (!$this->httpEnable) {
            parent::start();
            return $this;
        }

        if (static::mode == 'console') {
            $this->beforeSwooleStart();
            $this->onWorkerStart(null, null);
        } else {
            //开启一个http服务器
            $mode = $this->config->get('server.mode', SWOOLE_PROCESS);
            $this->server = new \swoole_http_server($this->httpSocketName, $this->httpPort, $mode);
            $this->server->on('Start', [$this, 'onStart']);
            $this->server->on('WorkerStart', [$this, 'onWorkerStart']);
            $this->server->on('WorkerStop', [$this, 'onWorkerStop']);
            $this->server->on('Task', [$this, 'onTask']);
            $this->server->on('Finish', [$this, 'onFinish']);
            $this->server->on('PipeMessage', [$this, 'onPipeMessage']);
            $this->server->on('WorkerError', [$this, 'onWorkerError']);
            $this->server->on('ManagerStart', [$this, 'onManagerStart']);
            $this->server->on('ManagerStop', [$this, 'onManagerStop']);
            $this->server->on('request', [$this, 'onRequest']);
            $this->server->on('Shutdown', [$this, 'onShutdown']);
            $set = $this->setServerSet();
            $set['daemonize'] = self::$daemonize ? 1 : 0;
            $this->server->set($set);
            $this->beforeSwooleStart();
            $this->server->start();
        }

        return $this;
    }
852575
public function disable(): self
    {
        if (!empty($this->logs)) {
            $this->logs->removeListener($this);
        }

        return $this;
    }
652917
public function refresh()
    {
        $behaviors = $this->owner->behaviors();
        $settings = $behaviors[$this->getName()];
        foreach ($settings as $attribute=>$value) {
            if (in_array($attribute, array('class'))) {
                continue;
            }
            $this->$attribute = $value;
        }
        return $this;
    }
1149348
public function group()
    {
        $columns = func_get_args();
        $group = '';
        $i = 0;
        //
        if ($columns) {
            foreach ($columns as $value) {
                if (!$i) {
                    $order .= ' group by '.$value;
                } else {
                    $order .= ','.$value;
                }
                $i = 1;
            }
        }
        //
        $this->group = $group;
        //
        return $this;
    }
199709
public function register()
    {
        $this->container['translator'] = function ($container) {
            $config = $container['config']->get('translator');

            $translator = new Translator($config->get('paths', [])->toArray());

            // 别名设置
            foreach ($config->get('aliases', []) as $key => $value) {
                $translator->alias($key, $value->toArray());
            }

            // 默认语言类型
            $translator->default(value($config->default));

            // 导入必须的语言包
            $translator->import($config->get('required', [])->toArray());

            return $translator;
        };
    }
654538
public function active()
    {
        if(!\Yii::$app->user->isGuest && !\Yii::$app->user->identity->isAdmin)
        {
            $this->andWhere(['deleted_at' => NULL]);
        }
        return $this;
    }
754459
public function validate()
    {
        $this->shouldValidate = false;

        if (parent::validates()) {
            $this->success = true;
        } else {
            $this->fail();
        }

        return $this;
    }
1033347
public function send()
    {
        // gzip支持
        if($this->gzipStatus)
        {
            $this->swooleResponse->gzip($this->gzipLevel);
        }
        $this->sendHeaders();
        $this->swooleResponse->end($this->getBody());
        $this->isEnded = true;
        return $this;
    }
1289374
public function tick()
    {
        if ($this->ticksUntilUnload !== null) {
            --$this->ticksUntilUnload;
            if ($this->ticksUntilUnload < 1) {
                $this->unloadDoctrineEntities();
                $this->ticksUntilUnload = $this->unloadDoctrineEveryTick;
            }
        }

        return $this;
    }
387307
public function load(): self
    {
        $this->loader = new Loader($this->files, true);
        $this->loader->load();

        return $this;
    }
177431
public function save(){

        foreach($this->_items as $item){
            if($item->exists()){
                $item->save();
            }
        }

        return $this;

    }
972336
public function clear()
    {
        $this->status = 200;
        $this->reasonPhrase = '';
        $this->headers = [];
        $this->ucHeaders = [];
        $this->cookies = [];
        $this->body = null;
        $this->asgiMap = [];

        return $this;
    }
1078023
public function false()
    {
        $message = ['%s is {{not|}} false', $this->value];
        $this->assert(($this->value === false), $message);

        return $this;
    }