|
@ -5,6 +5,7 @@ namespace Darksparrow\AuxiliumSchemaBuilder\SchemaBuilder; |
|
|
use Darksparrow\AuxiliumSchemaBuilder\Exceptions\SchemaDocumentFieldNameUnsetException; |
|
|
use Darksparrow\AuxiliumSchemaBuilder\Exceptions\SchemaDocumentFieldNameUnsetException; |
|
|
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocument; |
|
|
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocument; |
|
|
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocumentField; |
|
|
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocumentField; |
|
|
|
|
|
use Darksparrow\AuxiliumSchemaBuilder\Utilities\URLHandling; |
|
|
use JetBrains\PhpStorm\NoReturn; |
|
|
use JetBrains\PhpStorm\NoReturn; |
|
|
use ReflectionClass; |
|
|
use ReflectionClass; |
|
|
|
|
|
|
|
@ -105,6 +106,19 @@ class SchemaBuilder |
|
|
{ |
|
|
{ |
|
|
$propertySchema["@" . self::PascalCaseToSnakeCase(input: $key)] = $value; |
|
|
$propertySchema["@" . self::PascalCaseToSnakeCase(input: $key)] = $value; |
|
|
} |
|
|
} |
|
|
|
|
|
elseif($key == "ValidSchemas") |
|
|
|
|
|
{ |
|
|
|
|
|
$propertySchema["@valid_schemas"] = []; |
|
|
|
|
|
$classNameRegex = '/^(\\\\?[A-Z][a-zA-Z0-9_]*)((\\\\[A-Z][a-zA-Z0-9_]*)*)$/'; |
|
|
|
|
|
$urlRegex = '/^https?:\/\/[^\s$.?#].[^\s]*$/i'; |
|
|
|
|
|
foreach($value as $validSchema) |
|
|
|
|
|
{ |
|
|
|
|
|
if (preg_match($classNameRegex, $validSchema)) |
|
|
|
|
|
$propertySchema["@valid_schemas"][] = URLHandling::GetURLForSchema($validSchema); |
|
|
|
|
|
elseif (preg_match($urlRegex, $validSchema)) |
|
|
|
|
|
$propertySchema["@valid_schemas"][] = $validSchema; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if($propertyName == "") |
|
|
if($propertyName == "") |
|
|