Code Duplication    Length = 12-12 lines in 2 locations

src/POData/Writers/Json/JsonODataV1Writer.php 1 location

@@ 374-385 (lines=12) @@
371
            ->writeName(ODataConstants::JSON_RESULT_NAME) // "__results":
372
            ->startArrayScope(); // [
373
374
        foreach ($bag->propertyContents as $content) {
375
            if ($content instanceof ODataPropertyContent) {
376
                $this->_writer->startObjectScope();
377
                $this->writeProperties($content);
378
                $this->_writer->endScope();
379
            } else {
380
                // retrieving the collection datatype in order
381
                //to write in json specific format, with in chords or not
382
                preg_match('#\((.*?)\)#', $bag->type, $type);
383
                $this->_writer->writeValue($content, $type[1]);
384
            }
385
        }
386
387
        $this->_writer
388
            ->endScope()  // ]

src/POData/Writers/Json/JsonLightODataWriter.php 1 location

@@ 287-298 (lines=12) @@
284
    {
285
        $this->_writer->startArrayScope();
286
287
        foreach ($bag->propertyContents as $content) {
288
            if ($content instanceof ODataPropertyContent) {
289
                $this->_writer->startObjectScope();
290
                $this->writeProperties($content);
291
                $this->_writer->endScope();
292
            } else {
293
                // retrieving the collection datatype in order
294
                //to write in json specific format, with in chords or not
295
                preg_match('#\((.*?)\)#', $bag->type, $type);
296
                $this->_writer->writeValue($content, $type[1]);
297
            }
298
        }
299
300
        $this->_writer->endScope();
301
        return $this;