-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathFactoryInterface.php
More file actions
84 lines (73 loc) · 2.31 KB
/
Copy pathFactoryInterface.php
File metadata and controls
84 lines (73 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
declare(strict_types=1);
namespace Darsyn\IP\Contracts;
/**
* @experimental
*/
interface FactoryInterface
{
/**
* Create a New IP From Protocol Notation
*
* Strictly parses an IP address from its protocol notation only. Unlike
* factory(), a raw binary sequence is NOT accepted; user-supplied strings
* never reach the binary path (avoiding an SSRF/validation footgun).
*
* @throws \Darsyn\IP\Exception\InvalidIpAddressException
* @throws \Darsyn\IP\Exception\WrongVersionException
* @return static
*/
public static function fromProtocol(string $ip);
/**
* Create a New IP From Protocol Notation, or Null on Failure
*
* @return static|null
*/
public static function tryFromProtocol(string $ip);
/**
* Create a New IP From a Raw Binary Sequence
*
* @throws \Darsyn\IP\Exception\InvalidBinaryException
* @return static
*/
public static function fromBinary(string $binary);
/**
* Create a New IP From a Raw Binary Sequence, or Null on Failure
*
* @return static|null
*/
public static function tryFromBinary(string $binary);
/**
* Create a New IP From a Hexadecimal String
*
* @throws \Darsyn\IP\Exception\InvalidIpAddressException
* @return static
*/
public static function fromHex(string $hex);
/**
* Create a New IP From a Hexadecimal String, or Null on Failure
*
* @return static|null
*/
public static function tryFromHex(string $hex);
/**
* Create a New IP From an Integer Represented as a Decimal String
*
* Accepts the whole-address value in base-10, at any precision (unlike
* fromInteger(), version 6 addresses do not overflow). The value must fit
* within the address space of the class it is called on.
*
* @throws \Darsyn\IP\Exception\InvalidIpAddressException
* @return static
*/
public static function fromIntegerString(string $integer);
/**
* Create a New IP From an Integer Represented as a Decimal String, or
* Null on Failure
*
* @return static|null
*/
public static function tryFromIntegerString(string $integer);
/** Whether the supplied string is valid IP protocol notation. */
public static function isValid(string $ip): bool;
}