C:\xampp\htdocs\landing\wp-content\plugins\amp\vendor\ampproject\common\src\CssLength.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php

namespace AmpProject;

/**
 * Flexible unit of measure for CSS dimensions.
 *
 * Adapted from the `amp.validator.CssLength` class found in `validator.js` from the `ampproject/amphtml` project on
 * GitHub.
 *
 * @version 1911070201440
 * @link    https://github.com/ampproject/amphtml/blob/1911070201440/validator/engine/validator.js#L3351
 *
 * @package ampproject/common
 */
final class CssLength
{

    
// Special attribute values.
    
const AUTO  'auto';
    const 
FLUID 'fluid';

    
/**
     * Whether the value or unit is invalid. Note that passing an empty value as `$attr_value` is considered valid.
     *
     * @var bool
     */
    
protected $isValid false;

    
/**
     * Whether the attribute value is set.
     *
     * @var bool
     */
    
protected $isDefined false;

    
/**
     * Whether the attribute value is 'auto'. This is a special value that indicates that the value gets derived from
     * the context. In practice that's only ever the case for a width.
     *
     * @var bool
     */
    
protected $isAuto false;

    
/**
     * Whether the attribute value is 'fluid'.
     *
     * @var bool
     */
    
protected $isFluid false;

    
/**
     * The numeric value.
     *
     * @var float
     */
    
protected $numeral 0;

    
/**
     * The unit, 'px' being the default in case it's absent.
     *
     * @var string
     */
    
protected $unit 'px';

    
/**
     * Value of attribute.
     *
     * @var string
     */
    
protected $attrValue;

    
/**
     * Instantiate a CssLength object.
     *
     * @param string|null $attrValue Attribute value to be parsed.
     */
    
public function __construct($attrValue)
    {
        if (
null === $attrValue) {
            
$this->isValid true;
            return;
        }

        
$this->attrValue $attrValue;
        
$this->isDefined true;
    }

    
/**
     * Validate the attribute value.
     *
     * @param bool $allowAuto  Whether or not to allow the 'auto' value as a value.
     * @param bool $allowFluid Whether or not to allow the 'fluid' value as a value.
     */
    
public function validate($allowAuto$allowFluid)
    {
        if (
$this->isValid()) {
            return;
        }

        if (
self::AUTO === $this->attrValue) {
            
$this->isAuto  true;
            
$this->isValid $allowAuto;
            return;
        }

        if (
self::FLUID === $this->attrValue) {
            
$this->isFluid true;
            
$this->isValid $allowFluid;
        }

        
$pattern '/^(?<numeral>\d+(?:\.\d+)?)(?<unit>px|em|rem|vh|vw|vmin|vmax)?$/';
        if (
preg_match($pattern$this->attrValue$match)) {
            
$this->isValid true;
            
$this->numeral = isset($match['numeral']) ? (float)$match['numeral'] : $this->numeral;
            
$this->unit    = isset($match['unit']) ? $match['unit'] : $this->unit;
        }
    }

    
/**
     * Whether or not the attribute value is valid.
     *
     * @return bool
     */
    
public function isValid()
    {
        return 
$this->isValid;
    }

    
/**
     * Whether the attribute value is set.
     *
     * @return bool
     */
    
public function isDefined()
    {
        return 
$this->isDefined;
    }

    
/**
     * Whether the attribute value is 'fluid'.
     *
     * @return bool
     */
    
public function isFluid()
    {
        return 
$this->isFluid;
    }

    
/**
     * Whether the attribute value is 'auto'.
     *
     * @return bool
     */
    
public function isAuto()
    {
        return 
$this->isAuto;
    }

    
/**
     * The unit of the attribute.
     *
     * @return string
     */
    
public function getUnit()
    {
        return 
$this->unit;
    }

    
/**
     * The numeral of the attribute.
     *
     * @return float
     */
    
public function getNumeral()
    {
        return 
$this->numeral;
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586