Code Duplication    Length = 16-16 lines in 2 locations

src/voku/helper/SimpleHtmlDom.php 1 location

@@ 307-322 (lines=16) @@
304
     *
305
     * @return SimpleHtmlDomInterface
306
     */
307
    public function setAttribute(string $name, $value = null, bool $strict = false): SimpleHtmlDomInterface
308
    {
309
        if (
310
            ($strict && $value === null)
311
            ||
312
            (!$strict && empty($value))
313
        ) {
314
            /** @noinspection UnusedFunctionResultInspection */
315
            $this->removeAttribute($name);
316
        } elseif (\method_exists($this->node, 'setAttribute')) {
317
            /** @noinspection UnusedFunctionResultInspection */
318
            $this->node->setAttribute($name, $value);
319
        }
320
321
        return $this;
322
    }
323
324
    /**
325
     * Get dom node's plain text.

src/voku/helper/SimpleXmlDom.php 1 location

@@ 269-284 (lines=16) @@
266
     *
267
     * @return SimpleXmlDomInterface
268
     */
269
    public function setAttribute(string $name, $value = null, bool $strict = false): SimpleXmlDomInterface
270
    {
271
        if (
272
            ($strict && $value === null)
273
            ||
274
            (!$strict && empty($value))
275
        ) {
276
            /** @noinspection UnusedFunctionResultInspection */
277
            $this->removeAttribute($name);
278
        } elseif (\method_exists($this->node, 'setAttribute')) {
279
            /** @noinspection UnusedFunctionResultInspection */
280
            $this->node->setAttribute($name, $value);
281
        }
282
283
        return $this;
284
    }
285
286
    /**
287
     * Get dom node's plain text.