Skip to content

Commit 0e91b4b

Browse files
committed
Simplify remove() implementation
1 parent c97dd58 commit 0e91b4b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/main/php/io/streams/compress/Algorithms.class.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@ public function named(string $lookup): Algorithm {
5454
* @param string|io.streams.compress.Algorithm $target
5555
*/
5656
public function remove($target): bool {
57-
if ($target instanceof Algorithm) {
58-
$algorithm= $this->set[$target->name()] ?? null;
59-
} else {
60-
$algorithm= $this->set[$target] ?? (($name= $this->lookup[$target] ?? null) ? $this->set[$name] : null);
61-
}
62-
57+
$algorithm= $target instanceof Algorithm ? $this->set[$target->name()] ?? null : $this->find($target);
6358
if (null === $algorithm) return false;
6459

6560
unset($this->lookup[$algorithm->token()], $this->lookup[$algorithm->extension()]);

0 commit comments

Comments
 (0)