DotsUnited\BundleFu\Bundle::end PHP Method

end() public method

End capturing and bundling current output.
public end ( array $options = [] ) : Bundle
$options array
return Bundle
    public function end(array $options = array())
    {
        if (null === $this->currentBundleOptions) {
            throw new \RuntimeException('end() is called without a start() call.');
        }
        $options = array_merge($this->currentBundleOptions, $options);
        $captured = ob_get_clean();
        if ($options['bypass']) {
            echo $captured;
        } else {
            $this->extractFiles($captured, $options['docroot']);
        }
        $this->currentBundleOptions = null;
        return $this;
    }

Usage Example

Beispiel #1
0
 public function testEndWithoutSettingDocRootFirstShouldThrowException()
 {
     $this->setExpectedException('\\RuntimeException', 'Please set a document root either with setDocRoot() or via runtime through bundle options.');
     $bundle = new Bundle();
     $bundle->start();
     $bundle->end();
 }