api/webservice/SMS/Auth/Basic.php
Missing class import via use statement (line '24', column '14'). Open
Open
throw new \Api\Core\Exception('Web service - Applications: Unauthorized', 401);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '36', column '17'). Open
Open
$query = (new \App\Db\Query())->from('w_#__servers')->where(['type' => $type, 'status' => 1]);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid assigning values to variables in if clauses and the like (line '37', column '18'). Open
Open
public function setServer(): self
{
$this->api->app = [];
$apiKey = $this->api->request->getByType('x-api-key', \App\Purifier::ALNUM);
$type = $this->api->request->getByType('_container', \App\Purifier::STANDARD);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Declaration of function setServer() : \Api\SMS\Auth\Basic
should be compatible with function setServer() : \Api\Core\Auth\Basic
(method returning '\Api\SMS\Auth\Basic'
cannot override method returning '\Api\Core\Auth\Basic')
defined in /code/api/webservice/Core/Auth/Basic.php:40
Open
Open
public function setServer(): self
- Exclude checks
Call to method getInstance
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
Open
if ($apiKey && $row = $query->andWhere(['api_key' => \App\Encryption::getInstance()->encrypt($apiKey)])->one()) {
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
Open
$query = (new \App\Db\Query())->from('w_#__servers')->where(['type' => $type, 'status' => 1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$apiKey = $this->api->request->getByType('x-api-key', \App\Purifier::ALNUM);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (!$this->api->app) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->api->response->addHeader('WWW-Authenticate', 'Basic realm="' . $realm . '"');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($apiKey && $row = $query->andWhere(['api_key' => \App\Encryption::getInstance()->encrypt($apiKey)])->one()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->api->app = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function authenticate(string $realm): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$type = $this->api->request->getByType('_container', \App\Purifier::STANDARD);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$query = (new \App\Db\Query())->from('w_#__servers')->where(['type' => $type, 'status' => 1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
throw new \Api\Core\Exception('Web service - Applications: Unauthorized', 401);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$row['id'] = (int) $row['id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->api->app = $row;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function setServer(): self
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
Open
if ($apiKey && $row = $query->andWhere(['api_key' => \App\Encryption::getInstance()->encrypt($apiKey)])->one()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks