/** * @expectedException UnexpectedValueException */ public function testSelfDependencyThrowsAnException() { $sorter = new DependencySorter(); $sorter->add('foo/bar', array('foo/bar')); $sorter->sort(); }
/** * Sorts all registered extensions by their dependencies. * * @return void */ public function sortExtensions() { $sorter = new DependencySorter(); foreach ($this->all() as $extension) { $sorter->add($extension->getSlug(), $extension->getDependencies()); } $extensions = array(); foreach ($sorter->sort() as $slug) { $extensions[$slug] = $this->items[$slug]; } $this->items = $extensions; unset($extensions); }