api/webservice/Core/Auth.php
Avoid using static access to class '\App\Config' in method 'init'. Open
Open
$method = \App\Config::api('AUTH_METHOD');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected static $realm = 'YetiForceApi';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public static function init(\Api\Controller $controller): Auth\AbstractAuth
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$method = \App\Config::api('AUTH_METHOD');
- 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
$self = new $class();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$class = "Api\\{$container}\\Auth\\{$method}";
- 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
$self->authenticate(static::$realm);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Realm.
- 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
$self->setServer();
- 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
* Init.
- 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
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$class = "Api\\Core\\Auth\\{$method}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $self;
- 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
* @param \Api\Controller $controller
- 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 (!class_exists($class)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$self->setApi($controller);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$container = $controller->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
* @return Auth\AbstractAuth
- Exclude checks