for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Borobudur-Kernel package.
*
* (c) Hexacodelabs <http://hexacodelabs.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Borobudur\Kernel\Bundling;
use Borobudur\Kernel\Exception\RuntimeException;
/**
* @author Iqbal Maulana <[email protected]>
* @created 8/17/15
class BundleManager
{
* @var array
private $bundles = array();
* Add bundles.
* @param BundleInterface[] $bundles
public function add(array $bundles)
foreach($bundles as $bundle) {
$this->set($bundle);
}
* Set bundle.
* @param BundleInterface $bundle
public function set(BundleInterface $bundle) {
$name = $bundle->getName();
if (isset($this->bundles[$name])) {
throw new RuntimeException(sprintf('Bundle with name "%s" already registered.', $name));
$this->bundles[$name] = $bundle;
* Get registered bundle by name.
* @param string $name
* @return BundleInterface|null
public function get($name)
return $this->bundles[$name];
return null;
* Get all bundles.
* @return BundleInterface[]
public function all()
return $this->bundles;