/** * 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 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; }
/** * Decorates the cell * @param zibo\library\html\table\Cell $cell Cell of the value to decorate * @param zibo\library\html\table\Row $row Row containing the cell * @param int $rowNumber Number of the current row * @param array $remainingValues Array containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $number, array $remainingValues) { parent::decorate($cell, $row, $number, $remainingValues); $cell->appendToClass($this->className); }
/** * 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(); }