src/Utils/IterableUtils.php
public static function only(array $arr, callable $callback): bool
    {
        $arrLength = 0;

        foreach ($arr as $index => $value) {
            if ($callback($value, $index) === true) {
                $arrLength++;
            }
        }

        return $arrLength === 1;
    }
public static function only(array $arr, callable $callback): bool
    {
        $arrLength = 0;

        foreach ($arr as $index => $value) {
            if ($callback($value, $index) === true) {
                $arrLength++;
            }
        }

        return $arrLength === 1;
    }
public static function only ( array $ arr , callable $ callback ) : bool { $ arrLength = 0 ; foreach ( $ arr as $ index => $ value ) { if ( $ callback ( $ value , $ index ) === true ) { $ arrLength ++ ; } } return $ arrLength === 1 ; }
Verify if in all elements the condition is once accepted

@param array $arr The array to be used
@param $callback Function fired in array elements
@return bool
Verify if in all elements the condition is once accepted