From cb980bcf0176815d4bcb537bf8e780ff1fc21fe1 Mon Sep 17 00:00:00 2001 From: Simon Dann Date: Wed, 15 Aug 2018 23:41:50 +0100 Subject: [PATCH] Added interface for #315 --- .../Generators/ContentGeneratorFactory.php | 7 ++-- src/Modules/Generators/GeneratorInterface.php | 34 +++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 src/Modules/Generators/GeneratorInterface.php diff --git a/src/Modules/Generators/ContentGeneratorFactory.php b/src/Modules/Generators/ContentGeneratorFactory.php index 4acc12e..309fd8c 100644 --- a/src/Modules/Generators/ContentGeneratorFactory.php +++ b/src/Modules/Generators/ContentGeneratorFactory.php @@ -2,7 +2,6 @@ namespace Tapestry\Modules\Generators; -use Tapestry\Entities\Generators\FileGenerator; use Tapestry\Entities\Project; use Tapestry\Modules\Source\AbstractSource; @@ -19,7 +18,7 @@ class ContentGeneratorFactory /** * Registered item stack. * - * @var array|FileGenerator[] + * @var string[] */ private $items = []; @@ -62,9 +61,9 @@ public function add(string $class) * * @param string $name * @param AbstractSource $file - * @return FileGenerator + * @return GeneratorInterface */ - public function get(string $name, AbstractSource $file): FileGenerator + public function get(string $name, AbstractSource $file): GeneratorInterface { // @todo register new FileGenerator with the graph for #315 return new $this->items[$name]($file); diff --git a/src/Modules/Generators/GeneratorInterface.php b/src/Modules/Generators/GeneratorInterface.php new file mode 100644 index 0000000..e577d05 --- /dev/null +++ b/src/Modules/Generators/GeneratorInterface.php @@ -0,0 +1,34 @@ +