diff --git a/src/Helpers/ArrayHelper.php b/src/Helpers/ArrayHelper.php index d4d4a51..e13821f 100755 --- a/src/Helpers/ArrayHelper.php +++ b/src/Helpers/ArrayHelper.php @@ -4,6 +4,12 @@ namespace Webmasterskaya\CryptoPro\Helpers; class ArrayHelper { + /** + * @param array $array + * @param callable $fn + * + * @return bool + */ public static function any(array $array, callable $fn) { foreach ($array as $value) @@ -17,6 +23,12 @@ class ArrayHelper return false; } + /** + * @param array $array + * @param callable $fn + * + * @return bool + */ public static function every(array $array, callable $fn) { foreach ($array as $value) @@ -29,4 +41,21 @@ class ArrayHelper return true; } + + /** + * @param array $array + * @param callable $fn + * + * @return mixed|void + */ + public static function find(array $array, callable $fn) + { + foreach ($array as $key => $value) + { + if ($fn($value, $key, $array)) + { + return $value; + } + } + } } \ No newline at end of file