File abstract.llms.post.model.php
has 646 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* LLMS_Post_Model abstract class file
*
* @package LifterLMS/Abstracts/Classes
LLMS_Post_Model
has 52 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class LLMS_Post_Model implements JsonSerializable {
/**
* Name of the post type as stored in the database
* This will be prefixed (where applicable)
Function parse_properties_to_set
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function parse_properties_to_set( $model_array ) {
$llms_post = array(
'post' => array(),
'meta' => array(),
- 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 toArray
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function toArray() {
$arr = array(
'id' => $this->get( '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
Function ___get
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function ___get( $key, $raw = false ) {
// Force numeric id and prevent filtering on the id.
if ( 'id' === $key ) {
- 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 parse_properties_to_set
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parse_properties_to_set( $model_array ) {
$llms_post = array(
'post' => array(),
'meta' => array(),
Method ___get
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function ___get( $key, $raw = false ) {
// Force numeric id and prevent filtering on the id.
if ( 'id' === $key ) {
Method toArray
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toArray() {
$arr = array(
'id' => $this->get( 'id' ),
);
Method scrub_field
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function scrub_field( $val, $type ) {
if ( is_string( $val ) && 'html' !== $type ) {
$val = wp_strip_all_tags( $val );
}
Function update_meta_properties
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function update_meta_properties( $post_meta_properties, $allow_same_meta_value ) {
if ( empty( $post_meta_properties ) ) {
return;
}
- 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 scrub_field
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function scrub_field( $val, $type ) {
if ( is_string( $val ) && 'html' !== $type ) {
$val = wp_strip_all_tags( $val );
}
- 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 __construct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $model, $args = array() ) {
if ( 'new' === $model ) {
$model = $this->create( $args );
if ( ! is_wp_error( $model ) ) {
- 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 get_image
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function get_image( $size = 'full', $key = '' ) {
if ( 'thumbnail' === $key && post_type_supports( $this->db_post_type, 'thumbnail' ) ) {
$url = get_the_post_thumbnail_url( $this->get( 'id' ), $size );
} else {
$id = $this->get( $key );
- 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 get_price
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function get_price( $key, $price_args = array(), $format = 'html' ) {
$price = $this->get( $key );
// Handle empty or unset values gracefully.
- 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 to_array_extra_blocks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function to_array_extra_blocks( $content ) {
$blocks = array();
foreach ( parse_blocks( $content ) as $block ) {
- 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 toArrayCustom
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function toArrayCustom( $arr ) {
// Build an array of keys that are registered or can be excluded as a custom field.
$props = array_keys( $this->get_properties() );
foreach ( $props as &$prop ) {
- 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 set_bulk
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function set_bulk( $model_array, $wp_error = false, $allow_same_meta_value = false ) {
if ( empty( $model_array ) ) {
return $wp_error ? new WP_Error( 'empty_data', __( 'Empty data', 'lifterlms' ) ) : 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"