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

Commit

Permalink
Mise en "cache" du matchingEntries
Browse files Browse the repository at this point in the history
  • Loading branch information
dipston committed Jun 26, 2013
1 parent 77b601d commit dd3d92f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Lists/EntryList.php
Expand Up @@ -18,6 +18,11 @@ class EntryList
*/
protected $matchingResponse;

/**
* @var array $matchingEntries Array of matching entries
*/
protected $matchingEntries;

/**
* Constructor
*
Expand Down Expand Up @@ -55,12 +60,13 @@ public function isAllowed($entry)
*/
public function getMatchingEntries()
{
$matchingEntries = array();

foreach ($this->entries as $entry) {
$matchingEntries = array_merge($matchingEntries, $entry->getMatchingEntries());
if ($this->matchingEntries === null) {
$this->matchingEntries = array();
foreach ($this->entries as $entry) {
$this->matchingEntries = array_merge($this->matchingEntries, $entry->getMatchingEntries());
}
}

return $matchingEntries;
return $this->matchingEntries;
}
}

0 comments on commit dd3d92f

Please sign in to comment.