Code Duplication    Length = 12-17 lines in 2 locations

src/TreeHouse/IoBundle/Scrape/Parser/ParserBuilder.php 1 location

@@ 85-96 (lines=12) @@
82
     *
83
     * @throws \OutOfBoundsException
84
     */
85
    public function addModifierBetween(ModifierInterface $modifier, $startIndex, $endIndex, $continue = null)
86
    {
87
        for ($position = $startIndex; $position <= $endIndex; ++$position) {
88
            if (!$this->hasModifierAt($position)) {
89
                $this->addModifier($modifier, $position, $continue);
90
91
                return;
92
            }
93
        }
94
95
        throw new \OutOfBoundsException(sprintf('No position left between %d and %d', $startIndex, $endIndex));
96
    }
97
98
    /**
99
     * Shortcut for adding a field-value transformer.

src/TreeHouse/IoBundle/Import/Feed/Type/AbstractFeedType.php 1 location

@@ 155-171 (lines=17) @@
152
     *
153
     * @throws \OutOfBoundsException
154
     */
155
    protected function addModifierBetween(
156
        FeedBuilderInterface $builder,
157
        ModifierInterface $modifier,
158
        $startIndex,
159
        $endIndex,
160
        $continue = null
161
    ) {
162
        for ($position = $startIndex; $position <= $endIndex; ++$position) {
163
            if (!$builder->hasModifierAt($position)) {
164
                $builder->addModifier($modifier, $position, $continue);
165
166
                return;
167
            }
168
        }
169
170
        throw new \OutOfBoundsException(sprintf('No position left between %d and %d', $startIndex, $endIndex));
171
    }
172
173
    /**
174
     * Adds the given transformer between the start and end index, if there is a vacant position.