<?php

namespace Modules\Service\Uploads;


use Modules\Service\Uploads\Upload\FileService;
use Modules\Service\Uploads\Upload\ImageService;
use Modules\Service\Uploads\Upload\UploadFileService;

/**
 * Class based Helper to Send Notifications
 */
class UploadingService
{
    /**
     * Upload File Service.
     *
     * @param $file
     * @return string
     */
    public static function uploadFile($file)
    {
        if (in_array($file->extension(),['jpg','png','jpeg']))
        {
            $upload = new UploadFileService(new ImageService());
            $response = $upload->uploadFile($file);
        }
        else
        {
            $upload = new UploadFileService(new FileService());
            $response = $upload->uploadFile($file);
        }
        return $response;
    }

}


