Showing 72 of 72 total issues
Function getFriends
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function getFriends(): array
{
if (! $this->accessToken) {
throw new ExternalLoginServiceException("Access token not provided");
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getData
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
$ownerDetails = $provider->getResourceOwner($this->accessToken);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Result
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Result
{
/** @var string */
private string $externalId;
Method getData
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
$ownerDetails = $provider->getResourceOwner($this->accessToken);
Method getData
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
$ownerDetails = $provider->getResourceOwner($this->accessToken);
Method getFriends
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFriends(): array
{
if (! $this->accessToken) {
throw new ExternalLoginServiceException("Access token not provided");
}
Method getData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
if (isset($options['language'])) {
Method getData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getData(array $options): Result
{
$clientIDs = preg_split("/[[:space:]]+/isu", $this->options['clientId']);
foreach ($clientIDs as $clientID) {
Function getData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
$ownerDetails = $provider->getResourceOwner($this->accessToken);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getFriends
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getFriends(): array
{
$cursor = - 1;
$friendsId = [];
$count = 1000;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getData
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getData(array $options): Result
{
$clientIDs = preg_split("/[[:space:]]+/isu", $this->options['clientId']);
foreach ($clientIDs as $clientID) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid classes with short names like Vk. Configured minimum length is 3. Open
class Vk extends AbstractLeagueOAuth2
{
protected function createProvider(): VkProvider
{
return new VkProvider([
- Read upRead up
- Exclude checks
ShortClassName
Since: 2.9
Detects when classes or interfaces have a very short name.
Example
class Fo {
}
interface Fo {
}
Source https://phpmd.org/rules/naming.html#shortclassname
Function getData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
if (isset($options['language'])) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid using static access to class '\Laminas\Uri\UriFactory' in method 'removeSizeParam'. Open
$uri = UriFactory::factory($url);
- 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 '\Laminas\Uri\UriFactory' in method 'setSizeParam'. Open
$uri = UriFactory::factory($url);
- 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 '\Laminas\Json\Json' in method 'getFriends'. Open
$response = Json\Json::decode($response);
- 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 an NPath complexity of 972. The configured NPath complexity threshold is 200. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
if (isset($options['language'])) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getData() has an NPath complexity of 19683. The configured NPath complexity threshold is 200. Open
public function getData(array $options): Result
{
$provider = $this->getProvider();
$ownerDetails = $provider->getResourceOwner($this->accessToken);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
Avoid using static access to class '\DateTime' in method 'getData'. Open
$data['birthday'] = DateTime::createFromFormat('m/d/Y', $json['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
Avoid unused parameters such as '$params'. Open
public function callback(array $params): array
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}