Completed
Push — stable2 ( 929455...10fadc )
by Robin
13:53 queued 12:28
created

FileInfo::getPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Copyright (c) 2014 Robin Appelman <[email protected]>
4
 * This file is licensed under the Licensed under the MIT license:
5
 * http://opensource.org/licenses/MIT
6
 */
7
8
namespace Icewind\SMB;
9
10
class FileInfo implements IFileInfo {
11
	/*
12
	 * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the
13
	 * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or
14
	 * "system.*") is specified.
15
	 */
16
	const MODE_READONLY = 0x01;
17
	const MODE_HIDDEN = 0x02;
18
	const MODE_SYSTEM = 0x04;
19
	const MODE_VOLUME_ID = 0x08;
20
	const MODE_DIRECTORY = 0x10;
21
	const MODE_ARCHIVE = 0x20;
22
	const MODE_NORMAL = 0x80;
23
24
	/**
25
	 * @var string
26
	 */
27
	protected $path;
28
29
	/**
30
	 * @var string
31
	 */
32
	protected $name;
33
34
	/**
35
	 * @var int
36
	 */
37
	protected $size;
38
39
	/**
40
	 * @var int
41
	 */
42
	protected $time;
43
44
	/**
45
	 * @var int
46
	 */
47
	protected $mode;
48
49
	/**
50
	 * @param string $path
51
	 * @param string $name
52
	 * @param int $size
53
	 * @param int $time
54
	 * @param int $mode
55
	 */
56 4
	public function __construct($path, $name, $size, $time, $mode) {
57 4
		$this->path = $path;
58 4
		$this->name = $name;
59 4
		$this->size = $size;
60 4
		$this->time = $time;
61 4
		$this->mode = $mode;
62 4
	}
63
64
	/**
65
	 * @return string
66
	 */
67
	public function getPath() {
68
		return $this->path;
69
	}
70
71
	/**
72
	 * @return string
73
	 */
74
	public function getName() {
75
		return $this->name;
76
	}
77
78
	/**
79
	 * @return int
80
	 */
81
	public function getSize() {
82
		return $this->size;
83
	}
84
85
	/**
86
	 * @return int
87
	 */
88
	public function getMTime() {
89
		return $this->time;
90
	}
91
92
	/**
93
	 * @return bool
94
	 */
95
	public function isDirectory() {
96
		return (bool)($this->mode & self::MODE_DIRECTORY);
97
	}
98
99
	/**
100
	 * @return bool
101
	 */
102
	public function isReadOnly() {
103
		return (bool)($this->mode & self::MODE_READONLY);
104
	}
105
106
	/**
107
	 * @return bool
108
	 */
109
	public function isHidden() {
110
		return (bool)($this->mode & self::MODE_HIDDEN);
111
	}
112
113
	/**
114
	 * @return bool
115
	 */
116
	public function isSystem() {
117
		return (bool)($this->mode & self::MODE_SYSTEM);
118
	}
119
120
	/**
121
	 * @return bool
122
	 */
123
	public function isArchived() {
124
		return (bool)($this->mode & self::MODE_ARCHIVE);
125
	}
126
}
127