src/Dooki/DookiRequest.php
The class DookiRequest has 16 public methods. Consider refactoring DookiRequest to keep number of public methods under 10. Open
Open
class DookiRequest extends DookiAuth
{
private $api;
private $method;
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
DookiRequest
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class DookiRequest extends DookiAuth
{
private $api;
private $method;
Function search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function search($search)
{
$searchString = '';
foreach ($search as $field => $value) {
- 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
Line exceeds 120 characters; contains 130 characters Open
Open
throw new DookiRequestException($property . ' is not a valid property for DookiRequest. Use headers, query or json.');
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
Open
throw new DookiRequestException($method . ' is not a valid HTTP method. Use GET, POST, PUT, PATCH or DELETE instead.');
- Exclude checks