Advertisement
fruffl

Untitled

Jan 13th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1.  
  2.         public static function __callStatic($name, array $args = array())
  3.         {
  4.             $name = strtolower($name);
  5.            
  6.             switch($name):
  7.                 case 'equals':
  8.                     if(FALSE === isset($args[0]))
  9.                         throw new Exception('Missing argument 1.');
  10.                     if(FALSE === isset($args[1]))
  11.                         throw new Exception('Missing argument 2.');
  12.                     if(FALSE === ($args[0] instanceOf Object))
  13.                         throw new Exception('Argument 1 is not a Object');
  14.                     if(FALSE === ($args[1] instanceOf Object))
  15.                         throw new Exception('Argument 2 is not a Object');
  16.                    
  17.                     return $args[0]->getHashCode() === $args[1]->getHashCode();
  18.                     break;
  19.             endswitch;
  20.                            
  21.             throw new \Exception('STATIC Method '.get_called_class().'::'.$name.'() is not implemented.');
  22.         }
  23.        
  24.         public function __call($name, array $args = array())
  25.         {
  26.             $name = strtolower($name);
  27.            
  28.             switch($name):
  29.                 case 'equals':
  30.                     if(FALSE === isset($args[0]))
  31.                         throw new Exception('Missing argument 1.');
  32.                     if(FALSE === ($args[0] instanceOf Object))
  33.                         throw new Exception('Argument 1 is not a Object');
  34.                    
  35.                     return $this->getHashCode() === $args[0]->getHashCode();
  36.                     break;
  37.             endswitch;
  38.            
  39.             throw new \Exception('Method '.get_called_class().'::'.$name.'() is not implemented.');
  40.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement