Showing 79 of 79 total issues
Vision6Api
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Vision6Api extends Object
{
/** @var bool */
protected $apiKey = false;
Function invokeMethod
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function invokeMethod($apiKey, $methodName, $parameters)
{
$this->errorCode = false;
$this->errorMessage = false;
- 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
Method postRequest
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function postRequest($methodName, $postData)
{
// Build request headers
$headers = array(
'Content-Type: application/json',
Method subscribe
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function subscribe($data, Form $form)
{
if (!$this->request->isPOST()) {
// Bad Request
return new SS_HTTPResponse(
Method syncFields
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function syncFields()
{
if (static::$is_flushing && !defined('VISION6_API_KEY')) {
return;
}
Function build
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function build()
{
if (!($this->list instanceof Vision6List)) {
user_error(
_t(
- 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
Method build
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build()
{
if (!($this->list instanceof Vision6List)) {
user_error(
_t(
Method invokeMethod
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function invokeMethod($apiKey, $methodName, $parameters)
{
$this->errorCode = false;
$this->errorMessage = false;
Method validate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate($validator)
{
$form = $this->getForm();
$data = $form->getData();
Method subscribeEmail
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function subscribeEmail($listId, $fieldOrEmail)
{
$email = null;
if ($fieldOrEmail instanceof TextField) {
Function postRequest
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function postRequest($methodName, $postData)
{
// Build request headers
$headers = array(
'Content-Type: application/json',
- 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
The property $singular_name is not named in camelCase. Open
class EditableVision6SubscribeField extends EditableFormField
{
/** @var array */
private static $db = array(
'ListID' => 'Int',
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $db. Configured minimum length is 3. Open
protected static $db = array(
"FieldID" => "Int", // The ID of the Field.
"Name" => "Varchar(100)", // The name of the Field in the List.
"Type" => "Varchar", // The type of the Field. See below for a list of supported Field types.
"IsMandatory" => "Int(0)", // A value indicating whether the Field is displayed as mandatory in Web Forms by default.
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The property $allowed_actions is not named in camelCase. Open
class Vision6PageController extends Page_Controller
{
/** @var array */
private static $allowed_actions = array(
'subscribe',
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $is_flushing is not named in camelCase. Open
class Vision6Sync extends BuildTask implements Flushable
{
private static $is_flushing = false;
/** @var string */
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $plural_name is not named in camelCase. Open
class EditableVision6SubscribeField extends EditableFormField
{
/** @var array */
private static $db = array(
'ListID' => 'Int',
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $many_many is not named in camelCase. Open
class Vision6List extends DataObject
{
protected static $db = array(
"ListID" => "Int",
"Name" => "Varchar(200)",
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $fp. Configured minimum length is 3. Open
$fp = @fopen($this->getApiUrl(), 'rb', false, $context);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
protected static $db = array(
"ListID" => "Int",
"Name" => "Varchar(200)",
"FileFolderID" => "Int"
);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
private static $db = array(
'ListID' => 'Int',
'EmailField' => 'Varchar(255)',
'GracefulReject' => 'Boolean'
);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}