fannie/item/images/NutriFacts.php
Method post_handler
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function post_handler()
{
$this->saveForm();
$pdf = new FPDF('P', 'in', array(3.5, 1.25));
$pdf->SetMargins(0, 0, 0);
File NutriFacts.php
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Community Co-op
Method get_view
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function get_view()
{
$this->addScript('nutrifacts.js');
$ret = <<<HTML
<form method="post" target="_blank">
Method saveForm
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function saveForm()
{
$req = new NutriFactReqItemsModel($this->connection);
$req->upc(BarcodeLib::padUPC($this->form->upc));
$req->servingSize($this->form->serving_size);
Function post_handler
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function post_handler()
{
$this->saveForm();
$pdf = new FPDF('P', 'in', array(3.5, 1.25));
$pdf->SetMargins(0, 0, 0);
- 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 saveForm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
private function saveForm()
{
$req = new NutriFactReqItemsModel($this->connection);
$req->upc(BarcodeLib::padUPC($this->form->upc));
$req->servingSize($this->form->serving_size);
- 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"