本文整理汇总了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'];
}
}
示例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']);
}
}
示例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');
}
}
}
示例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;
}
示例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'];
}
}
示例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();
}
}