Browse files

Copied variability method into subclasses

  • Loading branch information...
1 parent 33c9a2d commit 6db925096245faf2126a76c1ee953d71d5780540 @giorgiosironi committed Feb 13, 2012
Showing with 18 additions and 2 deletions.
  1. +18 −2 ExtractHierarchy.php
View
20 ExtractHierarchy.php
@@ -16,8 +16,8 @@ public function testATopicInEvidenceDisplaysItselfAsStronger()
class Topic
{
- private $title;
- private $inEvidence;
+ protected $title;
+ protected $inEvidence;
public static function fromFields($title, $inEvidence = false)
{
@@ -54,8 +54,24 @@ protected function decoratedTitleText()
class OrdinaryTopic extends Topic
{
+ protected function decoratedTitleText()
+ {
+ if ($this->inEvidence) {
+ return "<strong>$this->title</strong>";
+ } else {
+ return $this->title;
+ }
+ }
}
class InEvidenceTopic extends Topic
{
+ protected function decoratedTitleText()
+ {
+ if ($this->inEvidence) {
+ return "<strong>$this->title</strong>";
+ } else {
+ return $this->title;
+ }
+ }
}

0 comments on commit 6db9250

Please sign in to comment.