Просмотр исходного кода

Fixes DocBlocks for Zend_Crypt

Frank Brückner 11 лет назад
Родитель
Сommit
4ae99d2306

+ 10 - 2
library/Zend/Crypt/DiffieHellman.php

@@ -102,7 +102,6 @@ class Zend_Crypt_DiffieHellman
      * @param string $generator
      * @param string $privateKey
      * @param string $privateKeyType
-     * @return void
      */
     public function __construct($prime, $generator, $privateKey = null, $privateKeyType = self::NUMBER)
     {
@@ -146,6 +145,7 @@ class Zend_Crypt_DiffieHellman
      *
      * @param string $number
      * @param string $type
+     * @throws Zend_Crypt_DiffieHellman_Exception
      * @return Zend_Crypt_DiffieHellman
      */
     public function setPublicKey($number, $type = self::NUMBER)
@@ -166,6 +166,7 @@ class Zend_Crypt_DiffieHellman
      * transaction.
      *
      * @param string $type
+     * @throws Zend_Crypt_DiffieHellman_Exception
      * @return string
      */
     public function getPublicKey($type = self::NUMBER)
@@ -195,6 +196,8 @@ class Zend_Crypt_DiffieHellman
      *
      * @param string $publicKey
      * @param string $type
+     * @param string $output
+     * @throws Zend_Crypt_DiffieHellman_Exception
      * @return mixed
      */
     public function computeSecretKey($publicKey, $type = self::NUMBER, $output = self::NUMBER)
@@ -218,6 +221,7 @@ class Zend_Crypt_DiffieHellman
      * Return the computed shared secret key from the DiffieHellman transaction
      *
      * @param string $type
+     * @throws Zend_Crypt_DiffieHellman_Exception
      * @return string
      */
     public function getSharedSecretKey($type = self::NUMBER)
@@ -238,6 +242,7 @@ class Zend_Crypt_DiffieHellman
      * Setter for the value of the prime number
      *
      * @param string $number
+     * @throws Zend_Crypt_DiffieHellman_Exception
      * @return Zend_Crypt_DiffieHellman
      */
     public function setPrime($number)
@@ -253,6 +258,7 @@ class Zend_Crypt_DiffieHellman
     /**
      * Getter for the value of the prime number
      *
+     * @throws Zend_Crypt_DiffieHellman_Exception
      * @return string
      */
     public function getPrime()
@@ -264,11 +270,11 @@ class Zend_Crypt_DiffieHellman
         return $this->_prime;
     }
 
-
     /**
      * Setter for the value of the generator number
      *
      * @param string $number
+     * @throws Zend_Crypt_DiffieHellman_Exception
      * @return Zend_Crypt_DiffieHellman
      */
     public function setGenerator($number)
@@ -284,6 +290,7 @@ class Zend_Crypt_DiffieHellman
     /**
      * Getter for the value of the generator number
      *
+     * @throws Zend_Crypt_DiffieHellman_Exception
      * @return string
      */
     public function getGenerator()
@@ -300,6 +307,7 @@ class Zend_Crypt_DiffieHellman
      *
      * @param string $number
      * @param string $type
+     * @throws Zend_Crypt_DiffieHellman_Exception
      * @return Zend_Crypt_DiffieHellman
      */
     public function setPrivateKey($number, $type = self::NUMBER)

+ 2 - 1
library/Zend/Crypt/Hmac.php

@@ -85,7 +85,7 @@ class Zend_Crypt_Hmac extends Zend_Crypt
      * @param string $hash
      * @param string $data
      * @param string $output
-     * @param boolean $internal
+     * @throws Zend_Crypt_Hmac_Exception
      * @return string
      */
     public static function compute($key, $hash, $data, $output = self::STRING)
@@ -108,6 +108,7 @@ class Zend_Crypt_Hmac extends Zend_Crypt
      * Setter for the hash method.
      *
      * @param string $hash
+     * @throws Zend_Crypt_Hmac_Exception
      * @return Zend_Crypt_Hmac
      */
     protected static function _setHashAlgorithm($hash)

+ 4 - 3
library/Zend/Crypt/Math/BigInteger.php

@@ -71,9 +71,10 @@ class Zend_Crypt_Math_BigInteger
     /**
      * Redirect all public method calls to the wrapped extension object.
      *
-     * @param   string $methodName
-     * @param   array $args
-     * @throws  Zend_Crypt_Math_BigInteger_Exception
+     * @param  string $methodName
+     * @param  array  $args
+     * @return mixed
+     * @throws Zend_Crypt_Math_BigInteger_Exception
      */
     public function __call($methodName, $args)
     {

+ 31 - 7
library/Zend/Crypt/Math/BigInteger/Bcmath.php

@@ -42,6 +42,7 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
     /**
      * Initialise a big integer into an extension specific type. This is not
      * applicable to BCMath.
+     *
      * @param string $operand
      * @param int $base
      * @return string
@@ -64,6 +65,8 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
     }
 
     /**
+     * Subtract one arbitrary precision number from another
+     *
      * @param string $left_operand
      * @param string $right_operand
      * @return string
@@ -77,6 +80,7 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
      * Compare two big integers and returns result as an integer where 0 means
      * both are identical, 1 that left_operand is larger, or -1 that
      * right_operand is larger.
+     *
      * @param string $left_operand
      * @param string $right_operand
      * @return int
@@ -89,6 +93,7 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
     /**
      * Divide two big integers and return result or NULL if the denominator
      * is zero.
+     *
      * @param string $left_operand
      * @param string $right_operand
      * @return string|null
@@ -99,8 +104,10 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
     }
 
     /**
+     * Get modulus of an arbitrary precision number
+     *
      * @param string $left_operand
-     * @param string $right_operand
+     * @param string $modulus
      * @return string
      */
     public function modulus($left_operand, $modulus)
@@ -109,6 +116,8 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
     }
 
     /**
+     * Multiply two arbitrary precision numbers
+     *
      * @param string $left_operand
      * @param string $right_operand
      * @return string
@@ -119,6 +128,8 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
     }
 
     /**
+     * Raise an arbitrary precision number to another
+     *
      * @param string $left_operand
      * @param string $right_operand
      * @return string
@@ -129,8 +140,12 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
     }
 
     /**
+     * Raise an arbitrary precision number to another, reduced by a specified
+     * modulus
+     *
      * @param string $left_operand
      * @param string $right_operand
+     * @param string $modulus
      * @return string
      */
     public function powmod($left_operand, $right_operand, $modulus)
