Code Duplication    Length = 16-16 lines in 2 locations

src/voku/helper/SimpleHtmlDom.php 1 location

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

src/voku/helper/SimpleXmlDom.php 1 location

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