yii\i18n\Formatter::asRaw PHP Method

asRaw() public method

This method simply returns back the parameter without any format. The only exception is a null value which will be formatted using [[nullDisplay]].
public asRaw ( mixed $value ) : string
$value mixed the value to be formatted.
return string the formatted result.
    public function asRaw($value)
    {
        if ($value === null) {
            return $this->nullDisplay;
        }
        return $value;
    }

Usage Example

示例#1
0
 public function testAsRaw()
 {
     $value = '123';
     $this->assertSame($value, $this->formatter->asRaw($value));
     $value = 123;
     $this->assertSame($value, $this->formatter->asRaw($value));
     $value = '<>';
     $this->assertSame($value, $this->formatter->asRaw($value));
     // null display
     $this->assertSame($this->formatter->nullDisplay, $this->formatter->asRaw(null));
 }