src/ConstraintCheck/Helper/RangeCheckerHelper.php 1 location
|
@@ 64-75 (lines=12) @@
|
61 |
|
* @param UnboundedQuantityValue $value |
62 |
|
* @return UnboundedQuantityValue $value converted to standard units if possible, otherwise unchanged $value. |
63 |
|
*/ |
64 |
|
private function standardize( UnboundedQuantityValue $value ) { |
65 |
|
if ( $this->unitConverter !== null ) { |
66 |
|
$standard = $this->unitConverter->toStandardUnits( $value ); |
67 |
|
if ( $standard !== null ) { |
68 |
|
return $standard; |
69 |
|
} else { |
70 |
|
return $value; |
71 |
|
} |
72 |
|
} else { |
73 |
|
return $value; |
74 |
|
} |
75 |
|
} |
76 |
|
|
77 |
|
/** |
78 |
|
* Compare two values. |
src/ConstraintCheck/Checker/AllowedUnitsChecker.php 1 location
|
@@ 166-177 (lines=12) @@
|
163 |
|
* @param UnboundedQuantityValue $value |
164 |
|
* @return UnboundedQuantityValue |
165 |
|
*/ |
166 |
|
private function standardize( UnboundedQuantityValue $value ) { |
167 |
|
if ( $this->unitConverter === null ) { |
168 |
|
return $value; |
169 |
|
} |
170 |
|
|
171 |
|
$standard = $this->unitConverter->toStandardUnits( $value ); |
172 |
|
if ( $standard !== null ) { |
173 |
|
return $standard; |
174 |
|
} else { |
175 |
|
return $value; |
176 |
|
} |
177 |
|
} |
178 |
|
|
179 |
|
public function checkConstraintParameters( Constraint $constraint ) { |
180 |
|
$constraintParameters = $constraint->getConstraintParameters(); |