rector/rules/CodingStyle/ValueObject/ConcatExpressionJoinData.php
2021-05-10 22:23:08 +00:00

53 lines
1.1 KiB
PHP

<?php
declare (strict_types=1);
namespace Rector\CodingStyle\ValueObject;
use PhpParser\Node;
use PhpParser\Node\Expr;
final class ConcatExpressionJoinData
{
/**
* @var string[]
*/
private $values = [];
/**
* @var Node[]
*/
private $nodesToRemove = [];
/**
* @var Expr[]
*/
private $placeholdersToNodes = [];
public function addString(string $value) : void
{
$this->values[] = $value;
}
public function addNodeToRemove(\PhpParser\Node $node) : void
{
$this->nodesToRemove[] = $node;
}
public function getString() : string
{
return \implode('', $this->values);
}
/**
* @return Node[]
*/
public function getNodesToRemove() : array
{
return $this->nodesToRemove;
}
public function addPlaceholderToNode(string $objectHash, \PhpParser\Node\Expr $expr) : void
{
$this->placeholdersToNodes[$objectHash] = $expr;
}
/**
* @return Expr[]
*/
public function getPlaceholdersToNodes() : array
{
return $this->placeholdersToNodes;
}
}