Code Duplication    Length = 16-16 lines in 2 locations

src/voku/helper/SimpleHtmlDom.php 1 location

@@ 330-345 (lines=16) @@
327
     *
328
     * @return SimpleHtmlDomInterface
329
     */
330
    public function setAttribute(string $name, $value = null, bool $strictEmptyValueCheck = false): SimpleHtmlDomInterface
331
    {
332
        if (
333
            ($strictEmptyValueCheck && $value === null)
334
            ||
335
            (!$strictEmptyValueCheck && empty($value))
336
        ) {
337
            /** @noinspection UnusedFunctionResultInspection */
338
            $this->removeAttribute($name);
339
        } elseif (\method_exists($this->node, 'setAttribute')) {
340
            /** @noinspection UnusedFunctionResultInspection */
341
            $this->node->setAttribute($name, HtmlDomParser::replaceToPreserveHtmlEntities((string) $value));
342
        }
343
344
        return $this;
345
    }
346
347
    /**
348
     * Get dom node's plain text.

src/voku/helper/SimpleXmlDom.php 1 location

@@ 287-302 (lines=16) @@
284
     *
285
     * @return SimpleXmlDomInterface
286
     */
287
    public function setAttribute(string $name, $value = null, bool $strictEmptyValueCheck = false): SimpleXmlDomInterface
288
    {
289
        if (
290
            ($strictEmptyValueCheck && $value === null)
291
            ||
292
            (!$strictEmptyValueCheck && empty($value))
293
        ) {
294
            /** @noinspection UnusedFunctionResultInspection */
295
            $this->removeAttribute($name);
296
        } elseif (\method_exists($this->node, 'setAttribute')) {
297
            /** @noinspection UnusedFunctionResultInspection */
298
            $this->node->setAttribute($name, HtmlDomParser::replaceToPreserveHtmlEntities((string) $value));
299
        }
300
301
        return $this;
302
    }
303
304
    /**
305
     * Get dom node's plain text.