2019-10-13 07:59:52 +02:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2021-04-10 22:21:54 +02:00
|
|
|
namespace Rector\Renaming\ValueObject;
|
2019-09-22 20:57:03 +02:00
|
|
|
|
2020-09-13 01:08:21 +02:00
|
|
|
final class RenamedNamespace
|
2019-09-22 20:57:03 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2021-05-10 23:39:21 +00:00
|
|
|
private $currentName;
|
2019-09-22 20:57:03 +02:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2021-05-10 23:39:21 +00:00
|
|
|
private $oldNamespace;
|
2019-09-22 20:57:03 +02:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2021-05-10 23:39:21 +00:00
|
|
|
private $newNamespace;
|
|
|
|
public function __construct(string $currentName, string $oldNamespace, string $newNamespace)
|
2019-09-22 20:57:03 +02:00
|
|
|
{
|
2021-05-10 23:39:21 +00:00
|
|
|
$this->currentName = $currentName;
|
2019-09-22 20:57:03 +02:00
|
|
|
$this->oldNamespace = $oldNamespace;
|
|
|
|
$this->newNamespace = $newNamespace;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getNameInNewNamespace() : string
|
2019-09-22 20:57:03 +02:00
|
|
|
{
|
2021-05-09 20:15:43 +00:00
|
|
|
return \str_replace($this->oldNamespace, $this->newNamespace, $this->currentName);
|
2019-09-22 20:57:03 +02:00
|
|
|
}
|
|
|
|
}
|