Browse files

refactored variable and method names

  • Loading branch information...
1 parent 1c909df commit 3d80da03822a63f17b49353ef92894d26aae4c7c @robertboloc committed Oct 10, 2012
View
22 library/Zend/Code/Generator/ClassGenerator.php
@@ -70,7 +70,7 @@ class ClassGenerator extends AbstractGenerator
/**
* @var array Array of string names
*/
- protected $useClasses = array();
+ protected $uses = array();
/**
* fromReflection() - build a Code Generation Php Object from a Class Reflection
@@ -489,12 +489,12 @@ public function addPropertyFromGenerator(PropertyGenerator $property)
*
* @param string $useClass
*/
- public function addUseClass($useClass, $useClassAlias = null)
+ public function addUse($use, $useAlias = null)
{
- if (!empty($useClassAlias)) {
- $useClass .= ' as ' . $useClassAlias;
+ if (!empty($useAlias)) {
+ $use .= ' as ' . $useAlias;
}
- $this->useClasses[] = $useClass;
+ $this->uses[] = $use;
}
/**
@@ -528,9 +528,9 @@ public function getProperty($propertyName)
*
* @return array
*/
- public function getUseClasses()
+ public function getUses()
{
- return $this->useClasses;
+ return $this->uses;
}
/**
@@ -692,10 +692,10 @@ public function generate()
$output .= 'namespace ' . $namespace . ';' . self::LINE_FEED . self::LINE_FEED;
}
- $useClasses = $this->getUseClasses();
- if (!empty($useClasses)) {
- foreach ($useClasses as $useClass) {
- $output .= 'use ' . $useClass . ';' . self::LINE_FEED;
+ $uses = $this->getUses();
+ if (!empty($uses)) {
+ foreach ($uses as $use) {
+ $output .= 'use ' . $use . ';' . self::LINE_FEED;
}
$output .= self::LINE_FEED;
}
View
6 tests/ZendTest/Code/Generator/ClassGeneratorTest.php
@@ -366,12 +366,12 @@ public function testPassingANamespacedClassnameShouldGenerateAClassnameWithoutIt
/**
* @group ZF2-151
*/
- public function testAddUseClass()
+ public function testAddUses()
{
$classGenerator = new ClassGenerator();
$classGenerator->setName('My\Class');
- $classGenerator->addUseClass('My\First\Use\Class');
- $classGenerator->addUseClass('My\Second\Use\Class', 'MyAlias');
+ $classGenerator->addUse('My\First\Use\Class');
+ $classGenerator->addUse('My\Second\Use\Class', 'MyAlias');
$generated = $classGenerator->generate();
$this->assertContains('use My\First\Use\Class;', $generated);

0 comments on commit 3d80da0

Please sign in to comment.