-
-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from ajcastro/refactor
Separate the concern of getting groupedEndpoints by creating different strategies
- Loading branch information
Showing
5 changed files
with
359 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Knuckles\Scribe\GroupedEndpoints; | ||
|
||
interface GroupedEndpointsContract | ||
{ | ||
public function get(): array; | ||
|
||
public function hasEncounteredErrors(): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Knuckles\Scribe\GroupedEndpoints; | ||
|
||
use Knuckles\Camel\Camel; | ||
use Knuckles\Scribe\Commands\GenerateDocumentation; | ||
use Knuckles\Scribe\Matching\RouteMatcherInterface; | ||
|
||
class GroupedEndpointsFactory | ||
{ | ||
public static function make(GenerateDocumentation $command, RouteMatcherInterface $routeMatcher): GroupedEndpointsContract | ||
{ | ||
if ($command->isForcing()) { | ||
return new GroupedEndpointsFromApp($command, $routeMatcher, false); | ||
} | ||
|
||
if ($command->shouldExtract()) { | ||
return new GroupedEndpointsFromApp($command, $routeMatcher, true); | ||
} | ||
|
||
return new GroupedEndpointsFromCamelDir; | ||
} | ||
} |
Oops, something went wrong.