/** * Returns the default logger. * * @return LoggerInterface */ public static function getDefault() { if (empty(static::$default)) { static::$default = new NullLogger(); } return static::$default; }
/** * 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; }
/** * @return Language */ public static function getDefaultLanguage() { if (static::$default === null) { static::$default = Language::find()->where(['is_default' => 1])->one(); } return static::$default; }
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); }
/** * 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; }
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; }
/** * @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; }
/** * 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; }
/** * 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); }
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; } }
/** * 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); }
/** * Set the template name * * @param string $view */ public function setView($view) { static::$default = $view; }
/** * 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); }
/** * Class init. */ public static function _init() { \Config::load('cart', true); static::$default = \Config::get('cart.default'); }
public static function setDefault($type) { static::$default = $type; }
/** * 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')); $subpackages = \Cli::option('subpackages', \Cli::option('s')); $default = \Cli::option('default'); $all = \Cli::option('all'); if ($all) { $modules = true; $packages = true; $subpackages = 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 do selected modules 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 do selected packages else { static::$packages = explode(',', $packages); } } // if subpackages option set if ( ! empty($subpackages)) { // if true - get all packages if ($subpackages === true) { // get all packages that have files in the migration folder foreach (glob(PKGPATH . '*/') as $p) { foreach (glob($p.'subpackage/*/') as $j) { if (count(glob($j.\Config::get('migrations.folder').'*.php'))) { static::$subpackages[] = basename($p) . "_" .basename($j); } } } } // else do selected packages else { static::$subpackages = explode(',', $subpackages); } } // if packages or modules are specified, and the app isn't, disable app migrations if ( ( ! empty($packages) or ! empty($modules) or ! empty($subpackages)) and empty($default)) { static::$default = false; } // set the module and package count static::$module_count = count(static::$modules); static::$package_count = count(static::$packages); static::$subpackage_count = count(static::$subpackages); }