Last active
October 3, 2015 13:58
-
-
Save vojtasvoboda/2464594 to your computer and use it in GitHub Desktop.
Lazy getter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class HomepagePresenter extends BasePresenter | |
{ | |
/** @var EntriesModel */ | |
protected $entriesModel; | |
/** | |
* Lazy getter for EntriesModel | |
* @return EntriesModel | |
*/ | |
public function getEntries() | |
{ | |
if ($this->entriesModel === NULL) | |
$this->entriesModel = new EntriesModel(); | |
return $this->entriesModel; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment