diff --git a/php/1-bad-practices/src/creating-real-objects.php b/php/1-bad-practices/src/creating-real-objects.php index 427f391..2c0e1ad 100644 --- a/php/1-bad-practices/src/creating-real-objects.php +++ b/php/1-bad-practices/src/creating-real-objects.php @@ -2,9 +2,15 @@ class Renderer { + private $formatter; + + public function __construct( Formatter $formatter ) { + + $this->formatter = $formatter; + } + public function render_formatted_data( $data ) { - $formatter = new Formatter(); - echo $formatter->format( $data ); + echo $this->formatter->format( $data ); } }