Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #49 from xtreamwayz/feature/pimple-3-support
Browse files Browse the repository at this point in the history
Add Pimple 3 support
  • Loading branch information
weierophinney committed Dec 21, 2015
2 parents 2c45aa4 + f87bfe4 commit 4b2ded5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"zendframework/zend-servicemanager": "^2.5",
"ocramius/proxy-manager": "^1.0",
"aura/di": "3.0.*@beta",
"mouf/pimple-interop": "^1.0"
"xtreamwayz/pimple-container-interop": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
<?php

use Interop\Container\Pimple\PimpleInterop;
use Xtreamwayz\Pimple\Container;

// Load configuration
$config = require __DIR__ . '/config.php';

// Build container
$container = new PimpleInterop();
$container = new Container();

// Inject config
$container['config'] = $config;

// Inject factories
foreach ($config['dependencies']['factories'] as $name => $object) {
$container[$name] = $container->share(function ($c) use ($object) {
$container[$name] = function ($c) use ($object) {
$factory = new $object();
return $factory($c);
});
};
}

// Inject invokables
foreach ($config['dependencies']['invokables'] as $name => $object) {
$container[$name] = $container->share(function ($c) use ($object) {
$container[$name] = function ($c) use ($object) {
return new $object();
});
};
}

return $container;
10 changes: 5 additions & 5 deletions src/ExpressiveInstaller/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'packages' => [
'aura/di' => '3.0.*@beta',
'filp/whoops' => '^1.1',
'mouf/pimple-interop' => '^1.0',
'xtreamwayz/pimple-container-interop' => '^1.0',
'ocramius/proxy-manager' => '^1.0',
'zendframework/zend-expressive-aurarouter' => '^1.0',
'zendframework/zend-expressive-fastroute' => '^1.0',
Expand Down Expand Up @@ -91,15 +91,15 @@
],
],
2 => [
'name' => 'Pimple-interop',
'name' => 'Pimple',
'packages' => [
'mouf/pimple-interop',
'xtreamwayz/pimple-container-interop',
],
'copy-files' => [
'/Resources/config/container-pimple-interop.php' => '/config/container.php',
'/Resources/config/container-pimple.php' => '/config/container.php',
],
'minimal-files' => [
'/Resources/config/container-pimple-interop.php' => '/config/container.php',
'/Resources/config/container-pimple.php' => '/config/container.php',
],
],
3 => [
Expand Down
6 changes: 3 additions & 3 deletions test/ExpressiveInstallerTest/ContainersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Aura\Di\Container as AuraContainer;
use ExpressiveInstaller\OptionalPackages;
use Interop\Container\ContainerInterface;
use Interop\Container\Pimple\PimpleInterop as PimpleInteropContainer;
use Xtreamwayz\Pimple\Container as PimpleContainer;
use ReflectionProperty;
use Zend\Expressive;
use Zend\ServiceManager\ServiceManager as ZendServiceManagerContainer;
Expand Down Expand Up @@ -68,8 +68,8 @@ public function containerProvider()
return [
'aura-minimal' => [1, 2, 'minimal-files', 404, AuraContainer::class],
'aura-full' => [1, 2, 'copy-files', 200, AuraContainer::class],
'pimple-minimal' => [2, 2, 'minimal-files', 404, PimpleInteropContainer::class],
'pimple-full' => [2, 2, 'copy-files', 200, PimpleInteropContainer::class],
'pimple-minimal' => [2, 2, 'minimal-files', 404, PimpleContainer::class],
'pimple-full' => [2, 2, 'copy-files', 200, PimpleContainer::class],
'zend-sm-minimal' => [3, 2, 'minimal-files', 404, ZendServiceManagerContainer::class],
'zend-sm-full' => [3, 2, 'copy-files', 200, ZendServiceManagerContainer::class],
];
Expand Down

0 comments on commit 4b2ded5

Please sign in to comment.