Code Duplication    Length = 19-19 lines in 2 locations

src/Generator.php 2 locations

@@ 331-349 (lines=19) @@
328
329
        // Now lets register and append the filters if they are mapped to a 1
330
        // Lets have a look at the precondition filter first
331
        if (isset($levelArray[0]) && $levelArray[0] == 1) {
332
            // Do we even got any preconditions?
333
            $filterNeeded = false;
334
            $iterator = $structureDefinition->getFunctionDefinitions()->getIterator();
335
            foreach ($iterator as $functionDefinition) {
336
                if ($functionDefinition->getAllPreconditions()->count() !== 0) {
337
                    $filterNeeded = true;
338
                    break;
339
                }
340
            }
341
342
            if ($filterNeeded) {
343
                $filters['PreconditionFilter'] = $this->appendFilter(
344
                    $res,
345
                    'AppserverIo\Doppelgaenger\StreamFilters\PreconditionFilter',
346
                    $structureDefinition->getFunctionDefinitions()
347
                );
348
            }
349
        }
350
351
        // What about the post-condition filter?
352
        if (isset($levelArray[1]) && $levelArray[1] == 1) {
@@ 352-370 (lines=19) @@
349
        }
350
351
        // What about the post-condition filter?
352
        if (isset($levelArray[1]) && $levelArray[1] == 1) {
353
            // Do we even got any post-conditions?
354
            $filterNeeded = false;
355
            $iterator = $structureDefinition->getFunctionDefinitions()->getIterator();
356
            foreach ($iterator as $functionDefinition) {
357
                if ($functionDefinition->getAllPostconditions()->count() !== 0) {
358
                    $filterNeeded = true;
359
                    break;
360
                }
361
            }
362
363
            if ($filterNeeded) {
364
                $filters['PostconditionFilter'] = $this->appendFilter(
365
                    $res,
366
                    'AppserverIo\Doppelgaenger\StreamFilters\PostconditionFilter',
367
                    $structureDefinition->getFunctionDefinitions()
368
                );
369
            }
370
        }
371
372
        // What about the invariant filter?
373
        if (isset($levelArray[2]) && $levelArray[2] == 1) {