-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename interface injector, add containerfactory
- Loading branch information
Showing
8 changed files
with
108 additions
and
57 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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Viloveul\Container; | ||
|
||
use Viloveul\Container\Container; | ||
use Viloveul\Container\Contracts\Container as IContainer; | ||
use Viloveul\Container\Contracts\ContainerFactory as IContainerFactory; | ||
|
||
class ContainerFactory implements IContainerFactory | ||
{ | ||
/** | ||
* @param array $definitions | ||
* @return mixed | ||
*/ | ||
public static function instance(array $definitions = []): IContainer | ||
{ | ||
$container = Container::getInstance(); | ||
foreach ($definitions as $key => $value) { | ||
$container->set($key, $value); | ||
} | ||
return $container; | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Viloveul\Container\Contracts; | ||
|
||
use Viloveul\Container\Contracts\Container; | ||
|
||
interface ContainerFactory | ||
{ | ||
/** | ||
* @param array $definitions | ||
*/ | ||
public static function instance(array $definitions = []): Container; | ||
} |