Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beranek/allow int in endpoint identifier version #148

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip

## [Unreleased][unreleased]
#### Changed
* [BC] Support for semantic versioning api. Need retype version from `int` to `string`.
* Support for semantic versioning api.
* [BC] DefaultHandler response code 404 instead 400

#### Added
Expand Down
9 changes: 8 additions & 1 deletion src/EndpointIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ class EndpointIdentifier implements EndpointInterface

private $apiAction;

public function __construct(string $method, string $version, string $package, ?string $apiAction = null)
/**
* @param string $method example: "GET", "POST", "PUT", "DELETE"
* @param string|int $version Version must have semantic numbering. For example "1", "1.1", "0.13.2" etc.
* @param string $package example: "users"
* @param string|null $apiAction example: "query"
*/
public function __construct(string $method, $version, string $package, ?string $apiAction = null)
{
$version = (string) $version;
$this->method = strtoupper($method);
if (strpos($version, '/') !== false) {
throw new InvalidArgumentException('Version must have semantic numbering. For example "1", "1.1", "0.13.2" etc.');
Expand Down
Loading