forked from 1up-lab/OneupUploaderBundle
-
Notifications
You must be signed in to change notification settings - Fork 1
/
UploadEvents.php
42 lines (34 loc) · 1.16 KB
/
UploadEvents.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Oneup\UploaderBundle;
final class UploadEvents
{
const PRE_UPLOAD = 'oneup_uploader.pre_upload';
const POST_UPLOAD = 'oneup_uploader.post_upload';
const POST_PERSIST = 'oneup_uploader.post_persist';
const POST_CHUNK_UPLOAD = 'oneup_uploader.post_chunk_upload';
const VALIDATION = 'oneup_uploader.validation';
public static function preUpload(string $mapping): string
{
return self::withMapping(self::PRE_UPLOAD, $mapping);
}
public static function postUpload(string $mapping): string
{
return self::withMapping(self::POST_UPLOAD, $mapping);
}
public static function postPersist(string $mapping): string
{
return self::withMapping(self::POST_PERSIST, $mapping);
}
public static function postChunkUpload(string $mapping): string
{
return self::withMapping(self::POST_CHUNK_UPLOAD, $mapping);
}
public static function validation(string $mapping): string
{
return self::withMapping(self::VALIDATION, $mapping);
}
private static function withMapping(string $event, string $mapping): string
{
return "{$event}.{$mapping}";
}
}