Code Duplication    Length = 16-16 lines in 2 locations

src/Arr.php 2 locations

@@ 434-449 (lines=16) @@
431
	 * @return  array
432
	 * @since 2.0
433
	 */
434
	public static function filterPrefixed($array, $prefix, $removePrefix = true)
435
	{
436
		$return = array();
437
		foreach ($array as $key => $val)
438
		{
439
			if (preg_match('/^' . $prefix . '/', $key))
440
			{
441
				if ($removePrefix === true)
442
				{
443
					$key = preg_replace('/^' . $prefix . '/', '', $key);
444
				}
445
				$return[$key] = $val;
446
			}
447
		}
448
		return $return;
449
	}
450
451
	/**
452
	 * Recursive version of PHP's array_filter()
@@ 507-522 (lines=16) @@
504
	 * @return  array
505
	 * @since 2.0
506
	 */
507
	public static function filterSuffixed($array, $suffix, $removeSuffix = true)
508
	{
509
		$return = array();
510
		foreach ($array as $key => $val)
511
		{
512
			if (preg_match('/' . $suffix . '$/', $key))
513
			{
514
				if ($removeSuffix === true)
515
				{
516
					$key = preg_replace('/' . $suffix . '$/', '', $key);
517
				}
518
				$return[$key] = $val;
519
			}
520
		}
521
		return $return;
522
	}
523
524
	/**
525
	 * Removes items from an array that match a key suffix.