contao/module-core — pull request #19 by leofeyer (2014-11-07 08:42:55+00:00)
Title: Use a trait to add the template inheritance logic

To me it still feels wrong that both the `Template` and the `Widget` class inherit from `View`. The two classes just aren't the same, e.g. there are the following methods:

- `Template::parse()`
- `Template::output()`
- `Template::getResponse()`

But only one of these methods is also in the `View` class:

- `View::parse()`

IMHO, this is a typical trait case. The PHP manual says:

> A Trait is intended to reduce some limitations of single inheritance by enabling a developer **to reuse sets of methods** freely in **several independent classes** living in different class hierarchies.

Horizontal composition of behavior is exactly what we need here to keep both classes separat from each other and still add the same shared logic to both of them.

@contao/developers Please vote on this PR.