public function addHash($options) { if (!is_array($options)) { $options = (array) $options; } $options['algorithm'] = 'md5'; parent::addHash($options); return $this; }
/** * Ensures that addHash() returns expected value * * @return void */ public function testAddHash() { $validator = new Zend_Validate_File_Hash('12345'); $validator->addHash('12344'); $this->assertEquals(array('12345' => 'crc32', '12344' => 'crc32'), $validator->getHash()); $validator->addHash(array('12321', '12121')); $this->assertEquals(array('12345' => 'crc32', '12344' => 'crc32', '12321' => 'crc32', '12121' => 'crc32'), $validator->getHash()); }
/** * Adds the md5 hash for one or multiple files * * @param string|array $hash Hash to check for * @param string $algorithm (Depreciated) Algorithm to use, fixed to md5 * @return Zend_Validate_File_Hash Provides a fluent interface */ public function addHash($hash, $algorithm = 'md5') { parent::addHash($hash, 'md5'); return $this; }