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

New functionality #3

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

New functionality #3

wants to merge 8 commits into from

Conversation

jzfgo
Copy link
Contributor

@jzfgo jzfgo commented Aug 8, 2017

Hi again,

I've added new functionality to the library:

I've updated the README accordingly.

Finally I've also made some stylistic code changes, mainly to better comply with PSR-2.

Edit: Forgot to add that all changes are Backwards Compatible :)

Copy link
Member

@massimilianobraglia massimilianobraglia left a comment

Choose a reason for hiding this comment

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

Hi @nkm, thanks for your contribution! This is a great feature. I'm going to leave some comments over the code you wrote. Once you finished, can you squash all your commits into a single commit please?

Unfortunately, this library lacks of tests. I'm also opening an issue to track it down.

Thanks again and sorry for the delay reviewing this!

@@ -19,7 +19,7 @@
class Context
{
const AUTH_TOKEN_URI = 'https://services.mailup.com/Authorization/OAuth/Token';
const BASE_URI = 'https://services.mailup.com/API/v1.1/Rest';
const BASE_URI = 'https://services.mailup.com/API/v1.1/Rest';

Choose a reason for hiding this comment

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

please, do not use internal indentation for assignments

'Content-Type' => 'application/json',
'Authorization' => 'Bearer '.$this->token->getAccessToken(),
],
json_encode($params)

Choose a reason for hiding this comment

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

add last ,

$this->username = $options['username'];
$this->password = $options['password'];
$this->username = $options['username'];
$this->password = $options['password'];

Choose a reason for hiding this comment

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

please, do not use internal indentation for assignments

$message = "Response not OK when requesting an access token. Response body: $responseBody";
$responseBody = (string) $response->getBody();
$message = "Response not OK when requesting an access token. "
. "Response body: {$responseBody}";

Choose a reason for hiding this comment

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

do not break a line (event strings) if it stays within the soft limit of PSR-2 (120 chars, http://www.php-fig.org/psr/psr-2/#overview).

Also, keep the operator in the line of the first argument. In this case it should be (but it is not for what mentioned above):

$message = "Response not OK when requesting an access token. "  .
     "Response body: {$responseBody}"
;

self::AUTH_TOKEN_URI,
[
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => 'Basic '.base64_encode($this->clientId.':'.$this->clientSecret),

Choose a reason for hiding this comment

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

spaces between . operator and its arguments

'MobileNumber' => $this->mobileNumber,
'MobilePrefix' => $this->mobilePrefix,
'Fields' => $this->fields,
'Fields' => $this->fields,

Choose a reason for hiding this comment

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

internal indentation

string $refreshToken
) {
$this->accessToken = $accessToken;
$this->validUntil = $validUntilTimestamp;

Choose a reason for hiding this comment

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

internal indentation

if (
null === $object
|| ! isset($object->accessToken, $object->validUntil, $object->refreshToken)
) {

Choose a reason for hiding this comment

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

if statement and binary operators

if (
null === $object
|| ! isset($object->access_token, $object->expires_in, $object->refresh_token)
) {

Choose a reason for hiding this comment

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

if and internal indentation

'accessToken' => $this->accessToken,
'validUntil' => $this->validUntil,
'accessToken' => $this->accessToken,
'validUntil' => $this->validUntil,

Choose a reason for hiding this comment

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

internal indentation

@massimilianobraglia
Copy link
Member

@nkm any news about this?

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