Skip to content

Commit 9c55477

Browse files
author
Nana Axel
committed
Implement file system events
1 parent 3e76cff commit 9c55477

File tree

4 files changed

+245
-0
lines changed

4 files changed

+245
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/**
4+
* FireFS - Easily manage your filesystem, through PHP
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*
24+
* @category Library
25+
* @package FireFS
26+
* @author Axel Nana <[email protected]>
27+
* @copyright 2018 Aliens Group, Inc.
28+
* @license MIT <https://github.com/ElementaryFramework/FireFS/blob/master/LICENSE>
29+
* @version GIT: 0.0.1
30+
* @link http://firefs.na2axl.tk
31+
*/
32+
33+
namespace ElementaryFramework\FireFS\Events;
34+
35+
/**
36+
* File System Entity Created Event
37+
*
38+
* Represent an event occurred when a file system entity
39+
* has been created.
40+
*
41+
* @package FireFS
42+
* @subpackage Exceptions
43+
* @author Axel Nana <[email protected]>
44+
*/
45+
class FileSystemEntityCreatedEvent extends FileSystemEvent
46+
{
47+
public function __construct(string $path)
48+
{
49+
parent::__construct(FileSystemEvent::EVENT_CREATE, $path);
50+
}
51+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/**
4+
* FireFS - Easily manage your filesystem, through PHP
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*
24+
* @category Library
25+
* @package FireFS
26+
* @author Axel Nana <[email protected]>
27+
* @copyright 2018 Aliens Group, Inc.
28+
* @license MIT <https://github.com/ElementaryFramework/FireFS/blob/master/LICENSE>
29+
* @version GIT: 0.0.1
30+
* @link http://firefs.na2axl.tk
31+
*/
32+
33+
namespace ElementaryFramework\FireFS\Events;
34+
35+
/**
36+
* File System Entity Deleted Event
37+
*
38+
* Represent an event occurred when a file system entity
39+
* has been deleted.
40+
*
41+
* @package FireFS
42+
* @subpackage Exceptions
43+
* @author Axel Nana <[email protected]>
44+
*/
45+
class FileSystemEntityDeletedEvent extends FileSystemEvent
46+
{
47+
public function __construct(string $path)
48+
{
49+
parent::__construct(FileSystemEvent::EVENT_DELETE, $path);
50+
}
51+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/**
4+
* FireFS - Easily manage your filesystem, through PHP
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*
24+
* @category Library
25+
* @package FireFS
26+
* @author Axel Nana <[email protected]>
27+
* @copyright 2018 Aliens Group, Inc.
28+
* @license MIT <https://github.com/ElementaryFramework/FireFS/blob/master/LICENSE>
29+
* @version GIT: 0.0.1
30+
* @link http://firefs.na2axl.tk
31+
*/
32+
33+
namespace ElementaryFramework\FireFS\Events;
34+
35+
/**
36+
* File System Entity Modified Event
37+
*
38+
* Represent an event occurred when a file system entity
39+
* has been modified.
40+
*
41+
* @package FireFS
42+
* @subpackage Exceptions
43+
* @author Axel Nana <[email protected]>
44+
*/
45+
class FileSystemEntityModifiedEvent extends FileSystemEvent
46+
{
47+
public function __construct(string $path)
48+
{
49+
parent::__construct(FileSystemEvent::EVENT_MODIFY, $path);
50+
}
51+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?php
2+
3+
/**
4+
* FireFS - Easily manage your filesystem, through PHP
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*
24+
* @category Library
25+
* @package FireFS
26+
* @author Axel Nana <[email protected]>
27+
* @copyright 2018 Aliens Group, Inc.
28+
* @license MIT <https://github.com/ElementaryFramework/FireFS/blob/master/LICENSE>
29+
* @version GIT: 0.0.1
30+
* @link http://firefs.na2axl.tk
31+
*/
32+
33+
namespace ElementaryFramework\FireFS\Events;
34+
35+
/**
36+
* File System Event
37+
*
38+
* Represent an event occurred in the file system manager.
39+
*
40+
* @package FireFS
41+
* @subpackage Exceptions
42+
* @author Axel Nana <[email protected]>
43+
*/
44+
abstract class FileSystemEvent
45+
{
46+
/**
47+
* Represent an unknown event.
48+
*/
49+
const EVENT_UNKNOWN = 0;
50+
51+
/**
52+
* Represent a "create" event.
53+
*/
54+
const EVENT_CREATE = 1;
55+
56+
/**
57+
* Represent a "modify" event.
58+
*/
59+
const EVENT_MODIFY = 2;
60+
61+
/**
62+
* Represent a "delete" event.
63+
*/
64+
const EVENT_DELETE = 3;
65+
66+
/**
67+
* The path to the entity which raised the event.
68+
*
69+
* @var string
70+
*/
71+
protected $_path;
72+
73+
/**
74+
* The type of the raised event.
75+
*
76+
* @var integer
77+
*/
78+
protected $_eventType;
79+
80+
/**
81+
* Creates a new file system event
82+
*
83+
* @param integer $type The event type.
84+
* @param string $path The path to the file system entity
85+
* which raised the event
86+
*/
87+
public function __construct(int $type, string $path)
88+
{
89+
$this->_eventType = $type;
90+
$this->_path = $path;
91+
}
92+
}

0 commit comments

Comments
 (0)