public static function eachLine(string $str, callable $callable, ...$args) : string
    {
        if ($str === '') {
            return $str;
        }

        $lines = mb_split('[\r\n]{1,2}', $str);

        foreach ($lines as $number => &$line) {
            $lines[$number] = (string) call_user_func($callable, $line, $number, ...$args);
        }

        return implode("\n", $lines);
    }