Code Duplication    Length = 11-12 lines in 2 locations

src/Observers/AttributeObserverTrait.php 1 location

@@ 118-128 (lines=11) @@
115
        $this->cleanUpEmptyColumnKeys = array();
116
117
        // query whether or not column names that has to be cleaned up have been configured
118
        if ($this->getSubject()->getConfiguration()->hasParam(ConfigurationKeys::CLEAN_UP_EMPTY_COLUMNS)) {
119
            // if yes, load the column names
120
            $cleanUpEmptyColumns = $this->getSubject()->getCleanUpColumns();
121
122
            // translate the column names into column keys
123
            foreach ($cleanUpEmptyColumns as $cleanUpEmptyColumn) {
124
                if ($this->hasHeader($cleanUpEmptyColumn)) {
125
                    $this->cleanUpEmptyColumnKeys[] = $this->getHeader($cleanUpEmptyColumn);
126
                }
127
            }
128
        }
129
130
        // remove all the empty values from the row, expected the columns has to be cleaned-up
131
        foreach ($this->row as $key => $value) {

src/Observers/CleanUpEmptyColumnsTrait.php 1 location

@@ 58-69 (lines=12) @@
55
            $this->cleanUpEmptyColumnKeys = array();
56
57
            // query whether or not column names that has to be cleaned up have been configured
58
            if ($this->getSubject()->getConfiguration()->hasParam(ConfigurationKeys::CLEAN_UP_EMPTY_COLUMNS)
59
                && ($this->getSubject() instanceof CleanUpColumnsSubjectInterface)) {
60
                // if yes, load the column names
61
                $cleanUpEmptyColumns = $this->getSubject()->getCleanUpColumns();
62
63
                // translate the column names into column keys
64
                foreach ($cleanUpEmptyColumns as $cleanUpEmptyColumn) {
65
                    if ($this->hasHeader($cleanUpEmptyColumn)) {
66
                        $this->cleanUpEmptyColumnKeys[] = $this->getHeader($cleanUpEmptyColumn);
67
                    }
68
                }
69
            }
70
        }
71
72
        // remove all the empty values from the row, expected the columns has to be cleaned-up