Code Duplication    Length = 11-13 lines in 2 locations

src/services/Element.php 1 location

@@ 307-317 (lines=11) @@
304
     * @param int|null $siteId
305
     * @return bool
306
     */
307
    protected function isCachedById(int $id, int $siteId = null)
308
    {
309
        // Resolve siteId
310
        $siteId = SiteHelper::resolveSiteId($siteId);
311
312
        if (!isset($this->_cacheById[$siteId])) {
313
            $this->_cacheById[$siteId] = [];
314
        }
315
316
        return array_key_exists($id, $this->_cacheById[$siteId]);
317
    }
318
319
    /**
320
     * @param ElementInterface $element

src/services/ElementByString.php 1 location

@@ 173-185 (lines=13) @@
170
     * @param int|null $siteId
171
     * @return bool
172
     */
173
    protected function isCachedByString($string, int $siteId = null)
174
    {
175
176
        // Resolve siteId
177
        $siteId = SiteHelper::resolveSiteId($siteId);
178
179
        if (!isset($this->_cacheByString[$siteId])) {
180
            $this->_cacheByString[$siteId] = [];
181
        }
182
183
        return array_key_exists($string, $this->_cacheByString);
184
185
    }
186
187
    /**
188
     * @param ElementInterface $element