Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Fix PSR2
Browse files Browse the repository at this point in the history
  • Loading branch information
neeckeloo committed Dec 13, 2012
1 parent 8519490 commit 119d6fa
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 39 deletions.
73 changes: 42 additions & 31 deletions library/Zend/Code/Generator/ClassGenerator.php
Expand Up @@ -70,7 +70,7 @@ class ClassGenerator extends AbstractGenerator
/**
* Build a Code Generation Php Object from a Class Reflection
*
* @param ClassReflection $classReflection
* @param ClassReflection $classReflection
* @return ClassGenerator
*/
public static function fromReflection(ClassReflection $classReflection)
Expand Down Expand Up @@ -142,7 +142,7 @@ public static function fromReflection(ClassReflection $classReflection)
* @configkey methods
*
* @throws Exception\InvalidArgumentException
* @param array $array
* @param array $array
* @return ClassGenerator
*/
public static function fromArray(array $array)
Expand Down Expand Up @@ -182,7 +182,7 @@ public static function fromArray(array $array)
break;
}
}

return $cg;
}

Expand Down Expand Up @@ -226,7 +226,7 @@ public function __construct($name = null, $namespaceName = null, $flags = null,
}

/**
* @param string $name
* @param string $name
* @return ClassGenerator
*/
public function setName($name)
Expand All @@ -238,6 +238,7 @@ public function setName($name)
}

$this->name = $name;

return $this;
}

Expand All @@ -258,7 +259,7 @@ public function getNamespaceName()
}

/**
* @param string $namespaceName
* @param string $namespaceName
* @return ClassGenerator
*/
public function setNamespaceName($namespaceName)
Expand All @@ -269,7 +270,7 @@ public function setNamespaceName($namespaceName)
}

/**
* @param FileGenerator $fileGenerator
* @param FileGenerator $fileGenerator
* @return ClassGenerator
*/
public function setContainingFileGenerator(FileGenerator $fileGenerator)
Expand All @@ -288,7 +289,7 @@ public function getContainingFileGenerator()
}

/**
* @param DocBlockGenerator $docBlock
* @param DocBlockGenerator $docBlock
* @return ClassGenerator
*/
public function setDocBlock(DocBlockGenerator $docBlock)
Expand All @@ -307,7 +308,7 @@ public function getDocBlock()
}

/**
* @param array|string $flags
* @param array|string $flags
* @return \Zend\Code\Generator\ClassGenerator
*/
public function setFlags($flags)
Expand All @@ -321,31 +322,34 @@ public function setFlags($flags)
}
// check that visibility is one of three
$this->flags = $flags;

return $this;
}

/**
* @param string $flag
* @param string $flag
* @return ClassGenerator
*/
public function addFlag($flag)
{
$this->setFlags($this->flags | $flag);

return $this;
}

/**
* @param string $flag
* @param string $flag
* @return ClassGenerator
*/
public function removeFlag($flag)
{
$this->setFlags($this->flags & ~$flag);

return $this;
}

/**
* @param bool $isAbstract
* @param bool $isAbstract
* @return AbstractMemberGenerator
*/
public function setAbstract($isAbstract)
Expand All @@ -358,11 +362,11 @@ public function setAbstract($isAbstract)
*/
public function isAbstract()
{
return (boolean)($this->flags & self::FLAG_ABSTRACT);
return (boolean) ($this->flags & self::FLAG_ABSTRACT);
}

/**
* @param bool $isFinal
* @param bool $isFinal
* @return AbstractMemberGenerator
*/
public function setFinal($isFinal)
Expand All @@ -379,12 +383,13 @@ public function isFinal()
}

/**
* @param string $extendedClass
* @param string $extendedClass
* @return ClassGenerator
*/
public function setExtendedClass($extendedClass)
{
$this->extendedClass = $extendedClass;

return $this;
}

Expand All @@ -397,12 +402,13 @@ public function getExtendedClass()
}

/**
* @param array $implementedInterfaces
* @param array $implementedInterfaces
* @return ClassGenerator
*/
public function setImplementedInterfaces(array $implementedInterfaces)
{
$this->implementedInterfaces = $implementedInterfaces;

return $this;
}

Expand All @@ -415,7 +421,7 @@ public function getImplementedInterfaces()
}

/**
* @param array $properties
* @param array $properties
* @return ClassGenerator
*/
public function addProperties(array $properties)
Expand All @@ -438,9 +444,9 @@ public function addProperties(array $properties)
/**
* Add Property from scalars
*
* @param string $name
* @param string|array $defaultValue
* @param int $flags
* @param string $name
* @param string|array $defaultValue
* @param int $flags
* @throws Exception\InvalidArgumentException
* @return ClassGenerator
*/
Expand All @@ -458,7 +464,7 @@ public function addProperty($name, $defaultValue = null, $flags = PropertyGenera
/**
* Add property from PropertyGenerator
*
* @param string|PropertyGenerator $property
* @param string|PropertyGenerator $property
* @throws Exception\InvalidArgumentException
* @return ClassGenerator
*/
Expand All @@ -471,6 +477,7 @@ public function addPropertyFromGenerator(PropertyGenerator $property)
}

