# fluent-support/1.10.2/app/Services/Tickets/Importer/MigratorService.php

Fluent Support – Helpdesk &amp; Customer Support Ticket System, version 1.10.2. 79 lines.

- Page: https://pluginprobe.com/plugins/fluent-support/1.10.2/code/app/Services/Tickets/Importer/MigratorService.php
- Raw: https://pluginprobe.com/plugins/fluent-support/1.10.2/raw/app/Services/Tickets/Importer/MigratorService.php
- Modified: 2025-05-28T13:27:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-support/1.10.2/code/app/Services/Tickets/Importer/MigratorService.php#L10-L20`.

```php
<?php

namespace FluentSupport\App\Services\Tickets\Importer;

class MigratorService
{
    /**
     * This `getStats` method will fetch available other systems data
     */
    public function getStats()
    {
        $stats = [];

        if (defined('WPAS_VERSION')) {
            $stats[] = $this->mapClassWithHandler('awesome-support')->stats();
        }

        if (defined('WPSC_VERSION')) {
            $stats[] = $this->mapClassWithHandler('support-candy')->stats();
        }

        if (defined('JSST_PLUGIN_PATH')) {
            $stats[] = $this->mapClassWithHandler('js-helpdesk')->stats();
        }

        $stats[] = $this->mapClassWithHandler('helpscout')->stats();
        $stats[] = $this->mapClassWithHandler('freshdesk')->stats();
        $stats[] = $this->mapClassWithHandler('zendesk')->stats();

        return [
            'stats' => $stats
        ];
    }

    /**
     * This `handleImport` method will handle the ticket import
     * @param int $page // It can be page number or ticket id for inserting ticket
     * @param string $handler
     */
    public function handleImport($page, $handler, $query=[])
    {
        if($query){
            $class = $this->mapClassWithHandler($handler);
            $class->setAccessToken($query['access_token']);
            isset($query['mailbox']) ? $class->setMailboxId($query['mailbox']) : '';
            isset($query['domain']) ? $class->setDomain($query['domain']) : '';
            isset($query['email']) ? $class->setEmail($query['email']) : '';

            return $class->doMigration($page, $handler);
        }

        return $this->mapClassWithHandler($handler)->doMigration($page, $handler);
    }

    public function deleteTickets($page, $handler)
    {
        return $this->mapClassWithHandler($handler)->deleteTickets($page);
    }

    // This method is a helper method of `handleImport` method it's responsible for calling a class by $handler
    private function mapClassWithHandler($handler)
    {
        $namespace = "FluentSupport\App\Services\Tickets\Importer\\";

        $classMapper = apply_filters('fluent_support/migrator_class_mapper', [
            'awesome-support' => 'AwesomeSupportTickets',
            'support-candy'   => 'SupportCandyTickets',
            'js-helpdesk'     => 'JSHelpdeskTickets',
            'helpscout'       => 'HelpScoutTickets',
            'freshdesk'       => 'FreshDeskTickets',
            'zendesk'         => 'ZendeskTickets'
        ]);

        $class = $namespace . $classMapper[$handler];

        return new $class();
    }
}

```
