-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[9.x] Flysystem v3 support #40411
Merged
Merged
[9.x] Flysystem v3 support #40411
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,7 +96,7 @@ public function __construct(FilesystemOperator $driver, FlysystemAdapter $adapte | |
} | ||
|
||
/** | ||
* Assert that the given file exists. | ||
* Assert that the given file or directory exists. | ||
* | ||
* @param string|array $path | ||
* @param string|null $content | ||
|
@@ -110,7 +110,7 @@ public function assertExists($path, $content = null) | |
|
||
foreach ($paths as $path) { | ||
PHPUnit::assertTrue( | ||
$this->exists($path), "Unable to find a file at path [{$path}]." | ||
$this->exists($path), "Unable to find a file or directory at path [{$path}]." | ||
); | ||
|
||
if (! is_null($content)) { | ||
|
@@ -119,7 +119,7 @@ public function assertExists($path, $content = null) | |
PHPUnit::assertSame( | ||
$content, | ||
$actual, | ||
"File [{$path}] was found, but content [{$actual}] does not match [{$content}]." | ||
"File or directory [{$path}] was found, but content [{$actual}] does not match [{$content}]." | ||
); | ||
} | ||
} | ||
|
@@ -128,7 +128,7 @@ public function assertExists($path, $content = null) | |
} | ||
|
||
/** | ||
* Assert that the given file does not exist. | ||
* Assert that the given file or directory does not exist. | ||
* | ||
* @param string|array $path | ||
* @return $this | ||
|
@@ -141,22 +141,22 @@ public function assertMissing($path) | |
|
||
foreach ($paths as $path) { | ||
PHPUnit::assertFalse( | ||
$this->exists($path), "Found unexpected file at path [{$path}]." | ||
$this->exists($path), "Found unexpected file or directory at path [{$path}]." | ||
); | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Determine if a file exists. | ||
* Determine if a file or directory exists. | ||
* | ||
* @param string $path | ||
* @return bool | ||
*/ | ||
public function exists($path) | ||
{ | ||
return $this->driver->fileExists($path); | ||
return $this->driver->has($path); | ||
} | ||
|
||
/** | ||
|
@@ -170,6 +170,50 @@ public function missing($path) | |
return ! $this->exists($path); | ||
} | ||
|
||
/** | ||
* Determine if a file exists. | ||
* | ||
* @param string $path | ||
* @return bool | ||
*/ | ||
public function fileExists($path) | ||
{ | ||
return $this->driver->fileExists($path); | ||
} | ||
|
||
/** | ||
* Determine if a file is missing. | ||
* | ||
* @param string $path | ||
* @return bool | ||
*/ | ||
public function fileMissing($path) | ||
{ | ||
return ! $this->fileExists($path); | ||
} | ||
|
||
/** | ||
* Determine if a directory exists. | ||
* | ||
* @param string $path | ||
* @return bool | ||
*/ | ||
public function directoryExists($path) | ||
{ | ||
return $this->driver->directoryExists($path); | ||
} | ||
|
||
/** | ||
* Determine if a directory is missing. | ||
* | ||
* @param string $path | ||
* @return bool | ||
*/ | ||
public function directoryMissing($path) | ||
{ | ||
return ! $this->directoryExists($path); | ||
} | ||
|
||
/** | ||
* Get the full path for the file at the given "short" path. | ||
* | ||
|
@@ -378,7 +422,7 @@ public function setVisibility($path, $visibility) | |
*/ | ||
public function prepend($path, $data, $separator = PHP_EOL) | ||
{ | ||
if ($this->exists($path)) { | ||
if ($this->fileExists($path)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I adjusted these because these methods are specifically for files. |
||
return $this->put($path, $data.$separator.$this->get($path)); | ||
} | ||
|
||
|
@@ -395,7 +439,7 @@ public function prepend($path, $data, $separator = PHP_EOL) | |
*/ | ||
public function append($path, $data, $separator = PHP_EOL) | ||
{ | ||
if ($this->exists($path)) { | ||
if ($this->fileExists($path)) { | ||
return $this->put($path, $this->get($path).$separator.$data); | ||
} | ||
|
||
|
@@ -689,7 +733,7 @@ public function directories($directory = null, $recursive = false) | |
} | ||
|
||
/** | ||
* Get all (recursive) of the directories within a given directory. | ||
* Get all the directories within a given directory (recursive). | ||
* | ||
* @param string|null $directory | ||
* @return array | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was how it's currently on 8.x:
https://github.com/laravel/framework/blob/8.x/src/Illuminate/Filesystem/FilesystemAdapter.php#L127