File tree 5 files changed +3
-21
lines changed
5 files changed +3
-21
lines changed Original file line number Diff line number Diff line change 14
14
"require" : {
15
15
"php" : " >=8.1" ,
16
16
"myclabs/deep-copy" : " ^1.11" ,
17
- "programmatordev/php-api-sdk" : " ^0.2 .0" ,
17
+ "programmatordev/php-api-sdk" : " ^1 .0" ,
18
18
"programmatordev/yet-another-php-validator" : " ^1.1"
19
19
},
20
20
"require-dev" : {
Original file line number Diff line number Diff line change 27
27
- [ Condition] ( #condition )
28
28
- [ Icon] ( #icon )
29
29
- [ Location] ( #location )
30
- - [ MoonPhase] ( #moonphase )
31
- - [ Temperature] ( #temperature )
32
30
- [ Timezone] ( #timezone )
33
31
- [ Wind] ( #wind )
34
32
Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ private function configureOptions(array $options): array
62
62
$ this ->optionsResolver ->setAllowedTypes ('language ' , 'string ' );
63
63
64
64
$ this ->optionsResolver ->setAllowedValues ('unitSystem ' , UnitSystem::getOptions ());
65
- $ this ->optionsResolver ->setAllowedValues ('language ' , Language::getOptions ());
66
65
67
66
return $ this ->optionsResolver ->resolve ($ options );
68
67
}
@@ -76,7 +75,7 @@ private function configureApi(): void
76
75
$ this ->addQueryDefault ('units ' , $ this ->options ['unitSystem ' ]);
77
76
$ this ->addQueryDefault ('lang ' , $ this ->options ['language ' ]);
78
77
79
- $ this ->addPostRequestHandler (function (PostRequestEvent $ event ) {
78
+ $ this ->addPostRequestListener (function (PostRequestEvent $ event ) {
80
79
$ response = $ event ->getResponse ();
81
80
$ statusCode = $ response ->getStatusCode ();
82
81
@@ -94,7 +93,7 @@ private function configureApi(): void
94
93
}
95
94
});
96
95
97
- $ this ->addResponseContentsHandler (function (ResponseContentsEvent $ event ) {
96
+ $ this ->addResponseContentsListener (function (ResponseContentsEvent $ event ) {
98
97
// decode json string response into an array
99
98
$ contents = $ event ->getContents ();
100
99
$ contents = \json_decode ($ contents , true );
Original file line number Diff line number Diff line change 2
2
3
3
namespace ProgrammatorDev \OpenWeatherMap \Resource \Util ;
4
4
5
- use ProgrammatorDev \Validator \Exception \ValidationException ;
6
5
use function DeepCopy \deep_copy ;
7
6
8
7
trait LanguageTrait
9
8
{
10
- use ValidationTrait;
11
-
12
- /**
13
- * @throws ValidationException
14
- */
15
9
public function withLanguage (string $ language ): static
16
10
{
17
- $ this ->validateLanguage ($ language );
18
-
19
11
$ clone = deep_copy ($ this , true );
20
12
$ clone ->api ->addQueryDefault ('lang ' , $ language );
21
13
Original file line number Diff line number Diff line change 5
5
use ProgrammatorDev \OpenWeatherMap \Resource \Resource ;
6
6
use ProgrammatorDev \OpenWeatherMap \Resource \Util \LanguageTrait ;
7
7
use ProgrammatorDev \OpenWeatherMap \Test \AbstractTest ;
8
- use ProgrammatorDev \Validator \Exception \ValidationException ;
9
8
10
9
class LanguageTraitTest extends AbstractTest
11
10
{
@@ -30,10 +29,4 @@ public function testMethods(): void
30
29
$ this ->assertSame ('pt ' , $ this ->resource ->withLanguage ('pt ' )->getLanguage ());
31
30
$ this ->assertSame ('en ' , $ this ->resource ->getLanguage ()); // back to default value
32
31
}
33
-
34
- public function testValidationException (): void
35
- {
36
- $ this ->expectException (ValidationException::class);
37
- $ this ->resource ->withLanguage ('invalid ' );
38
- }
39
32
}
You can’t perform that action at this time.
0 commit comments