Showing 10 of 13 total issues
Function collect_granting_rules
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
final public function collect_granting_rules(): array {
$rules_key = "permissions_rules_{$this->get_id()}";
$rules = $this->get_cache_value( $rules_key );
if ( $rules instanceof NotFoundException ) {
- 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 install_or_update
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function install_or_update(): ?InstallFailureException {
if ( ! Users::has_capabilities( 'activate_plugins' ) ) {
return new InstallFailureException( 'User does not have enough permissions to run the installation routine' );
}
Method output_installation_js
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function output_installation_js() {
if ( false === $this->has_notice_output ) {
return; // The installation/upgrade notice has not been outputted.
}
Function get_installable_versions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function get_installable_versions(): array {
$installable_versions = array();
foreach ( \get_declared_classes() as $declared_class ) {
if ( ! \is_a( $declared_class, InstallableInterface::class, true ) ) {
- 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 collect_granting_rules
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function collect_granting_rules(): array {
$rules_key = "permissions_rules_{$this->get_id()}";
$rules = $this->get_cache_value( $rules_key );
if ( $rules instanceof NotFoundException ) {
Method register_admin_notices
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register_admin_notices( AdminNoticesService $notices_service ): void {
if ( \doing_action( 'activate_' . $this->get_plugin()->get_plugin_file_path() ) ) {
return;
}
Function update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function update( string $current_version ): ?UpdateFailureException {
$current_version = \json_decode( $current_version, true );
if ( \is_null( $current_version ) ) {
return new UpdateFailureException( \__( 'Failed to update permissions', 'dws-wp-framework-core' ) );
}
- 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 uninstall
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function uninstall(): ?UninstallFailureException {
if ( ! Users::has_capabilities( (array) 'delete_plugins' ) ) {
return new UninstallFailureException( 'User does not have enough permissions to run the uninstallation routine' );
}
- 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 collect_permissions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
final public function collect_permissions(): array {
$permissions_key = "permissions_{$this->get_id()}";
$permissions = $this->get_cache_value( $permissions_key );
if ( $permissions instanceof NotFoundException ) {
- 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 install
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function install(): ?InstallFailureException {
$granting_rules = $this->collect_granting_rules();
$existing_roles = $this->get_existing_roles();
foreach ( $existing_roles as $wp_role ) {
- 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"