Showing 1,089 of 1,089 total issues
Function yy_r9
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function yy_r9(){
if ($this->php_handling == Smarty::PHP_PASSTHRU) {
$this->_retvalue = new _smarty_text($this, '<<?php ?>%');
} elseif ($this->php_handling == Smarty::PHP_QUOTE) {
$this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));
- 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 getSubTemplate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope)
{
// already in template cache?
if ($this->smarty->allow_ambiguous_resources) {
$_templateId = Smarty_Resource::getUniqueTemplateName($this, $template) . $cache_id . $compile_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"
Further reading
Function compile
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function compile($args, $compiler, $parameter, $tag)
{
// This tag does create output
$compiler->has_output = true;
// check and get attributes
- 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 log
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function log($strType, $strMessage) {
// Logmask, we add some infos into the KLogger
$strMask = "[ %12s ] [ %8s | %-8s ] [ %7.7s ] : %s";
$strIPAddress = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'unknown';
$strPage = isset($_REQUEST['page']) ? $_REQUEST['page'] : 'none';
- 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 check_acl_access
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function check_acl_access($params, $smarty)
{
$isAuthenticated = isset($_SESSION['AUTHENTICATED']) ? true : false;
$iAclSetting = $params['acl'];
// $params['icon'] is deprecated, only needed for mpos compatibility
- 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 connect
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function connect()
{
if (isset($this->_connection)) {
$this->_connection->connect();
} else {
- 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 encodeEmailAddress
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function encodeEmailAddress($addr) {
#
# Input: an email address, e.g. "foo@example.com"
#
# Output: the email address as a mailto link, with each character
- 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 getAllUserShares
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllUserShares() {
$this->debug->append("STA " . __METHOD__, 4);
if (! $data = $this->memcache->get(STATISTICS_ALL_USER_SHARES)) {
$data['share_id'] = 0;
$data['data'] = array();
Method send
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
$sent = 0;
$failedRecipients = (array) $failedRecipients;
Method run_0010
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run_0010() {
// Ugly but haven't found a better way
global $setting, $config, $statistics, $block, $mysqli;
// Version information
Method getCharPositions
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
{
if (!isset($currentMap['i']) || ! isset($currentMap['p'])) {
$currentMap['p'] = $currentMap['i'] = array();
}
Identical blocks of code found in 2 locations. Consider refactoring. Open
foreach ($_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {
$_value = str_replace("'","^#^",$_value);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 111.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
foreach ($_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {
$_value = str_replace("'","^#^",$_value);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 111.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method compile
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function compile($args, $compiler, $parameter)
{
if ($parameter == 0) {
$this->required_attributes = array('start', 'to');
$this->optional_attributes = array('max', 'step');
Method __get
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __get($property_name)
{
switch ($property_name) {
case 'source':
if (strlen($this->template_resource) == 0) {
Method getWorker
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getWorker($id, $interval=600) {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("
SELECT id, username, password, monitor,
(
Method compile
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function compile($args, $compiler, $parameter, $tag, $method)
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
if ($_attr['nocache'] === true) {
Method writeFile
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function writeFile($_filepath, $_contents, Smarty $smarty)
{
$_error_reporting = error_reporting();
error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
if ($smarty->_file_perms !== null) {
Method display_debug
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function display_debug($obj)
{
// prepare information of assigned variables
$ptr = self::get_debug_vars($obj);
if ($obj instanceof Smarty) {
Method _createParameter
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _createParameter($name, $value)
{
$origValue = $value;
$encoded = false;