|
1 | 1 | <?php |
2 | 2 |
|
| 3 | +use function DI\create; |
3 | 4 | use function DI\factory; |
4 | 5 | use function DI\object; |
5 | | -use Interop\Container\ContainerInterface; |
| 6 | +use Psr\Container\ContainerInterface; |
6 | 7 | use PhpParser\Parser; |
7 | 8 | use PhpSchool\LearnYouPhp\Exercise\ArrayWeGo; |
8 | 9 | use PhpSchool\LearnYouPhp\Exercise\BabySteps; |
|
22 | 23 |
|
23 | 24 | return [ |
24 | 25 | //Exercises |
25 | | - BabySteps::class => object(BabySteps::class), |
26 | | - HelloWorld::class => object(HelloWorld::class), |
27 | | - HttpJsonApi::class => object(HttpJsonApi::class), |
| 26 | + BabySteps::class => create(BabySteps::class), |
| 27 | + HelloWorld::class => create(HelloWorld::class), |
| 28 | + HttpJsonApi::class => create(HttpJsonApi::class), |
28 | 29 | MyFirstIo::class => factory(function (ContainerInterface $c) { |
29 | 30 | return new MyFirstIo($c->get(Filesystem::class), FakerFactory::create()); |
30 | 31 | }), |
|
34 | 35 | ConcernedAboutSeparation::class => factory(function (ContainerInterface $c) { |
35 | 36 | return new ConcernedAboutSeparation( |
36 | 37 | $c->get(Filesystem::class), |
37 | | - FakerFactory::create(), |
38 | 38 | $c->get(Parser::class) |
39 | 39 | ); |
40 | 40 | }), |
|
57 | 57 | 'eventListeners' => [ |
58 | 58 | 'create-solution-for-first-exercise' => [ |
59 | 59 | 'exercise.selected.hello-world' => [ |
60 | | - function () { |
61 | | - if (!file_exists('hello-world.php')) { |
62 | | - touch('hello-world.php'); |
| 60 | + DI\value(function () { |
| 61 | + if (!file_exists(getcwd() . '/hello-world.php')) { |
| 62 | + touch(getcwd() . '/hello-world.php'); |
63 | 63 | } |
64 | | - } |
| 64 | + }) |
65 | 65 | ] |
66 | 66 | ] |
67 | 67 | ] |
|
0 commit comments