Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -61,9 +61,6 @@ class Finder implements \IteratorAggregate, \Countable
private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
/**
* Constructor.
*/
public function __construct()
{
$this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
@@ -72,7 +69,7 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Creates a new Finder.
*
* @return Finder A new Finder instance
* @return static
*/
public static function create()
{
@@ -82,7 +79,7 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Restricts the matching to directories only.
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*/
public function directories()
{
@@ -94,7 +91,7 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Restricts the matching to files only.
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*/
public function files()
{
@@ -111,9 +108,9 @@ class Finder implements \IteratorAggregate, \Countable
* $finder->depth('> 1') // the Finder will start matching at level 1.
* $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point.
*
* @param int $level The depth level expression
* @param string|int $level The depth level expression
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see DepthRangeFilterIterator
* @see NumberComparator
@@ -137,7 +134,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param string $date A date range string
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see strtotime
* @see DateRangeFilterIterator
@@ -161,7 +158,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param string $pattern A pattern (a regexp, a glob, or a string)
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see FilenameFilterIterator
*/
@@ -177,7 +174,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param string $pattern A pattern (a regexp, a glob, or a string)
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see FilenameFilterIterator
*/
@@ -198,7 +195,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param string $pattern A pattern (string or regexp)
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see FilecontentFilterIterator
*/
@@ -219,7 +216,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param string $pattern A pattern (string or regexp)
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see FilecontentFilterIterator
*/
@@ -242,7 +239,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param string $pattern A pattern (a regexp or a string)
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see FilenameFilterIterator
*/
@@ -265,7 +262,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param string $pattern A pattern (a regexp or a string)
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see FilenameFilterIterator
*/
@@ -283,9 +280,9 @@ class Finder implements \IteratorAggregate, \Countable
* $finder->size('<= 1Ki');
* $finder->size(4);
*
* @param string $size A size range string
* @param string|int $size A size range string or an integer
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see SizeRangeFilterIterator
* @see NumberComparator
@@ -300,9 +297,13 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Excludes directories.
*
* Directories passed as argument must be relative to the ones defined with the `in()` method. For example:
*
* $finder->in(__DIR__)->exclude('ruby');
*
* @param string|array $dirs A directory path or an array of directories
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see ExcludeDirectoryFilterIterator
*/
@@ -316,9 +317,11 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Excludes "hidden" directories and files (starting with a dot).
*
* This option is enabled by default.
*
* @param bool $ignoreDotFiles Whether to exclude "hidden" files or not
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see ExcludeDirectoryFilterIterator
*/
@@ -336,9 +339,11 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Forces the finder to ignore version control directories.
*
* This option is enabled by default.
*
* @param bool $ignoreVCS Whether to exclude VCS files or not
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see ExcludeDirectoryFilterIterator
*/
@@ -376,9 +381,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* This can be slow as all the matching files and directories must be retrieved for comparison.
*
* @param \Closure $closure An anonymous function
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see SortableIterator
*/
@@ -394,7 +397,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* This can be slow as all the matching files and directories must be retrieved for comparison.
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see SortableIterator
*/
@@ -410,7 +413,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* This can be slow as all the matching files and directories must be retrieved for comparison.
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see SortableIterator
*/
@@ -428,7 +431,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* This can be slow as all the matching files and directories must be retrieved for comparison.
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see SortableIterator
*/
@@ -448,7 +451,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* This can be slow as all the matching files and directories must be retrieved for comparison.
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see SortableIterator
*/
@@ -466,7 +469,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* This can be slow as all the matching files and directories must be retrieved for comparison.
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see SortableIterator
*/
@@ -483,9 +486,7 @@ class Finder implements \IteratorAggregate, \Countable
* The anonymous function receives a \SplFileInfo and must return false
* to remove files.
*
* @param \Closure $closure An anonymous function
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @see CustomFilterIterator
*/
@@ -499,7 +500,7 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Forces the following of symlinks.
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*/
public function followLinks()
{
@@ -515,7 +516,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param bool $ignore
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*/
public function ignoreUnreadableDirs($ignore = true)
{
@@ -529,7 +530,7 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param string|array $dirs A directory path or an array of directories
*
* @return Finder|SplFileInfo[] The current Finder instance
* @return $this
*
* @throws \InvalidArgumentException if one of the directories does not exist
*/
@@ -539,9 +540,9 @@ class Finder implements \IteratorAggregate, \Countable
foreach ((array) $dirs as $dir) {
if (is_dir($dir)) {
$resolvedDirs[] = $dir;
} elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
$resolvedDirs = array_merge($resolvedDirs, $glob);
$resolvedDirs[] = $this->normalizeDir($dir);
} elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
$resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
} else {
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
}
@@ -563,11 +564,11 @@ class Finder implements \IteratorAggregate, \Countable
*/
public function getIterator()
{
if (0 === count($this->dirs) && 0 === count($this->iterators)) {
if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
}
if (1 === count($this->dirs) && 0 === count($this->iterators)) {
if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
return $this->searchInDirectory($this->dirs[0]);
}
@@ -590,9 +591,9 @@ class Finder implements \IteratorAggregate, \Countable
*
* @param mixed $iterator
*
* @return Finder|SplFileInfo[] The finder
* @return $this
*
* @throws \InvalidArgumentException When the given argument is not iterable.
* @throws \InvalidArgumentException when the given argument is not iterable
*/
public function append($iterator)
{
@@ -600,7 +601,7 @@ class Finder implements \IteratorAggregate, \Countable
$this->iterators[] = $iterator->getIterator();
} elseif ($iterator instanceof \Iterator) {
$this->iterators[] = $iterator;
} elseif ($iterator instanceof \Traversable || is_array($iterator)) {
} elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
$it = new \ArrayIterator();
foreach ($iterator as $file) {
$it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
@@ -613,6 +614,20 @@ class Finder implements \IteratorAggregate, \Countable
return $this;
}
/**
* Check if the any results were found.
*
* @return bool
*/
public function hasResults()
{
foreach ($this->getIterator() as $_) {
return true;
}
return false;
}
/**
* Counts all the results collected by the iterators.
*
@@ -713,4 +728,16 @@ class Finder implements \IteratorAggregate, \Countable
return $iterator;
}
/**
* Normalizes given directory names by removing trailing slashes.
*
* @param string $dir
*
* @return string
*/
private function normalizeDir($dir)
{
return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
}
}