Function buildFilepath
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
{
$file = $source->name;
if ($source instanceof Smarty_Config_Source) {
$_directories = $source->smarty->getConfigDir();
- 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 smarty_resource.php
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Smarty Resource Plugin
*
* @package Smarty
Method buildFilepath
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
{
$file = $source->name;
if ($source instanceof Smarty_Config_Source) {
$_directories = $source->smarty->getConfigDir();
Function load
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function load(Smarty $smarty, $type)
{
// try smarty's cache
if (isset($smarty->_resource_handlers[$type])) {
return $smarty->_resource_handlers[$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 load
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function load(Smarty $smarty, $type)
{
// try smarty's cache
if (isset($smarty->_resource_handlers[$type])) {
return $smarty->_resource_handlers[$type];
Function normalizePath
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function normalizePath($_path, $ds=true)
{
if ($ds) {
// don't we all just love windows?
$_path = str_replace('\\', '/', $_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
Method populateCompiledFilepath
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
{
$_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;
$_filepath = $compiled->source->uid;
// if use_sub_dirs, break file into directories
Function source
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function source(Smarty_Internal_Template $_template=null, Smarty $smarty=null, $template_resource=null)
{
if ($_template) {
$smarty = $_template->smarty;
$template_resource = $_template->template_resource;
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(Smarty_Resource $handler, Smarty $smarty, $resource, $type, $name, $unique_resource)
Avoid too many return
statements within this method. Open
return $smarty->_resource_handlers[$type] = self::$resources['stream'];
Avoid too many return
statements within this method. Open
return $file;
Avoid too many return
statements within this method. Open
return $smarty->_resource_handlers[$type] = self::$resources[$type];
Avoid too many return
statements within this method. Open
return self::load($smarty, $type);
Avoid too many return
statements within this method. Open
return $_return;
Avoid too many return
statements within this method. Open
return $_filepath;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $smarty->_resource_handlers[$type] = self::$resources[$type];
Function populateCompiledFilepath
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
{
$_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;
$_filepath = $compiled->source->uid;
// if use_sub_dirs, break file into directories
- 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"