Passed
Push — develop ( fc59e1...90305f )
by Jens
02:30
created

File::setFilePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
/**
3
 * Created by jensk on 12-10-2017.
4
 */
5
6
namespace CloudControl\Cms\services\fileservice;
7
8
9
use CloudControl\Cms\cc\Request;
10
11
/**
12
 * Class File
13
 * @package CloudControl\Cms\services\fileservice
14
 */
15
class File
16
{
17
    protected $filePath;
18
19
    public $file;
20
    public $type;
21
    public $size;
22
23
    /**
24
     * File constructor.
25
     * @param \stdClass $file
26
     * @param string $filePath
27
     */
28
    public function __construct(\stdClass $file, $filePath = 'files')
29
    {
30
        $this->file = $file->file;
31
        $this->type = $file->type;
32
        $this->size = $file->size;
33
        $this->filePath = $filePath;
34
    }
35
36
    public function __toString()
37
    {
38
        return Request::$subfolders . $this->filePath . '/' . $this->file;
39
    }
40
41
    /**
42
     * @param string $filePath
43
     */
44
    public function setFilePath($filePath)
45
    {
46
        $this->filePath = $filePath;
47
    }
48
49
}