protected function watchAllDirectories($directory)
    {
        $directory = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;

        if (! $this->watchDirectory($directory)) {
            return false;
        }

        $names = scandir($directory);

        foreach ($names as $name) {
            if (in_array($name, ['.', '..'], true)) {
                continue;
            }

            $subdirectory = $directory . $name;

            if (is_dir($subdirectory)) {
                $this->watchAllDirectories($subdirectory);
            }
        }

        return true;
    }