1.x
- Basic implementation of plugin initializer
- docs: improve documentation
- docs: improve API method documentation
- chore: improve composer package definition and readme
- feat(wip): allow private hooks calls
- improve into wp-hook and some additional unfinished things
- feat: moving toward actual implementation
- refactor: hookable driver should belong to separate package
- refactor: HookProvider also belongs to another package
- refactor: remove PluginHeaderData
- feat: add VERY simple command to cache plugin data
- refactor: rename header parser implementation
- refactor: simplify package
- refactor: remove unused tests
- chore: add static analysis
- feat: add initial bindings for wp-builder compatibility
- chore: add editorconfig
- fix: passthrough container definitions argument
- fix: use absolute cache path
- fix: don't use hook and global variable
- refactor: remove method, which can be replaced with get_path
- refactor: reorder definition loading, change config key name
- fix: correct cache path
- feat: add hook driver backward compatible with wp-builder
- fix: throw exception on failed load
- feat: add check for optional package
- chore: add config files
- feat: large rework, needs followup
Merge request reports
Activity
assigned to @marcinkolanko
added 11 commits
- 3de0152f - 1 earlier commit
- 2f91df31 - refactor: simplify creation of ArrayBindingLoader
- ea490813 - fix: skip ., .. path when scanning directory
- 97dfd42e - feat: expose additional bindings through extensions
- b33d5e9f - docs: document current configuration and prefixing process
- 5f773348 - refactor: favor NullObject pattern, instead of exception
- cc5ffff6 - tests: update test name
- b0dd9219 - test: add Path tests
- a72ecab5 - refactor: extract common method for definition creation
- 5dfee549 - refactor: minor fixes and improvements
- f1cd022a - test: update binding loader test
Toggle commit listadded 2 commits
added 1 commit
- ef3e3ace - refactor: remove "binder", follow the spirit of wp-builder and "hookable"
added 1 commit
- 495d715f - refactor: remove "binder", follow the spirit of wp-builder and "hookable"
added 6 commits
- 5775f80f - refactor: rename loader to filesystem definitions
- 1c8cef19 - refactor: simplify driver name
- 6a09ab5c - refactor: remove unused imports
- 96934a31 - refactor: simplify definitions loader instantation
- 21716a64 - feat: manually discover, which extensions to enable
- 11f17f99 - feat: include default extensions in runtime
Toggle commit listadded 2 commits
- bin/wpinit 0 → 100755
1 #!/usr/bin/env php 2 <?php 3 4 use WPDesk\Init\Util\PhpFileDumper; 5 6 include $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php'; 7 8 $filename = $argv[1] ?? null; 9 10 $parser = new \WPDesk\Init\Plugin\DefaultHeaderParser(); 11 12 $data = $parser->parse( $filename ); - bin/wpinit 0 → 100755
1 #!/usr/bin/env php 2 <?php 3 4 use WPDesk\Init\Util\PhpFileDumper; 5 6 include $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php'; 7 8 $filename = $argv[1] ?? null; 9 10 $parser = new \WPDesk\Init\Plugin\DefaultHeaderParser(); 11 12 $data = $parser->parse( $filename ); 13 14 $dumper = new PhpFileDumper(); 15 $dumper->dump( $parser->parse( $filename ), $argv[2] ); - src/Binding/Binder/CallableBinder.php 0 → 100644
11 12 class CallableBinder implements Binder { 13 14 /** @var ContainerInterface */ 15 private $container; 16 17 public function __construct( ContainerInterface $c ) { 18 $this->container = $c; 19 } 20 21 public function can_bind( Definition $def ): bool { 22 return $def instanceof CallableDefinition; 23 } 24 25 public function bind( Definition $def ): void { 26 if ( $def instanceof CallableDefinition ) { changed this line in version 14 of the diff
11 12 /** @var ?string */ 13 private $hook; 14 15 /** @var callable */ 16 private $callable; 17 18 public function __construct( 19 callable $callable, 20 ?string $hook = null, 21 ) { 22 $this->callable = $callable; 23 $this->hook = $hook; 24 } 25 26 public function hook(): ?string { - src/Binding/Binder/CallableBinder.php 0 → 100644
15 private $container; 16 17 public function __construct( ContainerInterface $c ) { 18 $this->container = $c; 19 } 20 21 public function can_bind( Definition $def ): bool { 22 return $def instanceof CallableDefinition; 23 } 24 25 public function bind( Definition $def ): void { 26 if ( $def instanceof CallableDefinition ) { 27 $ref = new \ReflectionFunction( $def->value() ); 28 $parameters = []; 29 foreach ( $ref->getParameters() as $ref_param ) { 30 $parameters[] = $this->container->get( $ref_param->getType()->getName() ); Nie, potrzebne jest dokładniejsze sprawdzenie i rzucenie wyjątku, jeśli nie będzie typowanego argumentu. Dokumentacja na ten temat jest w
docs/configuration.md
,hook_resources_path
. Oczekiwany jest zawsze typowany parametr, i to zawsze jako nazwa klasy, przynajmniej w tej chwili, ale to trochę kruche.changed this line in version 14 of the diff
- src/Binding/Loader/ArrayBindingLoader.php 0 → 100644
13 private $bindings; 14 15 /** @var DefinitionFactory */ 16 private $factory; 17 18 public function __construct( array $bindings, ?DefinitionFactory $factory = null) { 19 $this->bindings = $bindings; 20 $this->factory = $factory ?? new DefinitionFactory(); 21 } 22 23 public function load(): iterable { 24 yield from $this->normalize( $this->bindings ); 25 } 26 27 private function normalize( $bindings ) { 28 $normalized = []; changed this line in version 13 of the diff
- src/Binding/Loader/ArrayBindingLoader.php 0 → 100644
12 /** @var array */ 13 private $bindings; 14 15 /** @var DefinitionFactory */ 16 private $factory; 17 18 public function __construct( array $bindings, ?DefinitionFactory $factory = null) { 19 $this->bindings = $bindings; 20 $this->factory = $factory ?? new DefinitionFactory(); 21 } 22 23 public function load(): iterable { 24 yield from $this->normalize( $this->bindings ); 25 } 26 27 private function normalize( $bindings ) { a tu mozna dać typ zwracanych danych i typ przyjętego argumentu
Edited by Marcin Kolankochanged this line in version 13 of the diff
- src/Binding/Loader/ArrayBindingLoader.php 0 → 100644
25 } 26 27 private function normalize( $bindings ) { 28 $normalized = []; 29 foreach ( $bindings as $key => $value ) { 30 if ( is_array( $value ) ) { 31 foreach ( $value as $unit ) { 32 yield $this->create( $unit, $key ); 33 } 34 } else { 35 yield $this->create( $value, $key ); 36 } 37 } 38 } 39 40 private function create( $value, $hook ) { changed this line in version 13 of the diff
Please register or sign in to reply