Refactor
Try a different way of naming and grouping classes.
This commit is contained in:
parent
52c1b33711
commit
6b6b362a49
15 changed files with 111 additions and 59 deletions
31
modules/opd_daily_emails/src/DailyEmails.php
Normal file
31
modules/opd_daily_emails/src/DailyEmails.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\opd_daily_emails;
|
||||
|
||||
use Drupal\node\NodeInterface;
|
||||
|
||||
final class DailyEmails implements \Countable {
|
||||
|
||||
/**
|
||||
* @param array<positive-int, NodeInterface> $emails
|
||||
*/
|
||||
private function __construct(
|
||||
private array $emails,
|
||||
) {
|
||||
}
|
||||
|
||||
public function count(): int {
|
||||
return count($this->emails);
|
||||
}
|
||||
|
||||
public function first(): NodeInterface {
|
||||
return array_values($this->emails)[0];
|
||||
}
|
||||
|
||||
public static function new(array $emails): self {
|
||||
return new self($emails);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue