注入属性

@return void
322746
public function injectProps()
    {
        $className = $this->refClass->getParentClass()->getName();
        list($injects, $configs) = static::getInjects($className);

        // @inject()和@requestInject()注入
        foreach($injects as $propName => $annotations)
        {
            $annotation = reset($annotations);
            $propRef = $this->refClass->getProperty($propName);
            $propRef->setAccessible(true);
            $propRef->setValue($this->object, $annotation->getRealValue());
        }

        // 配置注入
        foreach($configs as $name => $value)
        {
            $propRef = $this->refClass->getProperty($name);
            if(null === $propRef)
            {
                continue;
            }
            $propRef->setAccessible(true);
            $propRef->setValue($this->object, $value);
        }
    }
176078
public function handle()
    {
        $this->createEnv();

        $this->getDatabaseInformation();
        /**
         * Migrate tables
         */
        $this->line('Migrate database...');
        $this->app->register(InstallModuleServiceProvider::class);

        $this->line('Create super admin role...');
        $this->createSuperAdminRole();
        $this->line('Create admin user...');
        $this->createAdminUser();
        $this->line('Install module dependencies...');
        $this->registerInstallModuleService();

        session()->flush();
        session()->regenerate();
        \Artisan::call('cache:clear');
        \Artisan::call('view:clear');

        $this->info("\nWebEd installed. Current version is " . get_cms_version());
    }
