diff --git a/src/SchemaBuilder/Helpers/SchemaBuilder.php b/src/SchemaBuilder/Helpers/SchemaBuilder.php new file mode 100644 index 0000000..a1589ce --- /dev/null +++ b/src/SchemaBuilder/Helpers/SchemaBuilder.php @@ -0,0 +1,52 @@ +getProperties(); + $attributes = $reflection->getAttributes()[0]; + + $schema = []; + + /* + * Schema "meta-data" from here... + */ + foreach($attributes->getArguments() as $key=>$value) + { + if($value != "") + $schema["@$key"] = $value; + } + + /* + * Property handling from here... + */ + foreach ($properties as $property) { + $attributes = $property->getAttributes(); + $propertyName = $property->getName(); + $propertySchema = []; + + foreach ($attributes as $attribute) + { + if($attribute->getName() != "Darksparrow\DeegraphPHP\SchemaBuilder\Attributes\SchemaDocumentField") + continue; + + foreach($attribute->getArguments() as $key=>$value) + { + if($value != "") + $propertySchema["@$key"] = $value; + } + } + + $schema["$propertyName"] = $propertySchema; + } + + return $schema; + } +}