Files
piratepoet/lib/Newsletter/Editor/PostListTransformer.php
Pavel Dohnal cdda3480ca Make all constructor signatures multiline
[MAILPOET-3732]
2021-09-16 14:19:40 +02:00

32 lines
647 B
PHP

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