Skip to content

Conversation

@mwille
Copy link
Contributor

@mwille mwille commented Sep 23, 2016

The new API endpoint depends on the changes in response constructor.

*
* @param array $data
* @return Response
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not name a method getUnsubscribedUsersCount and drop docblock comment?

Choose a reason for hiding this comment

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

This method removes subscribtions, so a set fits better.


/**
* Count the unsubscription statistics of a specific campaign.
*
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there more specific type? In worse case could be @param mixed[] $data.

Choose a reason for hiding this comment

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

I don't know what $data contains, so mixed[] should fit for now.

function __construct(array $result = array())
{
if (!isset($result['replyCode']) || !isset($result['replyText']) || !isset($result['data'])) {
if (!isset($result['replyCode']) || !isset($result['replyText']) || !array_key_exists('data', $result)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please explain this modification?

Choose a reason for hiding this comment

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

I'm not sure why @mwille did this, but I guess this can be dropped (the effect should be the same).

$this->replyCode = $result['replyCode'];
$this->replyText = $result['replyText'];
$this->data = $result['data'];
$this->data = (array) $result['data'];
Copy link
Contributor

Choose a reason for hiding this comment

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

What will happen here if $result['data'] is not an array?

Copy link

@kyoya-de kyoya-de Mar 24, 2017

Choose a reason for hiding this comment

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

This will force $this->data to be an array, it will be empty if $result['data'] is not an array (this might be better than mixed data types).

@kyoya-de
Copy link

I'm sorry for the late answer. My colleague doesn't work anymore on the project where these changes were required. So I tried to answer your questions.

@tim-bezhashvyly
Copy link
Contributor

Thank you for your response. Please update the PR and I will be happy to merge it.

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.

3 participants