Web.Admin/2014/wordpress/wp-admin/press-this.php
File press-this.php
has 492 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Press This Display and Handler.
*
* @package WordPress
Function get_images_from_uri
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
function get_images_from_uri($uri) {
$uri = preg_replace('/\/#.+?$/','', $uri);
if( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') )
return "'" . esc_attr( html_entity_decode($uri) ) . "'";
$content = wp_remote_fopen($uri);
- 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 press_it
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
function press_it() {
// define some basic variables
$quick['post_status'] = 'draft'; // set as draft first
$quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
$quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;
- 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 press_it
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function press_it() {
// define some basic variables
$quick['post_status'] = 'draft'; // set as draft first
$quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
$quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;