Created
July 3, 2012 13:54
-
-
Save msanroman/3039826 to your computer and use it in GitHub Desktop.
tdd-ed code
This file contains hidden or 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
public function findMetasFor($photo = null) { | |
if ($photo != null) | |
return $this->findMetasForShow($photo); | |
else return $this->findMetasForCategory(); | |
} | |
private function findMetasForCategory() { | |
if ($this->category != null) | |
return $this->metainformation[$this->category]; | |
else return $this->metainformation["all_{$this->locale}"]; | |
} | |
private function findMetasForShow($photo) { | |
$album = $this->galleries->findGalleryAlbumByCategoryAndAlbumPermalink($this->category, $this->permalink); | |
$metas = $this->metainformation["shots_{$this->locale}"]; | |
foreach($metas as $key => $meta) { | |
if ($key == 'og:image') | |
$meta->setEntity($photo); | |
else $meta->setEntity($album); | |
} | |
return $metas; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment