88class ExtractBuilder
99{
1010 public const FORMAT_CSV = 'csv ' ;
11+
1112 public const FORMAT_SQL = 'sql ' ;
1213
1314 public const DEFAULT_FORMAT = self ::FORMAT_SQL ;
@@ -19,22 +20,20 @@ class ExtractBuilder
1920
2021 /**
2122 * The model instance.
22- *
23- * @var mixed
2423 */
2524 protected mixed $ model ;
2625
2726 protected CsvBuilder |SqlBuilder $ builder ;
2827
2928 public function createBuilder (string $ type ): self
3029 {
31- if (!in_array ($ type , self ::FORMATS , true )) {
30+ if (! in_array ($ type , self ::FORMATS , true )) {
3231 throw new InvalidArgumentException ("Invalid builder type: {$ type }" );
3332 }
3433
3534 $ this ->builder = match ($ type ) {
36- self ::FORMAT_CSV => new CsvBuilder () ,
37- self ::FORMAT_SQL => new SqlBuilder () ,
35+ self ::FORMAT_CSV => new CsvBuilder ,
36+ self ::FORMAT_SQL => new SqlBuilder ,
3837 default => throw new InvalidArgumentException ("Unsupported builder type: {$ type }" ),
3938 };
4039
@@ -53,8 +52,6 @@ public function asSql(): self
5352
5453 /**
5554 * Get the model instance.
56- *
57- * @return mixed
5855 */
5956 public function getModel (): mixed
6057 {
@@ -63,9 +60,6 @@ public function getModel(): mixed
6360
6461 /**
6562 * Set the model instance.
66- *
67- * @param mixed $model
68- * @return self
6963 */
7064 public function setModel (mixed $ model ): self
7165 {
@@ -76,11 +70,11 @@ public function setModel(mixed $model): self
7670
7771 public function build (): string
7872 {
79- if (!isset ($ this ->builder )) {
73+ if (! isset ($ this ->builder )) {
8074 throw new RuntimeException ('Builder not initialized. Call asCsv() or asSql() first. ' );
8175 }
8276
83- if (!isset ($ this ->model )) {
77+ if (! isset ($ this ->model )) {
8478 throw new RuntimeException ('Model not set. Use setModel() to set the model before building. ' );
8579 }
8680
@@ -91,4 +85,4 @@ public function build(): string
9185
9286 return $ this ->builder ->build ();
9387 }
94- }
88+ }
0 commit comments