DotsUnited\BundleFu\Factory::createBundle PHP Method

createBundle() public method

Create a Bundle instance.
public createBundle ( string | array $options = null ) : Bundle
$options string | array An array of options or a bundle name as string
return Bundle
    public function createBundle($options = null)
    {
        if (!is_array($options)) {
            if (null !== $options) {
                $options = array('name' => $options);
            } else {
                $options = array();
            }
        }
        $options = array_merge($this->options, $options);
        if (isset($options['css_filter']) && is_string($options['css_filter'])) {
            $options['css_filter'] = $this->getFilter($options['css_filter']);
        }
        if (isset($options['js_filter']) && is_string($options['js_filter'])) {
            $options['js_filter'] = $this->getFilter($options['js_filter']);
        }
        return new Bundle($options);
    }

Usage Example

Ejemplo n.º 1
0
 public function testCreateBundleAcceptsStringArgument()
 {
     $factory = new Factory(array('name' => 'foo'));
     $bundle = $factory->createBundle('bar');
     $this->assertEquals('bar', $bundle->getName());
 }