Showing 35 of 1,262 total issues
Method setUp
has 1052 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setUp() {
// Root menu
$this->setRootMenuPage(
'Read Offline', // specify the name of the page group
'dashicons-book'
File class-read-offline-admin-settings.php
has 1134 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// Include the library
if ( ! class_exists( 'AdminPageFramework' ) ) {
File class-read-offline-create.php
has 789 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use PHPePub\Core\EPub;
use PHPePub\Core\EPubChapterSplitter;
use PHPePub\Core\Logger;
use PHPePub\Core\Structure\OPF\DublinCore;
Method pdf
has 326 lines of code (exceeds 25 allowed). Consider refactoring. Open
function pdf( $post ) {
$html = $this->html;
define( '_MPDF_TEMP_PATH', READOFFLINE_CACHE . '/tmp/' );
Function pdf
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
function pdf( $post ) {
$html = $this->html;
define( '_MPDF_TEMP_PATH', READOFFLINE_CACHE . '/tmp/' );
- 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 parse_request
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
function parse_request( $wp_query ) {
global $post;
$create_new = true;
if ( '1' == parent::$options['misc']['cache'] ) {
$create_new = 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 epub
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
function epub( $post ) {
$iso6391 = ( '' == get_locale() ) ? 'en' : strtolower( substr( get_locale(), 0, 2 ) ); // only ISO 639-1
if ( is_rtl() ) {
$writing_direction = EPub::DIRECTION_RIGHT_TO_LEFT;
- 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 epub
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
function epub( $post ) {
$iso6391 = ( '' == get_locale() ) ? 'en' : strtolower( substr( get_locale(), 0, 2 ) ); // only ISO 639-1
if ( is_rtl() ) {
$writing_direction = EPub::DIRECTION_RIGHT_TO_LEFT;
Function _split_content
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function _split_content( $html, $header ) {
$all_tags = ( 'all' === $header );
$content = array();
$title = '';
- 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 save_as_attachment_to_post_type
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save_as_attachment_to_post_type( $post_id, $post ) {
// Autosave, do nothing
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return $post_id; }
File class-read-offline.php
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
if ( ! defined( 'FS_CHMOD_DIR' ) ) {
define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
}
Method parse_request
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse_request( $wp_query ) {
global $post;
$create_new = true;
if ( '1' == parent::$options['misc']['cache'] ) {
$create_new = false;
Function mobi
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function mobi( $post ) {
$html = $this->html;
$mobi = new MOBI();
/*
- 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 save_as_attachment_to_post_type
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function save_as_attachment_to_post_type( $post_id, $post ) {
// Autosave, do nothing
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return $post_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
Method embed_post
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function embed_post( $content ) {
global $post;
if ( ! is_object( $post ) ) { return; }
$placements = array_intersect_assoc(
Method mobi
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mobi( $post ) {
$html = $this->html;
$mobi = new MOBI();
/*
Method widget
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function widget($args, $instance) {
global $post;
if (!is_single() && !is_page()) return;
Method _split_content
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _split_content( $html, $header ) {
$all_tags = ( 'all' === $header );
$content = array();
$title = '';
Function _create_tmp_directories
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function _create_tmp_directories() {
global $wp_filesystem;
if ( ! $wp_filesystem || ! is_object( $wp_filesystem ) ) {
WP_Filesystem(); }
if ( ! is_object( $wp_filesystem ) ) {
- 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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function __construct() {
self::$options = get_option( 'Read_Offline_Admin_Settings' );
// Only generate files for formats selected in plugin settings