Completed
Push — master ( e929f3...7e5e6c )
by Nazar
05:31
created

_Abstract   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 232
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
dl 0
loc 232
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

18 Methods

Rating   Name   Duplication   Size   Complexity  
__construct() 0 1 ?
file() 0 1 ?
file_get_contents() 0 1 ?
file_put_contents() 0 1 ?
copy() 0 1 ?
unlink() 0 1 ?
file_exists() 0 1 ?
get_files_list() 0 12 ?
rename() 0 1 ?
mkdir() 0 1 ?
rmdir() 0 1 ?
is_file() 0 1 ?
is_dir() 0 1 ?
url_by_source() 0 1 ?
source_by_url() 0 1 ?
A base_url() 0 3 1
A connected() 0 3 1
A __clone() 0 2 1
1
<?php
2
/**
3
 * @package   CleverStyle Framework
4
 * @author    Nazar Mokrynskyi <[email protected]>
5
 * @copyright Copyright (c) 2011-2016, Nazar Mokrynskyi
6
 * @license   MIT License, see license.txt
7
 */
8
namespace cs\Storage;
9
abstract class _Abstract {
10
	protected $connected = false;
11
	protected $base_url  = '';
12
	/**
13
	 * Connecting to the Storage
14
	 *
15
	 * @param string $base_url
16
	 * @param string $host
17
	 * @param string $user
18
	 * @param string $password
19
	 */
20
	abstract public function __construct ($base_url, $host, $user = '', $password = '');
21
	/**
22
	 * Function for getting content of a directory
23
	 *
24
	 * @abstract
25
	 *
26
	 * @see get_files_list()
27
	 *
28
	 * @param    string        $dir
29
	 * @param    bool|string   $mask
30
	 * @param    string        $mode
31
	 * @param    bool|string   $prefix_path
32
	 * @param    bool          $subfolders
33
	 * @param    bool          $sort
34
	 * @param    bool|string   $exclusion
35
	 * @param    bool          $system_files
36
	 * @param    callable|null $apply
37
	 * @param    int|null      $limit
38
	 *
39
	 * @return    array
40
	 */
41
	abstract public function get_files_list (
42
		$dir,
43
		$mask = false,
44
		$mode = 'f',
45
		$prefix_path = false,
46
		$subfolders = false,
47
		$sort = false,
48
		$exclusion = false,
49
		$system_files = false,
50
		$apply = null,
51
		$limit = null
52
	);
53
	/**
54
	 * Reads entire file into an array
55
	 *
56
	 * @abstract
57
	 *
58
	 * @see file()
59
	 *
60
	 * @param string   $filename
61
	 * @param int|null $flags
62
	 *
63
	 * @return array|false
64
	 */
65
	abstract public function file ($filename, $flags = null);
66
	/**
67
	 * Reads entire file into a string
68
	 *
69
	 * @abstract
70
	 *
71
	 * @see file_get_contents()
72
	 *
73
	 * @param string   $filename
74
	 * @param int|null $flags
75
	 *
76
	 * @return false|string
77
	 */
78
	abstract public function file_get_contents ($filename, $flags = null);
79
	/**
80
	 * Write a string to a file
81
	 *
82
	 * @abstract
83
	 *
84
	 * @see file_put_contents()
85
	 *
86
	 * @param string   $filename
87
	 * @param string   $data
88
	 * @param int|null $flags
89
	 *
90
	 * @return false|int
91
	 */
92
	abstract public function file_put_contents ($filename, $data, $flags = null);
93
	/**
94
	 * Copies file
95
	 *
96
	 * @abstract
97
	 *
98
	 * @see copy()
99
	 *
100
	 * @param string $source
101
	 * @param string $dest
102
	 *
103
	 * @return bool
104
	 */
105
	abstract public function copy ($source, $dest);
106
	/**
107
	 * Deletes a file
108
	 *
109
	 * @abstract
110
	 *
111
	 * @see unlink()
112
	 *
113
	 * @param string $filename
114
	 *
115
	 * @return bool
116
	 */
117
	abstract public function unlink ($filename);
118
	/**
119
	 * Checks whether a file or directory exists
120
	 *
121
	 * @abstract
122
	 *
123
	 * @see file_exists()
124
	 *
125
	 * @param string $filename
126
	 *
127
	 * @return bool
128
	 */
129
	abstract public function file_exists ($filename);
130
	/**
131
	 * Renames a file or directory
132
	 *
133
	 * @abstract
134
	 *
135
	 * @see rename()
136
	 *
137
	 * @param string $oldname
138
	 * @param string $newname
139
	 *
140
	 * @return bool
141
	 */
142
	abstract public function rename ($oldname, $newname);
143
	/**
144
	 * Attempts to create the directory specified by pathname.
145
	 *
146
	 * @abstract
147
	 *
148
	 * @see mkdir()
149
	 *
150
	 * @param string $pathname
151
	 * @param int    $mode
152
	 * @param bool   $recursive
153
	 *
154
	 * @return bool
155
	 */
156
	abstract public function mkdir ($pathname, $mode = 0777, $recursive = false);
157
	/**
158
	 * Removes directory
159
	 *
160
	 * @abstract
161
	 *
162
	 * @see rmdir()
163
	 *
164
	 * @param string $dirname
165
	 *
166
	 * @return bool
167
	 */
168
	abstract public function rmdir ($dirname);
169
	/**
170
	 * Tells whether the filename is a regular file
171
	 *
172
	 * @abstract
173
	 *
174
	 * @see is_file()
175
	 *
176
	 * @param string $filename
177
	 *
178
	 * @return bool
179
	 */
180
	abstract public function is_file ($filename);
181
	/**
182
	 * Tells whether the filename is a directory
183
	 *
184
	 * @abstract
185
	 *
186
	 * @see is_dir()
187
	 *
188
	 * @param string $filename
189
	 *
190
	 * @return bool
191
	 */
192
	abstract public function is_dir ($filename);
193
	/**
194
	 * Get file url by it's destination in file system
195
	 *
196
	 * @abstract
197
	 *
198
	 * @see url_by_source()
199
	 *
200
	 * @param string $source
201
	 *
202
	 * @return false|string
203
	 */
204
	abstract public function url_by_source ($source);
205
	/**
206
	 * Get file destination in file system by it's url
207
	 *
208
	 * @abstract
209
	 *
210
	 * @see source_by_url()
211
	 *
212
	 * @param string $url
213
	 *
214
	 * @return false|string
215
	 */
216
	abstract public function source_by_url ($url);
217
	/**
218
	 * Return base url of storage
219
	 *
220
	 * @return string
221
	 */
222 2
	public function base_url () {
223 2
		return $this->base_url;
224
	}
225
	/**
226
	 * Connection state
227
	 *
228
	 * @return bool
229
	 */
230 4
	public function connected () {
231 4
		return $this->connected;
232
	}
233
	/**
234
	 * Cloning restriction
235
	 *
236
	 * @final
237
	 */
238
	final protected function __clone () {
239
	}
240
}
241