imagecms/ImageCMS

View on GitHub
application/modules/xbanners/models/Base/BannerImage.php

Summary

Maintainability
F
2 wks
Test Coverage

File BannerImage.php has 1182 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace xbanners\models\Base;

use \Exception;
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 3 days to fix

BannerImage has 98 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class BannerImage extends PropelBaseModelClass implements ActiveRecordInterface
{
    /**
     * TableMap class name
     */
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 day to fix

Function getBannerImageI18ns has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    public function getBannerImageI18ns(Criteria $criteria = null, ConnectionInterface $con = null)
    {
        $partial = $this->collBannerImageI18nsPartial && !$this->isNew();
        if (null === $this->collBannerImageI18ns || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collBannerImageI18ns) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 5 hrs to fix

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 doSave has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doSave(ConnectionInterface $con)
    {
        $affectedRows = 0; // initialize var to track total num of affected rows
        if (!$this->alreadyInSave) {
            $this->alreadyInSave = true;
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 4 hrs to fix

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 doInsert has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doInsert(ConnectionInterface $con)
    {
        $modifiedColumns = array();
        $index = 0;

Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 3 hrs to fix

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 doInsert has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function doInsert(ConnectionInterface $con)
    {
        $modifiedColumns = array();
        $index = 0;

Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 3 hrs to fix

Method toArray has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
    {

        if (isset($alreadyDumpedObjects['BannerImage'][$this->hashCode()])) {
            return '*RECURSION*';
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 2 hrs to fix

Function toArray has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
    {

        if (isset($alreadyDumpedObjects['BannerImage'][$this->hashCode()])) {
            return '*RECURSION*';
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

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 getTranslation has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTranslation($locale = 'ru', ConnectionInterface $con = null)
    {
        if (!isset($this->currentTranslations[$locale])) {
            if (null !== $this->collBannerImageI18ns) {
                foreach ($this->collBannerImageI18ns as $translation) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

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 doSave has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function doSave(ConnectionInterface $con)
    {
        $affectedRows = 0; // initialize var to track total num of affected rows
        if (!$this->alreadyInSave) {
            $this->alreadyInSave = true;
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

Function getByPosition has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

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 getByPosition has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

Method setByPosition has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

Method getBannerImageI18ns has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getBannerImageI18ns(Criteria $criteria = null, ConnectionInterface $con = null)
    {
        $partial = $this->collBannerImageI18nsPartial && !$this->isNew();
        if (null === $this->collBannerImageI18ns || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collBannerImageI18ns) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

Method buildCriteria has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildCriteria()
    {
        $criteria = new Criteria(BannerImageTableMap::DATABASE_NAME);

        if ($this->isColumnModified(BannerImageTableMap::COL_ID)) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

Function setByPosition has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

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 fromArray has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
    {
        $keys = BannerImageTableMap::getFieldNames($keyType);

        if (array_key_exists($keys[0], $arr)) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

Method save has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function save(ConnectionInterface $con = null)
    {
        if ($this->isDeleted()) {
            throw new PropelException("You cannot save an object that has been deleted.");
        }
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

Method hydrate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
    {
        try {

            $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : BannerImageTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

Function fromArray has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
    {
        $keys = BannerImageTableMap::getFieldNames($keyType);

        if (array_key_exists($keys[0], $arr)) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

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 buildCriteria has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildCriteria()
    {
        $criteria = new Criteria(BannerImageTableMap::DATABASE_NAME);

        if ($this->isColumnModified(BannerImageTableMap::COL_ID)) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

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 countBannerImageI18ns has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function countBannerImageI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collBannerImageI18nsPartial && !$this->isNew();
        if (null === $this->collBannerImageI18ns || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collBannerImageI18ns) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 1 hr to fix

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 copyInto has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
    {
        $copyObj->setBannerId($this->getBannerId());
        $copyObj->setTarget($this->getTarget());
        $copyObj->setUrl($this->getUrl());
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 35 mins to fix

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 __call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __call($name, $params)
    {
        if (0 === strpos($name, 'get')) {
            $virtualColumn = substr($name, 3);
            if ($this->hasVirtualColumn($virtualColumn)) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 35 mins to fix

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

Avoid too many return statements within this method.
Open

                return $this->getPermanent();
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $this->getActiveTo();
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $this->getPosition();
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return null;
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $this->getActive();
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $this->getAllowedPage();
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $this->getActiveFrom();
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php - About 30 mins to fix

Function addBannerImageI18n has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addBannerImageI18n(ChildBannerImageI18n $l)
    {
        if ($l && $locale = $l->getLocale()) {
            $this->setLocale($locale);
            $this->currentTranslations[$locale] = $l;
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 25 mins to fix

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 clearAllReferences has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function clearAllReferences($deep = false)
    {
        if ($deep) {
            if ($this->collBannerImageI18ns) {
                foreach ($this->collBannerImageI18ns as $o) {
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 25 mins to fix

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 removeTranslation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function removeTranslation($locale = 'ru', ConnectionInterface $con = null)
    {
        if (!$this->isNew()) {
            ChildBannerImageI18nQuery::create()
                ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImage.php - About 25 mins to fix

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

Similar blocks of code found in 5 locations. Consider refactoring.
Open

    public function getBannerImageI18ns(Criteria $criteria = null, ConnectionInterface $con = null)
    {
        $partial = $this->collBannerImageI18nsPartial && !$this->isNew();
        if (null === $this->collBannerImageI18ns || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collBannerImageI18ns) {
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 4 other locations - About 1 day to fix
application/modules/core/models/Base/Route.php on lines 1383..1425
application/modules/core/models/Base/Route.php on lines 1633..1675
application/modules/xbanners/models/Base/Banners.php on lines 1437..1479
application/modules/xbanners/models/Base/Banners.php on lines 1662..1704

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 300.

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

Further Reading

Identical blocks of code found in 5 locations. Consider refactoring.
Open

    public function __call($name, $params)
    {
        if (0 === strpos($name, 'get')) {
            $virtualColumn = substr($name, 3);
            if ($this->hasVirtualColumn($virtualColumn)) {
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 4 other locations - About 1 day to fix
application/modules/core/models/Base/Route.php on lines 2013..2041
application/modules/xbanners/models/Base/BannerImageI18n.php on lines 1497..1525
application/modules/xbanners/models/Base/Banners.php on lines 2126..2154
application/modules/xbanners/models/Base/BannersI18n.php on lines 1314..1342

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 251.

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

Further Reading

Identical blocks of code found in 5 locations. Consider refactoring.
Open

    public function save(ConnectionInterface $con = null)
    {
        if ($this->isDeleted()) {
            throw new PropelException("You cannot save an object that has been deleted.");
        }
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 4 other locations - About 7 hrs to fix
application/modules/core/models/Base/Route.php on lines 703..740
application/modules/xbanners/models/Base/BannerImageI18n.php on lines 720..757
application/modules/xbanners/models/Base/Banners.php on lines 737..774
application/modules/xbanners/models/Base/BannersI18n.php on lines 600..637

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 233.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function reload($deep = false, ConnectionInterface $con = null)
    {
        if ($this->isDeleted()) {
            throw new PropelException("Cannot reload a deleted object.");
        }
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 2 other locations - About 6 hrs to fix
application/modules/core/models/Base/Route.php on lines 625..657
application/modules/xbanners/models/Base/Banners.php on lines 659..691

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 218.

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

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

    public function countBannerImageI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collBannerImageI18nsPartial && !$this->isNew();
        if (null === $this->collBannerImageI18ns || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collBannerImageI18ns) {
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 4 other locations - About 5 hrs to fix
application/modules/core/models/Base/Route.php on lines 1469..1492
application/modules/core/models/Base/Route.php on lines 1719..1742
application/modules/xbanners/models/Base/Banners.php on lines 1523..1546
application/modules/xbanners/models/Base/Banners.php on lines 1751..1774

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 190.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function getTranslation($locale = 'ru', ConnectionInterface $con = null)
    {
        if (!isset($this->currentTranslations[$locale])) {
            if (null !== $this->collBannerImageI18ns) {
                foreach ($this->collBannerImageI18ns as $translation) {
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 1 other location - About 4 hrs to fix
application/modules/xbanners/models/Base/Banners.php on lines 1928..1953

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 182.

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

Further Reading

Identical blocks of code found in 5 locations. Consider refactoring.
Open

    public function delete(ConnectionInterface $con = null)
    {
        if ($this->isDeleted()) {
            throw new PropelException("This object has already been deleted.");
        }
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 4 other locations - About 3 hrs to fix
application/modules/core/models/Base/Route.php on lines 668..688
application/modules/xbanners/models/Base/BannerImageI18n.php on lines 685..705
application/modules/xbanners/models/Base/Banners.php on lines 702..722
application/modules/xbanners/models/Base/BannersI18n.php on lines 565..585

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 150.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function addBannerImageI18n(ChildBannerImageI18n $l)
    {
        if ($l && $locale = $l->getLocale()) {
            $this->setLocale($locale);
            $this->currentTranslations[$locale] = $l;
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 1 other location - About 3 hrs to fix
application/modules/xbanners/models/Base/Banners.php on lines 1783..1803

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 146.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function setBannerImageI18ns(Collection $bannerImageI18ns, ConnectionInterface $con = null)
    {
        /** @var ChildBannerImageI18n[] $bannerImageI18nsToDelete */
        $bannerImageI18nsToDelete = $this->getBannerImageI18ns(new Criteria(), $con)->diff($bannerImageI18ns);

Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 1 other location - About 2 hrs to fix
application/modules/xbanners/models/Base/Banners.php on lines 1716..1740

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 129.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function removeTranslation($locale = 'ru', ConnectionInterface $con = null)
    {
        if (!$this->isNew()) {
            ChildBannerImageI18nQuery::create()
                ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 1 other location - About 1 hr to fix
application/modules/xbanners/models/Base/Banners.php on lines 1963..1981

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 118.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function removeBannerImageI18n(ChildBannerImageI18n $bannerImageI18n)
    {
        if ($this->getBannerImageI18ns()->contains($bannerImageI18n)) {
            $pos = $this->collBannerImageI18ns->search($bannerImageI18n);
            $this->collBannerImageI18ns->remove($pos);
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 2 other locations - About 1 hr to fix
application/modules/xbanners/models/Base/Banners.php on lines 1586..1600
application/modules/xbanners/models/Base/Banners.php on lines 1818..1832

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 114.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function setBannerId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 2 other locations - About 1 hr to fix
application/modules/xbanners/models/Base/BannerImageI18n.php on lines 425..441
application/modules/xbanners/models/Base/BannersI18n.php on lines 374..390

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 110.

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

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

    public function hashCode()
    {
        $validPk = null !== $this->getId();

        $validPrimaryKeyFKs = 0;
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 2 other locations - About 1 hr to fix
application/modules/core/models/Base/Route.php on lines 1194..1208
application/modules/xbanners/models/Base/Banners.php on lines 1247..1261

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 104.

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

Further Reading

There are no issues that match your filters.

Category
Status