Skip to content

Commit

Permalink
Move directory processing back into guides
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio committed Jan 24, 2022
1 parent bd398ea commit 4c31809
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

declare(strict_types=1);

namespace phpDocumentor\Guides;
namespace phpDocumentor\Guides\Handlers;

use League\Flysystem\FilesystemInterface;
use phpDocumentor\Descriptor\GuideSetDescriptor;

final class ParseDirectoryCommand
{
Expand All @@ -15,22 +14,16 @@ final class ParseDirectoryCommand
/** @var string */
private $directory;

/** @var GuideSetDescriptor */
private $documentationSet;
private string $inputFormat;

public function __construct(
GuideSetDescriptor $documentationSet,
FilesystemInterface $origin,
string $directory
string $directory,
string $inputFormat
) {
$this->origin = $origin;
$this->directory = $directory;
$this->documentationSet = $documentationSet;
}

public function getDocumentationSet(): GuideSetDescriptor
{
return $this->documentationSet;
$this->inputFormat = $inputFormat;
}

public function getOrigin(): FilesystemInterface
Expand All @@ -42,4 +35,9 @@ public function getDirectory(): string
{
return $this->directory;
}

public function getInputFormat(): string
{
return $this->inputFormat;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use League\Flysystem\FilesystemInterface;
use League\Tactician\CommandBus;
use phpDocumentor\Guides\FileCollector;
use phpDocumentor\Guides\ParseDirectoryCommand;

use function sprintf;

Expand All @@ -27,8 +26,7 @@ public function handle(ParseDirectoryCommand $command): void
{
$origin = $command->getOrigin();
$currentDirectory = $command->getDirectory();
$documentationSet = $command->getDocumentationSet();
$extension = $documentationSet->getInputFormat();
$extension = $command->getInputFormat();
$nameOfIndexFile = 'index';

$this->guardThatAnIndexFileExists(
Expand Down
4 changes: 2 additions & 2 deletions src/phpDocumentor/Pipeline/Stage/Parser/ParseGuides.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use phpDocumentor\Descriptor\GuideSetDescriptor;
use phpDocumentor\Guides\DocumentCollector;
use phpDocumentor\Guides\Event\PostParseDocument;
use phpDocumentor\Guides\Handlers\ParseDirectoryCommand;
use phpDocumentor\Guides\Metas;
use phpDocumentor\Guides\ParseDirectoryCommand;
use phpDocumentor\Parser\FlySystemFactory;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
Expand Down Expand Up @@ -91,7 +91,7 @@ public function __invoke(Payload $payload): Payload

$this->eventDispatcher->addListener(PostParseDocument::class, $listener);
$this->commandBus->handle(
new ParseDirectoryCommand($guideDocumentationSet, $origin, $sourcePath)
new ParseDirectoryCommand($origin, $sourcePath, $guideDocumentationSet->getInputFormat())
);
$this->eventDispatcher->removeListener(PostParseDocument::class, $listener);

Expand Down

0 comments on commit 4c31809

Please sign in to comment.