get('backend', 'resource') )); $config->options = [ PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ ]; $conn = new Sql\Connection($config); return $conn; } /** * Transform the given binary IP address in a human readable format * * @param string $ip * * @return array The first element is IPv4, the second IPv6 */ protected function transformIpAddress($ip) { $ipv4 = ltrim($ip, "\0"); if (strlen($ipv4) === 4) { return [inet_ntop($ipv4), null]; } else { return [null, inet_ntop($ip)]; } } }