commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / vendor / symfony / dependency-injection / Symfony / Component / DependencyInjection / ContainerInterface.php
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\DependencyInjection;
13
14 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
15 use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
16 use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
17
18 /**
19 * ContainerInterface is the interface implemented by service container classes.
20 *
21 * @author Fabien Potencier <fabien@symfony.com>
22 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
23 */
24 interface ContainerInterface
25 {
26 const EXCEPTION_ON_INVALID_REFERENCE = 1;
27 const NULL_ON_INVALID_REFERENCE = 2;
28 const IGNORE_ON_INVALID_REFERENCE = 3;
29 const SCOPE_CONTAINER = 'container';
30 const SCOPE_PROTOTYPE = 'prototype';
31
32 /**
33 * Sets a service.
34 *
35 * @param string $id The service identifier
36 * @param object $service The service instance
37 * @param string $scope The scope of the service
38 */
39 public function set($id, $service, $scope = self::SCOPE_CONTAINER);
40
41 /**
42 * Gets a service.
43 *
44 * @param string $id The service identifier
45 * @param int $invalidBehavior The behavior when the service does not exist
46 *
47 * @return object The associated service
48 *
49 * @throws ServiceCircularReferenceException When a circular reference is detected
50 * @throws ServiceNotFoundException When the service is not defined
51 *
52 * @see Reference
53 */
54 public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
55
56 /**
57 * Returns true if the given service is defined.
58 *
59 * @param string $id The service identifier
60 *
61 * @return bool true if the service is defined, false otherwise
62 */
63 public function has($id);
64
65 /**
66 * Gets a parameter.
67 *
68 * @param string $name The parameter name
69 *
70 * @return mixed The parameter value
71 *
72 * @throws InvalidArgumentException if the parameter is not defined
73 */
74 public function getParameter($name);
75
76 /**
77 * Checks if a parameter exists.
78 *
79 * @param string $name The parameter name
80 *
81 * @return bool The presence of parameter in container
82 */
83 public function hasParameter($name);
84
85 /**
86 * Sets a parameter.
87 *
88 * @param string $name The parameter name
89 * @param mixed $value The parameter value
90 */
91 public function setParameter($name, $value);
92
93 /**
94 * Enters the given scope.
95 *
96 * @param string $name
97 */
98 public function enterScope($name);
99
100 /**
101 * Leaves the current scope, and re-enters the parent scope.
102 *
103 * @param string $name
104 */
105 public function leaveScope($name);
106
107 /**
108 * Adds a scope to the container.
109 *
110 * @param ScopeInterface $scope
111 */
112 public function addScope(ScopeInterface $scope);
113
114 /**
115 * Whether this container has the given scope.
116 *
117 * @param string $name
118 *
119 * @return bool
120 */
121 public function hasScope($name);
122
123 /**
124 * Determines whether the given scope is currently active.
125 *
126 * It does however not check if the scope actually exists.
127 *
128 * @param string $name
129 *
130 * @return bool
131 */
132 public function isScopeActive($name);
133 }