Author: grobmeier
Date: Fri May 22 14:50:31 2009
New Revision: 777552

URL: http://svn.apache.org/viewvc?rev=777552&view=rev
Log:
LOG4PHP-23: moved to php5 syntax

Modified:
    incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php

Modified: incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php
URL: 
http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php?rev=777552&r1=777551&r2=777552&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php 
(original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php Fri 
May 22 14:50:31 2009
@@ -1,5 +1,5 @@
 <?php
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -21,13 +21,6 @@
  */
 
 /**
- * Default conversion Pattern
- */
-define('LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_CONVERSION_PATTERN', '%m%n');
-
-define('LOG4PHP_LOGGER_PATTERN_LAYOUT_TTCC_CONVERSION_PATTERN',    '%r [%t] %p 
%c %x - %m%n');
-
-/**
  * A flexible layout configurable with pattern string.
  * 
  * <p>The goal of this class is to {...@link format()} a {...@link 
LoggerLoggingEvent} and return the results as a string.
@@ -149,73 +142,61 @@
  * @since 0.3 
  */
 class LoggerLayoutPattern extends LoggerLayout {
+       /** Default conversion Pattern */
+       const DEFAULT_CONVERSION_PATTERN = '%m%n';
+
+       /** Default conversion TTCC Pattern */
+       const TTCC_CONVERSION_PATTERN = '%r [%t] %p %c %x - %m%n';
+
+       /** @var string output buffer appended to when format() is invoked */
+       private $sbuf;
 
-  /**
-   * @var string output buffer appended to when format() is invoked
-   */
-  var $sbuf;
-
-  /**
-   * @var string
-   */
-  var $pattern;
-
-  /**
-   * @var LoggerPatternConverter head chain
-   */   
-  var $head;
-
-  var $timezone;
-
-    /**
-     * Constructs a PatternLayout using the 
-     * {...@link LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_LAYOUT_PATTERN}.
-     * The default pattern just produces the application supplied message.
-     */
-    function LoggerLayoutPattern($pattern = null) {
-        if ($pattern === null) {    
-            
$this->LoggerLayoutPattern(LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_CONVERSION_PATTERN);
-        } else {
-            $this->pattern = $pattern;
-        }                
-    }
-    
-    /**
-     * Set the <b>ConversionPattern</b> option. This is the string which
-     * controls formatting and consists of a mix of literal content and
-     * conversion specifiers.
-     */
-    function setConversionPattern($conversionPattern) {
-        $this->pattern = $conversionPattern;
-        $patternParser = new LoggerPatternParser($this->pattern);
-        $this->head = $patternParser->parse();
-    }
-    
-    /**
-     * @return string Returns the value of the <b>ConversionPattern</b> option.
-     */
-    function getConversionPattern() {
-        return $this->pattern;
-    }
-    
-    function ignoresThrowable() { 
-        return true; 
-    }
-    
-    /**
-     * Produces a formatted string as specified by the conversion pattern.
-     *
-     * @param LoggerLoggingEvent $event
-     * @return string
-     */
-    function format(LoggerLoggingEvent $event) {
-        // Reset working stringbuffer
-        $this->sbuf = '';
-        $c = $this->head;
-        while($c !== null) {
-            $c->format($this->sbuf, $event);
-            $c = $c->next;
-        }
-        return $this->sbuf;
-    }
-}
+       /** @var string */
+       private $pattern;
+
+       /** @var LoggerPatternConverter head chain */
+       private $head;
+
+       private $timezone;
+
+       /**
+        * Constructs a PatternLayout using the 
+        * {...@link DEFAULT_LAYOUT_PATTERN}.
+        * The default pattern just produces the application supplied message.
+        */
+       public function __construct($pattern = null) {
+               if ($pattern === null) {
+                       $this->pattern = self :: DEFAULT_CONVERSION_PATTERN;
+               } else {
+                       $this->pattern = $pattern;
+               }
+       }
+
+       /**
+        * Set the <b>ConversionPattern</b> option. This is the string which
+        * controls formatting and consists of a mix of literal content and
+        * conversion specifiers.
+        */
+       public function setConversionPattern($conversionPattern) {
+               $this->pattern = $conversionPattern;
+               $patternParser = new LoggerPatternParser($this->pattern);
+               $this->head = $patternParser->parse();
+       }
+
+       /**
+        * Produces a formatted string as specified by the conversion pattern.
+        *
+        * @param LoggerLoggingEvent $event
+        * @return string
+        */
+       public function format(LoggerLoggingEvent $event) {
+               // Reset working stringbuffer
+               $this->sbuf = '';
+               $c = $this->head;
+               while ($c !== null) {
+                       $c->format($this->sbuf, $event);
+                       $c = $c->next;
+               }
+               return $this->sbuf;
+       }
+}
\ No newline at end of file


Reply via email to