Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
percymamedy committed Sep 2, 2016
2 parents 50326fe + 421ae01 commit 820c768
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Exceptions/WatsonBridgeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WatsonBridgeException extends RuntimeException
public function __construct($message = '', $code = 400, Exception $previous = null)
{
//Format message
$message = 'Watson Bridge: '.(($message != '') ? $message : $this->message);
$message = 'Watson Bridge: ' . (($message != '') ? $message : $this->message);
//Call parent exception
parent::__construct($message, $code, $previous);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct($username, $payLoad = [])
//Set Username for token
$this->username = $username;
//Have payload to set
if (!empty($payLoad)) {
if (! empty($payLoad)) {
$this->payLoad = $payLoad;
} else {
//Load from file
Expand All @@ -49,7 +49,7 @@ public function __construct($username, $payLoad = [])
*/
public function hasPayLoad()
{
return !empty($this->payLoad);
return ! empty($this->payLoad);
}

/**
Expand All @@ -59,7 +59,7 @@ public function hasPayLoad()
*/
public function exists()
{
return file_exists(__DIR__.'/Storage/'.'token-'.$this->username.'.json');
return file_exists(__DIR__ . '/Storage/' . 'token-' . $this->username . '.json');
}

/**
Expand All @@ -79,7 +79,7 @@ public function isExpired()
*/
public function isNotExpired()
{
return !$this->isExpired();
return ! $this->isExpired();
}

/**
Expand All @@ -100,7 +100,7 @@ public function isValid()
public function save()
{
//No payload to save
if (!$this->hasPayLoad()) {
if (! $this->hasPayLoad()) {
return false;
}
//Save the token
Expand All @@ -114,7 +114,7 @@ public function save()
*/
public function getFilePath()
{
return __DIR__.'/Storage/token-'.$this->username.'.json';
return __DIR__ . '/Storage/token-' . $this->username . '.json';
}

/**
Expand All @@ -125,7 +125,7 @@ public function getFilePath()
public function loadPayLoadFromFile()
{
//Not found
if (!$this->exists()) {
if (! $this->exists()) {
//We return empty array
return [];
}
Expand Down
6 changes: 3 additions & 3 deletions tests/TestToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function tearDown()
public function createTestTokenFile($name = '', $data = [])
{
file_put_contents(
$this->getTokenStoragePath($name.'.json'),
$this->getTokenStoragePath($name . '.json'),
collect($data)->toJson(),
LOCK_EX
);
Expand All @@ -62,7 +62,7 @@ public function createTestTokenFile($name = '', $data = [])
*/
public function deleteTestTokenFile($name = '')
{
unlink($this->getTokenStoragePath($name.'.json'));
unlink($this->getTokenStoragePath($name . '.json'));
}

/**
Expand All @@ -74,7 +74,7 @@ public function deleteTestTokenFile($name = '')
*/
public function getTokenStoragePath($file = '')
{
return __DIR__.'/../src/Storage/'.$file;
return __DIR__ . '/../src/Storage/' . $file;
}

/**
Expand Down

0 comments on commit 820c768

Please sign in to comment.