@@ -139,8 +154,9 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
     }
 
     /**
-     * @param string $left_operand
-     * @param string $right_operand
+     * Get the square root of an arbitrary precision number
+     *
+     * @param string $operand
      * @return string
      */
     public function sqrt($operand)
@@ -148,7 +164,10 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
         return bcsqrt($operand);
     }
 
-
+    /**
+     * @param string $operand
+     * @return string
+     */
     public function binaryToInteger($operand)
     {
         $result = '0';
@@ -160,7 +179,10 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
         return $result;
     }
 
-
+    /**
+     * @param string $operand
+     * @return string
+     */
     public function integerToBinary($operand)
     {
         $cmp = bccomp($operand, 0);
@@ -188,7 +210,10 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
         return $return;
     }**/ // Prior version for referenced offset
 
-
+    /**
+     * @param string $operand
+     * @return string
+     */
     public function hexToDecimal($operand)
     {
         $return = '0';
@@ -199,5 +224,4 @@ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_In
         }
         return $return;
     }
-
 }

+ 45 - 21
library/Zend/Crypt/Math/BigInteger/Gmp.php

@@ -53,8 +53,8 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
     /**
      * Adds two arbitrary precision numbers
      *
-     * @param string $left_operand
-     * @param string $right_operand
+     * @param resource $left_operand
+     * @param resource $right_operand
      * @return string
      */
     public function add($left_operand, $right_operand)
@@ -64,8 +64,10 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
     }
 
     /**
-     * @param string $left_operand
-     * @param string $right_operand
+     * Subtract numbers
+     *
+     * @param resource $left_operand
+     * @param resource $right_operand
      * @return string
      */
     public function subtract($left_operand, $right_operand)
@@ -78,8 +80,9 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
      * Compare two big integers and returns result as an integer where 0 means
      * both are identical, 1 that left_operand is larger, or -1 that
      * right_operand is larger.
-     * @param string $left_operand
-     * @param string $right_operand
+     *
+     * @param resource $left_operand
+     * @param resource $right_operand
      * @return int
      */
     public function compare($left_operand, $right_operand)
@@ -91,8 +94,9 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
     /**
      * Divide two big integers and return result or NULL if the denominator
      * is zero.
-     * @param string $left_operand
-     * @param string $right_operand
+     *
+     * @param resource $left_operand
+     * @param resource $right_operand
      * @return string|null
      */
     public function divide($left_operand, $right_operand)
@@ -102,8 +106,11 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
     }
 
     /**
-     * @param string $left_operand
-     * @param string $right_operand
+     * Modulo operation
+     *
+     * @param resource $left_operand
+     * @param resource $modulus
+     * @internal param string $right_operand
      * @return string
      */
     public function modulus($left_operand, $modulus)
@@ -113,8 +120,10 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
     }
 
     /**
-     * @param string $left_operand
-     * @param string $right_operand
+     * Multiply numbers
+     *
+     * @param resource $left_operand
+     * @param resource $right_operand
      * @return string
      */
     public function multiply($left_operand, $right_operand)
@@ -124,8 +133,10 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
     }
 
     /**
-     * @param string $left_operand
-     * @param string $right_operand
+     * Raise number into power
+     *
+     * @param resource $left_operand
+     * @param int      $right_operand
      * @return string
      */
     public function pow($left_operand, $right_operand)
@@ -135,8 +146,11 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
     }
 
     /**
-     * @param string $left_operand
-     * @param string $right_operand
+     * Raise number into power with modulo
+     *
+     * @param resource $left_operand
+     * @param resource $right_operand
+     * @param resource $modulus
      * @return string
      */
     public function powmod($left_operand, $right_operand, $modulus)
@@ -146,8 +160,9 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
     }
 
     /**
-     * @param string $left_operand
-     * @param string $right_operand
+     * Calculate square root
+     *
+     * @param $operand
      * @return string
      */
     public function sqrt($operand)
@@ -156,7 +171,10 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
         return gmp_strval($result);
     }
 
-
+    /**
+     * @param string $operand
+     * @return string
+     */
     public function binaryToInteger($operand)
     {
         $result = '0';
@@ -168,7 +186,10 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
         return gmp_strval($result);
     }
 
-
+    /**
+     * @param resource $operand GMP number resource
+     * @return string
+     */
     public function integerToBinary($operand)
     {
         $bigInt = gmp_strval($operand, 16);
@@ -181,7 +202,10 @@ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Inter
         return $return;
     }
 
-
+    /**
+     * @param string $operand
+     * @return string
+     */
     public function hexToDecimal($operand)
     {
         $return = '0';