for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace TomPHP\ContainerConfigurator;
use Assert\Assertion;
use InvalidArgumentException;
final class ServiceDefinition
{
/**
* @var string
*/
private $name;
private $class;
* @var bool
private $singleton;
* @var array
private $arguments;
private $methods;
* @param string $name
* @param array $config
* @param bool $singletonDefault
*
* @throws InvalidArgumentException
public function __construct($name, array $config, $singletonDefault = false)
Assertion::string($name);
Assertion::boolean($singletonDefault);
$this->name = $name;
$this->class = isset($config['class']) ? $config['class'] : $name;
$this->singleton = isset($config['singleton']) ? $config['singleton'] : $singletonDefault;
$this->arguments = isset($config['arguments']) ? $config['arguments'] : [];
$this->methods = isset($config['methods']) ? $config['methods'] : [];
}
* @return string
public function getName()
return $this->name;
public function getClass()
return $this->class;
* @return bool
public function isSingleton()
return $this->singleton;
* @return array
public function getArguments()
return $this->arguments;
public function getMethods()
return $this->methods;