Showing 151 of 151 total issues
Method setupSession
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function setupSession()
{
if (
(
$this->config->getCore('enable_module_customer')
Method handleItemGroups
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleItemGroups()
{
if (filter_input(INPUT_GET, 'clearorphaneditemgroups') !== null) {
$this->db->exec('DELETE FROM itemgroups_text WHERE itmgt_pid NOT IN (SELECT itmg_id FROM itemgroups_base)');
}
Method preparePage
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preparePage()
{
$this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
$this->P->cb_pagetype = 'content';
Method getItemSuggestions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getItemSuggestions(
Items $oItem,
$aPossibleSuggestions,
$sSetSuggestions,
$sCurrentitem,
Method setupTwig
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function setupTwig()
{
$this->serviceManager->setFactory('twig', function (ServiceManager $serviceManager) {
$loader = new \Twig_Loader_Filesystem([PATH_BASEDIR.'customization/views', HCSF_BASEDIR.'src/views/']);
Method getPurifier
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPurifier($purpose)
{
$purifier_config = \HTMLPurifier_Config::createDefault();
$purifier_config->set('Core.Encoding', 'UTF-8');
$purifier_config->set('Cache.SerializerPath', PATH_PURIFIERCACHE);
Method getItem
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getItem($sItemno = '')
{
if ($sItemno === '') {
$sItemno = filter_input(INPUT_GET, 'itemno', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
if (empty($sItemno)) {
Function init
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function init()
{
$this->serviceManager = new ServiceManager();
if (!CLI) {
- 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 preparePage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function preparePage()
{
$this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager, [], 'admin/base.twig');
$this->P->cb_pagetype = 'content';
$this->P->cb_subnav = 'admin';
- 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 getRoutingoverride
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getRoutingoverride($aPath)
{
$aRoutingoverride = [];
// /xxxx/item/0010.html
$aTMP['parts_in_path'] = count($aPath);
- 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 requireAdminAuth
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function requireAdminAuth() {
$adminusers = $this->config->getSecret('admin_users');
if ($this->requireAdminAuthAdminHome && (empty($adminusers) || !count($adminusers))) {
return true;
Method preparePage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preparePage()
{
$this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager, [], 'admin/base.twig');
$this->P->cb_pagetype = 'content';
$this->P->cb_subnav = 'admin';
Similar blocks of code found in 2 locations. Consider refactoring. Open
$aItem = [
'amount' => $iAmount,
'price' => $this->serviceManager->get('oItem')->calcPrice($aData['item'][$sItemno]),
'rg' => $aData['item'][$sItemno]['itm_rg'],
'vat' => $aData['item'][$sItemno]['itm_vatid'],
- 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 102.
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
[
'amount' => $iAmount,
'price' => $this->serviceManager->get('oItem')->calcPrice($additionaldata['item'][$additionalitem]),
'rg' => $additionaldata['item'][$additionalitem]['itm_rg'],
'vat' => $additionaldata['item'][$additionalitem]['itm_vatid'],
- 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 102.
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 preparePage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preparePage()
{
$this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
$this->P->cb_pagetype = 'content';
Method getShoppingcartData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getShoppingcartData()
{
$aCartinfo = [
'numberofitems' => 0,
'cartsums' => [],
Method sendCheckoutMails
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sendCheckoutMails($iInsertID, $sMailbody_us, $sMailbody_they)
{
$aFilesToSend = [];
if (
!empty($this->config->getShop('email_orderconfirmation_attachment_cancellationform_'.$this->config->getLang()))
Method prepareItemlistsearchform
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function prepareItemlistsearchform()
{
$aData = [
'searchcats' => [
'nummer|'.$this->hardcodedtextcats->get('itemadmin_search_itemno'),
Method buildShoppingCartTable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildShoppingCartTable(array $aCart, $bReadonly = false, $sCustomergroup = '', $aErr = [], $iVATfull = '', $iVATreduced = '')
{
if ($iVATfull === '' && $iVATreduced === '') {
$iVATfull = $this->shop['vat']['full'];
$iVATreduced = $this->shop['vat']['reduced'];
Method handlePasswordReset
has 26 lines of code (exceeds 25 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';