Skip to content

Commit 9dfd4c2

Browse files
author
ahmard
committed
Merge branch 'dev' of github.com:phprtc/watcher into 6-ability-to-ignore-path
2 parents 9752d6d + 846b718 commit 9dfd4c2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
processIsolation="false"
1010
>
1111
<testsuites>
12-
<testsuite name="QuickRoute Tests">
12+
<testsuite name="PHP RTC Watcher Tests">
1313
<directory>./tests</directory>
1414
</testsuite>
1515
</testsuites>

src/Watcher.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function inotifyPerformAdditionalOperations(array $inotifyEvent): void
7070
$eventInfo = new EventInfo($inotifyEvent, $this->watchedItems[$inotifyEvent['wd']]);
7171
// Register this path also if it's directory
7272
if ($eventInfo->getWatchedItem()->isDir()) {
73-
$this->recursivelyRegisterInotifyEvent($eventInfo->getWatchedItem()->getFullPath());
73+
$this->inotifyWatchPathRecursively($eventInfo->getWatchedItem()->getFullPath());
7474
}
7575

7676
return;
@@ -81,7 +81,7 @@ protected function inotifyPerformAdditionalOperations(array $inotifyEvent): void
8181
$eventInfo = new EventInfo($inotifyEvent, $this->watchedItems[$inotifyEvent['wd']]);
8282
// Remove this path also if it's directory
8383
if ($eventInfo->getWatchedItem()->isDir()) {
84-
$this->removeInotifyEvent($eventInfo);
84+
$this->inotifyRemovePathWatch($eventInfo);
8585
}
8686
}
8787
}
@@ -93,23 +93,23 @@ protected function inotifyPerformAdditionalOperations(array $inotifyEvent): void
9393
* @param string $path
9494
* @return void
9595
*/
96-
protected function recursivelyRegisterInotifyEvent(string $path): void
96+
protected function inotifyWatchPathRecursively(string $path): void
9797
{
9898
if (is_dir($path)) {
9999
$iterator = new RecursiveDirectoryIterator($path);
100100

101101
// Loop through files
102102
foreach (new RecursiveIteratorIterator($iterator) as $file) {
103103
if ($file->isDir()/**&& !in_array($file->getRealPath(), $this->watchedItems)**/) {
104-
$this->registerInotifyEvent($file->getRealPath());
104+
$this->inotifyWatchPath($file->getRealPath());
105105
}
106106
}
107107

108108
return;
109109
}
110110

111111
// Register file watch
112-
$this->registerInotifyEvent($path);
112+
$this->inotifyWatchPath($path);
113113
}
114114

115115
/**
@@ -118,7 +118,7 @@ protected function recursivelyRegisterInotifyEvent(string $path): void
118118
* @param string $path
119119
* @return void
120120
*/
121-
protected function registerInotifyEvent(string $path): void
121+
protected function inotifyWatchPath(string $path): void
122122
{
123123
$descriptor = inotify_add_watch(
124124
$this->getInotifyFD(),
@@ -138,7 +138,7 @@ protected function registerInotifyEvent(string $path): void
138138
* @param EventInfo $eventInfo
139139
* @return void
140140
*/
141-
protected function removeInotifyEvent(EventInfo $eventInfo)
141+
protected function inotifyRemovePathWatch(EventInfo $eventInfo)
142142
{
143143
// Stop watching event
144144
inotify_rm_watch($this->getInotifyFD(), $eventInfo->getWatchDescriptor());
@@ -209,7 +209,7 @@ public function watch(): void
209209
{
210210
// Register paths
211211
foreach ($this->paths as $path) {
212-
$this->recursivelyRegisterInotifyEvent($path);
212+
$this->inotifyWatchPathRecursively($path);
213213
}
214214

215215
// Set up a new event listener for inotify read events

0 commit comments

Comments
 (0)