protected function castDimension($value, $dimension)
    {
        // Check type
        if (!is_numeric($value)) {
            throw new InvalidArgumentException("{$dimension} must be a numeric value");
        }

        // Cast to integer
        $value = intval($value);

        // Check empty
        if (empty($value)) {
            throw new InvalidArgumentException("{$dimension} is required");
        }
        // Check flag
        if ($value < 1) {
            throw new InvalidArgumentException("{$dimension} must be positive");
        }
        return $value;
    }
protected function castDimension($value, $dimension)
    {
        // Check type
        if (!is_numeric($value)) {
            throw new InvalidArgumentException("{$dimension} must be a numeric value");
        }

        // Cast to integer
        $value = intval($value);

        // Check empty
        if (empty($value)) {
            throw new InvalidArgumentException("{$dimension} is required");
        }
        // Check flag
        if ($value < 1) {
            throw new InvalidArgumentException("{$dimension} must be positive");
        }
        return $value;
    }
protected function castDimension ( $ value , $ dimension ) { // Check type if ( ! is_numeric ( $ value ) ) { throw new InvalidArgumentException ( "{$dimension} must be a numeric value" ) ; } // Cast to integer $ value = intval ( $ value ) ; // Check empty if ( empty ( $ value ) ) { throw new InvalidArgumentException ( "{$dimension} is required" ) ; } // Check flag if ( $ value < 1 ) { throw new InvalidArgumentException ( "{$dimension} must be positive" ) ; } return $ value ; }
Validate a width or size is valid and casts it to integer

@param mixed $value value of dimension
@param string $dimension Name of dimension
@return int Validated value
Validate a width or size is valid and casts it to integer