From e1763bb1c3fb9167a9a39acdf73328691e825c2b Mon Sep 17 00:00:00 2001 From: calvinalkan Date: Fri, 16 Apr 2021 19:55:46 -0500 Subject: [PATCH] Add two new methods and rename the interface --- ...tainerAdapter.php => ContainerAdapter.php} | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) rename contracts/{SniccoContainerAdapter.php => ContainerAdapter.php} (56%) diff --git a/contracts/SniccoContainerAdapter.php b/contracts/ContainerAdapter.php similarity index 56% rename from contracts/SniccoContainerAdapter.php rename to contracts/ContainerAdapter.php index 117ab7c..e887b7b 100644 --- a/contracts/SniccoContainerAdapter.php +++ b/contracts/ContainerAdapter.php @@ -3,8 +3,9 @@ namespace Contracts; use ArrayAccess; - - interface SniccoContainerAdapter extends ArrayAccess { + use Closure; + + interface ContainerAdapter extends ArrayAccess { /** * Resolves the given type from the container. @@ -45,5 +46,25 @@ public function instance($abstract, $instance); * @return mixed */ public function call ( $callable , array $parameters = [] ); - + + /** + * Register a binding with the container. + * This will not be a singleton but a new object everytime it gets resolved. + * + * @param string $abstract + * @param Closure|string|null $concrete + * @return void + */ + public function bind( $abstract, $concrete ); + + /** + * Register a shared binding in the container. + * This object will be a singleton always + * + * @param string $abstract + * @param Closure|string|null $concrete + * @return void + */ + public function singleton($abstract, $concrete ); + } \ No newline at end of file