Code Duplication    Length = 19-19 lines in 2 locations

src/Arrayy.php 2 locations

@@ 1997-2015 (lines=19) @@
1994
   *
1995
   * @return bool
1996
   */
1997
  public function matches(\Closure $closure)
1998
  {
1999
    if (count($this->array) === 0) {
2000
      return false;
2001
    }
2002
2003
    // init
2004
    $array = $this->array;
2005
2006
    foreach ($array as $key => $value) {
2007
      $value = $closure($value, $key);
2008
2009
      if ($value === false) {
2010
        return false;
2011
      }
2012
    }
2013
2014
    return true;
2015
  }
2016
2017
  /**
2018
   * Check if any item in the current array matches a truth test.
@@ 2024-2042 (lines=19) @@
2021
   *
2022
   * @return bool
2023
   */
2024
  public function matchesAny(\Closure $closure)
2025
  {
2026
    if (count($this->array) === 0) {
2027
      return false;
2028
    }
2029
2030
    // init
2031
    $array = $this->array;
2032
2033
    foreach ($array as $key => $value) {
2034
      $value = $closure($value, $key);
2035
2036
      if ($value === true) {
2037
        return true;
2038
      }
2039
    }
2040
2041
    return false;
2042
  }
2043
2044
  /**
2045
   * Get the max value from an array.