lovata/oc-toolbox-plugin

View on GitHub

Showing 239 of 248 total issues

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

protected function setController()
{
if ($this->checkAdditionList(self::CODE_CONTROLLER)) {
return;
}
Severity: Major
Found in classes/console/CommonCreateFile.php and 1 other location - About 2 hrs to fix
classes/console/CommonCreateFile.php on lines 228..242

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

protected function setModel()
{
if ($this->checkAdditionList(self::CODE_MODEL)) {
return;
}
Severity: Major
Found in classes/console/CommonCreateFile.php and 1 other location - About 2 hrs to fix
classes/console/CommonCreateFile.php on lines 247..261

CommonProperty has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class CommonProperty extends ImportModel
{
const NAME = 'property';
 
use Validation;
Severity: Minor
Found in models/CommonProperty.php - About 2 hrs to fix

    CommonCreateFile has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CommonCreateFile extends Command
    {
    use LogoTrait;
     
    const PREFIX_LOWER = 'lower_';
    Severity: Minor
    Found in classes/console/CommonCreateFile.php - About 2 hrs to fix

      Function importPreviewImage has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      protected function importPreviewImage()
      {
      if (!$this->bNeedUpdatePreviewImage) {
      return;
      }
      Severity: Minor
      Found in classes/helper/AbstractImportModel.php - About 2 hrs to fix

      Function setLangProperties has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      private function setLangProperties()
      {
      if (empty($this->obElement) || !$this->obElement->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')) {
      return;
      }
      Severity: Minor
      Found in classes/item/ElementItem.php - About 2 hrs to fix

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

      <?php namespace Lovata\Toolbox\Classes\Console;
       
      use Lovata\Toolbox\Classes\Parser\Create\ExtendModelColumnsHandlerCreateFile;
       
      /**
      Severity: Major
      Found in classes/console/CreateExtendModelColumnsHandler.php and 1 other location - About 2 hrs to fix
      classes/console/CreateExtendModelFieldsHandler.php on lines 1..30

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

      <?php namespace Lovata\Toolbox\Classes\Console;
       
      use Lovata\Toolbox\Classes\Parser\Create\ExtendModelFieldsHandlerCreateFile;
       
      /**
      Severity: Major
      Found in classes/console/CreateExtendModelFieldsHandler.php and 1 other location - About 2 hrs to fix
      classes/console/CreateExtendModelColumnsHandler.php on lines 1..30

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

      public function parseByWrapper($arNameList, $sContent)
      {
      if (empty($arNameList) || !is_array($arNameList) || empty($sContent)) {
      return '';
      }
      Severity: Major
      Found in traits/parse/ParseByPatternTrait.php and 1 other location - About 2 hrs to fix
      traits/parse/ParseByPatternTrait.php on lines 36..48

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

      public function parseByNameWrapper($arNameList, $sContent)
      {
      if (empty($arNameList) || !is_array($arNameList) || empty($sContent)) {
      return '';
      }
      Severity: Major
      Found in traits/parse/ParseByPatternTrait.php and 1 other location - About 2 hrs to fix
      traits/parse/ParseByPatternTrait.php on lines 56..68

      Function getWidgetData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      public function getWidgetData()
      {
      $arResult = [];
       
      switch ($this->type) {
      Severity: Minor
      Found in models/CommonProperty.php - About 2 hrs to fix

      Method getWidgetData has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      public function getWidgetData()
      {
      $arResult = [];
       
      switch ($this->type) {
      Severity: Major
      Found in models/CommonProperty.php - About 2 hrs to fix

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

        protected function checkAdditionList($sCode)
        {
        $arAdditionList = array_get($this->arData, 'addition');
         
        if (!empty($sCode) && !empty($arAdditionList) && is_array($arAdditionList) && in_array($sCode, $arAdditionList)) {
        Severity: Major
        Found in classes/console/CommonCreateFile.php and 1 other location - About 2 hrs to fix
        classes/console/CommonCreateFile.php on lines 423..432

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

        protected function checkEnableList($sCode)
        {
        $arEnableList = array_get($this->arData, 'enable');
         
        if (!empty($sCode) && !empty($arEnableList) && is_array($arEnableList) && in_array($sCode, $arEnableList)) {
        Severity: Major
        Found in classes/console/CommonCreateFile.php and 1 other location - About 2 hrs to fix
        classes/console/CommonCreateFile.php on lines 439..448

        Method importImageList has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        protected function importImageList()
        {
        if (!$this->bNeedUpdateImageList) {
        return;
        }
        Severity: Minor
        Found in classes/helper/AbstractImportModel.php - About 1 hr to fix

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

          protected function initImageList()
          {
          if (!array_key_exists('images', $this->arImportData)) {
          $this->bNeedUpdateImageList = false;
          return;
          Severity: Minor
          Found in classes/helper/AbstractImportModelFromXML.php - About 1 hr to fix

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

          protected function save()
          {
          if (!$this->bSave || empty($this->arYAML) || !isset($this->sFilePath) || empty($this->sFilePath)) {
          return;
          }
          Severity: Major
          Found in classes/parser/update/PluginVersionYAMLUpdateFile.php and 1 other location - About 1 hr to fix
          classes/parser/update/PluginYAMLUpdateFile.php on lines 165..173

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

          protected function save()
          {
          if (!$this->bSave || empty($this->arYAML) || !isset($this->sFilePath) || empty($this->sFilePath)) {
          return;
          }
          Severity: Major
          Found in classes/parser/update/PluginYAMLUpdateFile.php and 1 other location - About 1 hr to fix
          classes/parser/update/PluginVersionYAMLUpdateFile.php on lines 149..157

          Method importPreviewImage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          protected function importPreviewImage()
          {
          if (!$this->bNeedUpdatePreviewImage) {
          return;
          }
          Severity: Minor
          Found in classes/helper/AbstractImportModel.php - About 1 hr to fix

            Method callCommandList has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            protected function callCommandList()
            {
            $sMessage = Lang::get('lovata.toolbox::lang.message.create', ['name' => self::CODE_MODEL]);
             
            if ($this->confirm($sMessage, true)) {
            Severity: Minor
            Found in classes/console/CreateAll.php - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language