From fd03dd44b9f41158fb55ceac8fe865de33366e65 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 27 Jul 2018 11:34:44 -0500 Subject: [PATCH] rename method --- src/Illuminate/Http/UploadedFile.php | 9 +++++---- tests/Http/HttpUploadedFileTest.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Http/UploadedFile.php b/src/Illuminate/Http/UploadedFile.php index 118421b371be..f6cb27572c67 100644 --- a/src/Illuminate/Http/UploadedFile.php +++ b/src/Illuminate/Http/UploadedFile.php @@ -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()); } /** diff --git a/tests/Http/HttpUploadedFileTest.php b/tests/Http/HttpUploadedFileTest.php index f68f9163642d..56b3673308e7 100644 --- a/tests/Http/HttpUploadedFileTest.php +++ b/tests/Http/HttpUploadedFileTest.php @@ -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())); } }