Skip to content
Snippets Groups Projects

more like builder pattern

Merged Krzysztof Dyszczyk requested to merge feature/builder-pattern into devel
6 files
+ 101
40
Compare changes
  • Side-by-side
  • Inline

Files

+ 7
23
@@ -2,32 +2,16 @@
namespace WPDesk\PluginBuilder\Builder;
use WPDesk\PluginBuilder\Plugin\AbstractPlugin;
class AbstractBuilder {
protected static $instances = [];
public function build() {
}
public function store_plugin() {
}
/**
* @param string $class
* @param AbstractPlugin $object
*/
protected function addToStorage( $class, $object ) {
if ( isset( self::$instances[ $class ] ) ) {
throw new Exception\ClassAlreadyExists( "Class {$class} already exists" );
}
self::$instances[ $class ] = $object;
public function init_plugin() {
}
/**
* @param string $class
*
* @return AbstractPlugin
*/
protected function getFromStorage( $class ) {
if ( isset( self::$instances[ $class ] ) ) {
return self::$instances[ $class ];
} else {
throw new Exception\ClassNotExists( "Class {$class} not exists in storage" );
}
public function get_plugin() {
}
}
\ No newline at end of file
Loading