Skip to content

Commit a5171c8

Browse files
committed
Inline and remove Diff::getText()
It's getting a single line now and only two places use it. Signed-off-by: Jack Cherng <[email protected]>
1 parent be52d42 commit a5171c8

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

src/Diff.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function setOptions(array $options): self
148148
*/
149149
public function getA(int $start = 0, ?int $end = null): array
150150
{
151-
return $this->getText($this->a, $start, $end);
151+
return \array_slice($this->a, $start, ($end ?? $start + 1) - $start);
152152
}
153153

154154
/**
@@ -164,7 +164,7 @@ public function getA(int $start = 0, ?int $end = null): array
164164
*/
165165
public function getB(int $start = 0, ?int $end = null): array
166166
{
167-
return $this->getText($this->b, $start, $end);
167+
return \array_slice($this->b, $start, ($end ?? $start + 1) - $start);
168168
}
169169

170170
/**
@@ -220,18 +220,4 @@ public function render(AbstractRenderer $renderer): string
220220
? $renderer::getIdenticalResult()
221221
: $renderer->render();
222222
}
223-
224-
/**
225-
* The work horse of getA() and getB().
226-
*
227-
* @param string[] $lines the array of lines
228-
* @param int $start the starting number
229-
* @param null|int $end the ending number. If not supplied, only the item in $start will be sliced.
230-
*
231-
* @return string[] array of all of the lines between the specified range
232-
*/
233-
private function getText(array $lines, int $start = 0, ?int $end = null): array
234-
{
235-
return \array_slice($lines, $start, ($end ?? $start + 1) - $start);
236-
}
237223
}

0 commit comments

Comments
 (0)