-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Send file contents #134
Send file contents #134
Conversation
…ted Payload class and tests
…date the snapshot accordingly
src/Payloads/FileContentsPayload.php
Outdated
|
||
public function getContent(): array | ||
{ | ||
if (!file_exists($this->filename)) { |
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.
Could you rewrite this without the else
statement? This branch could just return an array with the properties that should be set when the file does not exists. I also don't mind this case using the label File
.
Could you also add this method to the framework agnostic usage docs?
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.
When you say "this case using the label "File
", do you mean only the case where the file does not exist? or when it does exist - or both?
I assume you mean adding file()
to the docs - I already did, see the "Working with files" section I added above. I didn't add a screenshot as the other screenshots are from MacOS and I'm running Linux, so it'd have to be redone anyway.
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.
Requested changes submitted.
Could you make sure that all tests pass? |
…oth linux and windows
Absolutely. All tests are now passing. |
Thank you! |
This PR adds the
file()
method, which accepts a filename as its only parameter and sends the contents of the file to Ray. This method also sends a label containing the filename along with the payload.Note: The file content is encoded with
htmlentities()
andnl2br()
to ensure HTML files are displayed correctly.Developers will find this addition very helpful when working with the file system and need to debug multiple files quickly.
Unit tests and documentation have been added.