Skip to content

Commit

Permalink
this is kind of janky...but at least more isolated now
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuggins committed Jul 12, 2020
1 parent 6bd9545 commit e21d6ff
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/PathGetters/FilePath.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace OpenOnMake\PathGetters;

use OpenOnMake\File;
use OpenOnMake\CommandInfo;
use OpenOnMake\PathGetters\PathForTestCommand;
use OpenOnMake\PathGetters\PathForCommandCommand;
use OpenOnMake\PathGetters\PathForFactoryCommand;

class FilePath
{
private $file;

public function __construct(File $file)
{
$this->file = $file;
}

public function determine(CommandInfo $commandInfo)
{
if ($commandInfo->isTestCommand()) {
return (new PathForTestCommand($this->file))->handle($commandInfo);
} elseif ($commandInfo->isFactoryCommand()) {
return (new PathForFactoryCommand($this->file))->handle($commandInfo);
} elseif ($commandInfo->isCommandCommand()) {
return (new PathForCommandCommand($this->file))->handle($commandInfo);
}
return $this->file->find($this->file->filename($commandInfo->getCommandString(), $commandInfo->getArgName()));
}
}

0 comments on commit e21d6ff

Please sign in to comment.