Пример #1
0
Файл: Xsd.php Проект: seytar/psx
 protected function generateTypeDecimal(Property\DecimalType $type)
 {
     $max = $type->getMax();
     if ($max) {
         $this->writer->startElement('xs:maxInclusive');
         $this->writer->writeAttribute('value', $max);
         $this->writer->endElement();
     }
     $min = $type->getMin();
     if ($min) {
         $this->writer->startElement('xs:minInclusive');
         $this->writer->writeAttribute('value', $min);
         $this->writer->endElement();
     }
 }
Пример #2
0
 protected function assertDecimalConstraints($data, Property\DecimalType $property, $path)
 {
     if ($property->getMax() !== null) {
         if ($data > $property->getMax()) {
             throw new ValidationException($path . ' must be lower or equal then ' . $property->getMax());
         }
     }
     if ($property->getMin() !== null) {
         if ($data < $property->getMin()) {
             throw new ValidationException($path . ' must be greater or equal then ' . $property->getMin());
         }
     }
 }