web/lib/Zend/View/Helper/Placeholder/Container/Abstract.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_View
    16  * @package    Zend_View
    17  * @subpackage Helper
    17  * @subpackage Helper
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @version    $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
    19  * @version    $Id: Abstract.php 25255 2013-02-13 15:25:39Z frosch $
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    21  */
    21  */
    22 
    22 
    23 /**
    23 /**
    24  * Abstract class representing container for placeholder values
    24  * Abstract class representing container for placeholder values
    25  *
    25  *
    26  * @package    Zend_View
    26  * @package    Zend_View
    27  * @subpackage Helper
    27  * @subpackage Helper
    28  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    28  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    29  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    29  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    30  */
    30  */
    31 abstract class Zend_View_Helper_Placeholder_Container_Abstract extends ArrayObject
    31 abstract class Zend_View_Helper_Placeholder_Container_Abstract extends ArrayObject
    32 {
    32 {
    33     /**
    33     /**
    91     protected $_captureKey;
    91     protected $_captureKey;
    92 
    92 
    93     /**
    93     /**
    94      * Constructor - This is needed so that we can attach a class member as the ArrayObject container
    94      * Constructor - This is needed so that we can attach a class member as the ArrayObject container
    95      *
    95      *
    96      * @return void
    96      * @return \Zend_View_Helper_Placeholder_Container_Abstract
    97      */
    97      */
    98     public function __construct()
    98     public function __construct()
    99     {
    99     {
   100         parent::__construct(array(), parent::ARRAY_AS_PROPS);
   100         parent::__construct(array(), parent::ARRAY_AS_PROPS);
   101     }
   101     }
   250     }
   250     }
   251 
   251 
   252     /**
   252     /**
   253      * Start capturing content to push into placeholder
   253      * Start capturing content to push into placeholder
   254      *
   254      *
   255      * @param  int $type How to capture content into placeholder; append, prepend, or set
   255      * @param int|string $type How to capture content into placeholder; append, prepend, or set
       
   256      * @param null       $key
       
   257      * @throws Zend_View_Helper_Placeholder_Container_Exception
   256      * @return void
   258      * @return void
   257      * @throws Zend_View_Helper_Placeholder_Exception if nested captures detected
       
   258      */
   259      */
   259     public function captureStart($type = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $key = null)
   260     public function captureStart($type = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $key = null)
   260     {
   261     {
   261         if ($this->_captureLock) {
   262         if ($this->_captureLock) {
   262             require_once 'Zend/View/Helper/Placeholder/Container/Exception.php';
   263             require_once 'Zend/View/Helper/Placeholder/Container/Exception.php';
   347     }
   348     }
   348 
   349 
   349     /**
   350     /**
   350      * Render the placeholder
   351      * Render the placeholder
   351      *
   352      *
       
   353      * @param null $indent
   352      * @return string
   354      * @return string
   353      */
   355      */
   354     public function toString($indent = null)
   356     public function toString($indent = null)
   355     {
   357     {
       
   358         // Check items
       
   359         if (0 === $this->count()) {
       
   360             return '';
       
   361         }
       
   362 
   356         $indent = ($indent !== null)
   363         $indent = ($indent !== null)
   357                 ? $this->getWhitespace($indent)
   364                 ? $this->getWhitespace($indent)
   358                 : $this->getIndent();
   365                 : $this->getIndent();
   359 
   366 
   360         $items  = $this->getArrayCopy();
   367         $items  = $this->getArrayCopy();