/** * Hijacks the class and loop through the results * * @param object * @param callable * @return this */ public function iterate($scope, $callback) { Eden_Error::i()->argument(1, 'object')->argument(2, 'callable'); $this->_scope = $scope; $this->_callback = $callback; return $this; }
/** * Returns Embedly oEmbed Instance * * @param *string * @param *string * @return Eden_Embedly_Oembed */ public function oembed($key) { //Argument test Eden_Error::i()->argument(1, 'string'); //Argument 1 must be a string return Eden_Embedly_Oembed::i($key); }
/** * Hijacks the class and reports the results of the next * method call * * @param object * @param string * @return this */ public function next($scope, $name = NULL) { Eden_Error::i()->argument(1, 'object')->argument(2, 'string', 'null'); $this->_scope = $scope; $this->_name = $name; return $this; }
protected function _isValid($type, $data) { if ($type == 'gmt') { return preg_match('/^GMT(\\-|\\+)[0-9]{2,4}$/', $data); } return parent::_isValid($type, $data); }
public function __construct($key) { //argument test Eden_Error::i()->argument(1, 'string'); //Argument 1 must be a string $this->_key = $key; }
protected function _isValid($type, $data) { $valid = Eden_Timezone_Validation::i(); switch ($type) { case 'location': return $valid->isLocation($data); case 'utc': return $valid->isUtc($data); case 'abbr': return $valid->isAbbr($data); default: break; } return parent::_isValid($type, $data); }
private static function _getInstance($class) { $trace = debug_backtrace(); $args = array(); if (isset($trace[1]['args']) && count($trace[1]['args']) > 1) { $args = $trace[1]['args']; //shift out the class name array_shift($args); } else { if (isset($trace[2]['args']) && count($trace[2]['args']) > 0) { $args = $trace[2]['args']; } } if (count($args) === 0 || !method_exists($class, '__construct')) { return new $class(); } $reflect = new ReflectionClass($class); try { return $reflect->newInstanceArgs($args); } catch (Reflection_Exception $e) { Eden_Error::i()->setMessage(Eden_Error::REFLECTION_ERROR)->addVariable($class)->addVariable('new')->trigger(); } }
/** * Loops through returned result sets * * @param *callable * @return this */ public function each($callback) { Eden_Error::i()->argument(1, 'callable'); foreach ($this->_data as $key => $value) { call_user_func($callback, $key, $value); } return $this; }
/** * In a perfect production environment, * we can assume that arguments passed in * all methods are valid. To increase * performance call this method. * * @return this */ public function noArgTest() { self::$_argumentTest = false; return $this; }
/** * For one file Eden, you can set the default * location of Eden's template to another location. * * @param string * @return this */ public function setBlockRoot($root) { Eden_Error::i()->argument(1, 'folder'); self::$_blockRoot = $root; return $this; }
/** * Sets the PHP timezone * * @return this */ public function setTimezone($zone) { Eden_Error::i()->argument(1, 'string'); date_default_timezone_set($zone); return $this; }
/** * Lets the framework handle exceptions. * This is useful in the case that you * use this framework on a server with * no xdebug installed. * * @param string|null the error type to report * @param bool|null true will turn debug on * @return this */ public function setDebug($reporting = NULL, $default = NULL) { Eden_Error::i()->argument(1, 'int', 'null')->argument(2, 'bool', 'null'); Eden_Loader::i()->load('Eden_Template')->Eden_Error_Event()->when(!is_null($reporting), 1)->setReporting($reporting)->when($default === true, 4)->setErrorHandler()->setExceptionHandler()->listen('error', $this, 'error')->listen('exception', $this, 'error')->when($default === false, 4)->releaseErrorHandler()->releaseExceptionHandler()->unlisten('error', $this, 'error')->unlisten('exception', $this, 'error'); return $this; }
if(!class_exists('Eden_Timezone_Error')){class Eden_Timezone_Error extends Eden_Error{public static function i($message=NULL,$code=0){$class=__CLASS__;return new $class($message,$code);}protected function _isValid($type,$data){$valid=Eden_Timezone_Validation::i();switch($type){case 'location': return $valid->isLocation($data);case 'utc': return $valid->isUtc($data);case 'abbr': return $valid->isAbbr($data);default: break;}return parent::_isValid($type,$data);}}}