for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the Stack package.
*
* (c) Andrzej Kostrzewa <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Stack\DI\Definition;
* Defines an alias from an entry to another.
* @author Andrzej Kostrzewa <[email protected]>
class AliasDefinition
{
* Entry name.
* @var string|null
private $name;
* Name of the target entry.
private $targetName;
* AliasDefinition constructor.
* @param string|null $name Entry name
* @param string|null $targetName Name of the target entry
public function __construct($name = null, $targetName = null)
$this->name = $name;
$this->targetName = $targetName;
}
* Extract name from target entry.
* @param string $targetName
public function aliasFromNamespace($targetName)
$name = explode('\\', $targetName);
$name = end($name);
$this->name = strtolower($name);
* @return string|null Entry name
public function getName()
return $this->name;
* @return string|null Name of the target entry
public function getTargetName()
return $this->targetName;