Skip to content

Commit

Permalink
#148 Adding more convenient methods to UriInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Dec 23, 2024
1 parent 10712f1 commit cd167d6
Show file tree
Hide file tree
Showing 4 changed files with 860 additions and 3 deletions.
15 changes: 15 additions & 0 deletions interfaces/Contracts/UriInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,23 @@
*
* @method string|null getUsername() returns the user component of the URI.
* @method string|null getPassword() returns the scheme-specific information about how to gain authorization to access the resource.
* @method string toNormalizedString() returns the normalized string representation of the URI
* @method array toComponents() returns an associative array containing all the URI components.
* @method self when(callable|bool $condition, callable $onSuccess, ?callable $onFail = null) conditionally return a new instance
* @method self normalize() returns a new URI instance with normalized components
* @method self resolve(UriInterface $uri) resolves a URI against a base URI using RFC3986 rules
* @method self relativize(UriInterface $uri) relativize a URI against a base URI using RFC3986 rules
* @method self|null getOrigin() returns the URI origin as described in the WHATWG URL Living standard specification
* @method bool isOpaque() tells whether the given URI object represents an opaque URI.
* @method bool isAbsolute() tells whether the URI represents an absolute URI.
* @method bool isNetworkPath() tells whether the URI represents a network path URI.
* @method bool isAbsolutePath() tells whether the URI represents an absolute URI path.
* @method bool isRelativePath() tells whether the given URI object represents a relative path.
* @method bool isCrossOrigin(UriInterface $uri) tells whether the URI comes from a different origin than the current instance.
* @method bool isSameOrigin(UriInterface $uri) tells whether the URI comes from the same origin as the current instance.
* @method bool isSameDocument(UriInterface $uri) tells whether the given URI object represents the same document.
* @method bool isLocalFile() tells whether the `file` scheme base URI represents a local file.
* @method bool equals(UriInterface $uri, bool $excludeFragment) tells whether the given URI object represents the same document. It can take the fragment in account if it is explicitly specified
*/
interface UriInterface extends JsonSerializable, Stringable
{
Expand Down
4 changes: 2 additions & 2 deletions interfaces/IPv4/BCMathCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public function pow(mixed $value, int $exponent): string
return bcpow((string) $value, (string) $exponent, self::SCALE);
}

public function compare(mixed $value1, $value2): int
public function compare(mixed $value1, mixed $value2): int
{
return bccomp((string) $value1, (string) $value2, self::SCALE);
}

public function multiply(mixed $value1, $value2): string
public function multiply(mixed $value1, mixed $value2): string
{
return bcmul((string) $value1, (string) $value2, self::SCALE);
}
Expand Down
Loading

0 comments on commit cd167d6

Please sign in to comment.