Created
October 19, 2011 20:17
-
-
Save nerdsrescueme/1299541 to your computer and use it in GitHub Desktop.
Uninstantiable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Design namespace. This namespace is meant for abstract concepts and in most | |
* cases simply just interfaces that in someway structures the general design | |
* used in the core components. | |
* | |
* @package Atom | |
* @subpackage Library | |
*/ | |
namespace Atom\Design; | |
/** | |
* Uninstantiable Class | |
* | |
* This abstract class is used for classes that should not be instantiated | |
* or cloned. This includes fully static classes, informational classes... | |
* | |
* @package Atom | |
* @subpackage Library | |
*/ | |
abstract class Uninstantiable { | |
/** | |
* Throw an error if subclass construction is attempted | |
* | |
* @throws RuntimeException | |
*/ | |
final public function __construct() | |
{ | |
throw new \RuntimeException(__CLASS__.' is uninstantiable.'); | |
} | |
/** | |
* Throw an error if subclass cloning is attempted | |
* | |
* @throws RuntimeException | |
*/ | |
final public function __clone() | |
{ | |
throw new \RuntimeException(__CLASS__.' is uninstantiable.'); | |
} | |
} | |
/* End of file uninstantiable.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment