Code Duplication    Length = 36-36 lines in 2 locations

application/tests/_ci_phpunit_test/patcher/Patcher/ConstantPatcher.php 1 location

@@ 29-64 (lines=36) @@
26
		$this->node_visitor = new NodeVisitor();
27
	}
28
29
	protected static function generateNewSource($source)
30
	{
31
		$tokens = token_get_all($source);
32
		$new_source = '';
33
		$i = -1;
34
35
		ksort(self::$replacement);
36
		reset(self::$replacement);
37
		$replacement = each(self::$replacement);
38
39
		foreach ($tokens as $token)
40
		{
41
			$i++;
42
43
			if (is_string($token))
44
			{
45
				$new_source .= $token;
46
			}
47
			elseif ($i == $replacement['key'])
48
			{
49
				$new_source .= $replacement['value'];
50
				$replacement = each(self::$replacement);
51
			}
52
			else
53
			{
54
				$new_source .= $token[1];
55
			}
56
		}
57
58
		if ($replacement !== false)
59
		{
60
			throw new LogicException('Replacement data still remain');
61
		}
62
63
		return $new_source;
64
	}
65
}
66

application/tests/_ci_phpunit_test/patcher/Patcher/FunctionPatcher.php 1 location

@@ 161-196 (lines=36) @@
158
		return false;
159
	}
160
161
	protected static function generateNewSource($source)
162
	{
163
		$tokens = token_get_all($source);
164
		$new_source = '';
165
		$i = -1;
166
167
		ksort(self::$replacement);
168
		reset(self::$replacement);
169
		$replacement = each(self::$replacement);
170
171
		foreach ($tokens as $token)
172
		{
173
			$i++;
174
175
			if (is_string($token))
176
			{
177
				$new_source .= $token;
178
			}
179
			elseif ($i == $replacement['key'])
180
			{
181
				$new_source .= $replacement['value'];
182
				$replacement = each(self::$replacement);
183
			}
184
			else
185
			{
186
				$new_source .= $token[1];
187
			}
188
		}
189
190
		if ($replacement !== false)
191
		{
192
			throw new LogicException('Replacement data still remain');
193
		}
194
195
		return $new_source;
196
	}
197
}
198