Elgg  Version master
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  }
32  return $time;
33  }
42  public function setCurrentTime(\DateTime $time = null) {
43  $time = $time ?? new \DateTime();
44  $this->time = clone $time;
45  }
54  public function resetCurrentTime(): void {
55  unset($this->time);
56  }
57 }
setCurrentTime(\DateTime $time=null)
Set the current time.
Definition: TimeUsing.php:42
Reset the current time Use after the time has been set with setCurrentTime and it no longer needs to ...
Definition: TimeUsing.php:54
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
Extension of the DateTime class to support formatting a date using the locale.
Definition: DateTime.php:12