本文整理汇总了PHP中Container::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getConfig方法的具体用法?PHP Container::getConfig怎么用?PHP Container::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::getConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeLog
/**
* @param string $level
* @param string $message
*/
private function writeLog($level, $message)
{
if (!empty($message)) {
if ($this->file === null) {
$this->file = $this->container->getConfig()->get('log.error');
}
$content = date('Y-m-d H:i:s') . ' ' . $level . ': ' . $message . PHP_EOL;
file_put_contents($this->file, $content, FILE_APPEND);
}
}
示例2: configure
public function configure()
{
$config = $this->container->getConfig();
if ($config->get('app.timezone')) {
date_default_timezone_set($config->get('app.timezone'));
}
if ($this->container->getConfig()->get('app.debug')) {
error_reporting(E_ALL);
ini_set('display_errors', "On");
} else {
$errorHandler = new ErrorHandler($this->container->getErrorLogger());
set_error_handler([$errorHandler, 'error']);
set_exception_handler([$errorHandler, 'exception']);
register_shutdown_function([$errorHandler, 'shutdown']);
}
}
示例3: detectTravis
private function detectTravis()
{
$travis = getenv('TRAVIS');
if ($travis) {
$this->container->getApp()->setEnv(App::TRAVIS_ENV);
$this->container->getConfig()->setEnvironment('travis');
} elseif (is_array($_SERVER)) {
foreach ($_SERVER as $key => $value) {
if (stripos($key, 'TRAVIS') !== false) {
$this->container->getApp()->setEnv(App::TRAVIS_ENV);
$this->container->getConfig()->setEnvironment('travis');
break;
}
}
}
}
示例4: changeUser
/**
* @return bool
*/
private function changeUser()
{
$user = $this->container->getConfig()->get('command.user');
// Bypass cache commands as we need the sudoer user to run the commands
if (null !== $user && (!isset($_SERVER['argv'][1]) || $_SERVER['argv'][1] !== 'flushall') && (!isset($_SERVER['argv'][1]) || $_SERVER['argv'][1] !== 'redis:flushall') && (!isset($_SERVER['argv'][1]) || $_SERVER['argv'][1] !== 'apc:flushall')) {
$name = $user;
$user = posix_getpwnam($user);
posix_setgid($user['gid']);
posix_setuid($user['uid']);
if (posix_geteuid() !== (int) $user['uid']) {
$output = new ConsoleOutput();
$formatter = new FormatterHelper();
$output->writeln('', true);
$errorMessages = array('', ' [Error] ', ' Could not change user to ' . $name . ' ', '');
$formattedBlock = $formatter->formatBlock($errorMessages, 'error');
$output->writeln($formattedBlock);
$output->writeln('', true);
return false;
}
}
return true;
}
示例5: getConfig
/**
* @return Config
*/
public function getConfig()
{
return $this->container->getConfig();
}