diff --git a/src/Decoder.php b/src/Decoder.php index 7241e7e92..c25c70945 100644 --- a/src/Decoder.php +++ b/src/Decoder.php @@ -10,6 +10,7 @@ namespace Zend\Json; +use stdClass; use Zend\Json\Exception\InvalidArgumentException; use Zend\Json\Exception\RuntimeException; @@ -85,6 +86,7 @@ class Decoder * @param int $decodeType How objects should be decoded -- see * {@link Zend_Json::TYPE_ARRAY} and {@link Zend_Json::TYPE_OBJECT} for * valid values + * @throws InvalidArgumentException * @return void */ protected function __construct($source, $decodeType) @@ -176,7 +178,7 @@ protected function _decodeValue() * {@link $decodeType}. If invalid $decodeType present, returns as an * array. * - * @return array|StdClass + * @return array|stdClass * @throws Zend\Json\Exception\RuntimeException */ protected function _decodeObject() @@ -214,7 +216,7 @@ protected function _decodeObject() switch ($this->decodeType) { case Json::TYPE_OBJECT: // Create new StdClass and populate with $members - $result = new \stdClass(); + $result = new stdClass(); foreach ($members as $key => $value) { if ($key === '') { $key = '_empty_'; @@ -447,7 +449,7 @@ protected function _getNextToken() * * @link http://solarphp.com/ * @link http://svn.solarphp.com/core/trunk/Solar/Json.php - * @param string $value + * @param string $chrs * @return string */ public static function decodeUnicodeString($chrs) diff --git a/src/Encoder.php b/src/Encoder.php index 10b4ed81c..cc5bf9231 100644 --- a/src/Encoder.php +++ b/src/Encoder.php @@ -12,6 +12,7 @@ use Iterator; use IteratorAggregate; +use ReflectionClass; use Zend\Json\Exception\InvalidArgumentException; use Zend\Json\Exception\RecursionException; @@ -49,7 +50,7 @@ class Encoder * * @param boolean $cycleCheck Whether or not to check for recursion when encoding * @param array $options Additional options used during encoding - * @return void + * @return Encoder */ protected function __construct($cycleCheck = false, $options = array()) { @@ -247,7 +248,7 @@ protected function _encodeDatum(&$value) /** * JSON encode a string value by escaping characters as necessary * - * @param $value string + * @param string $string * @return string */ protected function _encodeString(&$string) @@ -272,10 +273,10 @@ protected function _encodeString(&$string) * Encode the constants associated with the ReflectionClass * parameter. The encoding format is based on the class2 format * - * @param $cls ReflectionClass + * @param ReflectionClass $cls * @return string Encoded constant block in class2 format */ - private static function _encodeConstants(\ReflectionClass $cls) + private static function _encodeConstants(ReflectionClass $cls) { $result = "constants : {"; $constants = $cls->getConstants(); @@ -297,11 +298,11 @@ private static function _encodeConstants(\ReflectionClass $cls) * Encode the public methods of the ReflectionClass in the * class2 format * - * @param $cls ReflectionClass + * @param ReflectionClass $cls * @return string Encoded method fragment * */ - private static function _encodeMethods(\ReflectionClass $cls) + private static function _encodeMethods(ReflectionClass $cls) { $methods = $cls->getMethods(); $result = 'methods:{'; @@ -361,11 +362,11 @@ private static function _encodeMethods(\ReflectionClass $cls) * Encode the public properties of the ReflectionClass in the class2 * format. * - * @param $cls ReflectionClass + * @param ReflectionClass $cls * @return string Encode properties list * */ - private static function _encodeVariables(\ReflectionClass $cls) + private static function _encodeVariables(ReflectionClass $cls) { $properties = $cls->getProperties(); $propValues = get_class_vars($cls->getName()); diff --git a/src/Json.php b/src/Json.php index 65b9e74b6..ead5af7c9 100644 --- a/src/Json.php +++ b/src/Json.php @@ -10,6 +10,7 @@ namespace Zend\Json; +use SimpleXMLElement; use Zend\Json\Exception\RecursionException; use Zend\Json\Exception\RuntimeException; @@ -192,7 +193,7 @@ protected static function _recursiveJsonExprFinder( * if it matches, we return a new Zend_Json_Expr instead of a text node * * @param SimpleXMLElement $simpleXmlElementObject - * @return Zend_Json_Expr|string + * @return Expr|string */ protected static function _getXmlValue($simpleXmlElementObject) { @@ -205,6 +206,7 @@ protected static function _getXmlValue($simpleXmlElementObject) return (trim(strval($simpleXmlElementObject))); } } + /** * _processXml - Contains the logic for xml2json * @@ -219,11 +221,10 @@ protected static function _getXmlValue($simpleXmlElementObject) * calling a recursive (protected static) function in this class. Once all * the XML elements are stored in the PHP array, it is returned to the caller. * - * Throws a Zend\Json\RecursionException if the XML tree is deeper than the allowed limit. - * * @param SimpleXMLElement $simpleXmlElementObject * @param boolean $ignoreXmlAttributes * @param integer $recursionDepth + * @throws Exception\RecursionException if the XML tree is deeper than the allowed limit. * @return array */ protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttributes, $recursionDepth = 0) diff --git a/src/Server/Server.php b/src/Server/Server.php index ec4516e0f..4f6109de1 100644 --- a/src/Server/Server.php +++ b/src/Server/Server.php @@ -72,6 +72,7 @@ class Server extends AbstractServer * * @param string|array|callable $function Valid PHP callback * @param string $namespace Ignored + * @throws Exception\InvalidArgumentException if function invalid or not callable * @return Server */ public function addFunction($function, $namespace = '') @@ -145,7 +146,8 @@ public function setClass($class, $namespace = '', $argv = null) * * @param string $fault * @param int $code - * @return false + * @param mixed $data + * @return Error */ public function fault($fault = null, $code = 404, $data = null) { @@ -158,6 +160,7 @@ public function fault($fault = null, $code = 404, $data = null) * Handle request * * @param Request $request + * @throws Exception\InvalidArgumentException * @return null|Response */ public function handle($request = false) @@ -188,6 +191,7 @@ public function handle($request = false) * Load function definitions * * @param array|Definition $definition + * @throws Exception\InvalidArgumentException * @return void */ public function loadFunctions($definition) diff --git a/src/Server/Smd.php b/src/Server/Smd.php index f1b9981bf..88a7801fe 100644 --- a/src/Server/Smd.php +++ b/src/Server/Smd.php @@ -114,6 +114,7 @@ public function setOptions(array $options) * Set transport * * @param string $transport + * @throws Exception\InvalidArgumentException * @return \Zend\Json\Server\Smd */ public function setTransport($transport) @@ -139,6 +140,7 @@ public function getTransport() * Set envelope * * @param string $envelopeType + * @throws Exception\InvalidArgumentException * @return Smd */ public function setEnvelope($envelopeType) @@ -165,6 +167,7 @@ public function getEnvelope() * Set content type * * @param string $type + * @throws Exception\InvalidArgumentException * @return \Zend\Json\Server\Smd */ public function setContentType($type) @@ -211,7 +214,7 @@ public function getTarget() /** * Set service ID * - * @param string $Id + * @param string $id * @return Smd */ public function setId($id) @@ -278,6 +281,8 @@ public function isDojoCompatible() * Add Service * * @param Smd\Service|array $service + * @throws Exception\RuntimeException + * @throws Exception\InvalidArgumentException * @return Smd */ public function addService($service) diff --git a/src/Server/Smd/Service.php b/src/Server/Smd/Service.php index 010942425..db165f24b 100644 --- a/src/Server/Smd/Service.php +++ b/src/Server/Smd/Service.php @@ -107,7 +107,7 @@ class Service * Constructor * * @param string|array $spec - * @throws Zend\Json\Server\Exception\InvalidArgumentException if no name provided + * @throws InvalidArgumentException if no name provided */ public function __construct($spec) { @@ -126,7 +126,7 @@ public function __construct($spec) * Set object state * * @param array $options - * @return Zend\Json\Server\Smd\Service + * @return Service */ public function setOptions(array $options) { @@ -147,8 +147,8 @@ public function setOptions(array $options) * Set service name * * @param string $name - * @return Zend\Json\Server\Smd\Service - * @throws Zend\Json\Server\Exception\InvalidArgumentException + * @return Service + * @throws InvalidArgumentException */ public function setName($name) { @@ -176,7 +176,8 @@ public function getName() * Currently limited to POST * * @param string $transport - * @return Zend\Json\Server\Smd\Service + * @throws InvalidArgumentException + * @return Service */ public function setTransport($transport) { @@ -202,7 +203,7 @@ public function getTransport() * Set service target * * @param string $target - * @return Zend\Json\Server\Smd\Service + * @return Service */ public function setTarget($target) { @@ -224,7 +225,8 @@ public function getTarget() * Set envelope type * * @param string $envelopeType - * @return Zend\Json\Server\Smd\Service + * @throws InvalidArgumentException + * @return Service */ public function setEnvelope($envelopeType) { @@ -252,7 +254,8 @@ public function getEnvelope() * @param string|array $type * @param array $options * @param int|null $order - * @return Zend\Json\Server\Smd\Service + * @throws InvalidArgumentException + * @return Service */ public function addParam($type, array $options = array(), $order = null) { @@ -294,7 +297,7 @@ public function addParam($type, array $options = array(), $order = null) * Each param should be an array, and should include the key 'type'. * * @param array $params - * @return Zend\Json\Server\Smd\Service + * @return Service */ public function addParams(array $params) { @@ -317,7 +320,7 @@ public function addParams(array $params) * Overwrite all parameters * * @param array $params - * @return Zend\Json\Server\Smd\Service + * @return Service */ public function setParams(array $params) { @@ -355,7 +358,8 @@ public function getParams() * Set return type * * @param string|array $type - * @return Zend\Json\Server\Smd\Service + * @throws InvalidArgumentException + * @return Service */ public function setReturn($type) {