for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types = 1);
/**
* Created by PhpStorm.
* User: root
* Date: 27.07.2016
* Time: 1:55.
*/
namespace samsonframework\container\collection\configurator;
use samsonframework\container\collection\CollectionKeyConfiguratorInterface;
use samsonframework\container\configurator\ServiceConfigurator;
use samsonframework\container\metadata\ClassMetadata;
* Service collection configurator class.
* @see \samsonframework\container\configurator\ServiceConfigurator
*
* @author Vitaly Egorov <[email protected]>
class Service extends ServiceConfigurator implements CollectionKeyConfiguratorInterface
{
use CollectionConfiguratorTrait;
public function __construct(array $scopeData)
// Check for name attribute
if (array_key_exists('@attributes', $scopeData) && array_key_exists('name', $scopeData['@attributes'])) {
parent::__construct($scopeData['@attributes']['name']);
} else {
throw new \InvalidArgumentException('Cannot configure service without name attribute');
}
* {@inheritdoc}
public function resolve($data)
$data
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$classMetadata = new ClassMetadata();
$classMetadata->name = $this->serviceName;
$classMetadata->scopes[] = $this->scopeName;
return $classMetadata;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.