@@ -28,6 +28,9 @@ discard block |
||
| 28 | 28 | protected $mapping; |
| 29 | 29 | protected $extension; |
| 30 | 30 | |
| 31 | + /** |
|
| 32 | + * @param DOMDocument $import |
|
| 33 | + */ |
|
| 31 | 34 | public function __construct($import = null) |
| 32 | 35 | { |
| 33 | 36 | parent::__construct('1.0', 'UTF-8'); |
@@ -50,6 +53,9 @@ discard block |
||
| 50 | 53 | $this->getStructure(); |
| 51 | 54 | } |
| 52 | 55 | |
| 56 | + /** |
|
| 57 | + * @param string $path |
|
| 58 | + */ |
|
| 53 | 59 | public function set($path = null, $value = null) |
| 54 | 60 | { |
| 55 | 61 | $path = $this->realxpath($path); |
@@ -65,6 +71,9 @@ discard block |
||
| 65 | 71 | return $this->nodes[$path]; |
| 66 | 72 | } |
| 67 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $query |
|
| 76 | + */ |
|
| 68 | 77 | public function get($query) |
| 69 | 78 | { |
| 70 | 79 | $nodes = $this->xpath->query($query); |
@@ -91,6 +100,9 @@ discard block |
||
| 91 | 100 | return $this->saveXML(); |
| 92 | 101 | } |
| 93 | 102 | |
| 103 | + /** |
|
| 104 | + * @param string $path |
|
| 105 | + */ |
|
| 94 | 106 | protected function createNodes($path) |
| 95 | 107 | { |
| 96 | 108 | $path_parts = explode('/', $path); |
@@ -237,6 +249,9 @@ discard block |
||
| 237 | 249 | } |
| 238 | 250 | } |
| 239 | 251 | |
| 252 | + /** |
|
| 253 | + * @return string |
|
| 254 | + */ |
|
| 240 | 255 | private function className($class) |
| 241 | 256 | { |
| 242 | 257 | if (!is_string($class)) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | if (strpos($path_parts[$i], ':') === false) { |
| 105 | 105 | $node_ns = 'epp'; |
| 106 | 106 | $node_name = $path_parts[$i]; |
| 107 | - $path_parts[$i] = $node_ns . ':' . $node_name; |
|
| 107 | + $path_parts[$i] = $node_ns.':'.$node_name; |
|
| 108 | 108 | } else { |
| 109 | 109 | list($node_ns, $node_name) = explode(':', $path_parts[$i], 2); |
| 110 | 110 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // get next key |
| 116 | 116 | $next_key = -1; |
| 117 | 117 | foreach (array_keys($this->nodes) as $each) { |
| 118 | - if (preg_match('/' . preg_quote($node_ns . ':' . $node_name, '/') . '\[(\d+)\]$/', $each, $matches)) { |
|
| 118 | + if (preg_match('/'.preg_quote($node_ns.':'.$node_name, '/').'\[(\d+)\]$/', $each, $matches)) { |
|
| 119 | 119 | if ($matches[1] > $next_key) { |
| 120 | 120 | $next_key = (int) $matches[1]; |
| 121 | 121 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if ($node_ns === 'epp') { |
| 152 | 152 | $this->nodes[$node_path] = $this->createElementNS($node_xmlns, $node_name); |
| 153 | 153 | } else { |
| 154 | - $this->nodes[$node_path] = $this->createElementNS($node_xmlns, $node_ns . ':' . $node_name); |
|
| 154 | + $this->nodes[$node_path] = $this->createElementNS($node_xmlns, $node_ns.':'.$node_name); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | // set attribute |
@@ -184,15 +184,15 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | if (!empty($this->mapping) && !empty($this->command)) { |
| 187 | - array_unshift($path_parts, $this->mapping . ':' . $this->command); |
|
| 187 | + array_unshift($path_parts, $this->mapping.':'.$this->command); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if (!empty($this->command)) { |
| 191 | - array_unshift($path_parts, 'epp:' . $this->command); |
|
| 191 | + array_unshift($path_parts, 'epp:'.$this->command); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (!empty($this->format)) { |
| 195 | - array_unshift($path_parts, 'epp:' . $this->format); |
|
| 195 | + array_unshift($path_parts, 'epp:'.$this->format); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | array_unshift($path_parts, 'epp:epp'); |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | if (strpos($method_name, 'Add') === 0) { |
| 105 | 105 | $method_name = lcfirst($method_name); |
| 106 | 106 | } else { |
| 107 | - $method_name = 'set' . $method_name; |
|
| 107 | + $method_name = 'set'.$method_name; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | if (is_callable([$this, $method_name])) { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | // if node only has a type attribute lets distinguish them directly |
| 110 | 110 | // and then ignore the attribtue |
| 111 | 111 | if ($each->hasAttribute('type')) { |
| 112 | - $key = $each->localName . '@' . $each->getAttribute('type'); |
|
| 112 | + $key = $each->localName.'@'.$each->getAttribute('type'); |
|
| 113 | 113 | $ignore_attributes = true; |
| 114 | 114 | } else { |
| 115 | 115 | $key = $each->localName; |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if ($insert_key) { |
| 155 | - if (isset($tmp['@' . $key][$attr->nodeName]) && !is_array($tmp['@' . $key][$attr->nodeName])) { |
|
| 156 | - $tmp['@' . $key][$attr->nodeName] = [$tmp['@' . $key][$attr->nodeName]]; |
|
| 155 | + if (isset($tmp['@'.$key][$attr->nodeName]) && !is_array($tmp['@'.$key][$attr->nodeName])) { |
|
| 156 | + $tmp['@'.$key][$attr->nodeName] = [$tmp['@'.$key][$attr->nodeName]]; |
|
| 157 | 157 | } |
| 158 | - $tmp['@' . $key][$attr->nodeName][$insert_key] = $attr->nodeValue; |
|
| 158 | + $tmp['@'.$key][$attr->nodeName][$insert_key] = $attr->nodeValue; |
|
| 159 | 159 | } else { |
| 160 | - $tmp['@' . $key][$attr->nodeName] = $attr->nodeValue; |
|
| 160 | + $tmp['@'.$key][$attr->nodeName] = $attr->nodeValue; |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $base_path = sprintf($base_path, $this->host_attr_index); |
| 49 | 49 | |
| 50 | - $this->set($base_path . '/domain:hostName', $host); |
|
| 50 | + $this->set($base_path.'/domain:hostName', $host); |
|
| 51 | 51 | |
| 52 | 52 | if (!empty($ips) && is_array($ips)) { |
| 53 | 53 | foreach ($ips as $ip) { |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | if ($ip_type === false) { |
| 56 | 56 | throw new Exception(sprintf('%s is not a valid IP address', $ip)); |
| 57 | 57 | } elseif ($ip_type === Validator::TYPE_IPV4) { |
| 58 | - $this->set($base_path . '/domain:hostAddr[@ip=\'v4\']', $ip); |
|
| 58 | + $this->set($base_path.'/domain:hostAddr[@ip=\'v4\']', $ip); |
|
| 59 | 59 | } elseif ($ip_type === Validator::TYPE_IPV6) { |
| 60 | - $this->set($base_path . '/domain:hostAddr[@ip=\'v6\']', $ip); |
|
| 60 | + $this->set($base_path.'/domain:hostAddr[@ip=\'v6\']', $ip); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -318,7 +318,7 @@ |
||
| 318 | 318 | return false; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - $ascii_email = substr($email, 0, $pos) . '@' . idn_to_ascii(substr($email, $pos + 1), 0, INTL_IDNA_VARIANT_2003); |
|
| 321 | + $ascii_email = substr($email, 0, $pos).'@'.idn_to_ascii(substr($email, $pos + 1), 0, INTL_IDNA_VARIANT_2003); |
|
| 322 | 322 | |
| 323 | 323 | return filter_var($ascii_email, FILTER_VALIDATE_EMAIL); |
| 324 | 324 | } |