PHP 8.2.31
Preview: ContextFactory.php Size: 831 B
/home/nshryvcy/himaltourism.com/wp-content/plugins/mailpoet/lib/Automation/Integrations/MailPoet/ContextFactory.php

<?php declare(strict_types = 1);

namespace MailPoet\Automation\Integrations\MailPoet;

if (!defined('ABSPATH')) exit;


use MailPoet\Segments\SegmentsRepository;

class ContextFactory {
  /** @var SegmentsRepository */
  private $segmentsRepository;

  public function __construct(
    SegmentsRepository $segmentsRepository
  ) {
    $this->segmentsRepository = $segmentsRepository;
  }

  /** @return mixed[] */
  public function getContextData(): array {
    return [
      'segments' => $this->getSegments(),
    ];
  }

  private function getSegments(): array {
    $segments = [];
    foreach ($this->segmentsRepository->findAll() as $segment) {
      $segments[] = [
        'id' => $segment->getId(),
        'name' => $segment->getName(),
        'type' => $segment->getType(),
      ];
    }
    return $segments;
  }
}

Directory Contents

Dirs: 6 × Files: 3

Name Size Perms Modified Actions
Actions DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Hooks DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Payloads DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Subjects DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Templates DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Triggers DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
831 B lrw-r--r-- 2023-04-04 05:35:40
Edit Download
0 B lrw-r--r-- 2023-04-04 05:35:40
Edit Download
2.91 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).