ILIAS
trunk Revision v11.0_alpha-1723-g8e69f309bab
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
c
e
g
h
j
l
m
p
s
t
u
v
+
Enumerations
a
c
e
f
i
j
l
m
n
o
p
r
s
t
u
v
z
+
Enumerator
a
c
d
e
f
g
i
l
m
n
o
p
q
s
t
u
v
y
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
Enumerations
Enumerator
+
Files
File List
+
Globals
+
All
$
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
z
+
Functions
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
u
v
+
Variables
$
a
c
e
g
h
i
m
n
o
p
r
s
t
u
v
z
Enumerations
Enumerator
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Modules
Pages
DateComparator.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Filesystem\Finder\Comparator
;
22
23
use
Exception
;
24
use
InvalidArgumentException
;
25
31
class
DateComparator
extends
BaseComparator
32
{
33
public
function
__construct
(
string
$test)
34
{
35
if
(!preg_match(
'#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i'
, $test, $matches)) {
36
throw
new
InvalidArgumentException
(sprintf(
'Don\'t understand "%s" as a date test.'
, $test));
37
}
38
39
try
{
40
$date = new \DateTime($matches[2]);
41
$target
= $date->format(
'U'
);
42
}
catch
(
Exception
) {
43
throw
new
InvalidArgumentException
(sprintf(
'"%s" is not a valid date.'
, $matches[2]));
44
}
45
46
$operator = $matches[1] ??
'=='
;
47
48
if
(
'since'
=== $operator ||
'after'
=== $operator) {
49
$operator =
'>'
;
50
}
51
52
if
(
'until'
=== $operator ||
'before'
=== $operator) {
53
$operator =
'<'
;
54
}
55
56
$this->
setOperator
($operator);
57
$this->
setTarget
(
$target
);
58
}
59
}
ILIAS\Filesystem\Finder\Finder::Comparator\BaseComparator\setTarget
setTarget(string $target)
Definition:
BaseComparator.php:40
ILIAS\Filesystem\Finder\Comparator
Definition:
BaseComparator.php:21
ILIAS\Filesystem\Finder\Comparator\DateComparator
Definition:
DateComparator.php:31
ILIAS\Filesystem\Finder\Finder::Comparator\BaseComparator\$target
string $target
Definition:
BaseComparator.php:32
ILIAS\Filesystem\Finder\Comparator\DateComparator\__construct
__construct(string $test)
Definition:
DateComparator.php:33
ILIAS\Filesystem\Finder\Finder::Comparator\BaseComparator\setOperator
setOperator(string $operator)
Definition:
BaseComparator.php:50
InvalidArgumentException
Exception
components
ILIAS
Filesystem
src
Finder
Comparator
DateComparator.php
Generated on Sun Apr 6 2025 23:03:16 for ILIAS by
1.8.13 (using
Doxyfile
)