public function testUniqueVariable() { $uniqueVariableScope = new UniqueVariableScope(); $name = $uniqueVariableScope->getUniqueName('name'); $this->assertEquals('name', $name); $name = $uniqueVariableScope->getUniqueName('name'); $this->assertEquals('name_1', $name); $name = $uniqueVariableScope->getUniqueName('name'); $this->assertEquals('name_2', $name); }
/** * Get a unique variable name * * @param string $prefix * * @return string */ public function getUniqueVariableName($prefix = 'var') { return $this->variableScope->getUniqueName($prefix); }