Code Duplication    Length = 18-18 lines in 2 locations

src/voku/helper/SimpleHtmlDomNode.php 2 locations

@@ 1133-1150 (lines=18) @@
1130
   *
1131
   * @return null
1132
   */
1133
  public function next_sibling()
1134
  {
1135
    if ($this->parent === null) {
1136
      return null;
1137
    }
1138
1139
    $idx = 0;
1140
    $count = count($this->parent->children);
1141
    while ($idx < $count && $this !== $this->parent->children[$idx]) {
1142
      ++$idx;
1143
    }
1144
1145
    if (++$idx >= $count) {
1146
      return null;
1147
    }
1148
1149
    return $this->parent->children[$idx];
1150
  }
1151
1152
  /**
1153
   * previous sibling
@@ 1167-1184 (lines=18) @@
1164
   *
1165
   * @return null|\voku\helper\SimpleHtmlDomNode
1166
   */
1167
  public function prev_sibling()
1168
  {
1169
    if ($this->parent === null) {
1170
      return null;
1171
    }
1172
1173
    $idx = 0;
1174
    $count = count($this->parent->children);
1175
    while ($idx < $count && $this !== $this->parent->children[$idx]) {
1176
      ++$idx;
1177
    }
1178
1179
    if (--$idx < 0) {
1180
      return null;
1181
    }
1182
1183
    return $this->parent->children[$idx];
1184
  }
1185
1186
  /**
1187
   * has child nodes