diff --git a/README.md b/README.md index 84e487b..13bbe09 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,8 @@ $container->set('config.', ['one', 'two, 'three']); - [ ] Add ability creating new instance of service every time - [ ] Add supporting Code Driven IoC - [ ] Add singleton getting for Container +- [ ] Add descriptions in the code for functions. +- [ ] Set definitions via constuctor - [ ] Add `remove` method? - [ ] Integrate CI - [ ] Add badges with tests passed diff --git a/src/Container.php b/src/Container.php index fdb39e5..82f9fc5 100644 --- a/src/Container.php +++ b/src/Container.php @@ -3,11 +3,11 @@ * Simple PHP DI Container (DIC) for WordPress with auto-wiring allows * you easily use it in your plugins and themes. * - * @version 0.2 * Author: Andrei Pisarevskii * Author Email: renakdup@gmail.com * Author Site: https://wp-yoda.com/en/ * + * Version: 0.2 * Source Code: https://github.com/renakdup/simple-wordpress-dic * * Licence: MIT License @@ -75,26 +75,16 @@ interface NotFoundExceptionInterface extends ContainerExceptionInterface {} class Container implements ContainerInterface { protected array $services = []; -// protected array $resolved_services = []; - public function set( string $id, $service ): void { $this->services[ $id ] = $service; -// unset( $this->resolved_services[ $id ] ); } /** * {@inheritdoc} */ public function get( string $id ) { -// if ( isset( $this->resolved_services[ $id ] ) || array_key_exists( $id, $this->resolved_services ) ) { -// return $this->resolved_services[ $id ]; -// } - - $resolved_service = $this->resolve_service( $this->has( $id ) ? $this->services[ $id ] : $id ); -// $this->resolved_services[ $id ] = $resolved_service; - return $resolved_service; }