[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/phpexcel/PHPExcel/Shared/Escher/DgContainer/ -> SpgrContainer.php (source)

   1  <?php
   2  
   3  /**
   4   * PHPExcel_Shared_Escher_DgContainer_SpgrContainer
   5   *
   6   * Copyright (c) 2006 - 2015 PHPExcel
   7   *
   8   * This library is free software; you can redistribute it and/or
   9   * modify it under the terms of the GNU Lesser General Public
  10   * License as published by the Free Software Foundation; either
  11   * version 2.1 of the License, or (at your option) any later version.
  12   *
  13   * This library is distributed in the hope that it will be useful,
  14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16   * Lesser General Public License for more details.
  17   *
  18   * You should have received a copy of the GNU Lesser General Public
  19   * License along with this library; if not, write to the Free Software
  20   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  21   *
  22   * @category   PHPExcel
  23   * @package    PHPExcel_Shared_Escher
  24   * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  25   * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  26   * @version    ##VERSION##, ##DATE##
  27   */
  28  class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
  29  {
  30      /**
  31       * Parent Shape Group Container
  32       *
  33       * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
  34       */
  35      private $parent;
  36  
  37      /**
  38       * Shape Container collection
  39       *
  40       * @var array
  41       */
  42      private $children = array();
  43  
  44      /**
  45       * Set parent Shape Group Container
  46       *
  47       * @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
  48       */
  49      public function setParent($parent)
  50      {
  51          $this->parent = $parent;
  52      }
  53  
  54      /**
  55       * Get the parent Shape Group Container if any
  56       *
  57       * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer|null
  58       */
  59      public function getParent()
  60      {
  61          return $this->parent;
  62      }
  63  
  64      /**
  65       * Add a child. This will be either spgrContainer or spContainer
  66       *
  67       * @param mixed $child
  68       */
  69      public function addChild($child)
  70      {
  71          $this->children[] = $child;
  72          $child->setParent($this);
  73      }
  74  
  75      /**
  76       * Get collection of Shape Containers
  77       */
  78      public function getChildren()
  79      {
  80          return $this->children;
  81      }
  82  
  83      /**
  84       * Recursively get all spContainers within this spgrContainer
  85       *
  86       * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer[]
  87       */
  88      public function getAllSpContainers()
  89      {
  90          $allSpContainers = array();
  91  
  92          foreach ($this->children as $child) {
  93              if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer) {
  94                  $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers());
  95              } else {
  96                  $allSpContainers[] = $child;
  97              }
  98          }
  99  
 100          return $allSpContainers;
 101      }
 102  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1