File indexing completed on 2025-01-19 05:21:21
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_Element */ 0024 // require_once 'Zend/Pdf/Element.php'; 0025 0026 0027 /** 0028 * PDF file 'boolean' element implementation 0029 * 0030 * @category Zend 0031 * @package Zend_Pdf 0032 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0033 * @license http://framework.zend.com/license/new-bsd New BSD License 0034 */ 0035 class Zend_Pdf_Element_Boolean extends Zend_Pdf_Element 0036 { 0037 /** 0038 * Object value 0039 * 0040 * @var boolean 0041 */ 0042 public $value; 0043 0044 0045 /** 0046 * Object constructor 0047 * 0048 * @param boolean $val 0049 * @throws Zend_Pdf_Exception 0050 */ 0051 public function __construct($val) 0052 { 0053 if (! is_bool($val)) { 0054 // require_once 'Zend/Pdf/Exception.php'; 0055 throw new Zend_Pdf_Exception('Argument must be boolean.'); 0056 } 0057 0058 $this->value = $val; 0059 } 0060 0061 0062 /** 0063 * Return type of the element. 0064 * 0065 * @return integer 0066 */ 0067 public function getType() 0068 { 0069 return Zend_Pdf_Element::TYPE_BOOL; 0070 } 0071 0072 0073 /** 0074 * Return object as string 0075 * 0076 * @param Zend_Pdf_Factory $factory 0077 * @return string 0078 */ 0079 public function toString($factory = null) 0080 { 0081 return $this->value ? 'true' : 'false'; 0082 } 0083 }