File indexing completed on 2024-06-23 05:55:33

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Pdf
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 
0023 /** Zend_Pdf_Filter_Compression */
0024 // require_once 'Zend/Pdf/Filter/Compression.php';
0025 
0026 /**
0027  * LZW stream filter
0028  *
0029  * @package    Zend_Pdf
0030  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0031  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0032  */
0033 class Zend_Pdf_Filter_Compression_Lzw extends Zend_Pdf_Filter_Compression
0034 {
0035     /**
0036      * Get EarlyChange decode param value
0037      *
0038      * @param array $params
0039      * @return integer
0040      * @throws Zend_Pdf_Exception
0041      */
0042     private static function _getEarlyChangeValue($params)
0043     {
0044         if (isset($params['EarlyChange'])) {
0045             $earlyChange = $params['EarlyChange'];
0046 
0047             if ($earlyChange != 0  &&  $earlyChange != 1) {
0048                 // require_once 'Zend/Pdf/Exception.php';
0049                 throw new Zend_Pdf_Exception('Invalid value of \'EarlyChange\' decode param - ' . $earlyChange . '.' );
0050             }
0051             return $earlyChange;
0052         } else {
0053             return 1;
0054         }
0055     }
0056 
0057 
0058     /**
0059      * Encode data
0060      *
0061      * @param string $data
0062      * @param array $params
0063      * @return string
0064      * @throws Zend_Pdf_Exception
0065      */
0066     public static function encode($data, $params = null)
0067     {
0068         if ($params != null) {
0069             $data = self::_applyEncodeParams($data, $params);
0070         }
0071 
0072         // require_once 'Zend/Pdf/Exception.php';
0073         throw new Zend_Pdf_Exception('Not implemented yet');
0074     }
0075 
0076     /**
0077      * Decode data
0078      *
0079      * @param string $data
0080      * @param array $params
0081      * @return string
0082      * @throws Zend_Pdf_Exception
0083      */
0084     public static function decode($data, $params = null)
0085     {
0086         // require_once 'Zend/Pdf/Exception.php';
0087         throw new Zend_Pdf_Exception('Not implemented yet');
0088 
0089         if ($params !== null) {
0090             return self::_applyDecodeParams($data, $params);
0091         } else {
0092             return $data;
0093         }
0094     }
0095 }