ExampleFile::setDirectory()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 2
nc 2
nop 1
1
<?php
2
/**
3
 * @author: jiangyi
4
 * @date: 下午9:53 2018/11/28
5
 */
6
7
namespace Hello;
8
9
class ExampleFile
10
{
11
    protected $id;
12
    protected $directory;
13
14
    public function __construct($id)
15
    {
16
        $this->id = $id;
17
    }
18
19
    public function setDirectory($directory)
20
    {
21
        $this->directory = $directory . DIRECTORY_SEPARATOR . $this->id;
22
23
        if (!file_exists($this->directory)) {
24
            mkdir($this->directory, 0700, true);
25
        }
26
    }
27
}
28