Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
DateTime.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\contents\transformation\transformers
;
4
5
use
Ubiquity\contents\transformation\TransformerInterface
;
6
use
Ubiquity\contents\transformation\TransformerViewInterface
;
7
use
Ubiquity\contents\transformation\TransformerFormInterface
;
8
18
class
DateTime
implements
TransformerInterface
,
TransformerViewInterface
,
TransformerFormInterface
{
19
20
public
static
function
transform
($value) {
21
if
($value !=
null
)
22
return
new \DateTime ( $value );
23
}
24
25
public
static
function
reverse
($value) {
26
if
($value instanceof \
DateTime
) {
27
return
$value->format (
'Y-m-d H:i:s'
);
28
}
29
return
$value;
30
}
31
32
public
static
function
toView
($value) {
33
return
self::reverse
( $value );
34
}
35
36
public
static
function
toForm
($value) {
37
if
($value instanceof \
DateTime
)
38
return
$value->format (
'Y-m-d\TH:i:s'
);
39
return
date (
'Y-m-d\TH:i:s'
, strtotime ( $value ) );
40
}
41
}
Ubiquity\contents\transformation\transformers\DateTime
Transform a mysql date to a php DateTime.
Definition
DateTime.php:18
Ubiquity\contents\transformation\transformers\DateTime\toView
static toView($value)
Transforms normalized data to view data.
Definition
DateTime.php:32
Ubiquity\contents\transformation\transformers\DateTime\transform
static transform($value)
Transforms model data to normalized data.
Definition
DateTime.php:20
Ubiquity\contents\transformation\transformers\DateTime\toForm
static toForm($value)
Transforms normalized data to form data.
Definition
DateTime.php:36
Ubiquity\contents\transformation\transformers\DateTime\reverse
static reverse($value)
Reverse data transforming to model data.
Definition
DateTime.php:25
Ubiquity\contents\transformation\TransformerFormInterface
Transform an instance for being used in a form.
Definition
TransformerFormInterface.php:18
Ubiquity\contents\transformation\TransformerInterface
Transform an instance.
Definition
TransformerInterface.php:15
Ubiquity\contents\transformation\TransformerViewInterface
Transform an instance for being displayed in a view.
Definition
TransformerViewInterface.php:15
Ubiquity\contents\transformation\transformers
Definition
Crypt.php:2
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity
src
Ubiquity
contents
transformation
transformers
DateTime.php
Generated on Sun Dec 10 2023 15:04:13 for
Ubiquity
by
doxygen
1.9.8