JBZoo\SimpleTypes\Formatter::text PHP Метод

text() публичный Метод

public text ( float $value, string $rule, boolean $showSymbol = true ) : mixed | string
$value float
$rule string
$showSymbol boolean
Результат mixed | string
    public function text($value, $rule, $showSymbol = true)
    {
        $data = $this->_format($value, $rule);
        $rData = $this->get($rule);
        $symbol = $showSymbol ? $rData['symbol'] : '';
        $result = str_replace(array('%v', '%s'), array($data['value'], $symbol), $data['template']);
        $result = trim($result);
        return $result;
    }

Usage Example

Пример #1
0
 /**
  * @param $rule
  * @return string
  * @throws \JBZoo\SimpleTypes\Exception
  */
 public function noStyle($rule = null)
 {
     $rule = $rule ? $this->_parser->checkRule($rule) : $this->_rule;
     $this->log('Formatted output in "' . $rule . '" as "noStyle"');
     return $this->_formatter->text($this->val($rule), $rule, false);
 }