File ViewPurchaseOrders.php
has 1298 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op
Method get_id_view
has 250 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_view()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
ViewPurchaseOrders
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
class ViewPurchaseOrders extends FannieRESTfulPage
{
protected $header = 'Purchase Orders';
protected $title = 'Purchase Orders';
Function get_id_view
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
protected function get_id_view()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
- 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_orders
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_orders($placed, $store=0, $month=0, $year=0)
{
$dbc = $this->connection;
$store = FormLib::get('store', $store);
Method get_id_sendAs_handler
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_sendAs_handler()
{
if (!file_exists('exporters/'.$this->sendAs.'.php')) {
return $this->unknownRequestHandler();
}
Method receiveUnOrderedItem
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function receiveUnOrderedItem($dbc)
{
echo '<div class="alert alert-danger">SKU not found in order</div>';
echo '<table class="table table-bordered">';
echo '<tr><th>SKU</th><th>UPC</th><th>Brand</th><th>Description</th>
Function get_id_sku_handler
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function get_id_sku_handler()
{
$dbc = $this->connection;
$model = new PurchaseOrderItemsModel($dbc);
$model->orderID($this->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 csvToHtml
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function csvToHtml($csv)
{
$lines = explode("\r\n", $csv);
$ret = "<table border=\"1\">\n";
$para = '';
- 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 receiveOrderedItem
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function receiveOrderedItem($dbc, $model)
{
echo '<table class="table table-bordered small">';
$uid = FannieAuth::getUID($this->current_user);
if (!is_array($model)) {
Method get_view
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_view()
{
$init = FormLib::get('init', 'placed');
$monthOpts = '<option>Last 30 days</option>';
Method get_id_sku_handler
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_sku_handler()
{
$dbc = $this->connection;
$model = new PurchaseOrderItemsModel($dbc);
$model->orderID($this->id);
Method get_id_receiveAll_view
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_receiveAll_view()
{
$dbc = FannieDB::getReadOnly($this->config->get('OP_DB'));
$poi = new PurchaseOrderItemsModel($dbc);
$poi->orderID($this->id);
Method get_id_recode_view
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_recode_view()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$model = new PurchaseOrderItemsModel($dbc);
Function get_orders
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function get_orders($placed, $store=0, $month=0, $year=0)
{
$dbc = $this->connection;
$store = FormLib::get('store', $store);
- 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 post_id_sku_qty_receiveAll_handler
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function post_id_sku_qty_receiveAll_handler()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$model = new PurchaseOrderItemsModel($dbc);
Function get_id_sendAs_handler
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function get_id_sendAs_handler()
{
if (!file_exists('exporters/'.$this->sendAs.'.php')) {
return $this->unknownRequestHandler();
}
- 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 post_id_sku_qty_cost_handler
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function post_id_sku_qty_cost_handler()
{
$dbc = $this->connection;
$model = new PurchaseOrderItemsModel($dbc);
$uid = FannieAuth::getUID($this->current_user);
Method get_id_receiveDone_handler
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_receiveDone_handler()
{
$prep = $this->connection->prepare("UPDATE
PurchaseOrderItems
SET receivedQty=0,
Method csvToHtml
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function csvToHtml($csv)
{
$lines = explode("\r\n", $csv);
$ret = "<table border=\"1\">\n";
$para = '';
Method post_id_setPlaced_handler
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function post_id_setPlaced_handler()
{
$this->connection->selectDB($this->config->get('OP_DB'));
$model = new PurchaseOrderModel($this->connection);
$model->orderID($this->id);
Function post_id_sku_qty_receiveAll_handler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function post_id_sku_qty_receiveAll_handler()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$model = new PurchaseOrderItemsModel($dbc);
- 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 post_id_setPlaced_handler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function post_id_setPlaced_handler()
{
$this->connection->selectDB($this->config->get('OP_DB'));
$model = new PurchaseOrderModel($this->connection);
$model->orderID($this->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 post_id_sku_qty_cost_handler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function post_id_sku_qty_cost_handler()
{
$dbc = $this->connection;
$model = new PurchaseOrderItemsModel($dbc);
$uid = FannieAuth::getUID($this->current_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 receiveOrderedItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function receiveOrderedItem($dbc, $model)
{
echo '<table class="table table-bordered small">';
$uid = FannieAuth::getUID($this->current_user);
if (!is_array($model)) {
- 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 receiveUnOrderedItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function receiveUnOrderedItem($dbc)
{
echo '<div class="alert alert-danger">SKU not found in order</div>';
echo '<table class="table table-bordered">';
echo '<tr><th>SKU</th><th>UPC</th><th>Brand</th><th>Description</th>
- 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"