Add space between foreach and ‘(‘

[MAILPOET-1791]
This commit is contained in:
Ján Mikláš
2019-02-13 12:52:39 +01:00
committed by M. Shull
parent fba2914392
commit ebbdec5ebd
134 changed files with 351 additions and 351 deletions

View File

@@ -46,7 +46,7 @@ class API {
$this->access_control = $access_control;
$this->settings = $settings;
$this->wp = $wp;
foreach($this->_available_api_versions as $available_api_version) {
foreach ($this->_available_api_versions as $available_api_version) {
$this->addEndpointNamespace(
sprintf('%s\%s', __NAMESPACE__, $available_api_version),
$available_api_version
@@ -116,7 +116,7 @@ class API {
$error_response = $this->createErrorResponse(Error::BAD_REQUEST, $error_message, Response::STATUS_BAD_REQUEST);
return $error_response;
} else if(!empty($this->_endpoint_namespaces[$this->_request_api_version])) {
foreach($this->_endpoint_namespaces[$this->_request_api_version] as $namespace) {
foreach ($this->_endpoint_namespaces[$this->_request_api_version] as $namespace) {
$endpoint_class = sprintf(
'%s\%s',
$namespace,

View File

@@ -81,11 +81,11 @@ class AutomatedLatestContent extends APIEndpoint {
$used_posts = array();
$rendered_posts = array();
foreach($data['blocks'] as $block) {
foreach ($data['blocks'] as $block) {
$posts = $this->ALC->getPosts($block, $used_posts);
$rendered_posts[] = $this->ALC->transformPosts($block, $posts);
foreach($posts as $post) {
foreach ($posts as $post) {
$used_posts[] = $post->ID;
}
}

View File

@@ -49,7 +49,7 @@ class Forms extends APIEndpoint {
$listing_data = $this->listing_handler->get('\MailPoet\Models\Form', $data);
$data = array();
foreach($listing_data['items'] as $form) {
foreach ($listing_data['items'] as $form) {
$form = $form->asArray();
$form['signups'] = StatisticsForms::getTotalSignups($form['id']);
@@ -161,7 +161,7 @@ class Forms extends APIEndpoint {
$is_widget = false;
$widgets = get_option('widget_mailpoet_form');
if(!empty($widgets)) {
foreach($widgets as $widget) {
foreach ($widgets as $widget) {
if(isset($widget['form']) && (int)$widget['form'] === $form_id) {
$is_widget = true;
break;
@@ -173,7 +173,7 @@ class Forms extends APIEndpoint {
// or if it's selected by the admin
$has_segment_selection = false;
$list_selection = [];
foreach($body as $i => $block) {
foreach ($body as $i => $block) {
if($block['type'] === 'segment') {
$has_segment_selection = true;
if(!empty($block['params']['values'])) {

View File

@@ -108,7 +108,7 @@ class Newsletters extends APIEndpoint {
if(!empty($segments)) {
NewsletterSegment::where('newsletter_id', $newsletter->id)
->deleteMany();
foreach($segments as $segment) {
foreach ($segments as $segment) {
if(!is_array($segment)) continue;
$relation = NewsletterSegment::create();
$relation->segment_id = (int)$segment['id'];
@@ -127,7 +127,7 @@ class Newsletters extends APIEndpoint {
$newsletter->type
)->findMany();
// update newsletter options
foreach($option_fields as $option_field) {
foreach ($option_fields as $option_field) {
if(isset($options[$option_field->name])) {
$newsletter_option = NewsletterOption::createOrUpdate(
array(
@@ -406,7 +406,7 @@ class Newsletters extends APIEndpoint {
$listing_data = $this->listing_handler->get('\MailPoet\Models\Newsletter', $data);
$data = array();
foreach($listing_data['items'] as $newsletter) {
foreach ($listing_data['items'] as $newsletter) {
$queue = false;
if($newsletter->type === Newsletter::TYPE_STANDARD) {
@@ -504,7 +504,7 @@ class Newsletters extends APIEndpoint {
'newsletter_type', $newsletter->type
)->findArray();
foreach($option_fields as $option_field) {
foreach ($option_fields as $option_field) {
if(isset($options[$option_field['name']])) {
$relation = NewsletterOption::create();
$relation->newsletter_id = $newsletter->id;

View File

@@ -46,7 +46,7 @@ class Segments extends APIEndpoint {
$listing_data = $this->listing_handler->get('\MailPoet\Models\Segment', $data);
$data = array();
foreach($listing_data['items'] as $segment) {
foreach ($listing_data['items'] as $segment) {
$segment->subscribers_url = admin_url(
'admin.php?page=mailpoet-subscribers#/filter[segment='.$segment->id.']'
);

View File

@@ -36,7 +36,7 @@ class Settings extends APIEndpoint {
__('You have not specified any settings to be saved.', 'mailpoet')
));
} else {
foreach($settings as $name => $value) {
foreach ($settings as $name => $value) {
$this->settings->set($name, $value);
}
$bridge = new Bridge();

View File

@@ -89,7 +89,7 @@ class Subscribers extends APIEndpoint {
}
$data = array();
foreach($listing_data['items'] as $subscriber) {
foreach ($listing_data['items'] as $subscriber) {
$data[] = $subscriber
->withSubscriptions()
->asArray();

View File

@@ -52,7 +52,7 @@ class API {
);
$custom_fields = CustomField::selectMany(array('id', 'name'))->findMany();
foreach($custom_fields as $custom_field) {
foreach ($custom_fields as $custom_field) {
$data[] = array(
'id' => 'cf_' . $custom_field->id,
'name' => $custom_field->name
@@ -88,7 +88,7 @@ class API {
// throw exception when trying to subscribe to WP Users or WooCommerce Customers segments
$found_segments_ids = array();
foreach($found_segments as $found_segment) {
foreach ($found_segments as $found_segment) {
if($found_segment->type === Segment::TYPE_WP_USERS) {
throw new \Exception(__(sprintf("Can't subscribe to a WordPress Users list with ID %d.", $found_segment->id), 'mailpoet'));
}
@@ -142,7 +142,7 @@ class API {
// throw exception when trying to subscribe to WP Users or WooCommerce Customers segments
$found_segments_ids = array();
foreach($found_segments as $segment) {
foreach ($found_segments as $segment) {
if($segment->type === Segment::TYPE_WP_USERS) {
throw new \Exception(__(sprintf("Can't unsubscribe from a WordPress Users list with ID %d.", $segment->id), 'mailpoet'));
}
@@ -287,7 +287,7 @@ class API {
protected function _scheduleWelcomeNotification(Subscriber $subscriber, array $segments) {
$result = Scheduler::scheduleSubscriberWelcomeNotification($subscriber->id, $segments);
if(is_array($result)) {
foreach($result as $queue) {
foreach ($result as $queue) {
if($queue instanceof Sending && $queue->getErrors()) {
throw new \Exception(
__(sprintf('Subscriber added, but welcome email failed to send: %s', strtolower(implode(', ', $queue->getErrors()))), 'mailpoet')