Folder.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace Lib\Imap\Parse\Folder;
/**
 * 文件夹
 * @author:dc
 * @time 2024/9/20 9:33
 * Class Folder
 * @package Lib\Imap\Parse
 */
class Folder{
    /**
     * 文件夹名称 utf-7编码 全路径
     * @var string
     */
    public string $folder;
    /**
     * 是否可以选择
     * @var bool
     */
    public bool $isSelect;
    /**
     * 上级解析结构
     * @var Folders
     */
    protected Folders $parent;
    /**
     * 标签
     * 有些邮箱把发件箱 send 改成了 send message 这里就有send标签,代表这个文件夹是发件箱
     * 草稿,垃圾箱。回收站,等默认几个文件夹都有可能被更改
     * @var array
     */
    public array $flags;
    public function __construct(string $folder,array $flags,bool $isSelect,Folders $parent)
    {
        $this->folder = $folder;
        $this->flags = $flags;
        $this->isSelect = $isSelect;
        $this->parent = $parent;
    }
    /**
     * 把文件夹编码转换成utf8的
     * @author:dc
     * @time 2024/9/20 10:00
     */
    public function getParseFolder(){
        return mb_iconv($this->folder, 'UTF-8', 'UTF7-IMAP');
    }
    /**
     * 获取子目录
     * @return static[]
     * @author:dc
     * @time 2024/9/20 11:55
     */
    public function getChild():array {
        return $this->parent->findChild($this);
    }
}