Completed
Push — master ( 1f0b5b...72c149 )
by Jeroen
06:29 queued 14s
created

Media::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Kunstmaan\MediaBundle\Validator\Constraints;
4
5
use Symfony\Component\Validator\Constraint;
6
7
/**
8
 * @Annotation
9
 */
10
class Media extends Constraint
11
{
12
    public const NOT_FOUND_ERROR = 'b707694b-ff60-4f3f-a1bb-22ecae5b6e0d';
13
    public const NOT_READABLE_ERROR = 'b4fca756-28db-4c71-adfc-ef2a0c3c3d7c';
14
    public const EMPTY_ERROR = 'bb60ad41-e149-407f-b52c-35023d123016';
15
    public const INVALID_MIME_TYPE_ERROR = 'a6afff66-fe95-4f97-8753-de0b0ec9cdf3';
16
    public const TOO_WIDE_ERROR = '30d779e0-0bb2-48d8-8571-9ce592ff04d3';
17
    public const TOO_NARROW_ERROR = '2420b5ba-fd3e-4bf4-9f81-a91132ec42a3';
18
    public const TOO_HIGH_ERROR = '9de7ece8-7837-4a6a-9602-6d0f4d2bd5fb';
19
    public const TOO_LOW_ERROR = '8833baac-1c7f-402c-96b5-1cf7ac2eb955';
20
21
    protected static $errorNames = [
22
        self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR',
23
        self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR',
24
        self::EMPTY_ERROR => 'EMPTY_ERROR',
25
        self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR',
26
        self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR',
27
        self::TOO_LOW_ERROR => 'TOO_LOW_ERROR',
28
        self::TOO_WIDE_ERROR => 'TOO_WIDE_ERROR',
29
        self::TOO_NARROW_ERROR => 'TOO_NARROW_ERROR',
30
    ];
31
32
    public $minHeight;
33
34
    public $maxHeight;
35
36
    public $minWidth;
37
38
    public $maxWidth;
39
40
    public $binaryFormat;
41
42
    public $mimeTypes = [];
43
44
    public $notFoundMessage = 'The file could not be found.';
45
46
    public $notReadableMessage = 'The file is not readable.';
47
48
    public $mimeTypesMessage = 'The type of the file is invalid ({{ type }}). Allowed types are {{ types }}.';
49
50
    public $disallowEmptyMessage = 'An empty file is not allowed.';
51
52
    public $maxWidthMessage = 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.';
53
54
    public $minWidthMessage = 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.';
55
56
    public $maxHeightMessage = 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.';
57
58
    public $minHeightMessage = 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.';
59
60
    public $uploadPartialErrorMessage = 'The file was only partially uploaded.';
61
62
    public $uploadNoFileErrorMessage = 'No file was uploaded.';
63
64
    public $uploadNoTmpDirErrorMessage = 'No temporary folder was configured in php.ini.';
65
66
    public $uploadCantWriteErrorMessage = 'Cannot write temporary file to disk.';
67
68
    public $uploadExtensionErrorMessage = 'A PHP extension caused the upload to fail.';
69
70
    public $uploadErrorMessage = 'The file could not be uploaded.';
71
}
72