8000 Simplify api · symfony/symfony@a16511a · GitHub
[go: up one dir, main page]

Skip to content

Commit a16511a

Browse files
committed
Simplify api
1 parent 762cf0d commit a16511a

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

benchmark.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
require_once('vendor/autoload.php');
4+
5+
use Symfony\Component\Yaml\Yaml;
6+
7+
$yaml = file_get_contents('.travis.yml');
8+
9+
$time_start = microtime(true);
10+
11+
for ($i = 0 ; $i < 1000; $i++)
12+
{
13+
Yaml::parse($yaml);
14+
}
15+
16+
$time_end = microtime(true);
17+
$time = $time_end - $time_start;
18+
19+
echo 'Durée : '.$time.' secondes<br/>';

src/Symfony/Component/HttpKernel/Bundle/SimpleBundle.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ abstract class SimpleBundle extends Bundle implements ConfigurationInterface
3030
*/
3131
final public function getContainerExtension()
3232
{
33-
return new SimpleExtension($this, function (array $config, ContainerBuilder $container) {
34-
$this->buildContainer($config, $container);
35-
});
33+
return new SimpleExtension($this);
3634
}
3735

3836
/**
@@ -70,7 +68,9 @@ final class SimpleExtension extends Extension
7068
public function __construct(SimpleBundle $bundle, Closure $buildContainer)
7169
{
7270
$this->bundle = $bundle;
73-
$this->buildContainer = $buildContainer;
71+
$this->buildContainer = Closure::bind(function (array $config, ContainerBuilder $container) {
72+
$this->buildContainer($config, $container);
73+
}, $bundle, SimpleBundle::class]);
7474
}
7575

7676
/**

0 commit comments

Comments
 (0)
0