Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
#490 adding flush to profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Bannert committed Oct 4, 2017
1 parent 9e38ef9 commit 949ede6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Viserio/Component/Contract/Profiler/DataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,11 @@ public function getMenu(): array;
* @return string
*/
public function getMenuPosition(): string;

/**
* Resets this data collector to its initial state.
*
* @return void
*/
public function flush(): void;
}
6 changes: 6 additions & 0 deletions src/Viserio/Component/Contract/Profiler/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,10 @@ public function setUrlGenerator(UrlGeneratorContract $urlGenerator): Profiler;
* @return null|\Viserio\Component\Contract\Routing\UrlGenerator
*/
public function getUrlGenerator(): ?UrlGeneratorContract;

/**
*
* @return void
*/
public function flush(): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ public function getOrphanedEvents(): array
return $this->orphanedEvents;
}

/**
* Resets this to its initial state.
*
* @return void
*/
public function flush(): void
{
$this->called = [];
}

/**
* @param string $eventName
* @param $listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,14 @@ public function getPanel(): string
],
]);
}

/**
* {@inheritdoc}
*/
public function flush(): void
{
$this->data = array();

$this->eventManager->flush();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ public function getData(): array
return $this->data;
}

/**
+ * {@inheritdoc}
+ */
public function flush(): void
{
$this->data = [];
}

/**
* Add measurement to float time.
*
Expand Down
10 changes: 10 additions & 0 deletions src/Viserio/Component/Profiler/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ public function getAssetsRenderer(): AssetsRendererContract
return $this->assetsRenderer;
}

/**
* {@inheritdoc}
*/
public function flush(): void
{
foreach ($this->collectors as $collector) {
$collector->flush();
}
}

/**
* Injects the web debug toolbar into the given Response.
*
Expand Down

0 comments on commit 949ede6

Please sign in to comment.