Skip to content

Commit 9da2d96

Browse files
committed
Working on filesystem.
1 parent eeda8b4 commit 9da2d96

9 files changed

Lines changed: 739 additions & 0 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"ircmaxell/password-compat": "~1.0",
1717
"filp/whoops": "1.1.*",
1818
"jeremeamia/superclosure": "~1.0",
19+
"league/flysystem": "~0.5",
1920
"monolog/monolog": "~1.6",
2021
"nesbot/carbon": "~1.0",
2122
"patchwork/utf8": "~1.1",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php namespace Illuminate\Contracts\Filesystem;
2+
3+
interface Cloud extends Filesystem {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php namespace Illuminate\Contracts\Filesystem;
2+
3+
interface Factory {
4+
5+
/**
6+
* Get an OAuth provider implementation.
7+
*
8+
* @param string $name
9+
* @return \Illuminate\Contracts\Filesystem\Filesystem
10+
*/
11+
public function disk($name = null);
12+
13+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php namespace Illuminate\Contracts\Filesystem;
2+
3+
class FileNotFoundException extends \Exception {}
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
<?php namespace Illuminate\Contracts\Filesystem;
2+
3+
interface Filesystem {
4+
5+
/**
6+
* The public visibility setting.
7+
*
8+
* @var string
9+
*/
10+
const VISIBILITY_PUBLIC = 'public';
11+
12+
/**
13+
* The private visibility setting.
14+
*
15+
* @var string
16+
*/
17+
const VISIBILITY_PRIVATE = 'private';
18+
19+
/**
20+
* Determine if a file exists.
21+
*
22+
* @param string $path
23+
* @return bool
24+
*/
25+
public function exists($path);
26+
27+
/**
28+
* Get the contents of a file.
29+
*
30+
* @param string $path
31+
* @return string
32+
*
33+
* @throws FileNotFoundException
34+
*/
35+
public function get($path);
36+
37+
/**
38+
* Write the contents of a file.
39+
*
40+
* @param string $path
41+
* @param string $contents
42+
* @param string $visibility
43+
* @return bool
44+
*/
45+
public function put($path, $contents, $visibility = null);
46+
47+
/**
48+
* Get the visibility for the given path.
49+
*
50+
* @param string $path
51+
* @return string
52+
*/
53+
public function getVisibility($path);
54+
55+
/**
56+
* Set the visibility for the given path.
57+
*
58+
* @param string $path
59+
* @param string $visibility
60+
* @return void
61+
*/
62+
public function setVisibility($path, $visibility);
63+
64+
/**
65+
* Prepend to a file.
66+
*
67+
* @param string $path
68+
* @param string $data
69+
* @return int
70+
*/
71+
public function prepend($path, $data);
72+
73+
/**
74+
* Append to a file.
75+
*
76+
* @param string $path
77+
* @param string $data
78+
* @return int
79+
*/
80+
public function append($path, $data);
81+
82+
/**
83+
* Delete the file at a given path.
84+
*
85+
* @param string|array $paths
86+
* @return bool
87+
*/
88+
public function delete($paths);
89+
90+
/**
91+
* Copy a file to a new location.
92+
*
93+
* @param string $from
94+
* @param string $to
95+
* @return bool
96+
*/
97+
public function copy($from, $to);
98+
99+
/**
100+
* Move a file to a new location.
101+
*
102+
* @param string $from
103+
* @param string $to
104+
* @return bool
105+
*/
106+
public function move($from, $to);
107+
108+
/**
109+
* Get the file size of a given file.
110+
*
111+
* @param string $path
112+
* @return int
113+
*/
114+
public function size($path);
115+
116+
/**
117+
* Get the file's last modification time.
118+
*
119+
* @param string $path
120+
* @return int
121+
*/
122+
public function lastModified($path);
123+
124+
/**
125+
* Get an array of all files in a directory.
126+
*
127+
* @param string|null $directory
128+
* @param bool $recursive
129+
* @return array
130+
*/
131+
public function files($directory = null, $recursive = false);
132+
133+
/**
134+
* Get all of the files from the given directory (recursive).
135+
*
136+
* @param string|null $directory
137+
* @return array
138+
*/
139+
public function allFiles($directory = null);
140+
141+
/**
142+
* Get all of the directories within a given directory.
143+
*
144+
* @param string|null $directory
145+
* @param bool $recursive
146+
* @return array
147+
*/
148+
public function directories($directory = null, $recursive = false);
149+
150+
/**
151+
* Get all (recursive) of the directories within a given directory.
152+
*
153+
* @param string|null $directory
154+
* @return array
155+
*/
156+
public function allDirectories($directory = null);
157+
158+
/**
159+
* Create a directory.
160+
*
161+
* @param string $path
162+
* @return bool
163+
*/
164+
public function makeDirectory($path);
165+
166+
/**
167+
* Recursively delete a directory.
168+
*
169+
* @param string $directory
170+
* @return bool
171+
*/
172+
public function deleteDirectory($directory);
173+
174+
}

0 commit comments

Comments
 (0)