for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class Evernote
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
/** @var string */
protected $token;
/** @var boolean */
protected $sandbox;
protected $china;
protected $key;
protected $secret;
/**
* @param string|null $token
*/
public function __construct($token = null)
$EvernoteSettings = EvernoteSettings::current_Evernote_settings();
if(empty($EvernoteSettings)) {
user_error(
_t(
'NO_EVERNOTE_ACTIVE',
'No Evernote Settings Available. Please setup the Evernote configuration.'
),
E_USER_ERROR
);
}
$this->token = $token;
$this->sandbox = boolval(($EvernoteSettings->Sandbox) ?: true);
$this->china = boolval(($EvernoteSettings->China) ?: false);
$this->key = ($EvernoteSettings->APIKey) ?: '';
$this->secret = ($EvernoteSettings->APISecret) ?: '';
* @return null|string
public function Authorize()
$oauth_handler = new \Evernote\Auth\OauthHandler($this->sandbox, false, $this->china);
try {
$oauth_data = $oauth_handler->authorize($this->key, $this->secret, $this->getCallbackUrl());
$this->token = $oauth_data['oauth_token'];
$ret = $this->token;
} catch (\Evernote\Exception\AuthorizationDeniedException $e) {
//If the user decline the authorization, an exception is thrown.
$ret = null;
return $ret;
* @return string
private function getCallbackUrl()
$thisUrl = Director::absoluteBaseURL().'evernote-auth/callback';
return $thisUrl;
* @param $token
* @return array
public function notebookList($token)
$client = new \Evernote\Client($token, $this->sandbox, null, null, $this->china);
$notebooks = array();
$notebooks
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
$notebooks = $client->listNotebooks();
return $notebooks;
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.