Showing 151 of 151 total issues
Method prepareSuggestions
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareSuggestions($sSetSuggestions, array $aPossibleSuggestions, Items $oItem)
{
// prepare defined suggestions
$sSetSuggestions = trim($sSetSuggestions);
$aDefinedSuggestions = [];
Method handleItems
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleItems()
{
if (filter_input(INPUT_GET, 'clearorphaneditems') !== null) {
$this->db->exec('DELETE FROM item_lang WHERE itml_pid NOT IN (SELECT itm_id FROM item_base)');
}
Function getUserData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getUserData($sField = '', $aUserdata = false)
{
if (!$aUserdata) {
if (!isset($_SESSION['user']) || !is_array($_SESSION['user'])) {
return false;
- 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 setupSession
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function setupSession()
{
if (
(
$this->config->getCore('enable_module_customer')
- 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 __construct
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(ServiceManager $serviceManager, $iParentID, $bReturnRaw = false, UserPage $basePage = null) {
parent::__construct($serviceManager);
$this->dbal = $this->serviceManager->get('dbal');
Similar blocks of code found in 2 locations. Consider refactoring. Open
$querybuilder
->update('customer')
->set('cust_no', ':cust_no')
->set('cust_email', ':cust_email')
->set('cust_corp', ':cust_corp')
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 107.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
$querybuilder
->insert('customer')
->setValue('cust_email', ':cust_email')
->setValue('cust_corp', ':cust_corp')
->setValue('cust_name', ':cust_name')
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 107.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method fillSuggestions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fillSuggestions($suggestions)
{
$iNumberOfSuggestions = count($suggestions['default']);
if ($iNumberOfSuggestions > $this->shop['itemdetail_suggestions']) { // if there are more suggestions than should be displayed, randomly pick as many as to be shown
$aKeysSuggestions = array_rand($suggestions['default'], $this->shop['itemdetail_suggestions']); // get the array keys that will stay
Method getNotification
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getNotification()
{
$return = '';
$getmsg = filter_input(INPUT_GET, 'msg');
$getcartkey = filter_input(INPUT_GET, 'cartkey', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
Method updatePage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function updatePage(UserPage $Ptoedit)
{
$purifier = false;
if ($this->config->getCore('pagetext_enable_purifier')) {
$purifier = $this->helper->getPurifier('page');
Function preparePage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function preparePage()
{
$this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
$this->P->cb_pagetype = 'content';
- 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 addDataWhere
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function addDataWhere($field, $needle, $newfield, $content)
{
foreach ($this->items as $key => $item) {
if ($needle !== false) {
if (!empty($item['itm_data']->$field) && $item['itm_data']->$field == $needle) {
- 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 handlePasswordReset
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function handlePasswordReset($aErr, $iID) {
$postpwd = filter_input(INPUT_POST, 'pwd');
if (!empty($postpwd)) {
if (strlen($postpwd) < $this->config->getCustomer('minimum_length_password')) {
$aErr[] = 'pwlength';
- 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 __construct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(ServiceManager $serviceManager, $sPagekey, $bReturnRaw = false)
{
//if (!$bReturnRaw) $this->container = $container;
$this->serviceManager = $serviceManager;
$this->status = 200;
- 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 getLanguage
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getLanguage()
{
$langavailable = $this->core['lang_available'];
if (
$this->core['lang_detection_method'] === 'domain'
Method queryItemWhereClause
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function queryItemWhereClause($mItemIndex = '', $mItemno = '')
{
$sql = ' WHERE ';
$getsearchtext = filter_input(INPUT_GET, 'searchtext', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
if (!empty($mItemno)) {
Method handleItemPage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleItemPage(ServiceManager $serviceManager, \HaaseIT\HCSF\Page $P, array $aP)
{
$mItemIndex = '';
if (isset($P->cb_pageconfig->itemindex)) {
$mItemIndex = $P->cb_pageconfig->itemindex;
Method __construct
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(ServiceManager $serviceManager, $sPagekey, $bReturnRaw = false)
{
//if (!$bReturnRaw) $this->container = $container;
$this->serviceManager = $serviceManager;
$this->status = 200;
Method preparePage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preparePage()
{
$headers = [
'Content-Disposition' => 'attachment; filename=hcsf_export.csv',
'Content-type' => 'text/csv',
Method showPageselect
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function showPageselect() {
$aGroups = [];
$adminpagegroups = $this->config->getCore('admin_page_groups');
foreach ($adminpagegroups as $sValue) {
$TMP = explode('|', $sValue);