Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Copied variability method into subclasses

  • Loading branch information...
commit 6db925096245faf2126a76c1ee953d71d5780540 1 parent 33c9a2d
Giorgio Sironi authored
Showing with 18 additions and 2 deletions.
  1. +18 −2 ExtractHierarchy.php
20 ExtractHierarchy.php
View
@@ -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;
+ }
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.