File yf_tpl.class.php
has 746 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Stadard Framework template engine.
*
Function _get_template_file
has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring. Open
public function _get_template_file($file_name = '', $force_storage = '', $JUST_CHECK_IF_EXISTS = false, $RETURN_TEMPLATE_PATH = false)
{
$string = false;
$NOT_FOUND = false;
$storage = 'inline';
- 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 init_graphics
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
public function init_graphics()
{
$init_type = MAIN_TYPE;
// Do not remove this!
$this->_init_global_tags();
- 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 _get_template_file
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _get_template_file($file_name = '', $force_storage = '', $JUST_CHECK_IF_EXISTS = false, $RETURN_TEMPLATE_PATH = false)
{
$string = false;
$NOT_FOUND = false;
$storage = 'inline';
yf_tpl
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_tpl
{
/** @var string @conf_skip Path to the templates (including current theme path) */
public $TPL_PATH = '';
/** @var string default template name */
Method init_graphics
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function init_graphics()
{
$init_type = MAIN_TYPE;
// Do not remove this!
$this->_init_global_tags();
Function _init
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function _init()
{
// Needed to ensure backtracking still works on big templates (extended from 1 000 000 on 26kb stpl js() parsing)
ini_set('pcre.backtrack_limit', '10000000');
- 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 _init
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _init()
{
// Needed to ensure backtracking still works on big templates (extended from 1 000 000 on 26kb stpl js() parsing)
ini_set('pcre.backtrack_limit', '10000000');
Method parse
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse($name, $replace = [], $params = [])
{
$name = strtolower(trim($name));
// Support for the driver name in prefix, example: "twig:user/account", "smarty:user/account"
if (strpos($name, ':') !== false) {
Method _get_cached_paths
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _get_cached_paths()
{
$cache_name = __FUNCTION__ . '_' . MAIN_TYPE;
if (isset($this->$cache_name)) {
return $this->$cache_name;
Function parse
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function parse($name, $replace = [], $params = [])
{
$name = strtolower(trim($name));
// Support for the driver name in prefix, example: "twig:user/account", "smarty:user/account"
if (strpos($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 _i18n_wrapper
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function _i18n_wrapper($input = '', $replace = [])
{
if ( ! strlen($input)) {
return '';
}
- 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 _i18n_wrapper
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _i18n_wrapper($input = '', $replace = [])
{
if ( ! strlen($input)) {
return '';
}
Consider simplifying this complex logical expression. Open
if (in_array($_storage, ['app', 'project', 'framework'])) {
$_theme = $_storage == 'framework' ? MAIN_TYPE : $theme;
if (isset($paths[$_storage][$_theme])) {
$file_path = $paths[$_storage][$_theme];
}
Method _parse_set_debug_info
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _parse_set_debug_info($name = '', $replace = [], $params = [], $string = '', $stpl_time_start)
Function _process_var_filters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _process_var_filters($text = '', $filters = '')
{
if (is_string($filters) && strpos($filters, '|') !== false) {
$filters = explode('|', $filters);
}
- 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 _url_wrapper
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _url_wrapper($params = [])
{
// Try to process method params (string like attrib1=value1;attrib2=value2)
if (is_string($params) && strlen($params)) {
// Url like this: /object/action/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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (preg_match('/(?P<text>.+?)["\']{1},[\s\t]*%(?P<args>[a-z]+.+)$/ims', $input, $m)) {
foreach (explode(';%', $m['args']) as $arg) {
$attr_name = $attr_val = '';
if (false !== strpos($arg, '=')) {
list($attr_name, $attr_val) = explode('=', trim($arg));
- 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 206.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function _process_var_filters($text = '', $filters = '')
{
if (is_string($filters) && strpos($filters, '|') !== false) {
$filters = explode('|', $filters);
}
- 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 145.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
} elseif (in_array($_storage, ['app_inherit2', 'site_inherit2']) && $this->_INHERITED_SKIN2) {
$_theme = $this->_INHERITED_SKIN2;
$s = substr($_storage, 0, -strlen('_inherit2'));
if (isset($paths[$s][$_theme])) {
$file_path = $paths[$s][$_theme];
- 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 95.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
} elseif (in_array($_storage, ['app_inherit', 'site_inherit']) && $this->_INHERITED_SKIN) {
$_theme = $this->_INHERITED_SKIN;
$s = substr($_storage, 0, -strlen('_inherit'));
if (isset($paths[$s][$_theme])) {
$file_path = $paths[$s][$_theme];
- 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 95.
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