Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
/**
4
 * This file is part of FPDI
5
 *
6
 * @package   setasign\Fpdi
7
 * @copyright Copyright (c) 2023 Setasign GmbH & Co. KG (https://www.setasign.com)
8
 * @license   http://opensource.org/licenses/mit-license The MIT License
9
 */
10
 
11
namespace setasign\Fpdi\PdfParser\Type;
12
 
13
/**
14
 * Class representing a numeric PDF object
15
 */
16
class PdfNumeric extends PdfType
17
{
18
    /**
19
     * Helper method to create an instance.
20
     *
21
     * @param int|float $value
22
     * @return PdfNumeric
23
     */
24
    public static function create($value)
25
    {
26
        $v = new self();
27
        $v->value = $value + 0;
28
 
29
        return $v;
30
    }
31
 
32
    /**
33
     * Ensures that the passed value is a PdfNumeric instance.
34
     *
35
     * @param mixed $value
36
     * @return self
37
     * @throws PdfTypeException
38
     */
39
    public static function ensure($value)
40
    {
41
        return PdfType::ensureType(self::class, $value, 'Numeric value expected.');
42
    }
43
}