-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed commented code and replaced Container::resolve_service to Con…
…tainer::get
- Loading branch information
Showing
2 changed files
with
3 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: [email protected] | ||
* 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; | ||
} | ||
|
||
|