fannie/item/PluRangePage.php
File PluRangePage.php
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/*******************************************************************************
Copyright 2014 Whole Foods Co-op, Duluth, MN
Function findOpenRange
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
private function findOpenRange($dbc, $min, $max)
{
$current = $min;
$range_start = false;
$lookup = $dbc->prepare('SELECT upc FROM products WHERE upc=?');
- 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_view
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_view()
{
// Produce ranges as of 19May14
// 3000 through 4999
// 93000 through 949999
Method post_start_number_handler
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function post_start_number_handler()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
Method get_length_number_view
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_length_number_view()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
Method findReuseBulkPlu
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function findReuseBulkPlu()
{
$dbc = FannieDB::get($this->config->get('OP_DB'));
$data = array();
Method get_length_number_handler
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_length_number_handler()
{
try {
$this->validLengthNumber($this->length, $this->number);
$min = '1' . str_repeat('0', $this->length-1);