Skip to content

Commit

Permalink
rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jul 27, 2018
1 parent e5bb47b commit fd03dd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/Illuminate/Http/UploadedFile.php
Expand Up @@ -91,15 +91,16 @@ public function storeAs($path, $name, $options = [])
* Get the contents of the uploaded file.
*
* @return bool|string
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function getContents()
public function get()
{
if ($this->isValid()) {
return file_get_contents($this->getPathname());
if (! $this->isValid()) {
throw new FileNotFoundException("File does not exist at path {$this->getPathname()}");
}

throw new FileNotFoundException("File does not exist at path {$this->getPathname()}");
return file_get_contents($this->getPathname());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Http/HttpUploadedFileTest.php
Expand Up @@ -18,6 +18,6 @@ public function testUploadedFileCanRetrieveContentsFromTextFile()
true
);

$this->assertEquals('This is a story about something that happened long ago when your grandfather was a child.', trim($file->getContents()));
$this->assertEquals('This is a story about something that happened long ago when your grandfather was a child.', trim($file->get()));
}
}

0 comments on commit fd03dd4

Please sign in to comment.