File ModuleGenerator.php
has 588 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* PepisCMS
*
Function makeUserSpaceModule
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public function makeUserSpaceModule($module_database_table_name,
$module_name,
$auto_install = true,
$parse_database_schema = true,
$database_group = 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
ModuleGenerator
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
class ModuleGenerator extends ContainerAware
{
/**
* @var \PiotrPolak\PepisCMS\Modulerunner\ModuleLocatorInterface
*/
Method makeUserSpaceModule
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function makeUserSpaceModule($module_database_table_name,
$module_name,
$auto_install = true,
$parse_database_schema = true,
$database_group = false,
Method prepareReplacementTokens
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
private function prepareReplacementTokens($module_database_table_name,
$module_name,
$module_label,
$module_name_singular,
$definition_output,
Function generateCall
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function generateCall($value, $datagrid_constants, $formbuilder_constants, $tabs)
{
$definition_output = '';
foreach ($value as $v_key => $v_value) {
if ($v_key == 'filter_type') {
- 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 makeUserSpaceModule
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
public function makeUserSpaceModule($module_database_table_name,
$module_name,
$auto_install = true,
$parse_database_schema = true,
$database_group = false,
Method generateSecurityPolicy
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateSecurityPolicy($module_name, $module_name_singular, $policy_save_path)
{
$method_default_access = array(
'index' => 'READ',
'edit' => 'WRITE',
Method buildTranslations
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function buildTranslations($module_name, $translations, $module_label, $language_pairs, $directory, $module_name_lower_case)
Method generatePublicStuffIfNeccesary
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function generatePublicStuffIfNeccesary($generate_public_controller, $directory, $module_name_lower_case, $template_base_path, array $data)
Method generateCrudStuffIfNecessary
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function generateCrudStuffIfNecessary($is_crud, $directory, $template_base_path, array $data, $module_name_lower_case)
Method generateOrRegenerateModel
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function generateOrRegenerateModel($directory, $module_name_lower_case, $module_name_singular, $template_base_path, array $data)
Function regenerateSetAcceptedFieldsForExistingModel
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function regenerateSetAcceptedFieldsForExistingModel($file_model_path, $data)
{
// Replace acceptable fields
$model_file_contents_exploded = file($file_model_path, FILE_IGNORE_NEW_LINES);
if (count($model_file_contents_exploded) > 0) {
- 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 generateFilterElement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function generateFilterElement($value, $key)
{
$filters_element = '';
foreach ($value as $v_key => $v_value) {
if ($v_key == 'filter_type') {
- 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 getCreatedAtFieldName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getCreatedAtFieldName($available_field_names, $definition)
{
foreach ($available_field_names as $available_field_name) {
if (strpos($available_field_name, 'create') !== false) {
// Input type check
- 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 mergeLanguageTranslationPairs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function mergeLanguageTranslationPairs($translation_file_path, $language_pairs)
{
// Merging existing translations with the new pairs
if (file_exists($translation_file_path)) {
$existing_language_pairs = $this->languagehelper->getLanguageByPath($translation_file_path);
- 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 getImageFieldNameBestMatch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getImageFieldNameBestMatch($available_field_names, $possible_image_field_names)
{
foreach ($available_field_names as $available_field_name) {
foreach ($possible_image_field_names as $possible_image_field_name) {
if (strpos($available_field_name, $possible_image_field_name) !== 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
Function getOrderFieldName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getOrderFieldName($available_field_names, $definition)
{
$possible_order_field_names = array('item_order', 'position', 'pos');
foreach ($possible_order_field_names as $possible_order_field_name) {
- 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 getUpdatedAtFieldName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getUpdatedAtFieldName($available_field_names, $definition)
{
foreach ($available_field_names as $available_field_name) {
if (strpos($available_field_name, 'update') !== false) {
// Input type check
- 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"