Completed
Push — master ( 6d48a0...fb36d6 )
by Jeroen De
14s
created

MailTemplateFilenameTraversable::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\Infrastructure;
6
7
/**
8
 * @licence GNU GPL v2+
9
 * @author Jeroen De Dauw < [email protected] >
10
 */
11
class MailTemplateFilenameTraversable implements \IteratorAggregate {
12
13
	private $mailTemplatePaths;
14
15
	public function __construct( array $mailTemplatePaths ) {
16
		$this->mailTemplatePaths = $mailTemplatePaths;
17
	}
18
19
	public function getIterator(): \Iterator {
20
		foreach ( $this->mailTemplatePaths as $path ) {
21
			foreach ( glob( $path . '/Mail_*' ) as $fileName ) {
22
				yield basename( $fileName );
23
			}
24
		}
25
	}
26
27
}