本文整理汇总了PHP中static::default方法的典型用法代码示例。如果您正苦于以下问题:PHP static::default方法的具体用法?PHP static::default怎么用?PHP static::default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::default方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDefault
/**
* Returns the default logger.
*
* @return LoggerInterface
*/
public static function getDefault()
{
if (empty(static::$default)) {
static::$default = new NullLogger();
}
return static::$default;
}
示例2: getCurrent
/**
* Returns the instance of default service container
*
* @return Services default service container
*/
public static function getCurrent()
{
if (static::$default === null) {
static::$default = new Services();
}
return static::$default;
}
示例3: getDefaultLanguage
/**
* @return Language
*/
public static function getDefaultLanguage()
{
if (static::$default === null) {
static::$default = Language::find()->where(['is_default' => 1])->one();
}
return static::$default;
}
示例4: let
function let(ConfigFactoryInterface $configFactory, GeneratorConfigInterface $config)
{
static::$default = __DIR__ . "/../../../fixtures";
static::$config = array('model' => $config);
$this->beConstructedWith($configFactory);
$config->generator()->willReturn('Here is the generator');
$configFactory->create(getcwd(), static::$default, 'json')->willReturn(static::$config);
}
示例5: getCurrent
/**
* Returns the instance of default formatter
*
* @return FormatterInterface default formatter
*/
public static function getCurrent()
{
if (static::$default === null) {
if (PHP_SAPI === "cli") {
static::$default = new ConsoleFormatter();
} else {
static::$default = new HtmlFormatter();
}
}
return static::$default;
}
示例6: getDefault
public static function getDefault()
{
if (static::$default === null) {
if (!(static::$default = Language::find()->where(['is_default' => 1])->andWhere(['is_active' => 1])->one())) {
if (!(static::$default = Language::find()->where(['is_active' => 1])->orderBy('id asc')->one())) {
static::$default = new Language();
}
}
}
return static::$default;
}
示例7: getDefault
/**
* @return ListDevises
*/
public static function getDefault()
{
if (is_null(static::$default)) {
/* @var $doctrine \Doctrine\Bundle\DoctrineBundle\Registry */
$doctrine = \AppKernel::getStaticContainer()->get('doctrine');
/* @var $em \Doctrine\ORM\EntityManager */
$em = $doctrine->getManager();
static::$default = $em->getRepository('ApplicationSonataClientBundle:ListDevises')->findOneByAlias(static::Device);
}
return static::$default;
}
示例8: getDefault
/**
* Get default locale
*
* @return mixed
*/
public function getDefault()
{
if (null === static::$default) {
foreach ($this->fetchAll() as $item) {
if ($item->isDefault()) {
static::$default = $item;
break;
}
}
}
return static::$default;
}
示例9: __construct
/**
* Sets vars by grabbing Cli options
*/
public function __construct()
{
// load config
\Config::load('migrations', true);
// get Cli options
$modules = \Cli::option('modules');
$packages = \Cli::option('packages');
$default = \Cli::option('default');
$all = \Cli::option('all');
if ($all) {
$modules = true;
$packages = true;
$default = true;
}
// if modules option set
if (!empty($modules)) {
// if true - get all modules
if ($modules === true) {
// loop through module paths
foreach (\Config::get('module_paths') as $path) {
// get all modules that have files in the migration folder
foreach (glob($path . '*/') as $m) {
if (count(glob($m . \Config::get('migrations.folder') . '/*.php'))) {
static::$modules[] = basename($m);
}
}
}
} else {
static::$modules = explode(',', $modules);
}
}
// if packages option set
if (!empty($packages)) {
// if true - get all packages
if ($packages === true) {
// get all packages that have files in the migration folder
foreach (glob(PKGPATH . '*/') as $p) {
if (count(glob($p . \Config::get('migrations.folder') . '/*.php'))) {
static::$packages[] = basename($p);
}
}
} else {
static::$packages = explode(',', $packages);
}
}
if ((!empty($packages) or !empty($modules)) and empty($default)) {
static::$default = false;
}
// set count
static::$module_count = count(static::$modules);
static::$package_count = count(static::$packages);
}
示例10: __construct
public function __construct($pathname, $namespace = '')
{
if (!static::$default) {
static::$default = $this;
}
if (!is_array($config = $this->loadFile($pathname))) {
throw new Exception("Unable to parse configuration file: {$pathname}");
}
if ('' == $namespace) {
$this->values = array_merge($this->values, $config);
} else {
$this->values[$namespace] = $config;
}
}
示例11: _init
/**
* Only load the configuration once
*
* @static
* @access public
*/
public static function _init()
{
Config::load('hybrid', 'hybrid');
static::$default = Config::get('hybrid.currency.default', static::$default);
}
示例12: setView
/**
* Set the template name
*
* @param string $view
*/
public function setView($view)
{
static::$default = $view;
}
示例13: __construct
/**
* sets the properties by grabbing Cli options
*/
public function __construct()
{
// load config
\Config::load('migrations', true);
// get Cli options
$modules = \Cli::option('modules', \Cli::option('m'));
$packages = \Cli::option('packages', \Cli::option('p'));
$default = \Cli::option('default');
$all = \Cli::option('all');
if ($all) {
$modules = true;
$packages = true;
$default = true;
}
// if modules option set
if (!empty($modules)) {
// if true - get all modules
if ($modules === true) {
// loop through module paths
foreach (\Config::get('module_paths') as $path) {
// get all modules that have files in the migration folder
foreach (new \GlobIterator(realpath($path) . DS . '*') as $m) {
if (count(new \GlobIterator($m->getPathname() . rtrim(DS . \Config::get('migrations.folder'), '\\/') . DS . '*.php'))) {
static::$modules[] = $m->getBasename();
}
}
}
} else {
static::$modules = explode(',', $modules);
}
}
// if packages option set
if (!empty($packages)) {
// if true - get all packages
if ($packages === true) {
// get all packages that have files in the migration folder
foreach (\Config::get('package_paths', array(PKGPATH)) as $path) {
// get all modules that have files in the migration folder
foreach (new \GlobIterator(realpath($path) . DS . '*') as $p) {
if (count(new \GlobIterator($p->getPathname() . rtrim(DS . \Config::get('migrations.folder'), '\\/') . DS . '*.php'))) {
static::$packages[] = $p->getBasename();
}
}
}
} else {
static::$packages = explode(',', $packages);
}
}
// if packages or modules are specified, and the app isn't, disable app migrations
if ((!empty($packages) or !empty($modules)) and empty($default)) {
static::$default = false;
}
// set the module and package count
static::$module_count = count(static::$modules);
static::$package_count = count(static::$packages);
}
示例14: _init
/**
* Class init.
*/
public static function _init()
{
\Config::load('cart', true);
static::$default = \Config::get('cart.default');
}
示例15: setDefault
public static function setDefault($type)
{
static::$default = $type;
}