Created
November 11, 2009 13:20
-
-
Save romac/231940 to your computer and use it in GitHub Desktop.
A PHP 5 class miming Objective-C's nil object.
This file contains hidden or 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 | |
| /* | |
| * Copyright (c) 2009, Romain Ruetschi <[email protected]> | |
| * Code licensed under the BSD License: | |
| * See http://opensource.org/licenses/bsd-license.php | |
| */ | |
| final class RRNil | |
| { | |
| private static $_instance = NULL; | |
| public static function getInstance() | |
| { | |
| if( !is_object( self::$_instance ) ) | |
| { | |
| self::$_instance = new self(); | |
| } | |
| return self::$_instance; | |
| } | |
| private function __construct() | |
| { | |
| } | |
| public function __clone() | |
| { | |
| return $this; | |
| } | |
| public function __wakeup() | |
| { | |
| return $this; | |
| } | |
| public function __get( $name ) | |
| { | |
| return $this; | |
| } | |
| public function __set( $name, $value ) | |
| { | |
| return $this; | |
| } | |
| public function __isset( $name ) | |
| { | |
| return FALSE; | |
| } | |
| public function __unset( $name ) | |
| { | |
| return; | |
| } | |
| public function __call( $methodName, $arguments = array() ) | |
| { | |
| return $this; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment