properties['verbosity'] = $value; break; } return parent::__set( $name, $value ); } /** * Property get */ public function __get( $name ) { switch ( $name ) { case 'verbosity': return $this->properties['verbosity']; break; } return parent::__get( $name ); } /** * Constructs the ezcLogMessage instance and parses a message. * * @param string $message The message given to the trigger_error * method. * @param int $severity The severity used by PHP. * @param string $defaultSource Use this source when not given in the * message itself. * @param string $defaultCategory Use this category when not give in the * message itself. * */ public function __construct( $message, $severity, $defaultSource, $defaultCategory ) { $this->parseMessage( $message, $severity, $defaultSource, $defaultCategory ); } /** * Parses the message and sets the properties according to the parsed message. * * @param string $message The message given to the trigger_error * method. * @param int $severity The severity used by PHP. * @param string $defaultSource Use this source when not given in the * message itself. * @param string $defaultCategory Use this category when not give in the * message itself. */ public function parseMessage( $message, $severity, $defaultSource, $defaultCategory ) { preg_match( "/^\s*(?:\[([^,\]]*)(?:,\s(.*))?\])?\s*(?:(\d+):)?\s*(.*)$/", $message, $matches ); $this->message = ( strcmp( $matches[4], "" ) == 0 ? false : $matches[4] ); $this->verbosity = ( strcmp( $matches[3], "" ) == 0 ? false : $matches[3] ); if ( strlen( $matches[2] ) == 0 ) { $this->category = ( strcmp( $matches[1], "" ) == 0 ? $defaultCategory : $matches[1] ); $this->source = $defaultSource; } else { $this->category = $matches[2]; $this->source = $matches[1]; } switch ( $severity ) { case E_USER_NOTICE: $this->severity = ezcLog::NOTICE; break; case E_USER_WARNING: $this->severity = ezcLog::WARNING; break; case E_USER_ERROR: $this->severity = ezcLog::ERROR; break; default: $this->severity = false; } } } ?>