Skip to content

Commit 854cf5d

Browse files
committed
add multiples processors in same function
1 parent a9fe0cb commit 854cf5d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/Rotation.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@ public function getProcessors()
1414
return $this->processors;
1515
}
1616

17-
public function addProcessor(AbstractProcessor $processor)
17+
/**
18+
* Add processors to rotate
19+
*
20+
* @param AbstractProcessor ...$processors
21+
* @return self
22+
*/
23+
public function addProcessor(AbstractProcessor ...$processors): self
1824
{
19-
$this->processors[] = $processor;
25+
$this->processors = array_merge($this->processors, $processors);
26+
27+
return $this;
2028
}
2129

2230
/**

tests/Processors/RotativeProcessorTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ public function test_rotation_processor_with_gz_processor()
4040

4141
$rotation = new Rotation();
4242

43-
$rotation->addProcessor(new GzProcessor());
44-
4543
$rotation->addProcessor(
44+
new GzProcessor(),
4645
(new RotativeProcessor())
4746
->setMaxFiles($maxFiles)
4847
->setFileOriginal(self::DIR_WORK.'file.log')

0 commit comments

Comments
 (0)