Asset::setMimeType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the limit0/assets package.
5
 *
6
 * (c) Limit Zero, LLC <[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 Limit0\Assets;
13
14
use Symfony\Component\HttpFoundation\File\UploadedFile;
15
16
/**
17
 * An Asset model extends the functionality available in \SplFileInfo and UploadedFile
18
 *
19
 * @author  Josh Worden <[email protected]>
20
 */
21
class Asset extends UploadedFile
22
{
23
    /**
24
     * @var array
25
     */
26
    private $storageMetadata = [];
27
28
    /**
29
     * Override UploadedFile constructor
30
     */
31 11
    public function __construct()
32
    {
33 11
    }
34
35 2
    public function __toString()
36
    {
37 2
        return $this->pathname;
0 ignored issues
show
Bug introduced by
The property pathname does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
38
    }
39
40
    /**
41
     * Returns the filename property.
42
     *
43
     * @return array
44
     */
45
    public function getStorageMetadata()
46
    {
47
        return $this->storageMetadata;
48
    }
49
50
    /**
51
     * Returns the filename property.
52
     *
53
     * @return string
54
     */
55 3
    public function getFilename()
56
    {
57 3
        return $this->filename;
0 ignored issues
show
Bug introduced by
The property filename does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
58
    }
59
60
    /**
61
     * Returns the filepath property.
62
     *
63
     * @return string
64
     */
65 1
    public function getFilepath()
66
    {
67 1
        return $this->filepath;
0 ignored issues
show
Bug introduced by
The property filepath does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
68
    }
69
70
    /**
71
     * Returns the extension property.
72
     *
73
     * @return string
74
     */
75 3
    public function getExtension()
76
    {
77 3
        return $this->extension;
0 ignored issues
show
Bug introduced by
The property extension does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
78
    }
79
80
    /**
81
     * Returns the pathname property.
82
     *
83
     * @return string
84
     */
85 3
    public function getPathname()
86
    {
87 3
        return $this->pathname;
88
    }
89
90
    /**
91
     * Returns the mimeType property.
92
     *
93
     * @return string
94
     */
95 3
    public function getMimeType()
96
    {
97 3
        return $this->mimeType;
0 ignored issues
show
Bug introduced by
The property mimeType cannot be accessed from this context as it is declared private in class Symfony\Component\HttpFoundation\File\UploadedFile.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
98
    }
99
100
    /**
101
     * Returns the clientOriginalName property.
102
     *
103
     * @return string
104
     */
105 1
    public function getClientOriginalName()
106
    {
107 1
        return $this->clientOriginalName;
0 ignored issues
show
Bug introduced by
The property clientOriginalName does not seem to exist. Did you mean originalName?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
108
    }
109
110
    /**
111
     * Returns the clientOriginalExtension property.
112
     *
113
     * @return string
114
     */
115 1
    public function getClientOriginalExtension()
116
    {
117 1
        return $this->clientOriginalExtension;
0 ignored issues
show
Bug introduced by
The property clientOriginalExtension does not seem to exist. Did you mean extension?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
118
    }
119
120
    /**
121
     * Returns the clientMimeType property.
122
     *
123
     * @return string
124
     */
125 1
    public function getClientMimeType()
126
    {
127 1
        return $this->clientMimeType;
0 ignored issues
show
Bug introduced by
The property clientMimeType does not seem to exist. Did you mean mimeType?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
128
    }
129
130
    /**
131
     * Returns the filename property.
132
     *
133
     * @param  array $value
134
     * @return self
135
     */
136
    public function setStorageMetadata(array $value = [])
137
    {
138
        $this->storageMetadata = $value;
139
        return $this;
140
    }
141
142
    /**
143
     * Sets the filename property.
144
     *
145
     * @param  string $value
146
     * @return self
147
     */
148 11
    public function setFilename($value)
149
    {
150 11
        $this->filename = $value;
151 11
        return $this;
152
    }
153
154
    /**
155
     * Sets the filepath property.
156
     *
157
     * @param  string $value
158
     * @return self
159
     */
160 3
    public function setFilepath($value)
161
    {
162 3
        $this->filepath = $value;
163 3
        return $this;
164
    }
165
166
    /**
167
     * Sets the extension property.
168
     *
169
     * @param  string $value
170
     * @return self
171
     */
172 11
    public function setExtension($value)
173
    {
174 11
        $this->extension = $value;
175 11
        return $this;
176
    }
177
178
    /**
179
     * Sets the pathname property.
180
     *
181
     * @param  string $value
182
     * @return self
183
     */
184 11
    public function setPathname($value)
185
    {
186 11
        $this->pathname = $value;
187 11
        return $this;
188
    }
189
190
    /**
191
     * Sets the mimeType property.
192
     *
193
     * @param  string $value
194
     * @return self
195
     */
196 11
    public function setMimeType($value)
197
    {
198 11
        $this->mimeType = $value;
0 ignored issues
show
Bug introduced by
The property mimeType cannot be accessed from this context as it is declared private in class Symfony\Component\HttpFoundation\File\UploadedFile.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
199 11
        return $this;
200
    }
201
202
    /**
203
     * Sets the clientOriginalName property.
204
     *
205
     * @param  string $value
206
     * @return self
207
     */
208 11
    public function setClientOriginalName($value)
209
    {
210 11
        $this->clientOriginalName = $value;
0 ignored issues
show
Bug introduced by
The property clientOriginalName does not seem to exist. Did you mean originalName?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
211 11
        return $this;
212
    }
213
214
    /**
215
     * Sets the clientOriginalExtension property.
216
     *
217
     * @param  string $value
218
     * @return self
219
     */
220 11
    public function setClientOriginalExtension($value)
221
    {
222 11
        $this->clientOriginalExtension = $value;
0 ignored issues
show
Bug introduced by
The property clientOriginalExtension does not seem to exist. Did you mean extension?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
223 11
        return $this;
224
    }
225
226
    /**
227
     * Sets the clientMimeType property.
228
     *
229
     * @param  string $value
230
     * @return self
231
     */
232 1
    public function setClientMimeType($value)
233
    {
234 1
        $this->clientMimeType = $value;
0 ignored issues
show
Bug introduced by
The property clientMimeType does not seem to exist. Did you mean mimeType?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
235 1
        return $this;
236
    }
237
}
238