1 | <?php |
||
52 | class DateCompare implements FilterInterface |
||
53 | { |
||
54 | |||
55 | /** |
||
56 | * Check against the date of the **last change of the content** of a file |
||
57 | */ |
||
58 | const DATE_M = 'MTime'; |
||
59 | |||
60 | /** |
||
61 | * Check against the date of the **last change of the metadata** of a file |
||
62 | */ |
||
63 | const DATE_C = 'CTime'; |
||
64 | |||
65 | /** |
||
66 | * Check against the date of the **last access** of the file |
||
67 | */ |
||
68 | const DATE_A = 'ATime'; |
||
69 | |||
70 | /** |
||
71 | * Check for equality |
||
72 | */ |
||
73 | const CHECK_EQUAL = 1; |
||
74 | |||
75 | /** |
||
76 | * Check whether the files date is **before** the reference date |
||
77 | */ |
||
78 | const CHECK_BEFORE = 2; |
||
79 | |||
80 | /** |
||
81 | * Check whether the files date is **after** the reference date |
||
82 | */ |
||
83 | const CHECK_AFTER = 3; |
||
84 | |||
85 | /** |
||
86 | * @var \DateTimeInterface $compareDate |
||
87 | */ |
||
88 | protected $compareDate = null; |
||
89 | |||
90 | /** |
||
91 | * @var string $compareType |
||
92 | */ |
||
93 | protected $compareType = null; |
||
94 | |||
95 | /** |
||
96 | * @var int compareAction |
||
97 | */ |
||
98 | protected $compareAction = null; |
||
99 | |||
100 | /** |
||
101 | * Create an instance of the comparator |
||
102 | * |
||
103 | * @param DateTime $compareDate |
||
104 | * @param string $compareType |
||
105 | * @param int $compareAction |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | 11 | public function __construct(\DateTimeInterface $compareDate, $compareType = self::DATE_M, $compareAction = self::CHECK_EQUAL) |
|
120 | |||
121 | /** |
||
122 | * Check whether the given file should be included in the final Filelist |
||
123 | * |
||
124 | * @param \SplFileInfo $file |
||
125 | * |
||
126 | * @return boolean |
||
127 | */ |
||
128 | 7 | public function filter(\SplFileInfo $file) |
|
147 | } |
||
148 |