Completed
Push — master ( c264d0...44985a )
by Taosikai
12:57
created

File   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 91
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getName() 0 4 1
A getUploadedFile() 0 4 1
A isUploaded() 0 4 1
A getException() 0 4 1
A getDetails() 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;
13
14
use Symfony\Component\HttpFoundation\File\UploadedFile;
15
16
final class File
17
{
18
    /**
19
     * @var string
20
     */
21
    protected $name;
22
23
    /**
24
     * @var UploadedFile
25
     */
26
    protected $uploadedFile;
27
28
    /**
29
     * Is uploaded
30
     *
31
     * @var boolean
32
     */
33
    protected $uploaded;
34
35
    /**
36
     * @var \Exception
37
     */
38
    protected $exception;
39
40
    /**
41
     * Storage system returned.
42
     *
43
     * @var \Symfony\Component\HttpFoundation\File\File|mixed
44
     */
45
    protected $details;
46
47
    public function __construct(
48
        UploadedFile $uploadedFile, $name, $uploaded, $details = null, $exception = null)
49
    {
50
        $this->uploadedFile = $uploadedFile;
51
        $this->name = $name;
52
        $this->uploaded = $uploaded;
53
        $this->details = $details;
54
        $this->exception = $exception;
55
    }
56
57
    /**
58
     * Gets the key generated by `Namer`
59
     *
60
     * @return string
61
     */
62
    public function getName()
63
    {
64
        return $this->name;
65
    }
66
67
    /**
68
     * Access file details saved in client by this object.
69
     *
70
     * @return UploadedFile
71
     */
72
    public function getUploadedFile()
73
    {
74
        return $this->uploadedFile;
75
    }
76
77
    /**
78
     * Checks whether the file is uploaded successfully.
79
     *
80
     * @return bool
81
     */
82
    public function isUploaded()
83
    {
84
        return $this->uploaded;
85
    }
86
87
    /**
88
     * The exception if the file is uploaded error.
89
     *
90
     * @return \Exception
91
     */
92
    public function getException()
93
    {
94
        return $this->exception;
95
    }
96
97
    /**
98
     * File details provided by storage layer.
99
     *
100
     * @return \Symfony\Component\HttpFoundation\File\File|mixed
101
     */
102
    public function getDetails()
103
    {
104
        return $this->details;
105
    }
106
}