File tree Expand file tree Collapse file tree 5 files changed +3
-21
lines changed Expand file tree Collapse file tree 5 files changed +3
-21
lines changed Original file line number Diff line number Diff line change 1414 "require" : {
1515 "php" : " >=8.1" ,
1616 "myclabs/deep-copy" : " ^1.11" ,
17- "programmatordev/php-api-sdk" : " ^0.2 .0" ,
17+ "programmatordev/php-api-sdk" : " ^1 .0" ,
1818 "programmatordev/yet-another-php-validator" : " ^1.1"
1919 },
2020 "require-dev" : {
Original file line number Diff line number Diff line change 2727 - [ Condition] ( #condition )
2828 - [ Icon] ( #icon )
2929 - [ Location] ( #location )
30- - [ MoonPhase] ( #moonphase )
31- - [ Temperature] ( #temperature )
3230 - [ Timezone] ( #timezone )
3331 - [ Wind] ( #wind )
3432
Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ private function configureOptions(array $options): array
6262 $ this ->optionsResolver ->setAllowedTypes ('language ' , 'string ' );
6363
6464 $ this ->optionsResolver ->setAllowedValues ('unitSystem ' , UnitSystem::getOptions ());
65- $ this ->optionsResolver ->setAllowedValues ('language ' , Language::getOptions ());
6665
6766 return $ this ->optionsResolver ->resolve ($ options );
6867 }
@@ -76,7 +75,7 @@ private function configureApi(): void
7675 $ this ->addQueryDefault ('units ' , $ this ->options ['unitSystem ' ]);
7776 $ this ->addQueryDefault ('lang ' , $ this ->options ['language ' ]);
7877
79- $ this ->addPostRequestHandler (function (PostRequestEvent $ event ) {
78+ $ this ->addPostRequestListener (function (PostRequestEvent $ event ) {
8079 $ response = $ event ->getResponse ();
8180 $ statusCode = $ response ->getStatusCode ();
8281
@@ -94,7 +93,7 @@ private function configureApi(): void
9493 }
9594 });
9695
97- $ this ->addResponseContentsHandler (function (ResponseContentsEvent $ event ) {
96+ $ this ->addResponseContentsListener (function (ResponseContentsEvent $ event ) {
9897 // decode json string response into an array
9998 $ contents = $ event ->getContents ();
10099 $ contents = \json_decode ($ contents , true );
Original file line number Diff line number Diff line change 22
33namespace ProgrammatorDev \OpenWeatherMap \Resource \Util ;
44
5- use ProgrammatorDev \Validator \Exception \ValidationException ;
65use function DeepCopy \deep_copy ;
76
87trait LanguageTrait
98{
10- use ValidationTrait;
11-
12- /**
13- * @throws ValidationException
14- */
159 public function withLanguage (string $ language ): static
1610 {
17- $ this ->validateLanguage ($ language );
18-
1911 $ clone = deep_copy ($ this , true );
2012 $ clone ->api ->addQueryDefault ('lang ' , $ language );
2113
Original file line number Diff line number Diff line change 55use ProgrammatorDev \OpenWeatherMap \Resource \Resource ;
66use ProgrammatorDev \OpenWeatherMap \Resource \Util \LanguageTrait ;
77use ProgrammatorDev \OpenWeatherMap \Test \AbstractTest ;
8- use ProgrammatorDev \Validator \Exception \ValidationException ;
98
109class LanguageTraitTest extends AbstractTest
1110{
@@ -30,10 +29,4 @@ public function testMethods(): void
3029 $ this ->assertSame ('pt ' , $ this ->resource ->withLanguage ('pt ' )->getLanguage ());
3130 $ this ->assertSame ('en ' , $ this ->resource ->getLanguage ()); // back to default value
3231 }
33-
34- public function testValidationException (): void
35- {
36- $ this ->expectException (ValidationException::class);
37- $ this ->resource ->withLanguage ('invalid ' );
38- }
3932}
You can’t perform that action at this time.
0 commit comments