diff --git a/src/Exceptions/SchemaDocumentFieldNameUnsetException.php b/src/Exceptions/SchemaDocumentFieldNameUnsetException.php new file mode 100644 index 0000000..38c3b1c --- /dev/null +++ b/src/Exceptions/SchemaDocumentFieldNameUnsetException.php @@ -0,0 +1,17 @@ +message = "$message"; + $this->code = $code; + } +} diff --git a/src/Exceptions/SchemaNameUnsetException.php b/src/Exceptions/SchemaDocumentNameUnsetException.php similarity index 84% rename from src/Exceptions/SchemaNameUnsetException.php rename to src/Exceptions/SchemaDocumentNameUnsetException.php index 4db0331..8720709 100644 --- a/src/Exceptions/SchemaNameUnsetException.php +++ b/src/Exceptions/SchemaDocumentNameUnsetException.php @@ -4,7 +4,7 @@ namespace Darksparrow\AuxiliumSchemaBuilder\Exceptions; use Exception; -class SchemaNameUnsetException extends Exception +class SchemaDocumentNameUnsetException extends Exception { public function __construct( string $message = "The Name field is required.", @@ -14,4 +14,4 @@ class SchemaNameUnsetException extends Exception $this->message = "$message"; $this->code = $code; } -} +} \ No newline at end of file diff --git a/src/SchemaBuilder/SchemaBuilder.php b/src/SchemaBuilder/SchemaBuilder.php index 7630e7d..f1dd3dc 100644 --- a/src/SchemaBuilder/SchemaBuilder.php +++ b/src/SchemaBuilder/SchemaBuilder.php @@ -2,7 +2,7 @@ namespace Darksparrow\AuxiliumSchemaBuilder\SchemaBuilder; -use Darksparrow\AuxiliumSchemaBuilder\Exceptions\SchemaNameUnsetException; +use Darksparrow\AuxiliumSchemaBuilder\Exceptions\SchemaDocumentFieldNameUnsetException; use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocument; use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocumentField; use JetBrains\PhpStorm\NoReturn; @@ -60,7 +60,7 @@ class SchemaBuilder /** - * @throws SchemaNameUnsetException + * @throws SchemaDocumentFieldNameUnsetException */ public static function GenerateSchema(object $targetSchema): array { @@ -85,7 +85,7 @@ class SchemaBuilder foreach ($property->getAttributes() as $attribute) { - if($attribute->getName() != "Darksparrow\DeegraphPHP\SchemaBuilder\Attributes\SchemaDocumentField") + if($attribute->getName() != "Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocumentField") continue; foreach($attribute->getArguments() as $key=>$value) @@ -101,7 +101,7 @@ class SchemaBuilder } } if($propertyName == "") - throw new SchemaNameUnsetException(); + throw new SchemaDocumentFieldNameUnsetException(); $schema["$propertyName"] = $propertySchema; }