Code Duplication    Length = 16-16 lines in 2 locations

src/voku/helper/SimpleHtmlDom.php 1 location

@@ 319-334 (lines=16) @@
316
     *
317
     * @return SimpleHtmlDomInterface
318
     */
319
    public function setAttribute(string $name, $value = null, bool $strict = false): SimpleHtmlDomInterface
320
    {
321
        if (
322
            ($strict && $value === null)
323
            ||
324
            (!$strict && empty($value))
325
        ) {
326
            /** @noinspection UnusedFunctionResultInspection */
327
            $this->removeAttribute($name);
328
        } elseif (\method_exists($this->node, 'setAttribute')) {
329
            /** @noinspection UnusedFunctionResultInspection */
330
            $this->node->setAttribute($name, $value);
331
        }
332
333
        return $this;
334
    }
335
336
    /**
337
     * Get dom node's plain text.

src/voku/helper/SimpleXmlDom.php 1 location

@@ 281-296 (lines=16) @@
278
     *
279
     * @return SimpleXmlDomInterface
280
     */
281
    public function setAttribute(string $name, $value = null, bool $strict = false): SimpleXmlDomInterface
282
    {
283
        if (
284
            ($strict && $value === null)
285
            ||
286
            (!$strict && empty($value))
287
        ) {
288
            /** @noinspection UnusedFunctionResultInspection */
289
            $this->removeAttribute($name);
290
        } elseif (\method_exists($this->node, 'setAttribute')) {
291
            /** @noinspection UnusedFunctionResultInspection */
292
            $this->node->setAttribute($name, $value);
293
        }
294
295
        return $this;
296
    }
297
298
    /**
299
     * Get dom node's plain text.