This repository was archived by the owner on Jun 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +33
-6
lines changed Expand file tree Collapse file tree 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 1616namespace Apisearch \Exception ;
1717
1818/**
19- * Class TooManyRequestsException
19+ * Class TooManyRequestsException.
2020 */
2121class TooManyRequestsException extends TransportableException
2222{
@@ -39,4 +39,4 @@ public static function tooManyRequestsReached(): self
3939 {
4040 return new self ('You reached the rate limit. Please, check your permissions ' );
4141 }
42- }
42+ }
Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ protected static function throwTransportableExceptionIfNeeded(
5858 throw new ResourceExistsException ($ response ['body ' ]['message ' ]);
5959 case ForbiddenException::getTransportableHTTPError ():
6060 throw new ForbiddenException ($ response ['body ' ]['message ' ]);
61- case TooManyRequestsException::getTransportableHTTPError ();
61+ case TooManyRequestsException::getTransportableHTTPError ():
6262 throw new TooManyRequestsException ($ response ['body ' ]['message ' ]);
6363 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 ' ]);
6565 }
6666 }
6767}
Original file line number Diff line number Diff line change @@ -100,8 +100,8 @@ public static function createFromArray(array $array): self
100100 }
101101
102102 return new self (
103- $ array ['lat ' ],
104- $ array ['lon ' ]
103+ \floatval ( $ array ['lat ' ]) ,
104+ \floatval ( $ array ['lon ' ])
105105 );
106106 }
107107}
Original file line number Diff line number Diff line change @@ -120,4 +120,23 @@ public function testToArray()
120120 $ coordinate ->toArray ()
121121 );
122122 }
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+ }
123142}
You can’t perform that action at this time.
0 commit comments