Showing 31 of 33 total issues
Method deleteAction
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteAction($objectId, $batch = false)
{
$this->setSession();
$page = $this->session->get(self::SESSION_VARS['page'], 1);
$viewParameters = ['page' => $page];
Method loadValidatorMetadata
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function loadValidatorMetadata(SymfonyClassMetadata $metadata)
{
$metadata->addPropertyConstraints('name', [
new NotBlank([
'message' => 'mautic.core.name.required',
Function onPluginUpdate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function onPluginUpdate(Plugin $plugin, MauticFactory $factory, $metadata = null, Schema $installedSchema = null)
{
$database = $factory->getDatabase();
$platform = $database->getDatabasePlatform()->getName();
$queries = [];
- 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 dispatchEvent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function dispatchEvent($action, &$entity, $isNew = false, Event $event = null)
{
if (!$entity instanceof TriggerCampaign) {
throw new MethodNotAllowedHttpException(['TriggerCampaign']);
}
- 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 listCampaigns
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function listCampaigns(int $offset = 0, int $pageNumber = 0, int $pageSize = 10, bool $paged = true, bool $unpaged = false, bool $forceFirstAndLastRels = false): array
Method getTriggerCampaigns
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function getTriggerCampaigns($filter, $start, $limit, $orderBy, $orderByDir)
Function deleteAction
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function deleteAction($objectId, $batch = false)
{
$this->setSession();
$page = $this->session->get(self::SESSION_VARS['page'], 1);
$viewParameters = ['page' => $page];
- 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 deleteMultipleCampaigns
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function deleteMultipleCampaigns($postActionVars, &$flashes)
{
/** @var TriggerCampaignModel $triggerCampaignModel */
$triggerCampaignModel = $this->getModel(TriggerCampaignModel::NAME);
$triggerCampaignIds = json_decode($this->request->query->get('ids', '{}'));
- 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 onTriggerCampaignPreSave
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function onTriggerCampaignPreSave(TriggerCampaignEvent $event): void
{
$triggerCampaign = $event->getTriggerCampaign();
if ($triggerCampaign->isNew()) {
- 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 $this->delegateView([
'viewParameters' => [
'form' => $this->setFormTheme($form, self::TEMPLATES['form'], self::THEMES['variables']),
'currentListId' => $triggerCampaign->getId(),
],
Function printmailingOnLoad
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Mautic.printmailingOnLoad = function (container) {
var prefix = 'trigger_campaign';
var parent = mQuery('.dynamic-content-variable, .dwc-variable');
if (parent.length) {
prefix = parent.attr('id');
- 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"