File TemplateManager.php
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace template_manager\classes;
use CMSFactory\Events;
- Create a ticketCreate a ticket
Function updateImageSizes
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function updateImageSizes($imageSizes) {
$sizes = [];
foreach ($imageSizes->size as $size) {
if (isset($size['name']) && isset($size['width']) && isset($size['height'])) {
if (is_numeric((string) $size['width']) && is_numeric((string) $size['height'])) {
- Read upRead up
- Create a ticketCreate a ticket
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 copyUploads
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private function copyUploads($templateName) {
$templateUploadsFolder = "./templates/{$templateName}/uploads";
if (is_dir($templateUploadsFolder)) {
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($templateUploadsFolder)) as $entity) {
- Read upRead up
- Create a ticketCreate a ticket
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 installDemoArchive
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function installDemoArchive($template_name) {
try {
Events::create()->raiseEvent(['templateName' => $template_name], self::EVENT_DEMODATA_PRE_INSTALLED);
$demodata_atchive = realpath('templates/' . $template_name . '/demodata/uploads.zip');
- Create a ticketCreate a ticket
Function installDemoArchive
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function installDemoArchive($template_name) {
try {
Events::create()->raiseEvent(['templateName' => $template_name], self::EVENT_DEMODATA_PRE_INSTALLED);
$demodata_atchive = realpath('templates/' . $template_name . '/demodata/uploads.zip');
- Read upRead up
- Create a ticketCreate a ticket
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 setTemplate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setTemplate(Template $template, $installDemodata = FALSE, $installDemoArchive = FALSE) {
if ($this->currentTemplate->name == $template->name) {
throw new Exception(lang('Current installed template can not be installed again', 'template_manager'));
}
- Create a ticketCreate a ticket
Function getTemplateToPay
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getTemplateToPay() {
if (MAINSITE) {
preg_match('/\/var\/www\/[a-zA-Z\d]+\/data\/www\/([a-zA-Z\d\.\-]+)\//', \CI::$APP->input->server('SCRIPT_FILENAME'), $matches);
$dirToPay = MAINSITE . '/application/config/' . $matches[1] . '/payments/template';
- Read upRead up
- Create a ticketCreate a ticket
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 setTemplate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function setTemplate(Template $template, $installDemodata = FALSE, $installDemoArchive = FALSE) {
if ($this->currentTemplate->name == $template->name) {
throw new Exception(lang('Current installed template can not be installed again', 'template_manager'));
}
- Read upRead up
- Create a ticketCreate a ticket
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 updateImageSizes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateImageSizes($imageSizes) {
$sizes = [];
foreach ($imageSizes->size as $size) {
if (isset($size['name']) && isset($size['width']) && isset($size['height'])) {
if (is_numeric((string) $size['width']) && is_numeric((string) $size['height'])) {
- Create a ticketCreate a ticket
Function listRemote
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function listRemote($sourceUrl = '') {
if (!$sourceUrl) {
$sourceUrl = self::$ImageCMSRepositoryURL;
}
- Read upRead up
- Create a ticketCreate a ticket
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 loadDefaultComponents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function loadDefaultComponents(array $except = []) {
if (count($this->defaultComponents) > 0) {
return;
}
$componentsPath = __DIR__ . '/../components/';
- Read upRead up
- Create a ticketCreate a ticket
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 query_from_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function query_from_file($sqlString) {
$allowedTables = \CI::$APP->load
->module('template_manager')
->config
- Read upRead up
- Create a ticketCreate a ticket
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"