src/SVG.php
File SVG.php
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace IdeasOnPurpose\WP;
use Doctrine\Inflector\InflectorFactory;
SVG
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class SVG
{
use Deprecated\Directory;
use Deprecated\DumpSymbols;
use Deprecated\Get;
Method rewrapSvg
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function rewrapSvg($svg, $attributes = [])
{
$esc_atts = array_map('urlencode', $attributes);
$svg->_links->self = add_query_arg($esc_atts, $svg->_links->self);
$svg->_links->svg = add_query_arg($esc_atts, $svg->_links->svg);
Method normalizeSvg
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function normalizeSvg($rawSVGString)
{
libxml_use_internal_errors(true);
$xml = simplexml_load_string(trim($rawSVGString));
Function rewrapSvg
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
public function rewrapSvg($svg, $attributes = [])
{
$esc_atts = array_map('urlencode', $attributes);
$svg->_links->self = add_query_arg($esc_atts, $svg->_links->self);
$svg->_links->svg = add_query_arg($esc_atts, $svg->_links->svg);
- 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 debug
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
public function debug()
{
if (count($this->lib) > 0) {
$id = 'debug-' . md5(microtime(true));
echo "<style>
Function normalizeSvg
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function normalizeSvg($rawSVGString)
{
libxml_use_internal_errors(true);
$xml = simplexml_load_string(trim($rawSVGString));
- 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"