Elgg  Version 4.3
Go to the documentation of this file.
1 <?php
3 namespace Elgg\Traits;
10 trait TimeUsing {
15  private $time;
25  public function getCurrentTime($modifier = '') {
26  $time = $this->time ?? new \DateTime();
27  $time = clone $time;
28  if ($modifier) {
29  $time->modify($modifier);
30  }
31  return $time;
32  }
41  public function setCurrentTime(\DateTime $time = null) {
42  $time = $time ?? new \DateTime();
43  $this->time = clone $time;
44  }
53  public function resetCurrentTime(): void {
54  unset($this->time);
55  }
56 }
setCurrentTime(\DateTime $time=null)
Set the current time.
Definition: TimeUsing.php:41
Reset the current time Use after the time has been set with setCurrentTime and it no longer needs to ...
Definition: TimeUsing.php:53
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
if(!$annotation instanceof ElggAnnotation) $time
Definition: time.php:20
getCurrentTime($modifier= '')
Get the (cloned) time.
Definition: TimeUsing.php:25