src/assets.php
Method register_assets
has 211 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function register_assets() {
$this->register_style(
'frontend',
'assets/dist/css/frontend.css',
array(
File assets.php
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Assets manager class
*
* @package TorroForms
Method setup_hooks
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function setup_hooks() {
$this->actions = array(
array(
'name' => 'wp_enqueue_scripts',
'callback' => array( $this, 'register_assets' ),
Function get_full_path
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function get_full_path( $src, $url = false ) {
if ( preg_match( '/^(http|https):\/\//', $src ) || 0 === strpos( $src, '//' ) ) {
if ( $url ) {
return $src;
}
- 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
Open
return parent::get_full_path( $src, $url );