src/GeneratorCollection.php
public function when($value, callable $callback): CollectionInterface
    {
        if ($value) {
            $this->generator = $callback($this)->generator;
        }

        return $this;
    }
public function when($value, callable $callback): CollectionInterface
    {
        if ($value) {
            $this->generator = $callback($this)->generator;
        }

        return $this;
    }
public function when ( $ value , callable $ callback ) : CollectionInterface { if ( $ value ) { $ this -> generator = $ callback ( $ this ) -> generator ; } return $ this ; }
Apply the callback if the value is truthy.

@param  bool $value
@param  callable $callback
@return mixed
Apply the callback if the value is truthy .