public static function getInstance() { if (is_null(self::$serviceLocator)) { self::$serviceLocator = new self(); } return self::$serviceLocator; }
/** * emailValidator * * @return object */ public function emailValidator() { if (is_null($this->emailValidator)) { $this->emailValidator = Gongo_Locator::get('Gongo_Str_Email'); } return $this->emailValidator; }
static function initializeApplication($app, $path = null) { if (!is_null($path) && is_null(self::$appRootPath)) { self::$appRootPath = $path; if (is_null(self::$environment)) { self::$environment = Gongo_App_Environment::get(self::$appRootPath); } if (is_null(self::cfg())) { self::cfg(self::$environment->config); } // Locator $locator = Gongo_Locator::getInstance(); $locator->config(self::$environment->config); $gongoBuilderClass = self::cfg()->Locator->Gongo_Builder; if ($gongoBuilderClass) { $locator->injectBuilder($gongoBuilderClass); self::$environment = Gongo_App_Environment::get(self::$appRootPath, true); self::cfg(self::$environment->config); } $errorReporting = self::cfg()->Error->error_reporting; if ($errorReporting) { error_reporting($errorReporting); } // autoloader spl_autoload_register('Gongo_App::autoload'); // preload self::preload(); } if (is_null(self::$application)) { self::$application = $app; } return $app; }
static function getInstance() { if (is_null(self::$singleton)) { self::$singleton = Gongo_Locator::get('Gongo_Str_Base'); } return self::$singleton; }
static function get($path = null) { if (is_null(self::$log)) { $path = is_null($path) ? 'log.txt' : $path; self::$log = Gongo_Locator::get('Gongo_Log', $path); } return self::$log; }
static function get($cfg = null) { if (is_null(self::$config)) { $cfg = is_null($cfg) ? dirname(__FILE__) . '/config.ini' : $cfg; self::$config = Gongo_Locator::get('Gongo_Config', $cfg); } return self::$config; }
public function __get($key) { if ($key === '_') { if (is_null($this->__)) { return null; } $aComponents = $this->___initializeComponents(); return $this->_ = Gongo_Locator::get('Gongo_Container', $aComponents); } return null; }
public function instance($name, $eager = null) { list($component, $dependency, $lazy) = $this->services[$name]; $args = array(); foreach ($dependency as $service) { $args[] = $this->instance($service, $eager); } if (!is_null($eager)) { return $eager ? Gongo_Locator::make($component, $args) : Gongo_Locator::makeLazy($component, $args); } return $lazy ? Gongo_Locator::makeLazy($component, $args) : Gongo_Locator::make($component, $args); }
public function filter($app, $src = null, $dst = null, $cast = false, $strict = false, $unset = true) { $filters = empty($this->options->filter) ? null : $this->options->filter; $src = is_null($src) ? $app->post : $src; $src = is_array($src) ? Gongo_Locator::get($this->options->defaultEntityClass, $src) : $src; $dst = is_null($dst) ? $src : $dst; $dst = is_array($dst) ? Gongo_Locator::get($this->options->defaultEntityClass, $dst) : $dst; if ($this->__filter) { return $this->filter->convert($src, $dst, $filters, $cast, $strict, $unset); } return $this->converter->convert($src, $dst, $filters, $cast, $strict, $unset); }
function _twig() { return Gongo_Locator::get('Gongo_App_Path_Twig', $this); }
public function initPath() { return Gongo_Locator::get('Gongo_App_Path_Mustache', Gongo_App::$environment->path, $this->templateType); }
function __construct($path) { $this->path = $path; Gongo_Locator::load($this->libraryPath, 'Smarty'); Smarty::muteExpectedErrors(); }
public function initFactory($aComponents = array()) { $this->factory = Gongo_Locator::getInstance(); $this->initializeComponents($aComponents); }
function init() { Gongo_Locator::load($this->libraryPath, 'HamlParser'); }
function __get($name) { $className = $this->className($name); return Gongo_Locator::get($className, $this); }
function init() { Gongo_Locator::load($this->libraryPath, 'Fammel'); }
function pages($args = array(), $hash = null, $short = true) { $range = $this->options->range; $last = $this->lastPage(); $first = $this->firstPage(); $page = $this->currentPage(); $left = max($page - $range, $first); $right = min($page + $range, $last); if ($page <= $range) { $extend = $range - ($page - $left); $right = min($page + $range + $extend, $last); } else { if ($page + $range > $last) { $extend = $range - ($last - $page); $left = max($page - $range - $extend, $first); } } $pages = array(); if ($last <= $first) { return $pages; } for ($i = $left; $i <= $right; $i++) { $bean = Gongo_Locator::get('Gongo_Bean'); $bean->no = $i + 1; $bean->url = $this->buildUrl($i, $args, $hash, $short); $bean->current = $i == $page; $pages[$i] = $bean; } return $pages; }
function __call($name, $args) { return Gongo_Locator::make('Gongo_' . $name, $args); }
function init() { Gongo_Locator::load($this->libraryPath, 'PHPTAL'); }
function newBuilder() { return Gongo_Locator::get($this->defaultBuilder)->namedScopes($this->namedScopes()); }
function getRelationMapperInstance($class) { return Gongo_Locator::get($class, $this->db()); }
static function property($obj) { return Gongo_Locator::get('Gongo_Fn_Property', $obj); }
public function parse() { return Gongo_Locator::get('Gongo_Bean', parse_ini_file($this->path, true)); }
static function iter($path) { return Sloth::iter(Gongo_Locator::get('DirectoryIterator', $path)); }
public function __call($sName, $aArgs) { if (isset($this->_clause[$sName])) { return call_user_func(array($this, $this->_clause[$sName][1]), $this->_clause[$sName][0], $aArgs); } if (isset($this->_namedScopes[$sName])) { $this->setQuery($this->_namedScopes[$sName]); $methodName = isset($this->_query['method']) ? $this->_query['method'] : $this->_defaultMethod; $methodName = is_array($methodName) ? $methodName[0] : $methodName; return call_user_func_array(array($this, $methodName), $aArgs); } if ($sName[0] === '_') { $sName = substr($sName, 1); if (isset($this->_namedScopes[$sName])) { $query = $this->_namedScopes[$sName]; $params = isset($query['params']) ? $query['params'] : null; return call_user_func(array($this->setQuery($this->_namedScopes[$sName]), '___bindParams'), $aArgs, $params); } } throw Gongo_Locator::get('Gongo_Db_GoQlException', "{$sName} was not found in GoQL method."); }
public function ___($ary = array()) { $className = get_class($this); return Gongo_Locator::get($className, $ary); }
function __construct($path) { $this->path = $path; Gongo_Locator::load($this->libraryPath, 'Smarty'); }
function _pdoBuilder() { return Gongo_Locator::get('Gongo_App_DB_PDO_Builder'); }