LangReplacer
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class LangReplacer
{
public static $domainTranslations = [];
- Create a ticketCreate a ticket
Function updateKeysInMoPoFiles
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private static function updateKeysInMoPoFiles($translated, $module) {
$languages = self::getModuleLanguages($module);
foreach ($languages as $language) {
$translationsAllLocales[$language] = self::getDomainTranslations($module, $language);
- 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 changeKeysInFile
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static function changeKeysInFile($file, $data) {
$translated = [];
if (is_writable($file)) {
$content = $newContent = file_get_contents($file);
foreach ($data as $signature => $data) {
- 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 parseDir
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function parseDir($dir) {
$dirIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
$results = [];
/** @var \SplFileInfo $item */
foreach ($dirIterator as $item) {
- 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 changeKeysInFile
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function changeKeysInFile($file, $data) {
$translated = [];
if (is_writable($file)) {
$content = $newContent = file_get_contents($file);
foreach ($data as $signature => $data) {
- Create a ticketCreate a ticket
Function findCyrillicKeys
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function findCyrillicKeys($module) {
if ($module == 'main') {
$langStrings = self::parseMain();
} else {
$langStrings = self::parseModule($module);
- 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 savePoMo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function savePoMo($saveDomain) {
foreach (self::$domainTranslations as $domain => $langs) {
if ($domain == $saveDomain) {
foreach ($langs as $lang => $translation) {
- 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"