Code Duplication    Length = 19-20 lines in 3 locations

src/Query/Parser.php 3 locations

@@ 85-104 (lines=20) @@
82
        return new ValueObject($fields);
83
    }
84
85
    private function parseList()
86
    {
87
        $this->expect(Token::T_BRACKET_LEFT);
88
        $items = array();
89
90
        while (true) {
91
            if ($this->scanner->eof()) {
92
                throw $this->getParseError('Unclosed bracket of list');
93
            }
94
95
            if ($this->accept(Token::T_BRACKET_RIGHT)) {
96
                break;
97
            }
98
99
            $items[] = $this->parseValue();
100
            $this->accept(Token::T_COMMA);
101
        }
102
103
        return new ValueList($items);
104
    }
105
106
    private function parseVariable()
107
    {
@@ 261-279 (lines=19) @@
258
        throw $this->getParseError($message . " but instead found \"{$token->getName()}\" with value \"{$token->value}\"");
259
    }
260
261
    private function parseSelectionSet()
262
    {
263
        $this->expect(Token::T_BRACE_LEFT);
264
265
        $selections = array();
266
        while (true) {
267
            if ($this->scanner->eof()) {
268
                throw $this->getParseError('Unclosed brace of selection set');
269
            }
270
271
            if ($this->accept(Token::T_BRACE_RIGHT)) {
272
                break;
273
            }
274
275
            $selections[] = $this->parseSelection();
276
        }
277
278
        return new SelectionSet($selections);
279
    }
280
281
    private function parseTypeCondition()
282
    {
@@ 294-313 (lines=20) @@
291
        return new TypeCondition($type);
292
    }
293
294
    private function parseListType()
295
    {
296
        $this->expect(Token::T_BRACKET_LEFT);
297
298
        $types = array();
299
        while (true) {
300
            if ($this->scanner->eof()) {
301
                throw $this->getParseError('Unclosed bracket of list type');
302
            }
303
304
            if ($this->accept(Token::T_BRACE_RIGHT)) {
305
                break;
306
            }
307
308
            $types[] = $this->parseType();
309
            $this->accept(Token::T_COMMA);
310
        }
311
312
        return new TypeList($types);
313
    }
314
315
    private function parseNamedType()
316
    {