Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/02/2009, 14:12
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: impedir proceso de un objeto

Fácil:
Código php:
Ver original
  1. class foo {
  2.      public function __construct($bar) {
  3.              if(empty($bar)) {
  4.                     throw new Exception('$bar is empty');
  5.              }
  6.      }
  7.  
  8.      public function something() {
  9.               echo "foo::something();";
  10.      }
  11. }
  12.  
  13. try {
  14.       $foo = new foo(null);
  15.       $foo->something;
  16. } catch( Exception $e ) {
  17.       echo "ups an error: " . $e->getMessage();
  18. }

Lee sobre excepciones para eso están.

Saludos