/** * Constructs a new percent decorator * @param string $fieldName field name for objects or arrays passed to this decorator (optional) * @param integer $precision Number of decimal digits to round to * @return null * @throws zibo\ZiboException when the precision is not a number or smaller then 0 */ public function __construct($fieldName = null, $precision = 0) { parent::__construct($fieldName); if (Number::isNegative($precision)) { throw new ZiboException('Provided precision cannot be smaller then 0'); } $this->precision = $precision; }
/** * Constructs a new log value decorator * @param string $fieldName The name of the field to decorate * @param string $className The class name for the cell to decorate * @return null */ public function __construct($fieldName, $className = null) { parent::__construct($fieldName); if (!$className) { $className = $fieldName; } $this->className = $className; }
/** * Constructs a new boolean decorator * @param string $fieldName field name for objects or arrays passed to this decorator (optional) * @param string $trueValue Value to decorate true values into * @param string $falseValue Value to decorate false values into * @param string $nullValue Value to decorate null values into * @return null */ public function __construct($fieldName = null, $trueValue = null, $falseValue = null, $nullValue = null) { parent::__construct($fieldName); $translator = I18n::getInstance()->getTranslator(); if ($trueValue === null) { $trueValue = $translator->translate(self::TRANSLATION_TRUE); } if ($falseValue === null) { $falseValue = $translator->translate(self::TRANSLATION_FALSE); } if ($nullValue === null) { $nullValue = self::DEFAULT_NULL_VALUE; } $this->trueValue = $trueValue; $this->falseValue = $falseValue; $this->nullValue = $nullValue; }
/** * Constructs a new decorator * @param string $fieldName field name for objects or arrays passed to this decorator (optional) * @param string $format Name of the date format * @param string $defaultValue Value to decorate the cell with if the date value could not be formatted * @return null * @throws zibo\ZiboException when an invalid field name or format is provided */ public function __construct($fieldName = null, $format = null, $defaultValue = null) { parent::__construct($fieldName); $this->setFormat($format); $this->locale = I18n::getInstance()->getLocale(); }