Elgg  Version 3.0
TimeUsing.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg;
4 
5 use DateTime;
6 
12 trait TimeUsing {
13 
17  private $time;
18 
27  public function getCurrentTime($modifier = '') {
28  $time = $this->time ? $this->time : new DateTime();
29  $time = clone $time;
30  if ($modifier) {
31  $time->modify($modifier);
32  }
33  return $time;
34  }
35 
42  public function setCurrentTime(DateTime $time = null) {
43  if (!$time) {
44  $time = new DateTime();
45  }
46  $this->time = clone $time;
47  }
48 }
getCurrentTime($modifier= '')
Get the (cloned) time.
Definition: TimeUsing.php:27
Configuration exception.
if(!$entity instanceof ElggEntity) $time
Definition: time.php:21
setCurrentTime(DateTime $time=null)
Set the current time.
Definition: TimeUsing.php:42