当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::has方法代码示例

本文整理汇总了PHP中yii\base\Application::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::has方法的具体用法?PHP Application::has怎么用?PHP Application::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\base\Application的用法示例。


在下文中一共展示了Application::has方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     \Yii::setAlias('@cornernote/dashboard', __DIR__);
     if ($app->has('i18n')) {
         $app->i18n->translations['dashboard'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en', 'basePath' => '@cornernote/dashboard/messages'];
     }
 }
开发者ID:cornernote,项目名称:yii2-dashboard,代码行数:12,代码来源:Bootstrap.php

示例2: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if (!$app instanceof \yii\web\Application) {
         return;
     }
     if (!$app->has('backend')) {
         $app->set('backend', static::className());
     }
     if ($app->get('backend') instanceof Component) {
         $app->on(\yii\web\Application::EVENT_BEFORE_ACTION, [self::className(), 'detectBackend']);
     }
 }
开发者ID:mihaildev,项目名称:yii2-backend,代码行数:16,代码来源:Component.php

示例3: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     $app->i18n->translations['admin/export'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@yz/admin/export/common/messages', 'sourceLanguage' => 'en-US'];
     if ($app instanceof \yii\console\Application) {
         if ($app->has('schedule')) {
             /** @var omnilight\scheduling\Schedule $schedule */
             $schedule = $app->get('schedule');
             // Place all your shedule command below
             $schedule->command('admin-export/export/process');
         }
     }
 }
开发者ID:omnilight,项目名称:yz2-admin-export,代码行数:16,代码来源:Bootstrap.php

示例4: getInstance

 /**
  * Get workbench compoment
  * @param yii\base\Application $app
  * @return \johnitvn\workbench\Workbench|null return Workbench or null if working directory is not exist
  */
 public static function getInstance(Application $app)
 {
     if (!$app->has("workbench")) {
         $workbench = new Workbench();
     } else {
         $workbench = $app->get("workbench");
     }
     if ($workbench->workingDir === null) {
         $workbench->workingDir = dirname(dirname(dirname(__DIR__))) . '/workbench';
     }
     // If workbench workspace not exist. return null
     if (!file_exists($workbench->workingDir)) {
         return null;
     }
     return $workbench;
 }
开发者ID:johnitvn,项目名称:yii2-workbench,代码行数:21,代码来源:Workbench.php

示例5: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     // Make sure to register the base folder as alias as well or things like assets won't work anymore
     \Yii::setAlias('@bedezign/yii2/audit', __DIR__);
     if ($app instanceof \yii\console\Application) {
         $app->controllerMap['audit'] = 'bedezign\\yii2\\audit\\commands\\AuditController';
     }
     $moduleName = Audit::findModuleIdentifier();
     if ($moduleName) {
         // The module was added in the configuration, make sure to add it to the application bootstrap so it gets loaded
         $app->bootstrap[] = $moduleName;
         $app->bootstrap = array_unique($app->bootstrap, SORT_REGULAR);
     }
     if ($app->has('i18n')) {
         $app->i18n->translations['audit'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en', 'basePath' => '@bedezign/yii2/audit/messages'];
     }
 }
开发者ID:bedezign,项目名称:yii2-audit,代码行数:22,代码来源:Bootstrap.php

示例6: _before

 public function _before(TestInterface $test)
 {
     $entryUrl = $this->config['entryUrl'];
     $entryFile = $this->config['entryScript'] ?: basename($entryUrl);
     $entryScript = $this->config['entryScript'] ?: parse_url($entryUrl, PHP_URL_PATH);
     $this->client = new Yii2Connector();
     $this->client->defaultServerVars = ['SCRIPT_FILENAME' => $entryFile, 'SCRIPT_NAME' => $entryScript, 'SERVER_NAME' => parse_url($entryUrl, PHP_URL_HOST), 'SERVER_PORT' => parse_url($entryUrl, PHP_URL_PORT) ?: '80'];
     $this->client->defaultServerVars['HTTPS'] = parse_url($entryUrl, PHP_URL_SCHEME) === 'https';
     $this->client->restoreServerVars();
     $this->client->configFile = Configuration::projectDir() . $this->config['configFile'];
     $this->app = $this->client->getApplication();
     if ($this->config['cleanup'] && $this->app->has('db')) {
         $this->transaction = $this->app->db->beginTransaction();
     }
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:15,代码来源:Yii2.php


注:本文中的yii\base\Application::has方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。