Skip to content

Commit 1db0381

Browse files
committed
small updates
1 parent 3c5a24e commit 1db0381

File tree

4 files changed

+36
-34
lines changed

4 files changed

+36
-34
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ thumbs.db
88
.settings
99
.idea
1010
composer.lock
11-
composer.phar
12-
vendor/*
11+
vendor/*

composer.json

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
{
2-
"name": "frostealth/php-container",
3-
"description": "PHP Container",
4-
"keywords": ["di", "container"],
5-
"license": "MIT",
6-
"authors": [
7-
{
8-
"name": "Kudinov Ivan",
9-
"email": "frostealth@gmail.com",
10-
"role": "Developer"
11-
}
12-
],
13-
"autoload": {
14-
"psr-4": {
15-
"frostealth\\": "src/"
16-
}
17-
},
18-
"require": {
19-
"php": ">=5.4.0",
20-
"frostealth/php-data-storage": "1.0.*"
21-
},
22-
"autoload-dev": {
23-
"psr-4": {
24-
"frostealth\\Container\\tests\\": "tests/"
25-
}
26-
},
27-
"require-dev": {
28-
"phpunit/phpunit": "4.2.*"
2+
"name": "frostealth/php-container",
3+
"description": "PHP Container",
4+
"keywords": [
5+
"di",
6+
"container"
7+
],
8+
"license": "MIT",
9+
"authors": [
10+
{
11+
"name": "Ivan Kudinov",
12+
"email": "frostealth@gmail.com",
13+
"homepage": "http://frostealth.ru"
2914
}
15+
],
16+
"autoload": {
17+
"psr-4": {
18+
"frostealth\\": "src/"
19+
}
20+
},
21+
"require": {
22+
"php": ">=5.4.0",
23+
"frostealth/php-data-storage": "1.0.*"
24+
},
25+
"autoload-dev": {
26+
"psr-4": {
27+
"frostealth\\Tests\\Container\\": "tests/"
28+
}
29+
},
30+
"require-dev": {
31+
"phpunit/phpunit": "4.2.*"
32+
}
3033
}

src/Container/Container.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function get($name)
2828
{
2929
$value = $this->storage->get($name);
3030
if (is_callable($value)) {
31-
$value = $value($this);
31+
$value = call_user_func($value, $this);
3232
}
3333

3434
return $value;
@@ -65,13 +65,13 @@ public function remove($name)
6565
* @param string $name
6666
* @param callable $callable
6767
*/
68-
public function singleton($name, \Closure $callable)
68+
public function singleton($name, callable $callable)
6969
{
7070
$this->storage->set($name, function () use ($callable) {
7171
static $instance = null;
7272

7373
if ($instance === null) {
74-
$instance = $callable($this);
74+
$instance = call_user_func($callable, $this);
7575
}
7676

7777
return $instance;

tests/ContainerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace frostealth\Container\tests;
3+
namespace frostealth\Tests\Container;
44

55
use frostealth\Container\Container;
66

77
/**
88
* Class ContainerTest
99
*
10-
* @package frostealth\ContainerTest\tests
10+
* @package frostealth\Tests\Container
1111
*/
1212
class ContainerTest extends \PHPUnit_Framework_TestCase
1313
{

0 commit comments

Comments
 (0)