Skip to content

Commit d96b1fe

Browse files
committed
Add available methods quick reference
1 parent 1614471 commit d96b1fe

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,59 @@ $validObject->code = "something else"; // PHP runtime error: $code is read-only
6666

6767
### Other references
6868

69+
A quick reference of available classes/methods; please see the PHPDoc for details.
70+
71+
**OpenLocationCode**:
72+
73+
```php
74+
/* Vectorial1024\OpenLocationCodePhp\OpenLocationCode */
75+
76+
class OpenLocationCode implememts Stringable
77+
{
78+
public readonly string $code;
79+
// The explicit string cast gives $this->code;
80+
81+
public const int CODE_PRECISION_NORMAL = 10;
82+
83+
public static function createFromCode(string $code): self;
84+
public static function createFromCoordinates(float $latitude, float $longitude, int $codeLength = self::CODE_PRECISION_NORMAL): self;
85+
public static function encode(float $latitude, float $longitude, int $codeLength = self::CODE_PRECISION_NORMAL): string;
86+
public function decode(): Vectorial1024\OpenLocationCodePhp\CodeArea;
87+
88+
public function shorten(float $referenceLatitude, float $referenceLongitude): self;
89+
public function recover(float $referenceLatitude, float $referenceLongitude): self;
90+
91+
public function contains(float $latitude, float $longitude): bool;
92+
93+
public static function isValidCode(string $code): bool;
94+
public function isValid(): bool;
95+
public function isFull(): bool;
96+
public function isShort(): bool;
97+
public function isPadded(): bool;
98+
}
99+
```
100+
101+
**CodeArea**
102+
103+
```php
104+
/* Vectorial1024\OpenLocationCodePhp\CodeArea */
105+
106+
class CodeArea
107+
{
108+
public readonly float $southLatitude;
109+
public readonly float $westLongitude;
110+
public readonly float $northLatitude;
111+
public readonly float $eastLongitude;
112+
public readonly int $length;
113+
114+
public function getLatitudeHeight(): float;
115+
public function getLongitudeWidth(): float;
116+
117+
public function getCenterLatitude(): float;
118+
public function getCenterLongitude(): float;
119+
}
120+
```
121+
69122
## Testing
70123
via PHPUnit; first ensure PHPUnit has been set up correctly:
71124

0 commit comments

Comments
 (0)