Move getting segments to the new class
[MAILPOET-4292]
This commit is contained in:
@@ -24,6 +24,9 @@ class API {
|
||||
/** @var CustomFields */
|
||||
private $customFields;
|
||||
|
||||
/** @var Segments */
|
||||
private $segments;
|
||||
|
||||
/** @var Subscribers */
|
||||
private $subscribers;
|
||||
|
||||
@@ -33,11 +36,13 @@ class API {
|
||||
public function __construct(
|
||||
RequiredCustomFieldValidator $requiredCustomFieldValidator,
|
||||
CustomFields $customFields,
|
||||
Segments $segments,
|
||||
Subscribers $subscribers,
|
||||
Changelog $changelog
|
||||
) {
|
||||
$this->requiredCustomFieldValidator = $requiredCustomFieldValidator;
|
||||
$this->customFields = $customFields;
|
||||
$this->segments = $segments;
|
||||
$this->subscribers = $subscribers;
|
||||
$this->changelog = $changelog;
|
||||
}
|
||||
@@ -116,9 +121,8 @@ class API {
|
||||
return $subscriber->withCustomFields()->withSubscriptions()->asArray();
|
||||
}
|
||||
|
||||
public function getLists() {
|
||||
return Segment::where('type', Segment::TYPE_DEFAULT)
|
||||
->findArray();
|
||||
public function getLists(): array {
|
||||
return $this->segments->getAll();
|
||||
}
|
||||
|
||||
public function addSubscriber(array $subscriber, $listIds = [], $options = []) {
|
||||
|
Reference in New Issue
Block a user