From a7e17cb70e9306f8887bd2b5ca1a37edcbe3ea0f Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Mon, 11 May 2015 15:02:33 +0200 Subject: Let composer manage its own files --- .../Finder/Iterator/CustomFilterIterator.php | 63 ---------- .../Finder/Iterator/DateRangeFilterIterator.php | 60 ---------- .../Finder/Iterator/DepthRangeFilterIterator.php | 47 -------- .../Iterator/ExcludeDirectoryFilterIterator.php | 55 --------- .../Finder/Iterator/FilePathsIterator.php | 131 --------------------- .../Finder/Iterator/FileTypeFilterIterator.php | 55 --------- .../Finder/Iterator/FilecontentFilterIterator.php | 76 ------------ .../Finder/Iterator/FilenameFilterIterator.php | 67 ----------- .../Component/Finder/Iterator/FilterIterator.php | 49 -------- .../Finder/Iterator/MultiplePcreFilterIterator.php | 66 ----------- .../Finder/Iterator/PathFilterIterator.php | 74 ------------ .../Finder/Iterator/RecursiveDirectoryIterator.php | 126 -------------------- .../Finder/Iterator/SizeRangeFilterIterator.php | 59 ---------- .../Component/Finder/Iterator/SortableIterator.php | 82 ------------- 14 files changed, 1010 deletions(-) delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/CustomFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilePathsIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilenameFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/PathFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php delete mode 100644 Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/SortableIterator.php (limited to 'Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator') diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/CustomFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/CustomFilterIterator.php deleted file mode 100644 index 24b15d9..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/CustomFilterIterator.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -/** - * CustomFilterIterator filters files by applying anonymous functions. - * - * The anonymous function receives a \SplFileInfo and must return false - * to remove files. - * - * @author Fabien Potencier - */ -class CustomFilterIterator extends FilterIterator -{ - private $filters = array(); - - /** - * Constructor. - * - * @param \Iterator $iterator The Iterator to filter - * @param array $filters An array of PHP callbacks - * - * @throws \InvalidArgumentException - */ - public function __construct(\Iterator $iterator, array $filters) - { - foreach ($filters as $filter) { - if (!is_callable($filter)) { - throw new \InvalidArgumentException('Invalid PHP callback.'); - } - } - $this->filters = $filters; - - parent::__construct($iterator); - } - - /** - * Filters the iterator values. - * - * @return bool true if the value should be kept, false otherwise - */ - public function accept() - { - $fileinfo = $this->current(); - - foreach ($this->filters as $filter) { - if (false === call_user_func($filter, $fileinfo)) { - return false; - } - } - - return true; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php deleted file mode 100644 index 4d5ef9a..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -use Symfony\Component\Finder\Comparator\DateComparator; - -/** - * DateRangeFilterIterator filters out files that are not in the given date range (last modified dates). - * - * @author Fabien Potencier - */ -class DateRangeFilterIterator extends FilterIterator -{ - private $comparators = array(); - - /** - * Constructor. - * - * @param \Iterator $iterator The Iterator to filter - * @param DateComparator[] $comparators An array of DateComparator instances - */ - public function __construct(\Iterator $iterator, array $comparators) - { - $this->comparators = $comparators; - - parent::__construct($iterator); - } - - /** - * Filters the iterator values. - * - * @return bool true if the value should be kept, false otherwise - */ - public function accept() - { - $fileinfo = $this->current(); - - if (!file_exists($fileinfo->getRealPath())) { - return false; - } - - $filedate = $fileinfo->getMTime(); - foreach ($this->comparators as $compare) { - if (!$compare->test($filedate)) { - return false; - } - } - - return true; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php deleted file mode 100644 index f78c71e..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -/** - * DepthRangeFilterIterator limits the directory depth. - * - * @author Fabien Potencier - */ -class DepthRangeFilterIterator extends FilterIterator -{ - private $minDepth = 0; - - /** - * Constructor. - * - * @param \RecursiveIteratorIterator $iterator The Iterator to filter - * @param int $minDepth The min depth - * @param int $maxDepth The max depth - */ - public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX) - { - $this->minDepth = $minDepth; - $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth); - - parent::__construct($iterator); - } - - /** - * Filters the iterator values. - * - * @return bool true if the value should be kept, false otherwise - */ - public function accept() - { - return $this->getInnerIterator()->getDepth() >= $this->minDepth; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php deleted file mode 100644 index 1ddde85..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -/** - * ExcludeDirectoryFilterIterator filters out directories. - * - * @author Fabien Potencier - */ -class ExcludeDirectoryFilterIterator extends FilterIterator -{ - private $patterns = array(); - - /** - * Constructor. - * - * @param \Iterator $iterator The Iterator to filter - * @param array $directories An array of directories to exclude - */ - public function __construct(\Iterator $iterator, array $directories) - { - foreach ($directories as $directory) { - $this->patterns[] = '#(^|/)'.preg_quote($directory, '#').'(/|$)#'; - } - - parent::__construct($iterator); - } - - /** - * Filters the iterator values. - * - * @return bool true if the value should be kept, false otherwise - */ - public function accept() - { - $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath(); - $path = strtr($path, '\\', '/'); - foreach ($this->patterns as $pattern) { - if (preg_match($pattern, $path)) { - return false; - } - } - - return true; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilePathsIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilePathsIterator.php deleted file mode 100644 index 4da2f5b..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilePathsIterator.php +++ /dev/null @@ -1,131 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -use Symfony\Component\Finder\SplFileInfo; - -/** - * Iterate over shell command result. - * - * @author Jean-François Simon - */ -class FilePathsIterator extends \ArrayIterator -{ - /** - * @var string - */ - private $baseDir; - - /** - * @var int - */ - private $baseDirLength; - - /** - * @var string - */ - private $subPath; - - /** - * @var string - */ - private $subPathname; - - /** - * @var SplFileInfo - */ - private $current; - - /** - * @param array $paths List of paths returned by shell command - * @param string $baseDir Base dir for relative path building - */ - public function __construct(array $paths, $baseDir) - { - $this->baseDir = $baseDir; - $this->baseDirLength = strlen($baseDir); - - parent::__construct($paths); - } - - /** - * @param string $name - * @param array $arguments - * - * @return mixed - */ - public function __call($name, array $arguments) - { - return call_user_func_array(array($this->current(), $name), $arguments); - } - - /** - * Return an instance of SplFileInfo with support for relative paths. - * - * @return SplFileInfo File information - */ - public function current() - { - return $this->current; - } - - /** - * @return string - */ - public function key() - { - return $this->current->getPathname(); - } - - public function next() - { - parent::next(); - $this->buildProperties(); - } - - public function rewind() - { - parent::rewind(); - $this->buildProperties(); - } - - /** - * @return string - */ - public function getSubPath() - { - return $this->subPath; - } - - /** - * @return string - */ - public function getSubPathname() - { - return $this->subPathname; - } - - private function buildProperties() - { - $absolutePath = parent::current(); - - if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) { - $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\'); - $dir = dirname($this->subPathname); - $this->subPath = '.' === $dir ? '' : $dir; - } else { - $this->subPath = $this->subPathname = ''; - } - - $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php deleted file mode 100644 index f50fd82..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -/** - * FileTypeFilterIterator only keeps files, directories, or both. - * - * @author Fabien Potencier - */ -class FileTypeFilterIterator extends FilterIterator -{ - const ONLY_FILES = 1; - const ONLY_DIRECTORIES = 2; - - private $mode; - - /** - * Constructor. - * - * @param \Iterator $iterator The Iterator to filter - * @param int $mode The mode (self::ONLY_FILES or self::ONLY_DIRECTORIES) - */ - public function __construct(\Iterator $iterator, $mode) - { - $this->mode = $mode; - - parent::__construct($iterator); - } - - /** - * Filters the iterator values. - * - * @return bool true if the value should be kept, false otherwise - */ - public function accept() - { - $fileinfo = $this->current(); - if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) { - return false; - } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) { - return false; - } - - return true; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php deleted file mode 100644 index 28cf770..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -/** - * FilecontentFilterIterator filters files by their contents using patterns (regexps or strings). - * - * @author Fabien Potencier - * @author Włodzimierz Gajda - */ -class FilecontentFilterIterator extends MultiplePcreFilterIterator -{ - /** - * Filters the iterator values. - * - * @return bool true if the value should be kept, false otherwise - */ - public function accept() - { - if (!$this->matchRegexps && !$this->noMatchRegexps) { - return true; - } - - $fileinfo = $this->current(); - - if ($fileinfo->isDir() || !$fileinfo->isReadable()) { - return false; - } - - $content = $fileinfo->getContents(); - if (!$content) { - return false; - } - - // should at least not match one rule to exclude - foreach ($this->noMatchRegexps as $regex) { - if (preg_match($regex, $content)) { - return false; - } - } - - // should at least match one rule - $match = true; - if ($this->matchRegexps) { - $match = false; - foreach ($this->matchRegexps as $regex) { - if (preg_match($regex, $content)) { - return true; - } - } - } - - return $match; - } - - /** - * Converts string to regexp if necessary. - * - * @param string $str Pattern: string or regexp - * - * @return string regexp corresponding to a given string or regexp - */ - protected function toRegex($str) - { - return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/'; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilenameFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilenameFilterIterator.php deleted file mode 100644 index f1cd391..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilenameFilterIterator.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -use Symfony\Component\Finder\Expression\Expression; - -/** - * FilenameFilterIterator filters files by patterns (a regexp, a glob, or a string). - * - * @author Fabien Potencier - */ -class FilenameFilterIterator extends MultiplePcreFilterIterator -{ - /** - * Filters the iterator values. - * - * @return bool true if the value should be kept, false otherwise - */ - public function accept() - { - $filename = $this->current()->getFilename(); - - // should at least not match one rule to exclude - foreach ($this->noMatchRegexps as $regex) { - if (preg_match($regex, $filename)) { - return false; - } - } - - // should at least match one rule - $match = true; - if ($this->matchRegexps) { - $match = false; - foreach ($this->matchRegexps as $regex) { - if (preg_match($regex, $filename)) { - return true; - } - } - } - - return $match; - } - - /** - * Converts glob to regexp. - * - * PCRE patterns are left unchanged. - * Glob strings are transformed with Glob::toRegex(). - * - * @param string $str Pattern: glob or regexp - * - * @return string regexp corresponding to a given glob or regexp - */ - protected function toRegex($str) - { - return Expression::create($str)->getRegex()->render(); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilterIterator.php deleted file mode 100644 index f4da44c..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilterIterator.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -/** - * This iterator just overrides the rewind method in order to correct a PHP bug. - * - * @see https://bugs.php.net/bug.php?id=49104 - * - * @author Alex Bogomazov - */ -abstract class FilterIterator extends \FilterIterator -{ - /** - * This is a workaround for the problem with \FilterIterator leaving inner \FilesystemIterator in wrong state after - * rewind in some cases. - * - * @see FilterIterator::rewind() - */ - public function rewind() - { - $iterator = $this; - while ($iterator instanceof \OuterIterator) { - $innerIterator = $iterator->getInnerIterator(); - - if ($innerIterator instanceof RecursiveDirectoryIterator) { - if ($innerIterator->isRewindable()) { - $innerIterator->next(); - $innerIterator->rewind(); - } - } elseif ($iterator->getInnerIterator() instanceof \FilesystemIterator) { - $iterator->getInnerIterator()->next(); - $iterator->getInnerIterator()->rewind(); - } - $iterator = $iterator->getInnerIterator(); - } - - parent::rewind(); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php deleted file mode 100644 index 068a7ef..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -use Symfony\Component\Finder\Expression\Expression; - -/** - * MultiplePcreFilterIterator filters files using patterns (regexps, globs or strings). - * - * @author Fabien Potencier - */ -abstract class MultiplePcreFilterIterator extends FilterIterator -{ - protected $matchRegexps = array(); - protected $noMatchRegexps = array(); - - /** - * Constructor. - * - * @param \Iterator $iterator The Iterator to filter - * @param array $matchPatterns An array of patterns that need to match - * @param array $noMatchPatterns An array of patterns that need to not match - */ - public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns) - { - foreach ($matchPatterns as $pattern) { - $this->matchRegexps[] = $this->toRegex($pattern); - } - - foreach ($noMatchPatterns as $pattern) { - $this->noMatchRegexps[] = $this->toRegex($pattern); - } - - parent::__construct($iterator); - } - - /** - * Checks whether the string is a regex. - * - * @param string $str - * - * @return bool Whether the given string is a regex - */ - protected function isRegex($str) - { - return Expression::create($str)->isRegex(); - } - - /** - * Converts string into regexp. - * - * @param string $str Pattern - * - * @return string regexp corresponding to a given string - */ - abstract protected function toRegex($str); -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/PathFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/PathFilterIterator.php deleted file mode 100644 index 2bb8ebd..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/PathFilterIterator.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -/** - * PathFilterIterator filters files by path patterns (e.g. some/special/dir). - * - * @author Fabien Potencier - * @author Włodzimierz Gajda - */ -class PathFilterIterator extends MultiplePcreFilterIterator -{ - /** - * Filters the iterator values. - * - * @return bool true if the value should be kept, false otherwise - */ - public function accept() - { - $filename = $this->current()->getRelativePathname(); - - if ('\\' === DIRECTORY_SEPARATOR) { - $filename = strtr($filename, '\\', '/'); - } - - // should at least not match one rule to exclude - foreach ($this->noMatchRegexps as $regex) { - if (preg_match($regex, $filename)) { - return false; - } - } - - // should at least match one rule - $match = true; - if ($this->matchRegexps) { - $match = false; - foreach ($this->matchRegexps as $regex) { - if (preg_match($regex, $filename)) { - return true; - } - } - } - - return $match; - } - - /** - * Converts strings to regexp. - * - * PCRE patterns are left unchanged. - * - * Default conversion: - * 'lorem/ipsum/dolor' ==> 'lorem\/ipsum\/dolor/' - * - * Use only / as directory separator (on Windows also). - * - * @param string $str Pattern: regexp or dirname. - * - * @return string regexp corresponding to a given string or regexp - */ - protected function toRegex($str) - { - return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/'; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php deleted file mode 100644 index af824d0..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -use Symfony\Component\Finder\Exception\AccessDeniedException; -use Symfony\Component\Finder\SplFileInfo; - -/** - * Extends the \RecursiveDirectoryIterator to support relative paths. - * - * @author Victor Berchet - */ -class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator -{ - /** - * @var bool - */ - private $ignoreUnreadableDirs; - - /** - * @var bool - */ - private $rewindable; - - /** - * Constructor. - * - * @param string $path - * @param int $flags - * @param bool $ignoreUnreadableDirs - * - * @throws \RuntimeException - */ - public function __construct($path, $flags, $ignoreUnreadableDirs = false) - { - if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) { - throw new \RuntimeException('This iterator only support returning current as fileinfo.'); - } - - parent::__construct($path, $flags); - $this->ignoreUnreadableDirs = $ignoreUnreadableDirs; - } - - /** - * Return an instance of SplFileInfo with support for relative paths. - * - * @return SplFileInfo File information - */ - public function current() - { - return new SplFileInfo(parent::current()->getPathname(), $this->getSubPath(), $this->getSubPathname()); - } - - /** - * @return \RecursiveIterator - * - * @throws AccessDeniedException - */ - public function getChildren() - { - try { - $children = parent::getChildren(); - - if ($children instanceof self) { - // parent method will call the constructor with default arguments, so unreadable dirs won't be ignored anymore - $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs; - } - - return $children; - } catch (\UnexpectedValueException $e) { - if ($this->ignoreUnreadableDirs) { - // If directory is unreadable and finder is set to ignore it, a fake empty content is returned. - return new \RecursiveArrayIterator(array()); - } else { - throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e); - } - } - } - - /** - * Do nothing for non rewindable stream. - */ - public function rewind() - { - if (false === $this->isRewindable()) { - return; - } - - // @see https://bugs.php.net/bug.php?id=49104 - parent::next(); - - parent::rewind(); - } - - /** - * Checks if the stream is rewindable. - * - * @return bool true when the stream is rewindable, false otherwise - */ - public function isRewindable() - { - if (null !== $this->rewindable) { - return $this->rewindable; - } - - if (false !== $stream = @opendir($this->getPath())) { - $infos = stream_get_meta_data($stream); - closedir($stream); - - if ($infos['seekable']) { - return $this->rewindable = true; - } - } - - return $this->rewindable = false; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php deleted file mode 100644 index 3d3140a..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -use Symfony\Component\Finder\Comparator\NumberComparator; - -/** - * SizeRangeFilterIterator filters out files that are not in the given size range. - * - * @author Fabien Potencier - */ -class SizeRangeFilterIterator extends FilterIterator -{ - private $comparators = array(); - - /** - * Constructor. - * - * @param \Iterator $iterator The Iterator to filter - * @param NumberComparator[] $comparators An array of NumberComparator instances - */ - public function __construct(\Iterator $iterator, array $comparators) - { - $this->comparators = $comparators; - - parent::__construct($iterator); - } - - /** - * Filters the iterator values. - * - * @return bool true if the value should be kept, false otherwise - */ - public function accept() - { - $fileinfo = $this->current(); - if (!$fileinfo->isFile()) { - return true; - } - - $filesize = $fileinfo->getSize(); - foreach ($this->comparators as $compare) { - if (!$compare->test($filesize)) { - return false; - } - } - - return true; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/SortableIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/SortableIterator.php deleted file mode 100644 index b32ac8d..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Iterator/SortableIterator.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Iterator; - -/** - * SortableIterator applies a sort on a given Iterator. - * - * @author Fabien Potencier - */ -class SortableIterator implements \IteratorAggregate -{ - const SORT_BY_NAME = 1; - const SORT_BY_TYPE = 2; - const SORT_BY_ACCESSED_TIME = 3; - const SORT_BY_CHANGED_TIME = 4; - const SORT_BY_MODIFIED_TIME = 5; - - private $iterator; - private $sort; - - /** - * Constructor. - * - * @param \Traversable $iterator The Iterator to filter - * @param int|callable $sort The sort type (SORT_BY_NAME, SORT_BY_TYPE, or a PHP callback) - * - * @throws \InvalidArgumentException - */ - public function __construct(\Traversable $iterator, $sort) - { - $this->iterator = $iterator; - - if (self::SORT_BY_NAME === $sort) { - $this->sort = function ($a, $b) { - return strcmp($a->getRealpath(), $b->getRealpath()); - }; - } elseif (self::SORT_BY_TYPE === $sort) { - $this->sort = function ($a, $b) { - if ($a->isDir() && $b->isFile()) { - return -1; - } elseif ($a->isFile() && $b->isDir()) { - return 1; - } - - return strcmp($a->getRealpath(), $b->getRealpath()); - }; - } elseif (self::SORT_BY_ACCESSED_TIME === $sort) { - $this->sort = function ($a, $b) { - return ($a->getATime() - $b->getATime()); - }; - } elseif (self::SORT_BY_CHANGED_TIME === $sort) { - $this->sort = function ($a, $b) { - return ($a->getCTime() - $b->getCTime()); - }; - } elseif (self::SORT_BY_MODIFIED_TIME === $sort) { - $this->sort = function ($a, $b) { - return ($a->getMTime() - $b->getMTime()); - }; - } elseif (is_callable($sort)) { - $this->sort = $sort; - } else { - throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.'); - } - } - - public function getIterator() - { - $array = iterator_to_array($this->iterator, true); - uasort($array, $this->sort); - - return new \ArrayIterator($array); - } -} -- cgit v1.2.3-70-g09d2