Skip to content

Commit c4f37f7

Browse files
committed
[FEATURE] Load data from composer.json if present
Load data like description, support links, composer name etc from the composer.json if one is found.
1 parent 47d7f05 commit c4f37f7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Command/Run.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use phpDocumentor\Guides\Event\PostCollectFilesForParsingEvent;
1717
use phpDocumentor\Guides\Event\PostParseDocument;
1818
use phpDocumentor\Guides\Event\PostParseProcess;
19+
use phpDocumentor\Guides\Event\PostProjectNodeCreated;
1920
use phpDocumentor\Guides\Event\PostRenderDocument;
2021
use phpDocumentor\Guides\Event\PostRenderProcess;
2122
use phpDocumentor\Guides\Event\PreParseDocument;
@@ -41,6 +42,7 @@
4142
use Symfony\Component\EventDispatcher\EventDispatcher;
4243

4344
use function array_pop;
45+
use function assert;
4446
use function count;
4547
use function getcwd;
4648
use function implode;
@@ -199,7 +201,7 @@ static function (PostRenderProcess $event) use ($renderingProgressBar, $renderin
199201
);
200202
}
201203

202-
private function getSettingsOverridenWithInput(InputInterface $input): ProjectSettings
204+
private function getSettingsOverriddenWithInput(InputInterface $input): ProjectSettings
203205
{
204206
$settings = $this->settingsManager->getProjectSettings();
205207

@@ -249,7 +251,7 @@ private function getSettingsOverridenWithInput(InputInterface $input): ProjectSe
249251

250252
protected function execute(InputInterface $input, OutputInterface $output): int
251253
{
252-
$settings = $this->getSettingsOverridenWithInput($input);
254+
$settings = $this->getSettingsOverriddenWithInput($input);
253255
$inputDir = $this->getAbsolutePath($settings->getInput());
254256
if (!is_dir($inputDir)) {
255257
throw new RuntimeException(sprintf('Input directory "%s" was not found! ' . "\n" .
@@ -264,6 +266,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
264266
$this->clock->now(),
265267
);
266268

269+
$event = new PostProjectNodeCreated($projectNode, $settings);
270+
$event = $this->eventDispatcher->dispatch($event);
271+
assert($event instanceof PostProjectNodeCreated);
272+
$projectNode = $event->getProjectNode();
273+
$settings = $event->getSettings();
274+
267275
$outputDir = $this->getAbsolutePath($settings->getOutput());
268276
$sourceFileSystem = new Filesystem(new Local($settings->getInput()));
269277
$sourceFileSystem->addPlugin(new Finder());

0 commit comments

Comments
 (0)