Showing 65 of 1,795 total issues
Method find
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function find($request, $match)
{
if (isset($match['secureId'])) {
$order = Shop_Shortcuts_GetObjectBySecureIdOr404('Shop_Order', $match['secureId']);
} else {
Method serviceTaxes
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function serviceTaxes ($request, $match)
{
$service = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['serviceId']);
$tax = new Shop_TaxClass();
$taxTable = $tax->_a['table'];
Method createOrderFilter
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createOrderFilter($request)
{
$sql = new Pluf_SQL('deleted=%d', array(
FALSE
));
Method find
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function find($request, $match)
{
$address = new Shop_Address();
$pag = new Pluf_Paginator($address);
if(User_Precondition::ownerRequired($request)){
Method addOrderHistory
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addOrderHistory($signal, $event)
{
switch ($event->event) {
case 'set_zone':
$object = $event->object->get_zone();
Method get
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get($request, $match)
{
// Check if product exsit
$item = Pluf_Shortcuts_GetObjectOr404('Shop_Product', $match['modelId']);
// Extract metafield id or metafield key if id is not provided
Method find
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function find($request, $match)
{
$item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
$paginator = new Pluf_Paginator(Pluf::factory('Shop_ServiceMetafield'));
$sql = new Pluf_SQL('service_id=%s', array(
Method get
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get($request, $match)
{
// Check if service exsit
$item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
// Extract metafield id or metafield key if id is not provided
Method find
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function find($request, $match)
{
$item = Pluf_Shortcuts_GetObjectOr404('Shop_Product', $match['modelId']);
$paginator = new Pluf_Paginator(Pluf::factory('Shop_ProductMetafield'));
$sql = new Pluf_SQL('product_id=%s', array(
Method upload
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function upload($request, $match)
{
$order = null;
if (isset($match['secureId'])) {
$order = Shop_Shortcuts_GetObjectBySecureIdOr404('Shop_Order', $match['secureId']);
Method find
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function find($request, $match)
{
$contact = new Shop_Contact();
$pag = new Pluf_Paginator($contact);
if (User_Precondition::ownerRequired($request)) {
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create($request, $match)
{
$order = null;
if (isset($match['secureId'])) {
$order = Shop_Shortcuts_GetObjectBySecureIdOr404('Shop_Order', $match['secureId']);
Function save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function save($commit = true)
{
$model = parent::save(false);
// update the content
if (array_key_exists('file', $this->cleaned_data)) {
- 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 getMetafieldByIdOrKey
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function getMetafieldByIdOrKey($request, $match){
$mfId = null;
// Extract metafield id (if exist)
if (isset($match['id'])) {
$mfId = $match['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 getMetafieldByIdOrKey
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function getMetafieldByIdOrKey($request, $match){
$mfId = null;
// Extract metafield id (if exist)
if (isset($match['id'])) {
$mfId = $match['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 transferCommission
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function transferCommission($request, $order)
{
$totalCost = $request->REQUEST['total_cost'];
$spareCost = $request->REQUEST['spare_cost'];
$commission = ($totalCost - $spareCost) * 0.2;
- 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 upload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function upload($request, $match)
{
$order = null;
if (isset($match['secureId'])) {
$order = Shop_Shortcuts_GetObjectBySecureIdOr404('Shop_Order', $match['secureId']);
- 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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function create($request, $match)
{
$user = $request->user;
$data = $request->REQUEST;
if (isset($user)) {
- 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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function create($request, $match)
{
// TODO: Hadi: if item is added previously to order it is good to increase its count only
/**
*
- 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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function create($request, $match)
{
$order = null;
if (isset($match['secureId'])) {
$order = Shop_Shortcuts_GetObjectBySecureIdOr404('Shop_Order', $match['secureId']);
- 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"