Pinq\Expressions\Operators\Cast::doCast PHP Метод

doCast() публичный статический Метод

Performs the cast operation on the supplied value.
public static doCast ( string $castTypeOperator, mixed $value ) : mixed
$castTypeOperator string
$value mixed
Результат mixed
    public static function doCast($castTypeOperator, $value)
    {
        if (!isset(self::$castTypeMap[$castTypeOperator])) {
            throw new PinqException('Cast operator \'%s\' is not supported', $castTypeOperator);
        }
        settype($value, self::$castTypeMap[$castTypeOperator]);
        return $value;
    }

Usage Example

Пример #1
0
 /**
  * @expectedException \Pinq\PinqException
  */
 public function testInvalidCasts()
 {
     Cast::doCast('addddsdsaf', null);
 }