Showing 72 of 72 total issues
Avoid using static access to class '\Locale' in method 'getData'. Open
$data['language'] = Locale::getPrimaryLanguage($json['locale']);
- 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
Avoid using static access to class '\DateTime' in method 'getData'. Open
$birthday = DateTime::createFromFormat('Y-m-d', $ownerDetailsArray['birthday']);
- 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
The method getData() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
if (isset($options['language'])) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method getFriends() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function getFriends(): array
{
if (! $this->accessToken) {
throw new ExternalLoginServiceException("Access token not provided");
}
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method getData() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
$ownerDetails = $provider->getResourceOwner($this->accessToken);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method getData() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
$ownerDetails = $provider->getResourceOwner($this->accessToken);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST)
Open
private array $defaultScope = ['public_profile', 'user_friends', 'user_hometown'];
- Exclude checks
Possibly zero references to public method \Autowp\ExternalLoginService\Linkedin::getFriends()
Open
public function getFriends(): array
- Exclude checks
Possibly zero references to class \Autowp\ExternalLoginService\Module
Open
class Module
- Exclude checks
Possibly zero references to protected property \Autowp\ExternalLoginService\PluginManager->factories
Open
protected $factories = [
- Exclude checks
Possibly zero references to protected method \Autowp\ExternalLoginService\Vk::createProvider()
Open
protected function createProvider(): VkProvider
- Exclude checks
Possibly zero references to protected method \Autowp\ExternalLoginService\Github::createProvider()
Open
protected function createProvider(): GithubProvider
- Exclude checks
Parameter $options
is never used Open
public function getData(array $options): Result
- Exclude checks
Parameter $options
is never used Open
public function getData(array $options): Result
- Exclude checks
Possibly zero references to public method \Autowp\ExternalLoginService\Linkedin::getFriendsUrl()
Open
public function getFriendsUrl(): string
- Exclude checks
Possibly zero references to public property \Autowp\ExternalLoginService\Provider\VkProvider->scopes
Open
public $scopes = [
- Exclude checks
Call with 1 arg(s) to \Autowp\ExternalLoginService\Provider\VkProvider::__construct()
which only takes 0 arg(s) defined at /code/src/Provider/VkProvider.php:10
Open
return new VkProvider([
- Exclude checks
Possibly zero references to public method \Autowp\ExternalLoginService\Vk::getData()
Open
public function getData(array $options): Result
- Exclude checks
Possibly zero references to protected method \Autowp\ExternalLoginService\Linkedin::getFriendsAuthorizationUrl()
Open
protected function getFriendsAuthorizationUrl(): string
- Exclude checks
Possibly zero references to public method \Autowp\ExternalLoginService\GooglePlus::getData()
Open
public function getData(array $options): Result
- Exclude checks