PHP code example of nassau / registry-compiler
1. Go to this page and download the library: Download nassau/registry-compiler library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nassau / registry-compiler example snippets
# somewhere inside AcmeBundle.php
public function build(ContainerBuilder $container)
{
(new RegistryCompilerPass)->register($container);
}
interface FooBarInterface {
public function makeFooBar($input);
}
class ChainFooBar implements FooBarInterface {
/** @var FooBarInterface[] **/
private $collection = [];
public function addFooBar($name, FooBarInterface $fooBar) {
$this->collection[$name] = $fooBar;
}
public function makeFooBar($input) {
foreach ($this->collection as $fooBar) {
$fooBar->makeFooBar($input);
}
}
}