Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion app/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Colors\Color;
use PhpSchool\PhpWorkshop\Listener\InitialCodeListener;
use PhpSchool\PhpWorkshop\Logger\Logger;
use Psr\Log\LoggerInterface;
use function DI\create;
use function DI\factory;
use Kadet\Highlighter\KeyLighter;
Expand Down Expand Up @@ -84,7 +86,17 @@

return [
'appName' => basename($_SERVER['argv'][0]),
'phpschoolGlobalDir' => sprintf('%s/.php-school', getenv('HOME')),
'currentWorkingDirectory' => function (ContainerInterface $c) {
return getcwd();
},
WorkshopType::class => WorkshopType::STANDARD(),
Psr\Log\LoggerInterface::class => function (ContainerInterface $c) {
$appName = $c->get('appName');
$globalDir = $c->get('phpschoolGlobalDir');

return new Logger("$globalDir/logs/$appName.log");
},
ExerciseDispatcher::class => function (ContainerInterface $c) {
return new ExerciseDispatcher(
$c->get(RunnerManager::class),
Expand Down Expand Up @@ -203,7 +215,7 @@

//Listeners
InitialCodeListener::class => function (ContainerInterface $c) {
return new InitialCodeListener(getcwd());
return new InitialCodeListener($c->get('currentWorkingDirectory'), $c->get(LoggerInterface::class));
},
PrepareSolutionListener::class => create(),
CodePatchListener::class => function (ContainerInterface $c) {
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"myclabs/php-enum": "^1.4",
"php-school/keylighter": "^0.8.4",
"nikic/php-parser": "^4.0",
"guzzlehttp/guzzle": "^7.2"
"guzzlehttp/guzzle": "^7.2",
"psr/log": "^1.1"
},
"require-dev": {
"composer/composer": "^2.0",
Expand Down
Loading