Skip to content

Instantly share code, notes, and snippets.

View jacobwalkr's full-sized avatar

Jacob Walker jacobwalkr

View GitHub Profile
@jacobwalkr
jacobwalkr / viewfactory.class.php
Last active December 11, 2015 17:28
ViewFactory class file. I'd like three classes that have the same logic as ViewFactory, but that implement their own build() logic. Is it possible to do it so that all three sub-classes are ViewFactorys? I'm especially trying to avoid copying and pasting the code because that seems to contradict OOP principles.
<?php
abstract class ViewFactory
{
private $view;
private $viewParameters;
private $database;
public function __construct($_database)
{
$this->view = new View(); // Defined elsewhere