Elgg  Version master
Profilable.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Traits\Debug;
4 
5 use Elgg\Timer;
6 
12 trait Profilable {
13 
14  private Timer $timer;
15 
22  public function setTimer(Timer $timer) {
23  $this->timer = $timer;
24  }
25 
31  public function hasTimer(): bool {
32  return isset($this->timer);
33  }
34 
43  protected function beginTimer(array $keys): void {
44  if (!$this->hasTimer()) {
45  return;
46  }
47 
48  $this->timer->begin($keys);
49  }
50 
59  protected function endTimer(array $keys): void {
60  if (!$this->hasTimer()) {
61  return;
62  }
63 
64  $this->timer->end($keys);
65  }
66 }
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
Capture timing info for profiling.
Definition: Timer.php:10
hasTimer()
Has a timer been set.
Definition: Profilable.php:31
$keys
Definition: access.php:31
$timer
Definition: pending.php:28
setTimer(Timer $timer)
Set a timer that should collect begin/end times for events.
Definition: Profilable.php:22
beginTimer(array $keys)
Start the timer (when enabled)
Definition: Profilable.php:43
endTimer(array $keys)
Ends the timer (when enabled)
Definition: Profilable.php:59