/** * Call this method to get singleton * * @return FactoryModel */ public static function getInstance() { if (self::$inst === null) { self::$inst = new self(); } return self::$inst; }
public function __construct($settings = array()) { $this->_settings = $settings; $this->_rendererType = !empty($settings['type']) ? $settings['type'] : self::RENDERER_TYPE; $this->_outputFormat = !empty($settings['output_format']) ? $settings['output_format'] : self::RENDERER_OUTPUT_FORMAT; $this->_factory = FactoryModel::getInstance(); }
/** * Initialize application and parse input parameters * */ public function __construct() { $this->_app = Core::getInstance(array('app' => 'shell', 'document_root' => dirname(__FILE__) . '/', 'app_root' => dirname(__FILE__) . '/../app/')); $this->_factory = FactoryModel::getInstance(); $this->_applyPhpVariables(); $this->_parseArgs(); $this->_validate(); $this->_showHelp(); }
/** * Get renderer object * * @param array $options * * @return RendererAbstract|bool */ public static function getRenderer($options = array()) { $configObj = Config::getInstance(); $renderData = $configObj->get('main', 'render'); $rendererType = !empty($renderData['renderer_type']) ? $renderData['renderer_type'] : (!empty($options['renderer_type']) ? $options['renderer_type'] : RendererAbstract::RENDERER_TYPE); $factory = FactoryModel::getInstance(); switch ((string) $rendererType) { case 'file': $renderType = 'fileRenderer'; break; default: $renderType = RendererAbstract::RENDERER_TYPE . 'Renderer'; } return $factory->getModel($renderType, $renderData); }
/** * Crawl all system urls * * @param array $options * @return CrawlerModel */ public function crawl($options = array()) { $adapter = $this->_factory->getModel('curlAdapter'); return $this->_executeRequests($options, $adapter); }