* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ abstract class MarkupAbstract extends CodeGeneratorAbstract { /** @var integer */ protected $heading; /** @var string */ protected $prefix; /** * @param integer $heading * @param string $prefix */ public function __construct(int $heading = 1, string $prefix = 'psx_model_') { parent::__construct(); $this->heading = $heading >= 1 && $heading <= 6 ? $heading : 1; $this->prefix = $prefix; } protected function normalizeClassName(string $name): string { return $name; } protected function normalizePropertyName(string $name): string { return $name; } /** * @param \PSX\Schema\TypeInterface $type * @return array */ protected function getConstraints(TypeInterface $type) { $constraints = []; if ($type instanceof ArrayType) { $minItems = $type->getMinItems(); if ($minItems !== null) { $constraints['minItems'] = $minItems; } $maxItems = $type->getMaxItems(); if ($maxItems !== null) { $constraints['maxItems'] = $maxItems; } } elseif ($type instanceof NumberType) { $minimum = $type->getMinimum(); if ($minimum !== null) { $constraints['minimum'] = $minimum; } $maximum = $type->getMaximum(); if ($maximum !== null) { $constraints['maximum'] = $maximum; } $multipleOf = $type->getMultipleOf(); if ($multipleOf !== null) { $constraints['multipleOf'] = $multipleOf; } } elseif ($type instanceof StringType) { $minLength = $type->getMinLength(); if ($minLength !== null) { $constraints['minLength'] = $minLength; } $maxLength = $type->getMaxLength(); if ($maxLength !== null) { $constraints['maxLength'] = $maxLength; } $pattern = $type->getPattern(); if ($pattern !== null) { $constraints['pattern'] = $pattern; } } if ($type instanceof ScalarType) { $enum = $type->getEnum(); if ($enum !== null) { $constraints['enum'] = $enum; } $const = $type->getConst(); if ($const !== null) { $constraints['const'] = $const; } } return $constraints; } } __halt_compiler();----SIGNATURE:----KLaMNxtguSJx8AE8DJ6vMmHJeYUKG9AEFCq7i10AvfSCuopZr7810ccxOJqbUVtlJtEj/z3VuyZ0CF6DZ/2owdXF+X/jfBhGGDAM8Gpt7VnphpuvKIwH8v30n2wFHFkRZQ2BNCyUCRVAN1zKbJ7pbdI8dx9lnni7sFL12PdsK98Avlg2ZKoEp9jxuVUqxdkgmCVwlETloJVDeFzJFyNtr7lAzbY2C558oWaz+bDODY6QLqIuoWy5l41YGnsMr4d6D0CpIkNS5rfSlBYQRYygdfxB35qOiIxvuX19wVBUa778+oRbQVeX9oNSqe6Fp3FhDk+VzjADVl5x4xVhulSfMLU68UBMeFimBPo5pQTxyx8c9Fb9ZKXCeqlzkZc48n4u4ZZqrpJ+MEeUbbjXipcO93hesrZsXvzDxLUPYYc5bPWN9kvvgWCz6ttgjVSFO6ngv4r53UPCx0qLoxJif9uelrjtFk0qat8nFCtRKFpJE4aCpeFSMjBT2ZGTOtc2sgPsyFJmjopTTBhsyKFD8DSxohRdfg2cSczqSTraCoTExFysClZc08KkEZnWTyKPRciMzYgUOUARfdTJZZVw814kurZnwz6YmJDVPqu6u07YRcV2EoUwwhsOXE7Su6762tAhNW3fhhl1kqViD1MOmc7caDZQqcDvrkCNPV+GqwkmX6o=----ATTACHMENT:----NTE2ODk3MDA1NDczNTM0MSA4MDg0NjI1MDg4MTEwIDcyODg2OTE2OTMxNzIyMTE=