Skip to content

Commit fd03dd4

Browse files
committed
rename method
1 parent e5bb47b commit fd03dd4

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/Illuminate/Http/UploadedFile.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,16 @@ public function storeAs($path, $name, $options = [])
9191
* Get the contents of the uploaded file.
9292
*
9393
* @return bool|string
94+
*
9495
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
9596
*/
96-
public function getContents()
97+
public function get()
9798
{
98-
if ($this->isValid()) {
99-
return file_get_contents($this->getPathname());
99+
if (! $this->isValid()) {
100+
throw new FileNotFoundException("File does not exist at path {$this->getPathname()}");
100101
}
101102

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

105106
/**

tests/Http/HttpUploadedFileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public function testUploadedFileCanRetrieveContentsFromTextFile()
1818
true
1919
);
2020

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

0 commit comments

Comments
 (0)