skyverge/wc-plugin-framework

View on GitHub

Showing 396 of 396 total issues

Function add_configuration_errors_notice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function add_configuration_errors_notice() {

        $errors = $this->get_configuration_errors();

        if ( ! empty( $errors ) ) {
Severity: Minor
Found in woocommerce/payment-gateway/External_Checkout/Admin.php - About 25 mins to fix

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 add_authorization_charge_form_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function add_authorization_charge_form_fields( $form_fields ) {

        assert( $this->supports_credit_card_authorization() && $this->supports_credit_card_charge() );

        $form_fields['transaction_type'] = array(
Severity: Minor
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway.php - About 25 mins to fix

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 add_system_status_information has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function add_system_status_information() {

        foreach ( $this->get_gateways() as $gateway ) {

            // Skip gateways that aren't enabled
Severity: Minor
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php - About 25 mins to fix

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 add_add_payment_method_customer_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function add_add_payment_method_customer_data( $order, $response ) {

        $user_id = $order->get_user_id();

        // set customer ID from response if available
Severity: Minor
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php - About 25 mins to fix

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_apple_pay_configuration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_apple_pay_configuration() : ?array {

        $apple_pay_configuration = null;

        if ( $this->gateway->supports_apple_pay() ) {

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_payment_token_subscriptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_payment_token_subscriptions( $user_id, $token ) {

        $subscriptions = wcs_get_users_subscriptions( $user_id );

        foreach ( $subscriptions as $key => $subscription ) {

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 tokenization_enabled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function tokenization_enabled() {

        foreach ( $this->get_gateways() as $gateway ) {

            if ( $gateway->is_enabled() && $gateway->supports_tokenization() && $gateway->tokenization_enabled() ) {
Severity: Minor
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php - About 25 mins to fix

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_google_pay_configuration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_google_pay_configuration() : ?array {

        $google_pay_configuration = null;

        if ( $this->gateway->supports_google_pay() ) {

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_assets_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_assets_version( ?string $gateway_id = null ) : string  {

        $script_version = parent::get_assets_version();

        if ( $gateway_id ) {
Severity: Minor
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php - About 25 mins to fix

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_token_by_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function get_token_by_id( $token_id ) {

        $token = null;

        foreach ( $this->get_plugin()->get_gateways() as $gateway ) {

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 prepare_setting_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepare_setting_item( $setting, $request ) {

        if ( $setting instanceof Setting ) {

            $item = [
Severity: Minor
Found in woocommerce/rest-api/Controllers/Settings.php - About 25 mins to fix

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 supports_add_payment_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function supports_add_payment_method() {

        foreach ( $this->get_plugin()->get_gateways() as $gateway ) {

            if ( $gateway->is_direct_gateway() && $gateway->supports_add_payment_method() ) {

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 do_transaction_response_invalid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function do_transaction_response_invalid( \WC_Order $order = null, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {

        $this->get_gateway()->add_debug_message( $message, 'error' );

        // if we have an order, mark it as held and add an order note
Severity: Minor
Found in woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php - About 25 mins to fix

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 update_token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function update_token( $user_id, $token, $environment_id = null ) {

        // default to current environment
        if ( null === $environment_id ) {
            $environment_id = $this->get_environment_id();

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 payment_token_deleted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function payment_token_deleted( $token_id, $core_token ) {

        if ( $this->get_gateway()->get_id() === $core_token->get_gateway_id() ) {

            $token = $this->build_token( $core_token->get_token(), $core_token );

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_payment_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_payment_url( $order_id ) {

        if ( $this->use_form_post() ) {
            // the checkout pay page
            $order = wc_get_order( $order_id );
Severity: Minor
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php - About 25 mins to fix

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

Severity
Category
Status
Source
Language