Doctrine\ODM\OrientDB\Caster\Caster::castInBuffer PHP Метод

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

Casts the current value into an integer verifying it belongs to a certain range ( -$limit < $value > + $limit ).
public castInBuffer ( integer $limit, string $type ) : integer
$limit integer
$type string
Результат integer
    public function castInBuffer($limit, $type)
    {
        $castFunction = function ($value) use($limit) {
            return abs($value) < $limit ? $value : $limit;
        };
        if (is_numeric($this->value) && abs($this->value) < $limit) {
            return $castFunction($this->value);
        }
        return $this->handleMismatch($castFunction, $type);
    }