public function map($callback)
    {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException('Callback has to be a valid callable, '.gettype($callback).' given.');
        }

        for ($i = 0; $this->checkIfLineNumberIsValid($i, false); $i++) {
            $this->setCurrentLineNumber($i);
            call_user_func($callback, $this->getLine($i), $i, $this);
        }
    }
public function map($callback)
    {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException('Callback has to be a valid callable, '.gettype($callback).' given.');
        }

        for ($i = 0; $this->checkIfLineNumberIsValid($i, false); $i++) {
            $this->setCurrentLineNumber($i);
            call_user_func($callback, $this->getLine($i), $i, $this);
        }
    }
public function map ( $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new InvalidArgumentException ( 'Callback has to be a valid callable, ' . gettype ( $ callback ) . ' given.' ) ; } for ( $ i = 0 ; $ this -> checkIfLineNumberIsValid ( $ i , false ) ; $ i ++ ) { $ this -> setCurrentLineNumber ( $ i ) ; call_user_func ( $ callback , $ this -> getLine ( $ i ) , $ i , $ this ) ; } }
Calls the given callback for each line in Text.

@param callable $callback

@throws InvalidArgumentException if $callback is not callable
Calls the given callback for each line in Text .