Showing 15 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
Function syncFields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function syncFields()
{
if (static::$is_flushing && !defined('VISION6_API_KEY')) {
return;
}
- 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 setApiUrl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setApiUrl($url)
{
// Add API version to url
$parts = @parse_url($url);
if ($parts) {
- 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 normalizeFormData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function normalizeFormData(array $postVars)
{
$output = array();
foreach ($postVars as $key => $val) {
- 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 too many return
statements within this method. Open
return $response;