1 <?php 2 /** 3 * Copyright 2012-2017 Horde LLC (http://www.horde.org/) 4 * 5 * See the enclosed file LICENSE for license information (LGPL). If you 6 * did not receive this file, see http://www.horde.org/licenses/lgpl21. 7 * 8 * @category Horde 9 * @copyright 2012-2017 Horde LLC 10 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 11 * @package Imap_Client 12 */ 13 14 /** 15 * Object representation of an IMAP nstring (NIL or string) (RFC 3501 [4.5]). 16 * 17 * @author Michael Slusarz <slusarz@horde.org> 18 * @category Horde 19 * @copyright 2012-2017 Horde LLC 20 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 21 * @package Imap_Client 22 */ 23 class Horde_Imap_Client_Data_Format_Nstring extends Horde_Imap_Client_Data_Format_String 24 { 25 /** 26 */ 27 public function __construct($data = null) 28 { 29 /* Data can be null (NIL) here. */ 30 if (is_null($data)) { 31 $this->_data = null; 32 } else { 33 parent::__construct($data); 34 } 35 } 36 37 /** 38 */ 39 public function __toString() 40 { 41 return is_null($this->_data) 42 ? '' 43 : parent::__toString(); 44 } 45 46 /** 47 */ 48 public function escape() 49 { 50 return is_null($this->_data) 51 ? 'NIL' 52 : parent::escape(); 53 } 54 55 public function escapeStream() 56 { 57 if (is_null($this->_data)) { 58 $stream = new Horde_Stream_Temp(); 59 $stream->add('NIL', true); 60 return $stream->stream; 61 } 62 63 return parent::escapeStream(); 64 } 65 66 /** 67 */ 68 public function quoted() 69 { 70 return is_null($this->_data) 71 ? false 72 : parent::quoted(); 73 } 74 75 /** 76 */ 77 public function length() 78 { 79 return is_null($this->_data) 80 ? 0 81 : parent::length(); 82 } 83 84 /** 85 */ 86 public function getStream() 87 { 88 return is_null($this->_data) 89 ? new Horde_Stream_Temp() 90 : parent::getStream(); 91 } 92 93 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body