$this->properties[$propertyName] = $property;

return $this;
}

Expand All @@ -483,7 +490,7 @@ public function getProperties()
}

/**
* @param string $propertyName
* @param string $propertyName
* @return PropertyGenerator|false
*/
public function getProperty($propertyName)
Expand All @@ -493,11 +500,12 @@ public function getProperty($propertyName)
return $property;
}
}

return false;
}

/**
* @param string $propertyName
* @param string $propertyName
* @return bool
*/
public function hasProperty($propertyName)
Expand All @@ -506,7 +514,7 @@ public function hasProperty($propertyName)
}

/**
* @param array $methods
* @param array $methods
* @return ClassGenerator
*/
public function addMethods(array $methods)
Expand All @@ -522,17 +530,18 @@ public function addMethods(array $methods)
}
}
}

return $this;
}

/**
* Add Method from scalars
*
* @param string $name
* @param array $parameters
* @param int $flags
* @param string $body
* @param string $docBlock
* @param string $name
* @param array $parameters
* @param int $flags
* @param string $body
* @param string $docBlock
* @throws Exception\InvalidArgumentException
* @return ClassGenerator
*/
Expand All @@ -551,7 +560,7 @@ public function addMethod($name = null, array $parameters = array(), $flags = Me
/**
* Add Method from MethodGenerator
*
* @param MethodGenerator $method
* @param MethodGenerator $method
* @throws Exception\InvalidArgumentException
* @return ClassGenerator
*/
Expand All @@ -564,6 +573,7 @@ public function addMethodFromGenerator(MethodGenerator $method)
}

$this->methods[$methodName] = $method;

return $this;
}

Expand All @@ -576,7 +586,7 @@ public function getMethods()
}

/**
* @param string $methodName
* @param string $methodName
* @return MethodGenerator|false
*/
public function getMethod($methodName)
Expand All @@ -586,11 +596,12 @@ public function getMethod($methodName)
return $method;
}
}

return false;
}

/**
* @param string $methodName
* @param string $methodName
* @return bool
*/
public function hasMethod($methodName)
Expand Down
19 changes: 11 additions & 8 deletions library/Zend/Code/Generator/DocBlockGenerator.php
Expand Up @@ -41,7 +41,7 @@ class DocBlockGenerator extends AbstractGenerator
/**
* Build a DocBlock generator object from a reflection object
*
* @param DocBlockReflection $reflectionDocBlock
* @param DocBlockReflection $reflectionDocBlock
* @return DocBlockGenerator
*/
public static function fromReflection(DocBlockReflection $reflectionDocBlock)
Expand Down Expand Up @@ -69,13 +69,13 @@ public static function fromReflection(DocBlockReflection $reflectionDocBlock)
* @configkey tags array
*
* @throws Exception\InvalidArgumentException
* @param array $array
* @param array $array
* @return DocBlockGenerator
*/
public static function fromArray(array $array)
{
$docBlock = new static();

foreach ($array as $name => $value) {
// normalize key
switch (strtolower(str_replace(array('.', '-', '_'), '', $name))) {
Expand Down Expand Up @@ -112,12 +112,13 @@ public function __construct($shortDescription = null, $longDescription = null, a
}

/**
* @param string $shortDescription
* @param string $shortDescription
* @return DocBlockGenerator
*/
public function setShortDescription($shortDescription)
{
$this->shortDescription = $shortDescription;

return $this;
}

Expand All @@ -130,12 +131,13 @@ public function getShortDescription()
}

/**
* @param string $longDescription
* @param string $longDescription
* @return DocBlockGenerator
*/
public function setLongDescription($longDescription)
{
$this->longDescription = $longDescription;

return $this;
}

Expand All @@ -148,7 +150,7 @@ public function getLongDescription()
}

/**
* @param array $tags
* @param array $tags
* @return DocBlockGenerator
*/
public function setTags(array $tags)
Expand All @@ -161,7 +163,7 @@ public function setTags(array $tags)
}

/**
* @param array|DocBlock\Tag $tag
* @param array|DocBlock\Tag $tag
* @throws Exception\InvalidArgumentException
* @return DocBlockGenerator
*/
Expand Down Expand Up @@ -214,7 +216,7 @@ public function generate()
}

/**
* @param string $content
* @param string $content
* @return string
*/
protected function docCommentize($content)
Expand All @@ -231,6 +233,7 @@ protected function docCommentize($content)
$output .= self::LINE_FEED;
}
$output .= $indent . ' */' . self::LINE_FEED;

return $output;
}

Expand Down

0 comments on commit 119d6fa

Please sign in to comment.