Skip to content

Instantly share code, notes, and snippets.

View tkouleris's full-sized avatar
:octocat:
Infinite Refactor

Thodoris Kouleris tkouleris

:octocat:
Infinite Refactor
View GitHub Profile
@tkouleris
tkouleris / Iterator.php
Created September 17, 2017 04:18
Iterator Design Pattern
<?php
class IntegerRange implements Iterator{
private $start;
private $end;
private $current;
public function __construct($start, $end){
$this->start = $start;
$this->end = $end;
$this->current = $start;
}
@tkouleris
tkouleris / Composite.php
Last active September 17, 2017 15:06
Composite Design Pattern
<?php
abstract class SongComposite{
public function songInfo(){}
}
class Song extends SongComposite{
private $songTitle;
private $songBand;
public function __construct($sTitle, $sBand){
$this->songTitle = $sTitle;
@tkouleris
tkouleris / Observer.php
Created October 8, 2017 16:11
Observe Pattern Implementation
<?php
/*
Observer Design Pattern - Weather Station Example
*/
abstract class Observer{
public function update(){}
}
abstract class Subject{