[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/tests_runner/src/ -> lmbTestTreePath.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  
  10  /**

  11   * class lmbTestTreePath.

  12   *

  13   * @package tests_runner

  14   * @version $Id: lmbTestTreePath.class.php 6021 2007-06-28 13:18:44Z pachanga $

  15   */
  16  class lmbTestTreePath
  17  {
  18    static function normalize($tests_path)
  19    {
  20      return '/' . implode('/', self :: toArray($tests_path));
  21    }
  22  
  23    static function toArray($tests_path)
  24    {
  25      $tests_path = preg_replace('~\/\/+~', '/', $tests_path);
  26      $tests_path = rtrim($tests_path, '/');
  27      $path_array = explode('/', $tests_path);
  28  
  29      if(isset($path_array[0]) && $path_array[0] == '')
  30        array_shift($path_array);
  31  
  32      $new_array = array();
  33      foreach($path_array as $item)
  34      {
  35        if($item == '..')
  36          array_pop($new_array);
  37        else
  38          $new_array[] = $item;
  39      }
  40      return $new_array;
  41    }
  42  }
  43  
  44  ?>


Generated: Tue Dec 2 03:54:09 2008 Cross-referenced by PHPXref 0.7