Completed
Push — master ( b5c7fa...23b509 )
by Taosikai
13:59
created

ConstraintException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 39
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getConstraint() 0 4 1
A getUploadedFile() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the slince/upload package.
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Slince\Upload\Exception;
13
14
use Slince\Upload\Constraint\ConstraintInterface;
15
use Symfony\Component\HttpFoundation\File\UploadedFile;
16
17
class ConstraintException extends UploadException
18
{
19
    /**
20
     * @var ConstraintInterface
21
     */
22
    protected $constraint;
23
24
    /**
25
     * @var UploadedFile
26
     */
27
    protected $uploadedFile;
28
29
    public function __construct(ConstraintInterface $constraint, UploadedFile $uploadedFile)
30
    {
31
        $this->constraint = $constraint;
32
        $this->uploadedFile = $uploadedFile;
33
        parent::__construct($constraint->getErrorMessage($uploadedFile));
34
    }
35
36
    /**
37
     * Gets the constraint
38
     *
39
     * @return ConstraintInterface
40
     */
41
    public function getConstraint()
42
    {
43
        return $this->constraint;
44
    }
45
46
    /**
47
     * Gets the uploaded file
48
     *
49
     * @return UploadedFile
50
     */
51
    public function getUploadedFile()
52
    {
53
        return $this->file;
54
    }
55
}