-
-
Notifications
You must be signed in to change notification settings - Fork 311
/
Entry.php
49 lines (44 loc) · 1.12 KB
/
Entry.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* PHP-DI
*
* @link http://mnapoli.github.io/PHP-DI/
* @copyright Matthieu Napoli (http://mnapoli.fr/)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/
namespace DI;
use DI\Definition\EntryReference;
use DI\DefinitionHelper\CallableDefinitionHelper;
use DI\DefinitionHelper\ObjectDefinitionHelper;
/**
* Helps defining a container entry.
*
* @author Matthieu Napoli <matthieu@mnapoli.fr>
*/
class Entry
{
/**
* @param string|null $className
* @return ObjectDefinitionHelper
*/
public static function object($className = null)
{
return new ObjectDefinitionHelper($className);
}
/**
* @param string $entryName
* @return EntryReference
*/
public static function link($entryName)
{
return new EntryReference($entryName);
}
/**
* @param string|callable $callable Can be either the name of a static method, or a callable
* @return CallableDefinitionHelper
*/
public static function factory(callable $callable)
{
return new CallableDefinitionHelper($callable);
}
}