Solution Review: Dependency Injection
Let's look at the solution of the Dependency Injection challenge.
We'll cover the following...
We'll cover the following...
Solution: Task 1
Explanation
- Line 2: We write the
Articleclass with protected properties$titleand$author. - Line 6: We add the
__construct()method to theArticleclass, which gets two parameters and sets the values of$titleand$authorproperties. - Line 11: We add the
getTitle()getter method to theArticleclass, which returns the$title