/** * Constructor * * @param array $optsArray Option configuration data * * @return Cpanel_Service_Abstract */ public function __construct($optsArray = array()) { parent::__construct($optsArray); if (!$this->listner) { Cpanel_Listner_Observer_GenericLogger::initLogger($this, 1, array('level' => 'std')); } return $this; }
/** * Constructor * * By default, Cpanel_Parser_LiveJSON::CONDENSED_MODE will be set * * @param arrays $optsArray Optional configuration data * * @return Cpanel_Parser_LiveJSON */ public function __construct($optsArray = array()) { parent::__construct($optsArray); $mode = $this->getOption('mode'); $this->setMode(self::CONDENSED_MODE); if ($mode) { $this->setMode($mode); } return $this; }
/** * The class is a Singleton. The constructor, however is public due to * inheritance from Cpanel_Core_Object. * * @param arrays $optsArray Option configuration data * * @return Cpanel_PublicAPI * @throws Exception If instantiated directly. {@link getInstance()} */ public function __construct($optsArray = false) { // Force the use of getInstance if (self::$_canInstantiate !== true) { throw new Exception(__CLASS__ . ' must be instantiated with ' . __CLASS__ . '::getInstance().'); } if (!is_array($optsArray)) { $optsArray = array('cpanel' => array()); } elseif (!array_key_exists('cpanel', $optsArray)) { $optsArray = array('cpanel' => $optsArray); } parent::__construct($optsArray); // TODO decouple into config option // Handle timezone $tz = ini_get('date.timezone'); $tz = $tz ? $tz : 'UTC'; date_default_timezone_set($tz); // TODO: refactor for dynamic loading and custom loading // Attach listner Cpanel_Listner_Observer_GenericLogger::initLogger($this, 1, array('level' => 'std')); // Create registry $this->registerRegistry(); return $this; }
/** * Cosntructor * * @param Cpanel_Query_Object $rObj Response object * * @return Cpanel_Query_Http_Abstract * @throws Exception If $rObj is an invalid query/response object */ public function __construct($rObj = '') { parent::__construct(); if ($rObj) { if (!$rObj instanceof Cpanel_Query_Object) { throw new Exception('Invalid QueryObject'); } $this->setResponseObject($rObj); } return $this; }
/** * Constructor * * By default, Cpanel_Parser_XML::DOM_MODE will be set. As well, * all errors warnings generated by LibXML will be suppressed. This errors * well be collected later, in the event of a decode error. * * @param arrays $optsArray Optional configuration data * * @return Cpanel_Parser_XML */ public function __construct($optsArray = array()) { parent::__construct($optsArray); $libErrMode = (bool) (!$this->disableSuppressLibXML); libxml_use_internal_errors($libErrMode); $mode = $this->mode; $this->setMode(self::DOM_MODE); if ($mode) { $this->setMode($mode); } return $this; }
/** * Constructor * * This constructor will define a shutdown function. This helps ensure the * cpsrvd receives the proper shutdown notification and the socket file is * properly closed. See {@link closeCpanelHandle()} * * @param Cpanel_Query_Object $rObj Optionally attach the response * object at instantiation. * * @return Cpanel_Query_Live_Abstract */ public function __construct($rObj = '') { parent::__construct(); if ($rObj) { if (!$rObj instanceof Cpanel_Query_Object) { throw new Exception('Invalid QueryObject'); } $this->setResponseObject($rObj); } if (!$this->socketTimeout) { $this->socketTimeout = self::SOCKET_TIMEOUT; } register_shutdown_function(array($this, 'closeCpanelHandle')); return $this; }
/** * Constructor * * @param arrays $optsArray Optional configuration data * * @return Cpanel_Query_Object */ public function __construct($optsArray = array()) { parent::__construct($optsArray); $this->_query = new Cpanel_Core_Object(); //TODO: make response an arrayobject with magic accessors? $this->_response = new Cpanel_Core_Object(); //@todo make meths of this? $this->_pinterface = 'Cpanel_Parser_Interface'; $this->_outputFormat = $this->_defaultOutputFormat; return $this; }
/** * Constructor * * Passing 'level'=>$value in configuration data array will set the logger's * verbosity level. Verbosity levels response to specific types of logged * messages generated by the log listner. Valid verbosity levels are: * 'loud' - will response to any logged message * 'verbose' - will response to 'info', 'warn' and 'die' messages * 'std' - will only response to 'warn' and 'die' messages * 'quiet' - will only response to 'die' messages * 'silent' - will never log any messages * * @param array $optArray Optional configuration data * * @return Cpanel_Listner_Observer_GenericLogger */ public function __construct($optArray = array()) { //TODO: break this out into methods $this->_levelkey = array('loud' => array('debug', 'info', 'warn', 'die'), 'verbose' => array('info', 'warn', 'die'), 'std' => array('warn', 'die'), 'quiet' => array('die'), 'silent' => array()); if (!array_key_exists('level', $optArray)) { $optArray['level'] = 'std'; } $tz = ini_get('date.timezone') ? ini_get('date.timezone') : 'UTC'; date_default_timezone_set($tz); parent::__construct($optArray); return $this; }