src/Shop/Order/Manager/SimplePreconditions.php

Summary

Maintainability
A
0 mins
Test Coverage

Reduce the number of returns of this function 4, down to the maximum allowed 3.
Open

    static public function canUpdateOrder ($request, $order)

Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

Noncompliant Code Example

With the default threshold of 3:

function myFunction(){ // Noncompliant as there are 4 return statements
  if (condition1) {
    return true;
  } else {
    if (condition2) {
      return false;
    } else {
      return true;
    }
  }
  return false;
}

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Shop_Order_Manager_SimplePreconditions

The class Shop_Order_Manager_SimplePreconditions is not named in CamelCase.
Open

class Shop_Order_Manager_SimplePreconditions
{

    /**
     * Checks if requester is allowed to update the order.

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

Expected "function abc(...)"; found "function abc (...)"
Open

    static public function canUpdateOrder ($request, $order)

Expected 0 spaces before opening parenthesis; 1 found
Open

    static public function canUpdateOrder ($request, $order)

The static declaration must come after the visibility declaration
Open

    static public function canUpdateOrder ($request, $order)

The closing brace for the class must go on the next line after the body
Open

}

Line exceeds 120 characters; contains 124 characters
Open

     * Order could be updated if requester is owner of order or the feild 'secureId' is exsited in the request`s parameters.

Whitespace found at end of line
Open

     *  

Expected 1 space after closing parenthesis; found 0
Open

        if($order->customer_id === $request->user->id){

Expected 1 space after closing parenthesis; found 0
Open

        if(array_key_exists('secureId', $request->REQUEST) && $order->secureId === $request->REQUEST['secureId']){

Class name "Shop_Order_Manager_SimplePreconditions" is not in camel caps format
Open

class Shop_Order_Manager_SimplePreconditions

Expected 1 space after IF keyword; 0 found
Open

        if($order->customer_id === $request->user->id){

Expected 1 space after IF keyword; 0 found
Open

        if(array_key_exists('secureId', $request->REQUEST) && $order->secureId === $request->REQUEST['secureId']){

There are no issues that match your filters.

Category
Status