Function read_entry
has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring. Open
function read_entry($f, $lineno = 0) {
$entry = new Translation_Entry();
// where were we in the last step
// can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural
$context = '';
- 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 read_entry
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
function read_entry($f, $lineno = 0) {
$entry = new Translation_Entry();
// where were we in the last step
// can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural
$context = '';
Function export_entry
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function export_entry(&$entry) {
if (is_null($entry->singular)) return false;
$po = array();
if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
- 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
File po.php
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Class for working with PO files
*
* @version $Id: po.php 283 2009-09-23 16:21:51Z nbachiyski $
Function unpoify
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function unpoify($string) {
$escapes = array('t' => "\t", 'n' => "\n", '\\' => '\\');
$lines = array_map('trim', explode("\n", $string));
$lines = array_map(array('PO', 'trim_quotes'), $lines);
$unpoified = '';
- 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 import_from_file
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function import_from_file($filename) {
$f = fopen($filename, 'r');
if (!$f) return false;
$lineno = 0;
while (true) {
- 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 false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return array('entry' => $entry, 'lineno' => $lineno);
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;