Code Duplication    Length = 36-36 lines in 2 locations

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

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

@@ 52-87 (lines=36) @@
49
		return false;
50
	}
51
52
	protected static function generateNewSource($source)
53
	{
54
		$tokens = token_get_all($source);
55
		$new_source = '';
56
		$i = -1;
57
58
		ksort(self::$replacement);
59
		reset(self::$replacement);
60
		$replacement = each(self::$replacement);
61
62
		foreach ($tokens as $token)
63
		{
64
			$i++;
65
66
			if (is_string($token))
67
			{
68
				$new_source .= $token;
69
			}
70
			elseif ($i == $replacement['key'])
71
			{
72
				$new_source .= $replacement['value'];
73
				$replacement = each(self::$replacement);
74
			}
75
			else
76
			{
77
				$new_source .= $token[1];
78
			}
79
		}
80
81
		if ($replacement !== false)
82
		{
83
			throw new LogicException('Replacement data still remain');
84
		}
85
86
		return $new_source;
87
	}
88
}
89