Horde_Compress_Fast::compress PHP Method

compress() public method

Compresses a string.
public compress ( string $text ) : string
$text string The string to compress.
return string The compressed string.
    public function compress($text)
    {
        if (!is_scalar($text) && !is_null($text)) {
            throw new Horde_Compress_Fast_Exception('Data to compress must be a string.');
        }
        return $this->_compress->compress(strval($text));
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @dataProvider providerTestStringInput
  */
 public function testStringInput($data, $success)
 {
     $ob = new Horde_Compress_Fast(array('drivers' => array('Horde_Compress_Fast_Null')));
     try {
         $ob->compress($data);
         if (!$success) {
             $this->fail('Expected exception.');
         }
     } catch (Horde_Compress_Fast_Exception $e) {
         if ($success) {
             $this->fail('Unexpected exception.');
         }
     }
 }
All Usage Examples Of Horde_Compress_Fast::compress