Code Duplication    Length = 4-4 lines in 2 locations

src/Internal/JsonElementWriter.php 1 location

@@ 305-308 (lines=4) @@
302
            return $this;
303
        }
304
305
        if (null !== $this->pendingName) {
306
            $this->stack[$this->last()]->add($this->pendingName, $value);
307
            $this->pendingName = null;
308
        }
309
310
        if ($this->topIsArray()) {
311
            $this->stack[$this->last()]->addJsonElement($value);

src/Internal/JsonEncodeWriter.php 1 location

@@ 287-290 (lines=4) @@
284
            return $this;
285
        }
286
287
        if (null !== $this->pendingName) {
288
            $this->stack[$this->last()]->{$this->pendingName} = &$value;
289
            $this->pendingName = null;
290
        }
291
292
        if ($this->topIsArray()) {
293
            $this->stack[$this->last()][] = &$value;