Skip to content

Instantly share code, notes, and snippets.

@xabbuh
Created September 5, 2015 11:31
Show Gist options
  • Save xabbuh/480c98a11b78285737ce to your computer and use it in GitHub Desktop.
Save xabbuh/480c98a11b78285737ce to your computer and use it in GitHub Desktop.
<?php
class Status
{
const YES = 'yes';
const NO = 'no';
const MAYBE = 'maybe';
private static $instances = array();
private $status;
public function __construct($status)
{
$this->status = $status;
}
public function getInstance($status)
{
if (!isset(self::$instances[$status])) {
self::$instances[$status] = new Satus($status);
}
return self::$instances[$status];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment