- array_walk: documentation ( source)
<?php
namespace Ettore;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
class Ettore {
public static function fromServiceProviders(array $providers) : Ettore {
$pimple = new Container();
array_walk($providers, function(ServiceProviderInterface $provider, $i, Container $pimple) {
$pimple->register($provider);
}, $pimple);
return new static(new App\App(new App\ServiceContainer($pimple)));
}
public function test() {
echo 'Ok';
}
}
$e = new Ettore();
$e->test();