1102278
public function handle()
    {
        $name = trim($this->argument('name'));

        $maxSize = trim($this->option('max-size'));
        $enableLogging = trim($this->option('enable-logging'));

        /**
         * @var Client
         */
        $client = $this->mns;
        if (!$client) {
            $this->error('请先配置阿里云MSN服务，并在DI里面注册');

            return;
        }
        //
        $topic = $client->getTopicRef($name);

        $topicAttr = new TopicAttributes();
        $topicAttr->setMaximumMessageSize($maxSize);
        $topicAttr->setLoggingEnabled($enableLogging);

        try {
            $res = $topic->setAttribute($topicAttr);
            if ($res->isSucceed()) {
                $this->line("Topic $name Updated");
                $this->output->newLine();
                $this->call('mns:list-topic');
            }
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
    }
895154
public function index()
    {
        $this->data['page']->title = 'Manage Blogs';

        // --------------------------------------------------------------------------

        //  Get blogs
        $this->data['blogs'] = $this->blog_model->getAll();

        if (empty($this->data['blogs'])) {

            if (!userHasPermission('admin:blog:blog:create')) {

                $status   = 'message';
                $message  = '<strong>You don\'t have a blog!</strong> Create a new blog ';
                $message .= 'in order to configure blog settings.';

                $this->session->set_flashdata($status, $message);

                redirect('admin/blog/blog/create');

            }
        }

        // --------------------------------------------------------------------------

        //  Add a header button
        if (userHasPermission('admin:blog:blog:create')) {

             Helper::addHeaderButton('admin/blog/blog/create', 'Create Blog');
        }

        // --------------------------------------------------------------------------

        //  Load views
        Helper::loadView('index');
    }
1026506
public function init() {

		parent::init();

		// Permission
		$this->crudPermission = CoreGlobal::PERM_USER;

		// Config
		$this->baseUrl	= '/user';
		$this->apixBase	= 'core/user';

		// Services
		$this->modelService = Yii::$app->factory->get( 'userService' );

		$this->optionService = Yii::$app->factory->get( 'optionService' );

		$this->countryService		= Yii::$app->factory->get( 'countryService' );
		$this->provinceService		= Yii::$app->factory->get( 'provinceService' );
		$this->regionService		= Yii::$app->factory->get( 'regionService' );
		$this->addressService		= Yii::$app->factory->get( 'addressService' );
		$this->modelAddressService	= Yii::$app->factory->get( 'modelAddressService' );
	}
181644
public function execute()
    {
        // clean up
        $cleanUpResult = $this->cleanUpIndex();

        // initialize for re-indexing
            /** @var Queue $indexQueue */
        $indexQueue = GeneralUtility::makeInstance(Queue::class);
        $indexQueueInitializationResults = $indexQueue->getInitializationService()
            ->initializeBySiteAndIndexConfigurations($this->getSite(), $this->indexingConfigurationsToReIndex);

        return ($cleanUpResult && !in_array(false, $indexQueueInitializationResults));
    }
1218013
public function handle() : void
    {
        if ($module = $this->option('module')) {
            $this->input->setOption('path', 'modules/' . $module . '/database/migrations');
        }

        parent::handle();
    }
1144253
public function handle()
    {
        $this->processOptions();

        //Publish
        $this->publishHomeController();
        $this->changeRegisterController();
        $this->changeLoginController();
        $this->changeForgotPasswordController();
        $this->publishNoGuestForgotPasswordController();
        $this->changeResetPasswordController();
        $this->publishPublicAssets();
        $this->publishViews();
        $this->publishResourceAssets();
        $this->publishTests();
        $this->publishLanguages();
        $this->publishGravatar();
        $this->publishConfig();
        $this->publishWebRoutes();
        $this->publishApiRoutes();
        $this->publishDusk();
        $this->publishDatabaseConfig();
    }
257891
public function reload()
    {
        $rpcServer = $this->getRpcServer();

        // 是否已启动
        if (! $rpcServer->isRunning()) {
            output()->writeln('<error>The server is not running! cannot reload</error>', true, true);
        }

        // 打印信息
        output()->writeln(sprintf('<info>Server %s is reloading ...</info>', input()->getFullScript()));

        // 重载
        $reloadTask = input()->hasOpt('t');
        $rpcServer->reload($reloadTask);
        output()->writeln(sprintf('<success>Server %s is reload success</success>', input()->getFullScript()));
    }
437983
public function handle()
    {
        $this->module = $this->laravel['modules'];

        $name = $this->argument('module');

        if (!empty($name)) {
            $this->reset($name);

            return;
        }

        foreach ($this->module->getOrdered($this->option('direction')) as $module) {
            $this->line('Running for module: <info>' . $module->getName() . '</info>');

            $this->reset($module);
        }
    }
745037
public function run()
    {
        // todo: think of a better way of doing this.
        $script = "jQuery('{$this->selector}').attr('data-spy', 'scroll');";
        if (isset($this->target)) {
            $script .= "jQuery('{$this->selector}').attr('data-target', '{$this->target}');";
        }
        if (isset($this->offset)) {
            $script .= "jQuery('{$this->selector}').attr('data-offset', '{$this->offset}');";
        }
        Yii::app()->clientScript->registerScript($this->getId(), $script, CClientScript::POS_BEGIN);
        $this->registerEvents($this->selector, $this->events);
    }
5691
public function handle()
    {
        $prefix = trim($this->option('prefix'));
        $max = trim($this->option('max'));
        $next = trim($this->option('next'));

        /**
         * @var Client
         */
        $client = $this->mns;
        if (!$client) {
            $this->error('请先配置阿里云MSN服务，并在DI里面注册');

            return;
        }

        $request = new ListTopicRequest($max, $prefix, $next);
        try {
            $data = [];
            $res = $client->listTopic($request);
            if ($res->isSucceed()) {
                foreach ($res->getTopicNames() as $topicName) {
                    $topic['name'] = $topicName;
                    $topicRef = $client->getTopicRef($topicName);

                    /* @var \AliyunMNS\Model\TopicAttributes $attr */
                    $attr = $topicRef->getAttribute()->getTopicAttributes();

                    $topic['msgCount'] = $attr->getMessageCount();
                    $topic['maxSize'] = $attr->getMaximumMessageSize();
                    $topic['ttl'] = $attr->getMessageRetentionPeriod();
                    $topic['createTime'] = date('Y-m-d H:i:s', $attr->getCreateTime());
                    $topic['updateTime'] = date('Y-m-d H:i:s', $attr->getLastModifyTime());
                    $topic['loggingEnabled'] = $attr->getLoggingEnabled() ? 'Y' : 'N';
                    $data[] = $topic;
                }
            }


            $topicHeaders = ['Name', 'MsgCount', 'MaxSize', 'TTL', 'CreateTime', 'UpdateTime', 'EnableLog'];
            $this->line('List of Topics:');
            $this->table($topicHeaders, $data);
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
    }
521299
public function run()
	{
		if(is_array($this->focus))
			$this->focus="#".CHtml::activeId($this->focus[0],$this->focus[1]);

		echo CHtml::endForm();
		$cs=Yii::app()->clientScript;
		if(!$this->enableAjaxValidation && !$this->enableClientValidation || empty($this->attributes))
		{
			if($this->focus!==null)
			{
				$cs->registerCoreScript('jquery');
				$cs->registerScript('CActiveForm#focus',"
					if(!window.location.hash)
						jQuery('".$this->focus."').focus();
				");
			}
			return;
		}

		$options=$this->clientOptions;
		if(isset($this->clientOptions['validationUrl']) && is_array($this->clientOptions['validationUrl']))
			$options['validationUrl']=CHtml::normalizeUrl($this->clientOptions['validationUrl']);

		foreach($this->_summaryAttributes as $attribute)
			$this->attributes[$attribute]['summary']=true;
		$options['attributes']=array_values($this->attributes);

		if($this->summaryID!==null)
			$options['summaryID']=$this->summaryID;

		if($this->focus!==null)
			$options['focus']=$this->focus;

		if(!empty(CHtml::$errorCss))
			$options['errorCss']=CHtml::$errorCss;

		$options=CJavaScript::encode($options);
		$cs->registerCoreScript('yiiactiveform');
		$id=$this->id;
		$cs->registerScript(__CLASS__.'#'.$id,"jQuery('#$id').yiiactiveform($options);");
	}
696670
public function run()
    {
        $this->seed('DataTypesTableSeeder');
        $this->seed('DataRowsTableSeeder');
        $this->seed('MenusTableSeeder');
        $this->seed('MenuItemsTableSeeder');
        $this->seed('RolesTableSeeder');
        $this->seed('PermissionsTableSeeder');
        $this->seed('PermissionRoleTableSeeder');
        //测试数据
        $this->seed('CategoriesTableSeeder');
        $this->seed('UsersTableSeeder');
        $this->seed('PostsTableSeeder');
        $this->seed('PagesTableSeeder');
        $this->seed('SettingsTableSeeder');
        $this->seed('TranslationsTableSeeder');
    }
47025
public function register()
    {
        //合并配置文件
        $this->mergeConfigFrom(
            realpath(__DIR__ . '/../config/picture.php'), 'picture'
        );
        $this->app->bind('pictureManager', function ($app) {
            $config = $app['config']['picture'];
            return new PictureManager($config,
                $this->app->make(ImageManager::class),
                $this->app['pictureManager.PictureUrlManager'],
                $this->app['pictureManager.pictureIdGenerator']);
        });

        $this->app->singleton('pictureManager.PictureUrlManager', function ($app) {
            return new PictureUrlManager($app);
        });
        $this->app->singleton('pictureManager.pictureIdGenerator', function ($app) {
            return new PictureIdGenerator();
        });
        $this->app->singleton('pictureManager.uploader', function ($app) {
            return new PictureUploader(
                Storage::disk($app['config']->get('picture.default_disk')),
                $this->app['pictureManager.PictureUrlManager'],
                $this->app['pictureManager.pictureIdGenerator']);
        });
    }
834059
public function delete()
    {
        if ( ! is_null($this->parent)) {
            $this->parent->removeChild($this->id);
        }

        $this->parent = null;
    }
1195781
public function init() {
		//触发应用开始事件
		$this->eventDispatcher->dispatchEvent(new \Fasim\Event\Event(\Fasim\Event\Event::$APP_START));

		//初始化配置
		$this->registerFacdes();

		//设置时区
		$timezone = $this->make('config')->get('timezone', 'Asia/Shanghai');
		date_default_timezone_set($timezone);

		//设置调试模式
		$debugMode = $this->make('config')->get('debug') === true;
		$this->setDebugMode($debugMode);
		$this->eventDispatcher->dispatchEvent(new \Fasim\Event\Event(\Fasim\Event\Event::$APP_READY));
	}