includes/class.llms.roles.php
Function get_post_type_caps
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function get_post_type_caps( $role ) {
$caps = array();
// Students get nothing.
- 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 get_wp_caps
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function get_wp_caps( $role ) {
$caps = array(
'read' => true,
);
Method get_post_type_caps
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function get_post_type_caps( $role ) {
$caps = array();
// Students get nothing.
File class.llms.roles.php
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* LLMS_Roles class.
*
* @package LifterLMS/Classes
Method get_core_caps
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function get_core_caps( $role ) {
$all_caps = array_fill_keys( array_values( self::get_all_core_caps() ), true );
switch ( $role ) {
Function update_caps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function update_caps( $role, $type = 'add', $exclude_groups = array() ) {
$role_caps = self::get_all_caps( $role->name );
$role_caps = empty( $exclude_groups ) ? $role_caps : array_diff_key( $role_caps, array_flip( $exclude_groups ) );
- 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"