2010-01-04 14:26:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2011-01-15 13:29:43 +00:00
|
|
|
* This file is part of the Symfony package.
|
2010-01-04 14:26:20 +00:00
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2010-01-04 14:26:20 +00:00
|
|
|
*
|
2011-01-15 13:29:43 +00:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2010-01-04 14:26:20 +00:00
|
|
|
*/
|
|
|
|
|
2011-01-15 13:29:43 +00:00
|
|
|
namespace Symfony\Component\DependencyInjection;
|
|
|
|
|
2011-11-30 13:11:00 +00:00
|
|
|
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
2011-12-04 23:51:22 +00:00
|
|
|
use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
|
2011-11-30 13:11:00 +00:00
|
|
|
|
2010-01-04 14:26:20 +00:00
|
|
|
/**
|
|
|
|
* Definition represents a service definition.
|
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-01-04 14:26:20 +00:00
|
|
|
*/
|
|
|
|
class Definition
|
|
|
|
{
|
2011-03-11 13:50:46 +00:00
|
|
|
private $class;
|
|
|
|
private $file;
|
|
|
|
private $factoryClass;
|
|
|
|
private $factoryMethod;
|
|
|
|
private $factoryService;
|
|
|
|
private $scope;
|
|
|
|
private $properties;
|
|
|
|
private $calls;
|
|
|
|
private $configurator;
|
|
|
|
private $tags;
|
|
|
|
private $public;
|
|
|
|
private $synthetic;
|
|
|
|
private $abstract;
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
protected $arguments;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* @param string $class The service class
|
|
|
|
* @param array $arguments An array of arguments to pass to the service constructor
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2010-07-04 17:56:48 +01:00
|
|
|
public function __construct($class = null, array $arguments = array())
|
2010-01-04 14:26:20 +00:00
|
|
|
{
|
2010-05-06 12:25:53 +01:00
|
|
|
$this->class = $class;
|
|
|
|
$this->arguments = $arguments;
|
|
|
|
$this->calls = array();
|
2011-01-17 22:28:59 +00:00
|
|
|
$this->scope = ContainerInterface::SCOPE_CONTAINER;
|
2010-08-05 06:34:53 +01:00
|
|
|
$this->tags = array();
|
2010-12-29 19:12:24 +00:00
|
|
|
$this->public = true;
|
2011-01-23 11:06:23 +00:00
|
|
|
$this->synthetic = false;
|
2011-01-26 23:14:31 +00:00
|
|
|
$this->abstract = false;
|
2011-03-04 14:26:00 +00:00
|
|
|
$this->properties = array();
|
2010-01-04 14:26:20 +00:00
|
|
|
}
|
|
|
|
|
2011-02-02 17:22:27 +00:00
|
|
|
/**
|
|
|
|
* Sets the name of the class that acts as a factory using the factory method,
|
|
|
|
* which will be invoked statically.
|
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $factoryClass The factory class name
|
2011-02-02 17:22:27 +00:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-02-02 17:22:27 +00:00
|
|
|
*/
|
|
|
|
public function setFactoryClass($factoryClass)
|
|
|
|
{
|
|
|
|
$this->factoryClass = $factoryClass;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the factory class.
|
|
|
|
*
|
|
|
|
* @return string The factory class name
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-02-02 17:22:27 +00:00
|
|
|
*/
|
|
|
|
public function getFactoryClass()
|
|
|
|
{
|
|
|
|
return $this->factoryClass;
|
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
2010-07-05 08:47:14 +01:00
|
|
|
* Sets the factory method able to create an instance of this class.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $factoryMethod The factory method name
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2011-02-02 17:22:27 +00:00
|
|
|
public function setFactoryMethod($factoryMethod)
|
2010-02-09 08:45:23 +00:00
|
|
|
{
|
2011-02-02 17:22:27 +00:00
|
|
|
$this->factoryMethod = $factoryMethod;
|
2010-05-06 12:25:53 +01:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-07-05 08:47:14 +01:00
|
|
|
* Gets the factory method.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2010-07-03 23:35:39 +01:00
|
|
|
* @return string The factory method name
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2010-07-05 08:47:14 +01:00
|
|
|
public function getFactoryMethod()
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2010-07-05 08:47:14 +01:00
|
|
|
return $this->factoryMethod;
|
2010-05-06 12:25:53 +01:00
|
|
|
}
|
|
|
|
|
2010-07-03 23:35:39 +01:00
|
|
|
/**
|
2011-02-02 17:22:27 +00:00
|
|
|
* Sets the name of the service that acts as a factory using the factory method.
|
2010-07-03 23:35:39 +01:00
|
|
|
*
|
2010-07-04 17:56:48 +01:00
|
|
|
* @param string $factoryService The factory service id
|
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-07-03 23:35:39 +01:00
|
|
|
*/
|
|
|
|
public function setFactoryService($factoryService)
|
|
|
|
{
|
|
|
|
$this->factoryService = $factoryService;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-07-04 17:56:48 +01:00
|
|
|
* Gets the factory service id.
|
2010-07-03 23:35:39 +01:00
|
|
|
*
|
2010-07-04 17:56:48 +01:00
|
|
|
* @return string The factory service id
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-07-03 23:35:39 +01:00
|
|
|
*/
|
2010-07-04 17:56:48 +01:00
|
|
|
public function getFactoryService()
|
2010-07-03 23:35:39 +01:00
|
|
|
{
|
2010-07-04 17:56:48 +01:00
|
|
|
return $this->factoryService;
|
2010-07-03 23:35:39 +01:00
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
|
|
|
* Sets the service class.
|
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $class The service class
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function setClass($class)
|
|
|
|
{
|
|
|
|
$this->class = $class;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-04-21 10:25:22 +01:00
|
|
|
* Gets the service class.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return string The service class
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function getClass()
|
|
|
|
{
|
|
|
|
return $this->class;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-07-05 08:47:14 +01:00
|
|
|
* Sets the arguments to pass to the service constructor/factory method.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param array $arguments An array of arguments
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function setArguments(array $arguments)
|
|
|
|
{
|
|
|
|
$this->arguments = $arguments;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2011-07-20 09:50:27 +01:00
|
|
|
/**
|
|
|
|
* @api
|
|
|
|
*/
|
2011-03-04 14:26:00 +00:00
|
|
|
public function setProperties(array $properties)
|
|
|
|
{
|
|
|
|
$this->properties = $properties;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2011-07-20 09:50:27 +01:00
|
|
|
/**
|
|
|
|
* @api
|
|
|
|
*/
|
2011-03-04 14:26:00 +00:00
|
|
|
public function getProperties()
|
|
|
|
{
|
|
|
|
return $this->properties;
|
|
|
|
}
|
|
|
|
|
2011-07-20 09:50:27 +01:00
|
|
|
/**
|
|
|
|
* @api
|
|
|
|
*/
|
2011-03-04 14:26:00 +00:00
|
|
|
public function setProperty($name, $value)
|
|
|
|
{
|
|
|
|
$this->properties[$name] = $value;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
2010-07-05 08:47:14 +01:00
|
|
|
* Adds an argument to pass to the service constructor/factory method.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param mixed $argument An argument
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function addArgument($argument)
|
|
|
|
{
|
|
|
|
$this->arguments[] = $argument;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2011-01-18 17:53:11 +00:00
|
|
|
/**
|
|
|
|
* Sets a specific argument
|
|
|
|
*
|
|
|
|
* @param integer $index
|
|
|
|
* @param mixed $argument
|
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-01-18 17:53:11 +00:00
|
|
|
*/
|
2011-04-19 22:29:10 +01:00
|
|
|
public function replaceArgument($index, $argument)
|
2011-01-18 17:53:11 +00:00
|
|
|
{
|
|
|
|
if ($index < 0 || $index > count($this->arguments) - 1) {
|
2011-12-04 23:51:22 +00:00
|
|
|
throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1));
|
2011-01-18 17:53:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->arguments[$index] = $argument;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
2010-07-05 08:47:14 +01:00
|
|
|
* Gets the arguments to pass to the service constructor/factory method.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return array The array of arguments
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function getArguments()
|
|
|
|
{
|
|
|
|
return $this->arguments;
|
|
|
|
}
|
|
|
|
|
2011-04-28 10:26:10 +01:00
|
|
|
/**
|
|
|
|
* Gets an argument to pass to the service constructor/factory method.
|
|
|
|
*
|
|
|
|
* @param integer $index
|
|
|
|
*
|
|
|
|
* @return mixed The argument value
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-04-28 10:26:10 +01:00
|
|
|
*/
|
|
|
|
public function getArgument($index)
|
|
|
|
{
|
|
|
|
if ($index < 0 || $index > count($this->arguments) - 1) {
|
2011-12-04 23:51:22 +00:00
|
|
|
throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1));
|
2011-04-28 10:26:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return $this->arguments[$index];
|
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
|
|
|
* Sets the methods to call after service initialization.
|
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param array $calls An array of method calls
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function setMethodCalls(array $calls = array())
|
|
|
|
{
|
|
|
|
$this->calls = array();
|
2010-05-07 15:09:11 +01:00
|
|
|
foreach ($calls as $call) {
|
2010-05-06 12:25:53 +01:00
|
|
|
$this->addMethodCall($call[0], $call[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a method to call after service initialization.
|
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $method The method name to call
|
|
|
|
* @param array $arguments An array of arguments to pass to the method call
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
2011-11-30 13:11:00 +00:00
|
|
|
* @throws InvalidArgumentException on empty $method param
|
|
|
|
*
|
2011-07-20 09:50:27 +01:00
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function addMethodCall($method, array $arguments = array())
|
|
|
|
{
|
2011-11-30 13:11:00 +00:00
|
|
|
if (empty($method)) {
|
|
|
|
throw new InvalidArgumentException(sprintf('Method name cannot be empty.'));
|
|
|
|
}
|
2010-05-06 12:25:53 +01:00
|
|
|
$this->calls[] = array($method, $arguments);
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2010-08-30 12:51:19 +01:00
|
|
|
/**
|
|
|
|
* Removes a method to call after service initialization.
|
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $method The method name to remove
|
2010-08-30 12:51:19 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-08-30 12:51:19 +01:00
|
|
|
*/
|
|
|
|
public function removeMethodCall($method)
|
|
|
|
{
|
|
|
|
foreach ($this->calls as $i => $call) {
|
|
|
|
if ($call[0] === $method) {
|
|
|
|
unset($this->calls[$i]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if the current definition has a given method to call after service initialization.
|
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $method The method name to search for
|
2010-08-30 12:51:19 +01:00
|
|
|
*
|
2011-01-21 01:39:28 +00:00
|
|
|
* @return Boolean
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-08-30 12:51:19 +01:00
|
|
|
*/
|
|
|
|
public function hasMethodCall($method)
|
|
|
|
{
|
2011-02-04 18:10:13 +00:00
|
|
|
foreach ($this->calls as $call) {
|
2010-08-30 12:51:19 +01:00
|
|
|
if ($call[0] === $method) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
|
|
|
* Gets the methods to call after service initialization.
|
|
|
|
*
|
|
|
|
* @return array An array of method calls
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function getMethodCalls()
|
|
|
|
{
|
|
|
|
return $this->calls;
|
|
|
|
}
|
|
|
|
|
2011-01-26 23:14:31 +00:00
|
|
|
/**
|
|
|
|
* Sets tags for this definition
|
|
|
|
*
|
|
|
|
* @param array $tags
|
|
|
|
*
|
|
|
|
* @return Definition the current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-01-26 23:14:31 +00:00
|
|
|
*/
|
|
|
|
public function setTags(array $tags)
|
|
|
|
{
|
|
|
|
$this->tags = $tags;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
2010-08-05 06:34:53 +01:00
|
|
|
* Returns all tags.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2010-08-05 06:34:53 +01:00
|
|
|
* @return array An array of tags
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2010-08-05 06:34:53 +01:00
|
|
|
public function getTags()
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2010-08-05 06:34:53 +01:00
|
|
|
return $this->tags;
|
2010-05-06 12:25:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-08-05 06:34:53 +01:00
|
|
|
* Gets a tag by name.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $name The tag name
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return array An array of attributes
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2010-08-05 06:34:53 +01:00
|
|
|
public function getTag($name)
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2011-01-05 13:42:38 +00:00
|
|
|
return isset($this->tags[$name]) ? $this->tags[$name] : array();
|
2010-05-06 12:25:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-08-05 06:34:53 +01:00
|
|
|
* Adds a tag for this definition.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $name The tag name
|
|
|
|
* @param array $attributes An array of attributes
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2010-08-05 06:34:53 +01:00
|
|
|
public function addTag($name, array $attributes = array())
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2010-08-05 06:34:53 +01:00
|
|
|
$this->tags[$name][] = $attributes;
|
2010-05-06 12:25:53 +01:00
|
|
|
|
|
|
|
return $this;
|
2010-02-09 08:45:23 +00:00
|
|
|
}
|
|
|
|
|
2011-01-24 08:23:15 +00:00
|
|
|
/**
|
|
|
|
* Whether this definition has a tag with the given name
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
*
|
|
|
|
* @return Boolean
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-01-24 08:23:15 +00:00
|
|
|
*/
|
|
|
|
public function hasTag($name)
|
|
|
|
{
|
|
|
|
return isset($this->tags[$name]);
|
|
|
|
}
|
|
|
|
|
2012-04-14 07:11:21 +01:00
|
|
|
/**
|
|
|
|
* Clears all tags for a given name.
|
|
|
|
*
|
|
|
|
* @param string $name The tag name
|
|
|
|
*
|
|
|
|
* @return Definition
|
|
|
|
*/
|
|
|
|
public function clearTag($name)
|
|
|
|
{
|
|
|
|
if (isset($this->tags[$name])) {
|
|
|
|
unset($this->tags[$name]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2010-06-15 22:22:54 +01:00
|
|
|
/**
|
2010-08-05 06:34:53 +01:00
|
|
|
* Clears the tags for this definition.
|
2010-06-15 22:22:54 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-06-15 22:22:54 +01:00
|
|
|
*/
|
2010-08-05 06:34:53 +01:00
|
|
|
public function clearTags()
|
2010-06-15 22:22:54 +01:00
|
|
|
{
|
2010-08-05 06:34:53 +01:00
|
|
|
$this->tags = array();
|
2010-06-15 22:22:54 +01:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
|
|
|
* Sets a file to require before creating the service.
|
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $file A full pathname to include
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function setFile($file)
|
2010-02-09 08:45:23 +00:00
|
|
|
{
|
2010-05-06 12:25:53 +01:00
|
|
|
$this->file = $file;
|
|
|
|
|
|
|
|
return $this;
|
2010-02-09 08:45:23 +00:00
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
|
|
|
* Gets the file to require before creating the service.
|
|
|
|
*
|
|
|
|
* @return string The full pathname to include
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function getFile()
|
|
|
|
{
|
|
|
|
return $this->file;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-01-17 22:28:59 +00:00
|
|
|
* Sets the scope of the service
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param string $scope Whether the service must be shared or not
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2011-01-17 22:28:59 +00:00
|
|
|
public function setScope($scope)
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2011-01-17 22:28:59 +00:00
|
|
|
$this->scope = $scope;
|
2010-05-06 12:25:53 +01:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-01-17 22:28:59 +00:00
|
|
|
* Returns the scope of the service
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2011-01-17 22:28:59 +00:00
|
|
|
* @return string
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2011-01-17 22:28:59 +00:00
|
|
|
public function getScope()
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2011-01-17 22:28:59 +00:00
|
|
|
return $this->scope;
|
2010-05-06 12:25:53 +01:00
|
|
|
}
|
|
|
|
|
2010-12-29 19:12:24 +00:00
|
|
|
/**
|
|
|
|
* Sets the visibility of this service.
|
|
|
|
*
|
|
|
|
* @param Boolean $boolean
|
2011-12-13 07:50:54 +00:00
|
|
|
*
|
2010-12-29 19:12:24 +00:00
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-12-29 19:12:24 +00:00
|
|
|
*/
|
|
|
|
public function setPublic($boolean)
|
|
|
|
{
|
|
|
|
$this->public = (Boolean) $boolean;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether this service is public facing
|
|
|
|
*
|
|
|
|
* @return Boolean
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-12-29 19:12:24 +00:00
|
|
|
*/
|
|
|
|
public function isPublic()
|
|
|
|
{
|
|
|
|
return $this->public;
|
|
|
|
}
|
|
|
|
|
2011-01-23 11:06:23 +00:00
|
|
|
/**
|
|
|
|
* Sets whether this definition is synthetic, that is not constructed by the
|
|
|
|
* container, but dynamically injected.
|
|
|
|
*
|
|
|
|
* @param Boolean $boolean
|
|
|
|
*
|
|
|
|
* @return Definition the current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-01-23 11:06:23 +00:00
|
|
|
*/
|
|
|
|
public function setSynthetic($boolean)
|
|
|
|
{
|
|
|
|
$this->synthetic = (Boolean) $boolean;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether this definition is synthetic, that is not constructed by the
|
|
|
|
* container, but dynamically injected.
|
|
|
|
*
|
|
|
|
* @return Boolean
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-01-23 11:06:23 +00:00
|
|
|
*/
|
|
|
|
public function isSynthetic()
|
|
|
|
{
|
|
|
|
return $this->synthetic;
|
|
|
|
}
|
|
|
|
|
2011-01-26 23:14:31 +00:00
|
|
|
/**
|
|
|
|
* Whether this definition is abstract, that means it merely serves as a
|
|
|
|
* template for other definitions.
|
|
|
|
*
|
|
|
|
* @param Boolean $boolean
|
|
|
|
*
|
|
|
|
* @return Definition the current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-01-26 23:14:31 +00:00
|
|
|
*/
|
|
|
|
public function setAbstract($boolean)
|
|
|
|
{
|
|
|
|
$this->abstract = (Boolean) $boolean;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether this definition is abstract, that means it merely serves as a
|
|
|
|
* template for other definitions.
|
|
|
|
*
|
|
|
|
* @return Boolean
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2011-01-26 23:14:31 +00:00
|
|
|
*/
|
|
|
|
public function isAbstract()
|
|
|
|
{
|
|
|
|
return $this->abstract;
|
|
|
|
}
|
|
|
|
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
|
|
|
* Sets a configurator to call after the service is fully initialized.
|
|
|
|
*
|
2012-05-15 21:19:31 +01:00
|
|
|
* @param mixed $callable A PHP callable
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
|
|
|
* @return Definition The current instance
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function setConfigurator($callable)
|
|
|
|
{
|
|
|
|
$this->configurator = $callable;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the configurator to call after the service is fully initialized.
|
|
|
|
*
|
|
|
|
* @return mixed The PHP callable to call
|
2011-07-20 09:50:27 +01:00
|
|
|
*
|
|
|
|
* @api
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
|
|
|
public function getConfigurator()
|
|
|
|
{
|
|
|
|
return $this->configurator;
|
|
|
|
}
|
2010-01-04 14:26:20 +00:00
|
|
|
}
|