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

Support for file operations #103

Merged
merged 9 commits into from
Jun 19, 2024
Merged

Support for file operations #103

merged 9 commits into from
Jun 19, 2024

Conversation

seba-aln
Copy link
Contributor

feat: Added support for file sharing operations

@seba-aln seba-aln force-pushed the feat/files-endpoint branch from e8b13f2 to 4d4d66a Compare June 18, 2024 12:01
@seba-aln seba-aln force-pushed the feat/files-endpoint branch from 4d4d66a to 922b768 Compare June 18, 2024 12:09

// Listing files in the channel
$channelFiles = $pubnub->listFiles()->channel($channelName)->sync();
if ($channelFiles->getCount() > 0) {

Choose a reason for hiding this comment

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

What do you think about introducing:
$fileCount = $channelFiles->getCount();
?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would improve readability

public function encryptMessage($message)
{
$crypto = $this->pubnub->getCryptoSafe();
$message = PubNubUtil::writeValueAsString($message);

Choose a reason for hiding this comment

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

What do you think about renaming to:
$messageString
?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed


protected function buildMessage()
{
$message = [

Choose a reason for hiding this comment

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

Wouldn't $messageData be a more descriptive name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

{
$params = [];
foreach ($this->customParamMapping as $customParam => $requestParam) {
if (isset($this->$customParam) && !empty($this->$customParam)) {

Choose a reason for hiding this comment

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

Is issset required here? What is a responsibility of empty method check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isset is a safeguard for accessing unintialized typed property and !empty checks if the value is not empty (not null, 0 or empty string

Choose a reason for hiding this comment

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

ok, I thought that empty implicitly performs isset
because:
"The isset function only checks if a variable is set and not NULL"

->fileId($this->fileUploadEnvelope->getFileId())
->fileName($this->fileName);

if (isset($this->meta)) {

Choose a reason for hiding this comment

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

This line is duplicated in line 269, 272, 275 is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unintentional copypaste

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@seba-aln seba-aln force-pushed the feat/files-endpoint branch from 1fb3ba8 to 43c51a1 Compare June 18, 2024 14:34
{
$params = [];
foreach ($this->customParamMapping as $customParam => $requestParam) {
if (isset($this->$customParam) && !empty($this->$customParam)) {

Choose a reason for hiding this comment

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

ok, I thought that empty implicitly performs isset
because:
"The isset function only checks if a variable is set and not NULL"

@seba-aln
Copy link
Contributor Author

@pubnub-release-bot release

@seba-aln seba-aln merged commit 26de0a5 into master Jun 19, 2024
6 checks passed
@seba-aln seba-aln deleted the feat/files-endpoint branch June 19, 2024 07:31
@pubnub-release-bot
Copy link
Contributor

🚀 Release successfully completed 🚀

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.

4 participants