File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,8 +182,11 @@ public function __construct(array $options = [])
182182 $ method = 'set ' . $ this ->toPascalCase ($ option );
183183 if (method_exists ($ this , $ method )) {
184184 // We want to make sure that we can set the individual arguments from an associative array or a regular array.
185- $ args = is_array ($ value ) ? $ value : [$ value ];
186- $ this ->{$ method }(...$ args );
185+ if (is_array ($ value )) {
186+ $ this ->{$ method }(...$ value );
187+ } else {
188+ $ this ->{$ method }($ value );
189+ }
187190 }
188191 }
189192 }
Original file line number Diff line number Diff line change 1818 'height ' => 400 ,
1919 'fit ' => 'fill ' ,
2020 'watermarkPosition ' => 'center ' ,
21+ 'border ' => [
22+ 'width ' => 10 ,
23+ 'color ' => '000000 ' ,
24+ 'borderMethod ' => 'overlay ' ,
25+ ],
2126 ]);
2227
2328 expect ($ options )->toBeOptions ();
24- expect ($ options ->toString ())->toBe ('w=300&h=400&fit=fill&markpos=center ' );
29+ expect ($ options ->toString ())->toBe ('w=300&h=400&fit=fill&markpos=center&border=10,000000,overlay ' );
2530});
2631
2732test ('can handle complex options ' , function (): void {
3136 ->setWatermarkPosition ('center ' )
3237 ->setWatermarkAlpha (50 )
3338 ->setQuality (80 )
34- ->setFormat ('png ' );
39+ ->setFormat ('png ' )
40+ ->setBorder (10 , '000000 ' , 'overlay ' );
3541
3642 expect ($ options )->toBeOptions ();
37- expect ($ options ->toString ())->toBe ('sharp=5&fit=fill&markpos=center&markalpha=50&q=80&fm=png ' );
43+ expect ($ options ->toString ())->toBe ('sharp=5&fit=fill&markpos=center&markalpha=50&q=80&fm=png&border=10,000000,overlay ' );
3844});
3945
4046test ('magic __toString behaves like toString method ' , function (): void {
You can’t perform that action at this time.
0 commit comments