예제 #1
0
 /**
  * Initializes PyString.
  *
  * @param PyStringNode $simpleString String from which this example string should be created
  * @param array        $tokens       Replacement tokens values
  */
 public function __construct(PyStringNode $simpleString, array $tokens)
 {
     $this->cleanLines = $lines = $simpleString->getLines();
     foreach ($tokens as $key => $value) {
         foreach (array_keys($lines) as $line) {
             $lines[$line] = str_replace('<' . $key . '>', $value, $lines[$line]);
         }
     }
     $this->setLines($lines);
 }
예제 #2
0
 /**
  * Replaces tokens in PyString with row values.
  *
  * @param PyStringNode $argument
  *
  * @return PyStringNode
  */
 protected function replacePyStringArgumentTokens(PyStringNode $argument)
 {
     $strings = $argument->getStrings();
     foreach ($strings as $line => $string) {
         $strings[$line] = $this->replaceTextTokens($strings[$line]);
     }
     return new PyStringNode($strings, $argument->getLine());
 }