Code Duplication    Length = 24-24 lines in 2 locations

includes/parser/Preprocessor_DOM.php 1 location

@@ 1413-1436 (lines=24) @@
1410
	 * @param string|PPNode_DOM|DOMDocument $args,...
1411
	 * @return array
1412
	 */
1413
	public function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
1414
		$args = array_slice( func_get_args(), 3 );
1415
		$out = [ $start ];
1416
		$first = true;
1417
1418
		foreach ( $args as $root ) {
1419
			if ( $root instanceof PPNode_DOM ) {
1420
				$root = $root->node;
1421
			}
1422
			if ( !is_array( $root ) && !( $root instanceof DOMNodeList ) ) {
1423
				$root = [ $root ];
1424
			}
1425
			foreach ( $root as $node ) {
1426
				if ( $first ) {
1427
					$first = false;
1428
				} else {
1429
					$out[] = $sep;
1430
				}
1431
				$out[] = $node;
1432
			}
1433
		}
1434
		$out[] = $end;
1435
		return $out;
1436
	}
1437
1438
	public function __toString() {
1439
		return 'frame{}';

includes/parser/Preprocessor_Hash.php 1 location

@@ 1235-1258 (lines=24) @@
1232
	 * @param string|PPNode $args,...
1233
	 * @return PPNode_Hash_Array
1234
	 */
1235
	public function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
1236
		$args = array_slice( func_get_args(), 3 );
1237
		$out = [ $start ];
1238
		$first = true;
1239
1240
		foreach ( $args as $root ) {
1241
			if ( $root instanceof PPNode_Hash_Array ) {
1242
				$root = $root->value;
1243
			}
1244
			if ( !is_array( $root ) ) {
1245
				$root = [ $root ];
1246
			}
1247
			foreach ( $root as $node ) {
1248
				if ( $first ) {
1249
					$first = false;
1250
				} else {
1251
					$out[] = $sep;
1252
				}
1253
				$out[] = $node;
1254
			}
1255
		}
1256
		$out[] = $end;
1257
		return new PPNode_Hash_Array( $out );
1258
	}
1259
1260
	public function __toString() {
1261
		return 'frame{}';