Code Duplication    Length = 11-13 lines in 2 locations

src/services/Element.php 1 location

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

src/services/traits/ElementByString.php 1 location

@@ 160-172 (lines=13) @@
157
     * @param int|null $siteId
158
     * @return bool
159
     */
160
    protected function isCachedByString($string, int $siteId = null)
161
    {
162
163
        // Resolve siteId
164
        $siteId = SiteHelper::resolveSiteId($siteId);
165
166
        if (!isset($this->_cacheByString[$siteId])) {
167
            $this->_cacheByString[$siteId] = [];
168
        }
169
170
        return array_key_exists($string, $this->_cacheByString[$siteId]);
171
172
    }
173
174
    /**
175
     * @param ElementInterface $element