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

File   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 35
rs 10
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A __toString() 0 4 1
A setFilePath() 0 4 1
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
}