rector/rules/CodingStyle/ValueObject/ConcatExpressionJoinData.php

53 lines
1.1 KiB
PHP
Raw Normal View History

2019-10-13 07:59:52 +02:00
<?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;
}
}