diff --git a/src/BuildDirector/LegacyBuildDirector.php b/src/BuildDirector/LegacyBuildDirector.php new file mode 100644 index 0000000000000000000000000000000000000000..5fdae463ca075361c28743a1901515db0a868eb0 --- /dev/null +++ b/src/BuildDirector/LegacyBuildDirector.php @@ -0,0 +1,28 @@ +<?php + +namespace WPDesk\PluginBuilder\BuildDirector; + +use WPDesk\PluginBuilder\Builder\AbstractBuilder; +use WPDesk\PluginBuilder\Plugin\AbstractPlugin; + +class LegacyBuildDirector { + /** @var AbstractBuilder */ + private $builder; + + public function __construct(AbstractBuilder $builder) { + $this->builder = $builder; + } + + public function buildPlugin() { + $this->builder->build_plugin(); + $this->builder->init_plugin(); + $this->builder->store_plugin(); + } + + /** + * @return AbstractPlugin + */ + public function getPlugin() { + return $this->builder->get_plugin(); + } +} \ No newline at end of file diff --git a/src/Builder/AbstractBuilder.php b/src/Builder/AbstractBuilder.php index 16c0ec442d2e1d3d215d2c1c3a3e2c66ae4daadd..ef1a4ead500ff91daa08974cab9ff72e7fccd828 100644 --- a/src/Builder/AbstractBuilder.php +++ b/src/Builder/AbstractBuilder.php @@ -2,7 +2,9 @@ namespace WPDesk\PluginBuilder\Builder; -class AbstractBuilder { +use WPDesk\PluginBuilder\Plugin\AbstractPlugin; + +abstract class AbstractBuilder { /** * Create plugin class */ @@ -23,9 +25,9 @@ class AbstractBuilder { /** * Return built plugin + * @return AbstractPlugin */ - public function get_plugin() { - } + abstract function get_plugin(); /** * Set settings class in plugin diff --git a/src/Plugin/Exception/ClassAlreadyExists.php b/src/Plugin/Exception/ClassAlreadyExists.php deleted file mode 100644 index 7d05c469537358416c90d1ab1985fc2a2a2bd573..0000000000000000000000000000000000000000 --- a/src/Plugin/Exception/ClassAlreadyExists.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -namespace WPDesk\PluginBuilder\Plugin\Exception; - -class ClassAlreadyExists extends \RuntimeException -{ - -} \ No newline at end of file diff --git a/src/Plugin/Exception/ClassNotExists.php b/src/Plugin/Exception/ClassNotExists.php deleted file mode 100644 index a10987b2b3d52b178cf1eda30d56e7d5abd3f99d..0000000000000000000000000000000000000000 --- a/src/Plugin/Exception/ClassNotExists.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -namespace WPDesk\PluginBuilder\Plugin\Exception; - -class ClassNotExists extends \RuntimeException -{ - -} \ No newline at end of file