File tree 5 files changed +33
-6
lines changed
5 files changed +33
-6
lines changed Original file line number Diff line number Diff line change
1
+ /.gitattributes export-ignore
2
+ /.gitignore export-ignore
3
+ /Tests export-ignore
4
+ /phpunit.xml export-ignore
5
+ /.php_cs export-ignore
6
+ /.formatter.yml export-ignore
7
+ /.circleci export-ignore
8
+ /.editorconfig export-ignore
Original file line number Diff line number Diff line change 16
16
namespace Apisearch \Exception ;
17
17
18
18
/**
19
- * Class TooManyRequestsException
19
+ * Class TooManyRequestsException.
20
20
*/
21
21
class TooManyRequestsException extends TransportableException
22
22
{
@@ -39,4 +39,4 @@ public static function tooManyRequestsReached(): self
39
39
{
40
40
return new self ('You reached the rate limit. Please, check your permissions ' );
41
41
}
42
- }
42
+ }
Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ protected static function throwTransportableExceptionIfNeeded(
58
58
throw new ResourceExistsException ($ response ['body ' ]['message ' ]);
59
59
case ForbiddenException::getTransportableHTTPError ():
60
60
throw new ForbiddenException ($ response ['body ' ]['message ' ]);
61
- case TooManyRequestsException::getTransportableHTTPError ();
61
+ case TooManyRequestsException::getTransportableHTTPError ():
62
62
throw new TooManyRequestsException ($ response ['body ' ]['message ' ]);
63
63
case ConnectionException::getTransportableHTTPError ():
64
- throw new ConnectionException ('Apisearch returned an internal error code [500] - ' . $ response ['body ' ]['message ' ]);
64
+ throw new ConnectionException ('Apisearch returned an internal error code [500] - ' . $ response ['body ' ]['message ' ]);
65
65
}
66
66
}
67
67
}
Original file line number Diff line number Diff line change @@ -100,8 +100,8 @@ public static function createFromArray(array $array): self
100
100
}
101
101
102
102
return new self (
103
- $ array ['lat ' ],
104
- $ array ['lon ' ]
103
+ \floatval ( $ array ['lat ' ]) ,
104
+ \floatval ( $ array ['lon ' ])
105
105
);
106
106
}
107
107
}
Original file line number Diff line number Diff line change @@ -120,4 +120,23 @@ public function testToArray()
120
120
$ coordinate ->toArray ()
121
121
);
122
122
}
123
+
124
+ /**
125
+ * Test string values.
126
+ */
127
+ public function testAsString ()
128
+ {
129
+ $ coordinateAsArray = [
130
+ 'lat ' => '1.20 ' ,
131
+ 'lon ' => '2.10 ' ,
132
+ ];
133
+ $ coordinate = Coordinate::createFromArray ($ coordinateAsArray );
134
+ $ this ->assertEquals (
135
+ [
136
+ 'lat ' => 1.20 ,
137
+ 'lon ' => 2.10 ,
138
+ ],
139
+ $ coordinate ->toArray ()
140
+ );
141
+ }
123
142
}
You can’t perform that action at this time.
0 commit comments