Code Duplication    Length = 24-24 lines in 2 locations

src/services/ModelAccessor.php 1 location

@@ 126-149 (lines=24) @@
123
     * @param string $toScenario
124
     * @return Model[]
125
     */
126
    public function findAll(string $toScenario = null)
127
    {
128
129
        // Check addToCache
130
        if (is_null($this->_cacheAll)) {
131
132
            $this->_cacheAll = [];
133
134
            // Find record in db
135
            if ($records = $this->findAllRecords()) {
136
137
                foreach ($records as $record) {
138
139
                    $this->_cacheAll[] = $this->findByRecord($record, $toScenario);
140
141
                }
142
143
            }
144
145
        }
146
147
        return $this->_cacheAll;
148
149
    }
150
151
    /**
152
     * @param string $toScenario

src/services/ObjectAccessor.php 1 location

@@ 127-150 (lines=24) @@
124
     * @param string $toScenario
125
     * @return Object[]
126
     */
127
    public function findAll(string $toScenario = null)
128
    {
129
130
        // Check addToCache
131
        if (is_null($this->_cacheAll)) {
132
133
            $this->_cacheAll = [];
134
135
            // Find record in db
136
            if ($records = $this->findAllRecords()) {
137
138
                foreach ($records as $record) {
139
140
                    $this->_cacheAll[] = $this->findByRecord($record, $toScenario);
141
142
                }
143
144
            }
145
146
        }
147
148
        return $this->_cacheAll;
149
150
    }
151
152
    /**
153
     * @param string $toScenario