Skip to content
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

Improve Attachment and ClassifiedTaxCategory #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bagulho
Copy link

@bagulho bagulho commented Jan 8, 2024

Allow Attachment to define the content of the file
Add missing accessors for ClassifiedTaxCategory

Allow Attachment to define the content of the file
Add missing accessors for ClassifiedTaxCategory
@kouinkouin
Copy link

Hi!
For the new property Attachement::$fileContent, do you think that could be better to accept a raw file content, instead of an base64-encoded string?
The name fileContent does not suggest the string must be base64-encoded.
What do you think?

Copy link

@kouinkouin kouinkouin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property $fileName is not used in the class (excepted in get/set).
Maybe, in the method XmlSerialize, we could replace the line 167 with:

-                    'filename' => basename($this->filePath)
+                    'filename' => $filename

?

if ($this->filePath || $this->fileContent) {
if ($this->filePath) {
$fileContents = base64_encode(file_get_contents($this->filePath));
$mimeType = $this->getFileMimeType();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add:

$filename = basename($this->filePath);

$mimeType = $this->getFileMimeType();
} else {
$fileContents = $this->fileContent;
$mimeType = $this->mimeType;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add:

$filename = $this->filename;

@kouinkouin
Copy link

Your PR interests me because that is absent of the main branch, so thanks for the PR :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants