Convert variable names to camel case
[MAILPOET-1796]
This commit is contained in:
@ -23,24 +23,24 @@ class AddToNewslettersSegments {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add(array $initial_segments) {
|
||||
$dynamic_segments = $this->getListings();
|
||||
return array_merge($initial_segments, $dynamic_segments);
|
||||
public function add(array $initialSegments) {
|
||||
$dynamicSegments = $this->getListings();
|
||||
return array_merge($initialSegments, $dynamicSegments);
|
||||
}
|
||||
|
||||
private function getListings() {
|
||||
$dynamic_segments = $this->loader->load();
|
||||
return $this->buildResult($dynamic_segments);
|
||||
$dynamicSegments = $this->loader->load();
|
||||
return $this->buildResult($dynamicSegments);
|
||||
}
|
||||
|
||||
private function buildResult($dynamic_segments) {
|
||||
private function buildResult($dynamicSegments) {
|
||||
$result = [];
|
||||
foreach ($dynamic_segments as $dynamic_segment) {
|
||||
foreach ($dynamicSegments as $dynamicSegment) {
|
||||
$result[] = [
|
||||
'id' => $dynamic_segment->id,
|
||||
'name' => $dynamic_segment->name,
|
||||
'subscribers' => $this->subscribersCountLoader->getSubscribersCount($dynamic_segment),
|
||||
'deleted_at' => $dynamic_segment->deleted_at,
|
||||
'id' => $dynamicSegment->id,
|
||||
'name' => $dynamicSegment->name,
|
||||
'subscribers' => $this->subscribersCountLoader->getSubscribersCount($dynamicSegment),
|
||||
'deleted_at' => $dynamicSegment->deletedAt,
|
||||
];
|
||||
}
|
||||
return $result;
|
||||
|
@ -23,45 +23,45 @@ class AddToSubscribersFilters {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add(array $segment_filters) {
|
||||
$dynamic_segments = $this->getListings();
|
||||
return $this->sort(array_merge($segment_filters, $dynamic_segments));
|
||||
public function add(array $segmentFilters) {
|
||||
$dynamicSegments = $this->getListings();
|
||||
return $this->sort(array_merge($segmentFilters, $dynamicSegments));
|
||||
}
|
||||
|
||||
private function getListings() {
|
||||
$dynamic_segments = $this->loader->load();
|
||||
return $this->buildResult($dynamic_segments);
|
||||
$dynamicSegments = $this->loader->load();
|
||||
return $this->buildResult($dynamicSegments);
|
||||
}
|
||||
|
||||
private function buildResult($dynamic_segments) {
|
||||
private function buildResult($dynamicSegments) {
|
||||
$result = [];
|
||||
foreach ($dynamic_segments as $dynamic_segment) {
|
||||
foreach ($dynamicSegments as $dynamicSegment) {
|
||||
$result[] = [
|
||||
'value' => $dynamic_segment->id,
|
||||
'value' => $dynamicSegment->id,
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
$dynamic_segment->name,
|
||||
number_format($this->subscribersCountLoader->getSubscribersCount($dynamic_segment))
|
||||
$dynamicSegment->name,
|
||||
number_format($this->subscribersCountLoader->getSubscribersCount($dynamicSegment))
|
||||
),
|
||||
];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function sort($segment_filters) {
|
||||
$special_segment_filters = [];
|
||||
private function sort($segmentFilters) {
|
||||
$specialSegmentFilters = [];
|
||||
$segments = [];
|
||||
foreach ($segment_filters as $segment_filter) {
|
||||
if (is_numeric($segment_filter['value'])) {
|
||||
$segments[] = $segment_filter;
|
||||
foreach ($segmentFilters as $segmentFilter) {
|
||||
if (is_numeric($segmentFilter['value'])) {
|
||||
$segments[] = $segmentFilter;
|
||||
} else {
|
||||
$special_segment_filters[] = $segment_filter;
|
||||
$specialSegmentFilters[] = $segmentFilter;
|
||||
}
|
||||
}
|
||||
usort($segments, function ($a, $b) {
|
||||
return strcasecmp($a["label"], $b["label"]);
|
||||
});
|
||||
return array_merge($special_segment_filters, $segments);
|
||||
return array_merge($specialSegmentFilters, $segments);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ class SendingNewslettersSubscribersFinder {
|
||||
/** @var SubscribersIds */
|
||||
private $subscribers_ids_loader;
|
||||
|
||||
public function __construct(SingleSegmentLoader $single_segment_loader, SubscribersIds $subscribers_ids_loader) {
|
||||
$this->single_segment_loader = $single_segment_loader;
|
||||
$this->subscribers_ids_loader = $subscribers_ids_loader;
|
||||
public function __construct(SingleSegmentLoader $singleSegmentLoader, SubscribersIds $subscribersIdsLoader) {
|
||||
$this->singleSegmentLoader = $singleSegmentLoader;
|
||||
$this->subscribersIdsLoader = $subscribersIdsLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -27,10 +27,10 @@ class SendingNewslettersSubscribersFinder {
|
||||
*
|
||||
* @return Subscriber[]
|
||||
*/
|
||||
public function findSubscribersInSegment(Segment $segment, array $subscribers_to_process_ids) {
|
||||
public function findSubscribersInSegment(Segment $segment, array $subscribersToProcessIds) {
|
||||
if ($segment->type !== DynamicSegment::TYPE_DYNAMIC) return [];
|
||||
$dynamic_segment = $this->single_segment_loader->load($segment->id);
|
||||
return $this->subscribers_ids_loader->load($dynamic_segment, $subscribers_to_process_ids);
|
||||
$dynamicSegment = $this->singleSegmentLoader->load($segment->id);
|
||||
return $this->subscribersIdsLoader->load($dynamicSegment, $subscribersToProcessIds);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,8 +40,8 @@ class SendingNewslettersSubscribersFinder {
|
||||
*/
|
||||
public function getSubscriberIdsInSegment(Segment $segment) {
|
||||
if ($segment->type !== DynamicSegment::TYPE_DYNAMIC) return [];
|
||||
$dynamic_segment = $this->single_segment_loader->load($segment->id);
|
||||
$result = $this->subscribers_ids_loader->load($dynamic_segment);
|
||||
$dynamicSegment = $this->singleSegmentLoader->load($segment->id);
|
||||
$result = $this->subscribersIdsLoader->load($dynamicSegment);
|
||||
return $this->createResultArray($result);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class SubscribersListingsHandlerFactory {
|
||||
public function get(Segment $segment, $data) {
|
||||
if ($segment->type === DynamicSegment::TYPE_DYNAMIC) {
|
||||
$listing = new Handler();
|
||||
return $listing_data = $listing->get('\MailPoet\Models\SubscribersInDynamicSegment', $data);
|
||||
return $listingData = $listing->get('\MailPoet\Models\SubscribersInDynamicSegment', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user