[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/fs/src/ -> lmbFileLocationsList.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/fs/src/lmbFileLocations.interface.php');
  10  
  11  /**

  12   * class lmbFileLocationsList.

  13   *

  14   * @package fs

  15   * @version $Id$

  16   */
  17  class lmbFileLocationsList implements lmbFileLocations
  18  {
  19    protected $locations = array();
  20  
  21    function __construct()
  22    {
  23      if(($args = func_get_args()) > 0)
  24        $this->locations = $args;
  25    }
  26  
  27    function getLocations($params = array())
  28    {
  29      return $this->_collectLocations($this->locations, $params);
  30    }
  31  
  32    function _collectLocations($locations, $params)
  33    {
  34      $result = array();
  35      foreach($locations as $location)
  36      {
  37        if(is_object($location) && $location instanceof lmbFileLocations)
  38        {
  39          foreach($location->getLocations($params) as $sub_location)
  40            $result[] = $sub_location;
  41        }
  42        elseif(!is_array($location))
  43          $result[] = $location;
  44        else
  45          $result = array_merge($result, $this->_collectLocations($location, $params));
  46      }
  47      return $result;
  48    }
  49  }
  50  
  51  ?>


Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7