@@ 2910-2925 (lines=16) @@ | ||
2907 | * |
|
2908 | * @return bool |
|
2909 | */ |
|
2910 | public function matches(\Closure $closure): bool |
|
2911 | { |
|
2912 | if (\count($this->getArray(), \COUNT_NORMAL) === 0) { |
|
2913 | return false; |
|
2914 | } |
|
2915 | ||
2916 | foreach ($this->getGenerator() as $key => $value) { |
|
2917 | $value = $closure($value, $key); |
|
2918 | ||
2919 | if ($value === false) { |
|
2920 | return false; |
|
2921 | } |
|
2922 | } |
|
2923 | ||
2924 | return true; |
|
2925 | } |
|
2926 | ||
2927 | /** |
|
2928 | * Check if any item in the current array matches a truth test. |
|
@@ 2934-2949 (lines=16) @@ | ||
2931 | * |
|
2932 | * @return bool |
|
2933 | */ |
|
2934 | public function matchesAny(\Closure $closure): bool |
|
2935 | { |
|
2936 | if (\count($this->getArray(), \COUNT_NORMAL) === 0) { |
|
2937 | return false; |
|
2938 | } |
|
2939 | ||
2940 | foreach ($this->getGenerator() as $key => $value) { |
|
2941 | $value = $closure($value, $key); |
|
2942 | ||
2943 | if ($value === true) { |
|
2944 | return true; |
|
2945 | } |
|
2946 | } |
|
2947 | ||
2948 | return false; |
|
2949 | } |
|
2950 | ||
2951 | /** |
|
2952 | * Get the max value from an array. |