Files
piratepoet/lib/Newsletter/Editor/PostListTransformer.php
Jan Jakeš 01a0fe96c4 Remove no longer necessary checks
[MAILPOET-1948]
2019-09-12 13:59:32 +02:00

30 lines
625 B
PHP

<?php
namespace MailPoet\Newsletter\Editor;
class PostListTransformer {
private $args;
private $transformer;
function __construct($args) {
$this->args = $args;
$this->transformer = new PostTransformer($args);
}
function transform($posts) {
$results = [];
$use_divider = filter_var($this->args['showDivider'], FILTER_VALIDATE_BOOLEAN);
foreach ($posts as $index => $post) {
if ($use_divider && $index > 0) {
$results[] = $this->transformer->getDivider();
}
$results = array_merge($results, $this->transformer->transform($post));
}
return $results;
}
}