1 | <?php |
||
51 | class HostNormalizer |
||
52 | { |
||
53 | /** |
||
54 | * Create single host entries for any host definitions that specify |
||
55 | * multiple hosts in the provided set of connection configurations. |
||
56 | * |
||
57 | * @param array $connections The set of connection configs containing host |
||
58 | * definitions to normalize |
||
59 | * |
||
60 | * @return array The normalized Redis Sentinel connection configuration |
||
61 | */ |
||
62 | public static function normalizeConnections(array $connections) |
||
74 | |||
75 | /** |
||
76 | * Create single host entries for any host definitions that specify |
||
77 | * multiple hosts in the provided connection configuration. |
||
78 | * |
||
79 | * @param array $connection The connection config which contains the host |
||
80 | * definitions for a single Redis Sentinel connection |
||
81 | * |
||
82 | * @return array The normalized connection configuration values |
||
83 | */ |
||
84 | public static function normalizeConnection(array $connection) |
||
99 | |||
100 | /** |
||
101 | * Parse the provided host definition into multiple host definitions if it |
||
102 | * specifies more than one host. |
||
103 | * |
||
104 | * @param array|string $host The host definition from a Redis Sentinel |
||
105 | * connection |
||
106 | * |
||
107 | * @return array One or more host definitions parsed from the provided |
||
108 | * host definition |
||
109 | */ |
||
110 | public static function normalizeHost($host) |
||
122 | |||
123 | /** |
||
124 | * Parse a host definition in the form of an array into multiple host |
||
125 | * definitions if it specifies more than one host. |
||
126 | * |
||
127 | * @param array $hostArray The host definition from a Redis Sentinel |
||
128 | * connection |
||
129 | * |
||
130 | * @return array One or more host definitions parsed from the provided |
||
131 | * host definition |
||
132 | */ |
||
133 | protected static function normalizeHostArray(array $hostArray) |
||
143 | |||
144 | /** |
||
145 | * Parse a host definition in the form of a string into multiple host |
||
146 | * definitions it it specifies more than one host. |
||
147 | * |
||
148 | * @param string $hostString The host definition from a Redis Sentinel |
||
149 | * connection |
||
150 | * @param int $port The port number to use for the resulting host |
||
151 | * definitions if the parsed host definition doesn't contain port numbers |
||
152 | * |
||
153 | * @return array One or more host definitions parsed from the provided |
||
154 | * host definition |
||
155 | */ |
||
156 | protected static function normalizeHostString($hostString, $port = 26379) |
||
172 | } |
||
173 |