Skip to content
Merged
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
115 changes: 63 additions & 52 deletions docs/10-api.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,65 @@
# API Reference

| Method | Returns | IPv4 | IPv6 | Multi |
|--------------------------------------------|----------------------|------|------|-------|
| `factory(string $ip, [$strategy])` | Static `IpInterface` | ✓ | ✓ | ✓ |
| `getBinary()` | `string` | ✓ | ✓ | ✓ |
| `getOctets()` | `list<int>` | ✓ | ✓ | ✓ |
| `toString()` | `string` | ✓ | ✓ | ✓ |
| `jsonSerialize()` | `string` | ✓ | ✓ | ✓ |
| `toIntegerString()` | `string` | ✓ | ✓ | ✓ |
| `toHexString()` | `string` | ✓ | ✓ | ✓ |
| `equals(IpInterface $ip)` | `bool` | ✓ | ✓ | ✓ |
| `getVersion()` | `int` | ✓ | ✓ | ✓ |
| `isVersion(int $version)` | `bool` | ✓ | ✓ | ✓ |
| `isVersion4()` | `bool` | ✓ | ✓ | ✓ |
| `isVersion6()` | `bool` | ✓ | ✓ | ✓ |
| `getNetworkIp(int $cidr)` | Static `IpInterface` | ✓ | ✓ | ✓ |
| `getBroadcastIp(int $cidr)` | Static `IpInterface` | ✓ | ✓ | ✓ |
| `next()` | Static `IpInterface` | ✓ | ✓ | ✓ |
| `previous()` | Static `IpInterface` | ✓ | ✓ | ✓ |
| `offset(int $offset)` | Static `IpInterface` | ✓ | ✓ | ✓ |
| `inRange(IpInterface $ip, int $cidr)` | `bool` | ✓ | ✓ | ✓ |
| `getCommonCidr(IpInterface $ip)` | `int` | ✓ | ✓ | ✓ |
| `isMapped()` | `bool` | ✓ | ✓ | ✓ |
| `isDerived()` | `bool` | ✓ | ✓ | ✓ |
| `isCompatible()` | `bool` | ✓ | ✓ | ✓ |
| `isEmbedded()` | `bool` | ✓ | ✓ | ✓ |
| `isLinkLocal()` | `bool` | ✓ | ✓ | ✓ |
| `isLoopback()` | `bool` | ✓ | ✓ | ✓ |
| `isMulticast()` | `bool` | ✓ | ✓ | ✓ |
| `isPrivateUse()` | `bool` | ✓ | ✓ | ✓ |
| `isUnspecified()` | `bool` | ✓ | ✓ | ✓ |
| `isBenchmarking()` | `bool` | ✓ | ✓ | ✓ |
| `isDocumentation()` | `bool` | ✓ | ✓ | ✓ |
| `isGloballyReachable()` | `bool` | ✓ | ✓ | ✓ |
| `isBroadcast()` | `bool` | ✓ | | ✓ |
| `isShared()` | `bool` | ✓ | | ✓ |
| `isFutureReserved()` | `bool` | ✓ | | ✓ |
| `getDotAddress()` | `string` | ✓ | | ✓ |
| `toInteger()` | `int` | ✓ | | ✓ |
| `getCompactedAddress()` | `string` | | ✓ | ✓ |
| `getExpandedAddress()` | `string` | | ✓ | ✓ |
| `getCompactedAddress()` | `string` | | ✓ | ✓ |
| `getSegments()` | `list<int>` | | ✓ | ✓ |
| `getMulticastScope()` | `?int` | | ✓ | ✓ |
| `isUniqueLocal()` | `bool` | | ✓ | ✓ |
| `isUnicast()` | `bool` | | ✓ | ✓ |
| `isUnicastGlobal()` | `bool` | | ✓ | ✓ |
| `isEmbeddedAccordingToStrategy($strategy)` | `bool` | | ✓ | ✓ |
| `isNat64WellKnown()` | `bool` | | ✓ | ✓ |
| `isNat64LocalUse()` | `bool` | | ✓ | ✓ |
| `isTeredo()` | `bool` | | ✓ | ✓ |
| `getEmbeddedIp([$strategy])` | `IPv4` | | ✓ | ✓ |
| `getProtocolAppropriateAddress()` | `string` | | | ✓ |
| Contract | Method | Returns | IPv4 | IPv6 | Multi |
|------------------------------|---------------------------------------------------|--------------------------------|------|------|-------|
| `IpInterface` | `factory(string $ip, [$strategy])` _(deprecated)_ | Static `IpInterface` | ✓ | ✓ | ✓ |
| ↳ | `isPublicUse()` _(deprecated)_ | `bool` | ✓ | ✓ | ✓ |
| `FactoryInterface` | `fromProtocol(string $ip, [$strategy])` | Static `IpInterface` | ✓ | ✓ | ✓ |
| ↳ | `tryFromProtocol(string $ip, [$strategy])` | Static `IpInterface` or `null` | ✓ | ✓ | ✓ |
| ↳ | `fromBinary(string $binary, [$strategy])` | Static `IpInterface` | ✓ | ✓ | ✓ |
| ↳ | `tryFromBinary(string $binary, [$strategy])` | Static `IpInterface` or `null` | ✓ | ✓ | ✓ |
| ↳ | `fromHex(string $hex, [$strategy])` | Static `IpInterface` | ✓ | ✓ | ✓ |
| ↳ | `tryFromHex(string $hex, [$strategy])` | Static `IpInterface` or `null` | ✓ | ✓ | ✓ |
| ↳ | `fromIntegerString(string $integer, [$strategy])` | Static `IpInterface` | ✓ | ✓ | ✓ |
| ↳ | `isValid(string $ip, [$strategy])` | `bool` | ✓ | ✓ | ✓ |
| `Factory4Interface` | `fromInteger(int $integer, [$strategy])` | Static `IpInterface` | ✓ | | ✓ |
| `OutputInterface` | `getBinary()` | `string` | ✓ | ✓ | ✓ |
| ↳ | `getOctets()` | `list<int>` | ✓ | ✓ | ✓ |
| ↳ | `toIntegerString()` | `string` | ✓ | ✓ | ✓ |
| ↳ | `toHexString()` | `string` | ✓ | ✓ | ✓ |
| ↳ | `toString()` | `string` | ✓ | ✓ | ✓ |
| ↳ | `__toString()` | `string` | ✓ | ✓ | ✓ |
| ↳ (`JsonSerializable`) | `jsonSerialize()` | `string` | ✓ | ✓ | ✓ |
| `Output4Interface` | `toDotAddress([$strategy])` | `string` | ✓ | | ✓ |
| ↳ | `toInteger()` | `int` | ✓ | | ✓ |
| `Output6Interface` | `toCompactedAddress([$strategy])` | `string` | | ✓ | ✓ |
| ↳ | `toExpandedAddress()` | `string` | | ✓ | ✓ |
| ↳ | `getSegments()` | `list<int>` | | ✓ | ✓ |
| `VersionIdentityInterface` | `getVersion()` | `int` | ✓ | ✓ | ✓ |
| ↳ | `isVersion(int $version)` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `isVersion4()` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `isVersion6()` | `bool` | ✓ | ✓ | ✓ |
| `ComparisonInterface` | `inRange(IpInterface $ip, int $cidr)` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `getCommonCidr(IpInterface $ip)` | `int` | ✓ | ✓ | ✓ |
| ↳ | `equals(IpInterface $ip)` | `bool` | ✓ | ✓ | ✓ |
| `StrategyDetectionInterface` | `isEmbeddedAccordingToStrategy($strategy)` | `bool` | | ✓ | ✓ |
| ↳ | `getEmbeddedIp([$strategy])` | `IPv4` | | ✓ | ✓ |
| ↳ | `isMapped()` | `bool` | | ✓ | ✓ |
| ↳ | `isDerived()` | `bool` | | ✓ | ✓ |
| ↳ | `isCompatible()` | `bool` | | ✓ | ✓ |
Comment thread
greptile-apps[bot] marked this conversation as resolved.
| ↳ | `isNat64WellKnown()` | `bool` | | ✓ | ✓ |
| ↳ | `isNat64LocalUse()` | `bool` | | ✓ | ✓ |
| ↳ | `isTeredo()` | `bool` | | ✓ | ✓ |
| `ClassificationInterface` | `isLinkLocal()` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `isLoopback()` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `isMulticast()` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `isPrivateUse()` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `isUnspecified()` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `isBenchmarking()` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `isDocumentation()` | `bool` | ✓ | ✓ | ✓ |
| ↳ | `isGloballyReachable()` | `bool` | ✓ | ✓ | ✓ |
| `Classification4Interface` | `isBroadcast()` | `bool` | ✓ | | ✓ |
| ↳ | `isShared()` | `bool` | ✓ | | ✓ |
| ↳ | `isFutureReserved()` | `bool` | ✓ | | ✓ |
| `Classification6Interface` | `getMulticastScope()` | `?int` | | ✓ | ✓ |
| ↳ | `isUniqueLocal()` | `bool` | | ✓ | ✓ |
| ↳ | `isUnicast()` | `bool` | | ✓ | ✓ |
| ↳ | `isUnicastGlobal()` | `bool` | | ✓ | ✓ |
| `ArithmeticInterface` | `getNetworkIp(int $cidr)` | Static `IpInterface` | ✓ | ✓ | ✓ |
| ↳ | `getBroadcastIp(int $cidr)` | Static `IpInterface` | ✓ | ✓ | ✓ |
| ↳ | `next()` | Static `IpInterface` | ✓ | ✓ | ✓ |
| ↳ | `previous()` | Static `IpInterface` | ✓ | ✓ | ✓ |
| ↳ | `offset(int $offset)` | Static `IpInterface` | ✓ | ✓ | ✓ |
| `MultiVersionInterface` | `setDefaultEmbeddingStrategy($strategy)` | `void` | | | ✓ |
| ↳ | `toProtocolAppropriateAddress([$strategy])` | `string` | | | ✓ |
| ↳ | `isEmbedded()` | `bool` | | | ✓ |