[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\Finder\Iterator; 13 14 @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); 15 16 use Symfony\Component\Finder\SplFileInfo; 17 18 /** 19 * Iterate over shell command result. 20 * 21 * @author Jean-François Simon <contact@jfsimon.fr> 22 * 23 * @deprecated since 2.8, to be removed in 3.0. 24 */ 25 class FilePathsIterator extends \ArrayIterator 26 { 27 /** 28 * @var string 29 */ 30 private $baseDir; 31 32 /** 33 * @var int 34 */ 35 private $baseDirLength; 36 37 /** 38 * @var string 39 */ 40 private $subPath; 41 42 /** 43 * @var string 44 */ 45 private $subPathname; 46 47 /** 48 * @var SplFileInfo 49 */ 50 private $current; 51 52 /** 53 * @param array $paths List of paths returned by shell command 54 * @param string $baseDir Base dir for relative path building 55 */ 56 public function __construct(array $paths, $baseDir) 57 { 58 $this->baseDir = $baseDir; 59 $this->baseDirLength = \strlen($baseDir); 60 61 parent::__construct($paths); 62 } 63 64 /** 65 * @param string $name 66 * @param array $arguments 67 * 68 * @return mixed 69 */ 70 public function __call($name, array $arguments) 71 { 72 return \call_user_func_array(array($this->current(), $name), $arguments); 73 } 74 75 /** 76 * Return an instance of SplFileInfo with support for relative paths. 77 * 78 * @return SplFileInfo File information 79 */ 80 public function current() 81 { 82 return $this->current; 83 } 84 85 /** 86 * @return string 87 */ 88 public function key() 89 { 90 return $this->current->getPathname(); 91 } 92 93 public function next() 94 { 95 parent::next(); 96 $this->buildProperties(); 97 } 98 99 public function rewind() 100 { 101 parent::rewind(); 102 $this->buildProperties(); 103 } 104 105 /** 106 * @return string 107 */ 108 public function getSubPath() 109 { 110 return $this->subPath; 111 } 112 113 /** 114 * @return string 115 */ 116 public function getSubPathname() 117 { 118 return $this->subPathname; 119 } 120 121 private function buildProperties() 122 { 123 $absolutePath = parent::current(); 124 125 if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) { 126 $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\'); 127 $dir = \dirname($this->subPathname); 128 $this->subPath = '.' === $dir ? '' : $dir; 129 } else { 130 $this->subPath = $this->subPathname = ''; 131 } 132 133 $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname); 134 } 135 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |