logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject [36/43] Fixed code formatting to conform to PSR-2
Date Thu, 28 Nov 2013 16:04:06 GMT
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Configuration/DefaultConfigurator.php
----------------------------------------------------------------------
diff --git a/src/Configuration/DefaultConfigurator.php b/src/Configuration/DefaultConfigurator.php
index 9e4e6bd..7ef223b 100644
--- a/src/Configuration/DefaultConfigurator.php
+++ b/src/Configuration/DefaultConfigurator.php
@@ -36,24 +36,24 @@ use Apache\Log4php\LoggerException;
  */
 class DefaultConfigurator implements ConfiguratorInterface
 {
-	/** XML configuration file format. */
-	const FORMAT_XML = 'xml';
+    /** XML configuration file format. */
+    const FORMAT_XML = 'xml';
 
-	/** PHP configuration file format. */
-	const FORMAT_PHP = 'php';
+    /** PHP configuration file format. */
+    const FORMAT_PHP = 'php';
 
-	/** INI (properties) configuration file format. */
-	const FORMAT_INI = 'ini';
+    /** INI (properties) configuration file format. */
+    const FORMAT_INI = 'ini';
 
-	/** Defines which adapter should be used for parsing which format. */
-	private $adapters = array(
-		self::FORMAT_XML => 'XmlAdapter',
-		self::FORMAT_INI => 'IniAdapter',
-		self::FORMAT_PHP => 'PhpAdapter',
-	);
+    /** Defines which adapter should be used for parsing which format. */
+    private $adapters = array(
+        self::FORMAT_XML => 'XmlAdapter',
+        self::FORMAT_INI => 'IniAdapter',
+        self::FORMAT_PHP => 'PhpAdapter',
+    );
 
-	/** Default configuration; used if no configuration file is provided. */
-	private static $defaultConfiguration = array(
+    /** Default configuration; used if no configuration file is provided. */
+    private static $defaultConfiguration = array(
         'threshold' => 'ALL',
         'rootLogger' => array(
             'level' => 'DEBUG',
@@ -64,449 +64,475 @@ class DefaultConfigurator implements ConfiguratorInterface
                 'class' => '\\Apache\\Log4php\\Appenders\\EchoAppender'
             ),
         ),
-	);
-
-	/** Holds the appenders before they are linked to loggers. */
-	private $appenders = array();
-
-	/**
-	 * Configures log4php based on the given configuration. The input can
-	 * either be a path to the config file, or a PHP array holding the
-	 * configuration.
-	 *
-	 * If no configuration is given, or if the given configuration cannot be
-	 * parsed for whatever reason, a warning will be issued, and log4php
-	 * will use the default configuration contained in
-	 * {@link $defaultConfiguration}.
-	 *
-	 * @param Hierarchy $hierarchy The hierarchy on which to perform
-	 * 		the configuration.
-	 * @param string|array $input Either path to the config file or the
-	 * 		configuration as an array. If not set, default configuration
-	 * 		will be used.
-	 */
-	public function configure(Hierarchy $hierarchy, $input = null) {
-		$config = $this->parse($input);
-		$this->doConfigure($hierarchy, $config);
-	}
-
-	/**
-	 * Parses the given configuration and returns the parsed configuration
-	 * as a PHP array. Does not perform any configuration.
-	 *
-	 * If no configuration is given, or if the given configuration cannot be
-	 * parsed for whatever reason, a warning will be issued, and the default
-	 * configuration will be returned ({@link $defaultConfiguration}).
-	 *
-	 * @param string|array $input Either path to the config file or the
-	 * 		configuration as an array. If not set, default configuration
-	 * 		will be used.
-	 * @return array The parsed configuration.
-	 */
-	public function parse($input) {
-		// No input - use default configuration
-		if (!isset($input)) {
-			$config = self::$defaultConfiguration;
-		}
-
-		// Array input - contains configuration within the array
-		else if (is_array($input)) {
-			$config = $input;
-		}
-
-		// String input - contains path to configuration file
-		else if (is_string($input)) {
-			try {
-				$config = $this->parseFile($input);
-			} catch (LoggerException $e) {
-				$this->warn("Configuration failed. " . $e->getMessage() . " Using default configuration.");
-				$config = self::$defaultConfiguration;
-			}
-		}
-
-		// Anything else is an error
-		else {
-			$this->warn("Invalid configuration param given. Reverting to default configuration.");
-			$config = self::$defaultConfiguration;
-		}
-
-		return $config;
-	}
-
-	/**
-	 * Returns the default log4php configuration.
-	 * @return array
-	 */
-	public static function getDefaultConfiguration() {
-		return self::$defaultConfiguration;
-	}
-
-	/**
-	 * Loads the configuration file from the given URL, determines which
-	 * adapter to use, converts the configuration to a PHP array and
-	 * returns it.
-	 *
-	 * @param string $url Path to the config file.
-	 * @return The configuration from the config file, as a PHP array.
-	 * @throws LoggerException If the configuration file cannot be loaded, or
-	 * 		if the parsing fails.
-	 */
-	private function parseFile($url) {
-
-		if (!file_exists($url)) {
-			throw new LoggerException("File not found at [$url].");
-		}
-
-		$type = $this->getConfigType($url);
-		$adapterClass = "Apache\\Log4php\\Configuration\\Adapters\\" . $this->adapters[$type];
-
-		$adapter = new $adapterClass();
-		return $adapter->convert($url);
-	}
-
-	/** Determines configuration file type based on the file extension. */
-	private function getConfigType($url) {
-		$info = pathinfo($url);
-		$ext = strtolower($info['extension']);
-
-		switch($ext) {
-			case 'xml':
-				return self::FORMAT_XML;
-
-			case 'ini':
-			case 'properties':
-				return self::FORMAT_INI;
-
-			case 'php':
-				return self::FORMAT_PHP;
-
-			default:
-				throw new LoggerException("Unsupported configuration file extension: $ext");
-		}
-	}
-
-	/**
-	 * Constructs the logger hierarchy based on configuration.
-	 *
-	 * @param Hierarchy $hierarchy
-	 * @param array $config
-	 */
-	private function doConfigure(Hierarchy $hierarchy, $config) {
-		if (isset($config['threshold'])) {
-			$threshold = Level::toLevel($config['threshold']);
-			if (isset($threshold)) {
-				$hierarchy->setThreshold($threshold);
-			} else {
-				$this->warn("Invalid threshold value [{$config['threshold']}] specified. Ignoring threshold definition.");
-			}
-		}
-
-		// Configure appenders and add them to the appender pool
-		if (isset($config['appenders']) && is_array($config['appenders'])) {
-			foreach($config['appenders'] as $name => $appenderConfig) {
-				$this->configureAppender($name, $appenderConfig);
-			}
-		}
-
-		// Configure root logger
-		if (isset($config['rootLogger'])) {
-			$this->configureRootLogger($hierarchy, $config['rootLogger']);
-		}
-
-		// Configure loggers
-		if (isset($config['loggers']) && is_array($config['loggers'])) {
-			foreach($config['loggers'] as $loggerName => $loggerConfig) {
-				$this->configureOtherLogger($hierarchy, $loggerName, $loggerConfig);
-			}
-		}
-
-		// Configure renderers
-		if (isset($config['renderers']) && is_array($config['renderers'])) {
-			foreach($config['renderers'] as $rendererConfig) {
-				$this->configureRenderer($hierarchy, $rendererConfig);
-			}
-		}
-
-		if (isset($config['defaultRenderer'])) {
-			$this->configureDefaultRenderer($hierarchy, $config['defaultRenderer']);
-		}
-	}
-
-	private function configureRenderer(Hierarchy $hierarchy, $config) {
-		if (empty($config['renderingClass'])) {
-			$this->warn("Rendering class not specified. Skipping renderer definition.");
-			return;
-		}
-
-		if (empty($config['renderedClass'])) {
-			$this->warn("Rendered class not specified. Skipping renderer definition.");
-			return;
-		}
-
-		// Error handling performed by RendererMap
-		$hierarchy->getRendererMap()->addRenderer($config['renderedClass'], $config['renderingClass']);
-	}
-
-	private function configureDefaultRenderer(Hierarchy $hierarchy, $class) {
-		if (empty($class)) {
-			$this->warn("Rendering class not specified. Skipping default renderer definition.");
-			return;
-		}
-
-		// Error handling performed by RendererMap
-		$hierarchy->getRendererMap()->setDefaultRenderer($class);
-	}
-
-	/**
-	 * Configures an appender based on given config and saves it to
-	 * {@link $appenders} array so it can be later linked to loggers.
-	 * @param string $name Appender name.
-	 * @param array $config Appender configuration options.
-	 */
-	private function configureAppender($name, $config) {
-
-		// TODO: add this check to other places where it might be useful
-		if (!is_array($config)) {
-			$type = gettype($config);
-			$this->warn("Invalid configuration provided for appender [$name]. Expected an array, found <$type>. Skipping appender definition.");
-			return;
-		}
-
-		// Parse appender class
-		$class = $config['class'];
-		if (empty($class)) {
-			$this->warn("No class given for appender [$name]. Skipping appender definition.");
-			return;
-		}
-
-		// Instantiate the appender
-		if (class_exists($class)) {
-			$appender = new $class($name);
-		} else {
-			// Try the default namespace
-			$nsClass = "\\Apache\\Log4php\\Appenders\\$class";
-			if (class_exists($nsClass)) {
-				$appender = new $nsClass($name);
-			}
-		}
-
-		if (!isset($appender)) {
-			$this->warn("Invalid class [$class] given for appender [$name]. Class does not exist. Skipping appender definition.");
-			return;
-		}
-
-		if (!($appender instanceof AbstractAppender)) {
-			$this->warn("Invalid class [$class] given for appender [$name]. Not a valid Appender class. Skipping appender definition.");
-			return;
-		}
-
-		// Parse the appender threshold
-		if (isset($config['threshold'])) {
-			$threshold = Level::toLevel($config['threshold']);
-			if ($threshold instanceof Level) {
-				$appender->setThreshold($threshold);
-			} else {
-				$this->warn("Invalid threshold value [{$config['threshold']}] specified for appender [$name]. Ignoring threshold definition.");
-			}
-		}
-
-		// Parse the appender layout
-		if ($appender->requiresLayout() && isset($config['layout'])) {
-			$this->createAppenderLayout($appender, $config['layout']);
-		}
-
-		// Parse filters
-		if (isset($config['filters']) && is_array($config['filters'])) {
-			foreach($config['filters'] as $filterConfig) {
-				$this->createAppenderFilter($appender, $filterConfig);
-			}
-		}
-
-		// Set options if any
-		if (isset($config['params'])) {
-			$this->setOptions($appender, $config['params']);
-		}
-
-		// Activate and save for later linking to loggers
-		$appender->activateOptions();
-		$this->appenders[$name] = $appender;
-	}
-
-	/**
-	 * Parses layout config, creates the layout and links it to the appender.
-	 * @param AbstractAppender $appender
-	 * @param array $config Layout configuration.
-	 */
-	private function createAppenderLayout(AbstractAppender $appender, $config) {
-		$name = $appender->getName();
-		$class = $config['class'];
-		if (empty($class)) {
-			$this->warn("Layout class not specified for appender [$name]. Reverting to default layout.");
-			return;
-		}
-
-		if (class_exists($class)) {
-			$layout = new $class();
-		} else {
-			$nsClass = "Apache\\Log4php\\Layouts\\$class";
-			if (class_exists($nsClass)) {
-				$layout = new $nsClass();
-			}
-		}
-
-		if (!isset($layout)) {
-			$this->warn("Nonexistant layout class [$class] specified for appender [$name]. Reverting to default layout.");
-			return;
-		}
-
-
-		if (!($layout instanceof AbstractLayout)) {
-			$this->warn("Invalid layout class [$class] sepcified for appender [$name]. Reverting to default layout.");
-			return;
-		}
-
-		if (isset($config['params'])) {
-			$this->setOptions($layout, $config['params']);
-		}
-
-		$layout->activateOptions();
-		$appender->setLayout($layout);
-	}
-
-	/**
-	 * Parses filter config, creates the filter and adds it to the appender's
-	 * filter chain.
-	 * @param Appender $appender
-	 * @param array $config Filter configuration.
-	 */
-	private function createAppenderFilter(AbstractAppender $appender, $config) {
-		$name = $appender->getName();
-		$class = $config['class'];
-
-		if (class_exists($class)) {
-			$filter = new $class();
-		} else {
-			$nsClass = "Apache\\Log4php\\Filters\\$class";
-			if (class_exists($nsClass)) {
-				$filter = new $nsClass();
-			}
-		}
-
-		if (!isset($filter)) {
-			$this->warn("Nonexistant filter class [$class] specified on appender [$name]. Skipping filter definition.");
-			return;
-		}
-
-		if (!($filter instanceof AbstractFilter)) {
-			$this->warn("Invalid filter class [$class] sepcified on appender [$name]. Skipping filter definition.");
-			return;
-		}
-
-		if (isset($config['params'])) {
-			$this->setOptions($filter, $config['params']);
-		}
-
-		$filter->activateOptions();
-		$appender->addFilter($filter);
-	}
-
-	/**
-	 * Configures the root logger
-	 * @see configureLogger()
-	 */
-	private function configureRootLogger(Hierarchy $hierarchy, $config) {
-		$logger = $hierarchy->getRootLogger();
-		$this->configureLogger($logger, $config);
-	}
-
-	/**
-	 * Configures a logger which is not root.
-	 * @see configureLogger()
-	 */
-	private function configureOtherLogger(Hierarchy $hierarchy, $name, $config) {
-		// Get logger from hierarchy (this creates it if it doesn't already exist)
-		$logger = $hierarchy->getLogger($name);
-		$this->configureLogger($logger, $config);
-	}
-
-	/**
-	 * Configures a logger.
-	 *
-	 * @param Logger $logger The logger to configure
-	 * @param array $config Logger configuration options.
-	 */
-	private function configureLogger(Logger $logger, $config) {
-		$loggerName = $logger->getName();
-
-		// Set logger level
-		if (isset($config['level'])) {
-			$level = Level::toLevel($config['level']);
-			if (isset($level)) {
-				$logger->setLevel($level);
-			} else {
-				$this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName]. Ignoring level definition.");
-			}
-		}
-
-		// Link appenders to logger
-		if (isset($config['appenders'])) {
-			foreach($config['appenders'] as $appenderName) {
-				if (isset($this->appenders[$appenderName])) {
-					$logger->addAppender($this->appenders[$appenderName]);
-				} else {
-					$this->warn("Nonexistnant appender [$appenderName] linked to logger [$loggerName].");
-				}
-			}
-		}
-
-		// Set logger additivity
-		if (isset($config['additivity'])) {
-			try {
-				$additivity = OptionConverter::toBooleanEx($config['additivity'], null);
-				$logger->setAdditivity($additivity);
-			} catch (LoggerException $ex) {
-				$this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [$loggerName]. Ignoring additivity setting.");
-			}
-		}
-	}
-
-	/**
-	 * Helper method which applies given options to an object which has setters
-	 * for these options (such as appenders, layouts, etc.).
-	 *
-	 * For example, if options are:
-	 * <code>
-	 * array(
-	 * 	'file' => '/tmp/myfile.log',
-	 * 	'append' => true
-	 * )
-	 * </code>
-	 *
-	 * This method will call:
-	 * <code>
-	 * $object->setFile('/tmp/myfile.log')
-	 * $object->setAppend(true)
-	 * </code>
-	 *
-	 * If required setters do not exist, it will produce a warning.
-	 *
-	 * @param mixed $object The object to configure.
-	 * @param unknown_type $options
-	 */
-	private function setOptions($object, $options) {
-		foreach($options as $name => $value) {
-			$setter = "set$name";
-			if (method_exists($object, $setter)) {
-				$object->$setter($value);
-			} else {
-				$class = get_class($object);
-				$this->warn("Nonexistant option [$name] specified on [$class]. Skipping.");
-			}
-		}
-	}
-
-	/** Helper method to simplify error reporting. */
-	private function warn($message) {
-		trigger_error("log4php: $message", E_USER_WARNING);
-	}
+    );
+
+    /** Holds the appenders before they are linked to loggers. */
+    private $appenders = array();
+
+    /**
+     * Configures log4php based on the given configuration. The input can
+     * either be a path to the config file, or a PHP array holding the
+     * configuration.
+     *
+     * If no configuration is given, or if the given configuration cannot be
+     * parsed for whatever reason, a warning will be issued, and log4php
+     * will use the default configuration contained in
+     * {@link $defaultConfiguration}.
+     *
+     * @param Hierarchy $hierarchy The hierarchy on which to perform
+     * 		the configuration.
+     * @param string|array $input Either path to the config file or the
+     * 		configuration as an array. If not set, default configuration
+     * 		will be used.
+     */
+    public function configure(Hierarchy $hierarchy, $input = null)
+    {
+        $config = $this->parse($input);
+        $this->doConfigure($hierarchy, $config);
+    }
+
+    /**
+     * Parses the given configuration and returns the parsed configuration
+     * as a PHP array. Does not perform any configuration.
+     *
+     * If no configuration is given, or if the given configuration cannot be
+     * parsed for whatever reason, a warning will be issued, and the default
+     * configuration will be returned ({@link $defaultConfiguration}).
+     *
+     * @param string|array $input Either path to the config file or the
+     * 		configuration as an array. If not set, default configuration
+     * 		will be used.
+     * @return array The parsed configuration.
+     */
+    public function parse($input)
+    {
+        // No input - use default configuration
+        if (!isset($input)) {
+            $config = self::$defaultConfiguration;
+        }
+
+        // Array input - contains configuration within the array
+        else if (is_array($input)) {
+            $config = $input;
+        }
+
+        // String input - contains path to configuration file
+        else if (is_string($input)) {
+            try {
+                $config = $this->parseFile($input);
+            } catch (LoggerException $e) {
+                $this->warn("Configuration failed. " . $e->getMessage() . " Using default configuration.");
+                $config = self::$defaultConfiguration;
+            }
+        }
+
+        // Anything else is an error
+        else {
+            $this->warn("Invalid configuration param given. Reverting to default configuration.");
+            $config = self::$defaultConfiguration;
+        }
+
+        return $config;
+    }
+
+    /**
+     * Returns the default log4php configuration.
+     * @return array
+     */
+    public static function getDefaultConfiguration()
+    {
+        return self::$defaultConfiguration;
+    }
+
+    /**
+     * Loads the configuration file from the given URL, determines which
+     * adapter to use, converts the configuration to a PHP array and
+     * returns it.
+     *
+     * @param  string          $url Path to the config file.
+     * @return The             configuration from the config file, as a PHP array.
+     * @throws LoggerException If the configuration file cannot be loaded, or
+     * 		if the parsing fails.
+     */
+    private function parseFile($url)
+    {
+        if (!file_exists($url)) {
+            throw new LoggerException("File not found at [$url].");
+        }
+
+        $type = $this->getConfigType($url);
+        $adapterClass = "Apache\\Log4php\\Configuration\\Adapters\\" . $this->adapters[$type];
+
+        $adapter = new $adapterClass();
+
+        return $adapter->convert($url);
+    }
+
+    /** Determines configuration file type based on the file extension. */
+    private function getConfigType($url)
+    {
+        $info = pathinfo($url);
+        $ext = strtolower($info['extension']);
+
+        switch ($ext) {
+            case 'xml':
+                return self::FORMAT_XML;
+
+            case 'ini':
+            case 'properties':
+                return self::FORMAT_INI;
+
+            case 'php':
+                return self::FORMAT_PHP;
+
+            default:
+                throw new LoggerException("Unsupported configuration file extension: $ext");
+        }
+    }
+
+    /**
+     * Constructs the logger hierarchy based on configuration.
+     *
+     * @param Hierarchy $hierarchy
+     * @param array     $config
+     */
+    private function doConfigure(Hierarchy $hierarchy, $config)
+    {
+        if (isset($config['threshold'])) {
+            $threshold = Level::toLevel($config['threshold']);
+            if (isset($threshold)) {
+                $hierarchy->setThreshold($threshold);
+            } else {
+                $this->warn("Invalid threshold value [{$config['threshold']}] specified. Ignoring threshold definition.");
+            }
+        }
+
+        // Configure appenders and add them to the appender pool
+        if (isset($config['appenders']) && is_array($config['appenders'])) {
+            foreach ($config['appenders'] as $name => $appenderConfig) {
+                $this->configureAppender($name, $appenderConfig);
+            }
+        }
+
+        // Configure root logger
+        if (isset($config['rootLogger'])) {
+            $this->configureRootLogger($hierarchy, $config['rootLogger']);
+        }
+
+        // Configure loggers
+        if (isset($config['loggers']) && is_array($config['loggers'])) {
+            foreach ($config['loggers'] as $loggerName => $loggerConfig) {
+                $this->configureOtherLogger($hierarchy, $loggerName, $loggerConfig);
+            }
+        }
+
+        // Configure renderers
+        if (isset($config['renderers']) && is_array($config['renderers'])) {
+            foreach ($config['renderers'] as $rendererConfig) {
+                $this->configureRenderer($hierarchy, $rendererConfig);
+            }
+        }
+
+        if (isset($config['defaultRenderer'])) {
+            $this->configureDefaultRenderer($hierarchy, $config['defaultRenderer']);
+        }
+    }
+
+    private function configureRenderer(Hierarchy $hierarchy, $config)
+    {
+        if (empty($config['renderingClass'])) {
+            $this->warn("Rendering class not specified. Skipping renderer definition.");
+
+            return;
+        }
+
+        if (empty($config['renderedClass'])) {
+            $this->warn("Rendered class not specified. Skipping renderer definition.");
+
+            return;
+        }
+
+        // Error handling performed by RendererMap
+        $hierarchy->getRendererMap()->addRenderer($config['renderedClass'], $config['renderingClass']);
+    }
+
+    private function configureDefaultRenderer(Hierarchy $hierarchy, $class)
+    {
+        if (empty($class)) {
+            $this->warn("Rendering class not specified. Skipping default renderer definition.");
+
+            return;
+        }
+
+        // Error handling performed by RendererMap
+        $hierarchy->getRendererMap()->setDefaultRenderer($class);
+    }
+
+    /**
+     * Configures an appender based on given config and saves it to
+     * {@link $appenders} array so it can be later linked to loggers.
+     * @param string $name   Appender name.
+     * @param array  $config Appender configuration options.
+     */
+    private function configureAppender($name, $config)
+    {
+        // TODO: add this check to other places where it might be useful
+        if (!is_array($config)) {
+            $type = gettype($config);
+            $this->warn("Invalid configuration provided for appender [$name]. Expected an array, found <$type>. Skipping appender definition.");
+
+            return;
+        }
+
+        // Parse appender class
+        $class = $config['class'];
+        if (empty($class)) {
+            $this->warn("No class given for appender [$name]. Skipping appender definition.");
+
+            return;
+        }
+
+        // Instantiate the appender
+        if (class_exists($class)) {
+            $appender = new $class($name);
+        } else {
+            // Try the default namespace
+            $nsClass = "\\Apache\\Log4php\\Appenders\\$class";
+            if (class_exists($nsClass)) {
+                $appender = new $nsClass($name);
+            }
+        }
+
+        if (!isset($appender)) {
+            $this->warn("Invalid class [$class] given for appender [$name]. Class does not exist. Skipping appender definition.");
+
+            return;
+        }
+
+        if (!($appender instanceof AbstractAppender)) {
+            $this->warn("Invalid class [$class] given for appender [$name]. Not a valid Appender class. Skipping appender definition.");
+
+            return;
+        }
+
+        // Parse the appender threshold
+        if (isset($config['threshold'])) {
+            $threshold = Level::toLevel($config['threshold']);
+            if ($threshold instanceof Level) {
+                $appender->setThreshold($threshold);
+            } else {
+                $this->warn("Invalid threshold value [{$config['threshold']}] specified for appender [$name]. Ignoring threshold definition.");
+            }
+        }
+
+        // Parse the appender layout
+        if ($appender->requiresLayout() && isset($config['layout'])) {
+            $this->createAppenderLayout($appender, $config['layout']);
+        }
+
+        // Parse filters
+        if (isset($config['filters']) && is_array($config['filters'])) {
+            foreach ($config['filters'] as $filterConfig) {
+                $this->createAppenderFilter($appender, $filterConfig);
+            }
+        }
+
+        // Set options if any
+        if (isset($config['params'])) {
+            $this->setOptions($appender, $config['params']);
+        }
+
+        // Activate and save for later linking to loggers
+        $appender->activateOptions();
+        $this->appenders[$name] = $appender;
+    }
+
+    /**
+     * Parses layout config, creates the layout and links it to the appender.
+     * @param AbstractAppender $appender
+     * @param array            $config   Layout configuration.
+     */
+    private function createAppenderLayout(AbstractAppender $appender, $config)
+    {
+        $name = $appender->getName();
+        $class = $config['class'];
+        if (empty($class)) {
+            $this->warn("Layout class not specified for appender [$name]. Reverting to default layout.");
+
+            return;
+        }
+
+        if (class_exists($class)) {
+            $layout = new $class();
+        } else {
+            $nsClass = "Apache\\Log4php\\Layouts\\$class";
+            if (class_exists($nsClass)) {
+                $layout = new $nsClass();
+            }
+        }
+
+        if (!isset($layout)) {
+            $this->warn("Nonexistant layout class [$class] specified for appender [$name]. Reverting to default layout.");
+
+            return;
+        }
+
+        if (!($layout instanceof AbstractLayout)) {
+            $this->warn("Invalid layout class [$class] sepcified for appender [$name]. Reverting to default layout.");
+
+            return;
+        }
+
+        if (isset($config['params'])) {
+            $this->setOptions($layout, $config['params']);
+        }
+
+        $layout->activateOptions();
+        $appender->setLayout($layout);
+    }
+
+    /**
+     * Parses filter config, creates the filter and adds it to the appender's
+     * filter chain.
+     * @param Appender $appender
+     * @param array    $config   Filter configuration.
+     */
+    private function createAppenderFilter(AbstractAppender $appender, $config)
+    {
+        $name = $appender->getName();
+        $class = $config['class'];
+
+        if (class_exists($class)) {
+            $filter = new $class();
+        } else {
+            $nsClass = "Apache\\Log4php\\Filters\\$class";
+            if (class_exists($nsClass)) {
+                $filter = new $nsClass();
+            }
+        }
+
+        if (!isset($filter)) {
+            $this->warn("Nonexistant filter class [$class] specified on appender [$name]. Skipping filter definition.");
+
+            return;
+        }
+
+        if (!($filter instanceof AbstractFilter)) {
+            $this->warn("Invalid filter class [$class] sepcified on appender [$name]. Skipping filter definition.");
+
+            return;
+        }
+
+        if (isset($config['params'])) {
+            $this->setOptions($filter, $config['params']);
+        }
+
+        $filter->activateOptions();
+        $appender->addFilter($filter);
+    }
+
+    /**
+     * Configures the root logger
+     * @see configureLogger()
+     */
+    private function configureRootLogger(Hierarchy $hierarchy, $config)
+    {
+        $logger = $hierarchy->getRootLogger();
+        $this->configureLogger($logger, $config);
+    }
+
+    /**
+     * Configures a logger which is not root.
+     * @see configureLogger()
+     */
+    private function configureOtherLogger(Hierarchy $hierarchy, $name, $config)
+    {
+        // Get logger from hierarchy (this creates it if it doesn't already exist)
+        $logger = $hierarchy->getLogger($name);
+        $this->configureLogger($logger, $config);
+    }
+
+    /**
+     * Configures a logger.
+     *
+     * @param Logger $logger The logger to configure
+     * @param array  $config Logger configuration options.
+     */
+    private function configureLogger(Logger $logger, $config)
+    {
+        $loggerName = $logger->getName();
+
+        // Set logger level
+        if (isset($config['level'])) {
+            $level = Level::toLevel($config['level']);
+            if (isset($level)) {
+                $logger->setLevel($level);
+            } else {
+                $this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName]. Ignoring level definition.");
+            }
+        }
+
+        // Link appenders to logger
+        if (isset($config['appenders'])) {
+            foreach ($config['appenders'] as $appenderName) {
+                if (isset($this->appenders[$appenderName])) {
+                    $logger->addAppender($this->appenders[$appenderName]);
+                } else {
+                    $this->warn("Nonexistnant appender [$appenderName] linked to logger [$loggerName].");
+                }
+            }
+        }
+
+        // Set logger additivity
+        if (isset($config['additivity'])) {
+            try {
+                $additivity = OptionConverter::toBooleanEx($config['additivity'], null);
+                $logger->setAdditivity($additivity);
+            } catch (LoggerException $ex) {
+                $this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [$loggerName]. Ignoring additivity setting.");
+            }
+        }
+    }
+
+    /**
+     * Helper method which applies given options to an object which has setters
+     * for these options (such as appenders, layouts, etc.).
+     *
+     * For example, if options are:
+     * <code>
+     * array(
+     * 	'file' => '/tmp/myfile.log',
+     * 	'append' => true
+     * )
+     * </code>
+     *
+     * This method will call:
+     * <code>
+     * $object->setFile('/tmp/myfile.log')
+     * $object->setAppend(true)
+     * </code>
+     *
+     * If required setters do not exist, it will produce a warning.
+     *
+     * @param mixed        $object  The object to configure.
+     * @param unknown_type $options
+     */
+    private function setOptions($object, $options)
+    {
+        foreach ($options as $name => $value) {
+            $setter = "set$name";
+            if (method_exists($object, $setter)) {
+                $object->$setter($value);
+            } else {
+                $class = get_class($object);
+                $this->warn("Nonexistant option [$name] specified on [$class]. Skipping.");
+            }
+        }
+    }
+
+    /** Helper method to simplify error reporting. */
+    private function warn($message)
+    {
+        trigger_error("log4php: $message", E_USER_WARNING);
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Configuration/adapters/AdapterInterface.php
----------------------------------------------------------------------
diff --git a/src/Configuration/adapters/AdapterInterface.php b/src/Configuration/adapters/AdapterInterface.php
index f0fea69..15b565a 100644
--- a/src/Configuration/adapters/AdapterInterface.php
+++ b/src/Configuration/adapters/AdapterInterface.php
@@ -29,7 +29,7 @@ namespace Apache\Log4php\Configuration\Adapters;
  */
 interface AdapterInterface
 {
-	/** Converts the configuration file to PHP format usable by the configurator. */
-	public function convert($input);
+    /** Converts the configuration file to PHP format usable by the configurator. */
+    public function convert($input);
 
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Configuration/adapters/IniAdapter.php
----------------------------------------------------------------------
diff --git a/src/Configuration/adapters/IniAdapter.php b/src/Configuration/adapters/IniAdapter.php
index 61c003b..fcc50e2 100644
--- a/src/Configuration/adapters/IniAdapter.php
+++ b/src/Configuration/adapters/IniAdapter.php
@@ -28,267 +28,276 @@ use Apache\Log4php\LoggerException;
  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  * @since 2.2
  */
-class IniAdapter implements AdapterInterface {
-
-	/** Name to assign to the root logger. */
-	const ROOT_LOGGER_NAME = "root";
-
-	/** Prefix used for defining logger additivity. */
-	const ADDITIVITY_PREFIX = "log4php.additivity.";
-
-	/** Prefix used for defining logger threshold. */
-	const THRESHOLD_PREFIX = "log4php.threshold";
-
-	/** Prefix used for defining the root logger. */
-	const ROOT_LOGGER_PREFIX = "log4php.rootLogger";
-
-	/** Prefix used for defining a logger. */
-	const LOGGER_PREFIX = "log4php.logger.";
-
-	/** Prefix used for defining an appender. */
-	const APPENDER_PREFIX = "log4php.appender.";
-
-	/** Prefix used for defining a renderer. */
-	const RENDERER_PREFIX = "log4php.renderer.";
-
-	/** Holds the configuration. */
-	private $config = array();
-
-	/**
-	 * Loads and parses the INI configuration file.
-	 *
-	 * @param string $url Path to the config file.
-	 * @throws LoggerException
-	 */
-	private function load($url) {
-		if (!file_exists($url)) {
-			throw new LoggerException("File [$url] does not exist.");
-		}
-
-		$properties = @parse_ini_file($url, true);
-		if ($properties === false) {
-			$error = error_get_last();
-			throw new LoggerException("Error parsing configuration file: {$error['message']}");
-		}
-
-		return $properties;
-	}
-
-	/**
-	* Converts the provided INI configuration file to a PHP array config.
-	*
-	* @param string $path Path to the config file.
-	* @throws LoggerException If the file cannot be loaded or parsed.
-	*/
-	public function convert($path) {
-		// Load the configuration
-		$properties = $this->load($path);
-
-		// Parse threshold
-		if (isset($properties[self::THRESHOLD_PREFIX])) {
-			$this->config['threshold'] = $properties[self::THRESHOLD_PREFIX];
-		}
-
-		// Parse root logger
-		if (isset($properties[self::ROOT_LOGGER_PREFIX])) {
-			$this->parseLogger($properties[self::ROOT_LOGGER_PREFIX], self::ROOT_LOGGER_NAME);
-		}
-
-		$appenders = array();
-
-		foreach($properties as $key => $value) {
-			// Parse loggers
-			if ($this->beginsWith($key, self::LOGGER_PREFIX)) {
-				$name = substr($key, strlen(self::LOGGER_PREFIX));
-				$this->parseLogger($value, $name);
-			}
-
-			// Parse additivity
-			if ($this->beginsWith($key, self::ADDITIVITY_PREFIX)) {
-				$name = substr($key, strlen(self::ADDITIVITY_PREFIX));
-				$this->config['loggers'][$name]['additivity'] = $value;
-			}
-
-			// Parse appenders
-			else if ($this->beginsWith($key, self::APPENDER_PREFIX)) {
-				$this->parseAppender($key, $value);
-			}
-
-			// Parse renderers
-			else if ($this->beginsWith($key, self::RENDERER_PREFIX)) {
-				$this->parseRenderer($key, $value);
-			}
-		}
-
-		return $this->config;
-	}
-
-
-	/**
-	 * Parses a logger definition.
-	 *
-	 * Loggers are defined in the following manner:
-	 * <pre>
-	 * log4php.logger.<name> = [<level>], [<appender-ref>, <appender-ref>, ...]
-	 * </pre>
-	 *
-	 * @param string $value The configuration value (level and appender-refs).
-	 * @param string $name Logger name.
-	 */
-	private function parseLogger($value, $name) {
-		// Value is divided by commas
-		$parts = explode(',', $value);
-		if (empty($value) || empty($parts)) {
-			return;
-		}
-
-		// The first value is the logger level
-		$level = array_shift($parts);
-
-		// The remaining values are appender references
-		$appenders = array();
-		while($appender = array_shift($parts)) {
-			$appender = trim($appender);
-			if (!empty($appender)) {
-				$appenders[] = trim($appender);
-			}
-		}
-
-		// Find the target configuration
-		if ($name == self::ROOT_LOGGER_NAME) {
-			$this->config['rootLogger']['level'] = trim($level);
-			$this->config['rootLogger']['appenders'] = $appenders;
-		} else {
-			$this->config['loggers'][$name]['level'] = trim($level);
-			$this->config['loggers'][$name]['appenders'] = $appenders;
-		}
-	}
-
-	/**
-	 * Parses an configuration line pertaining to an appender.
-	 *
-	 * Parses the following patterns:
-	 *
-	 * Appender class:
-	 * <pre>
-	 * log4php.appender.<name> = <class>
-	 * </pre>
-	 *
-	 * Appender parameter:
-	 * <pre>
-	 * log4php.appender.<name>.<param> = <value>
-	 * </pre>
-	 *
- 	 * Appender threshold:
-	 * <pre>
-	 * log4php.appender.<name>.threshold = <level>
-	 * </pre>
-	 *
- 	 * Appender layout:
-	 * <pre>
-	 * log4php.appender.<name>.layout = <layoutClass>
-	 * </pre>
-	 *
-	 * Layout parameter:
-	 * <pre>
-	 * log4php.appender.<name>.layout.<param> = <value>
-	 * </pre>
-	 *
-	 * For example, a full appender config might look like:
-	 * <pre>
-	 * log4php.appender.myAppender = ConsoleAppender
-	 * log4php.appender.myAppender.threshold = info
-	 * log4php.appender.myAppender.target = stdout
-	 * log4php.appender.myAppender.layout = PatternLayout
-	 * log4php.appender.myAppender.layout.conversionPattern = "%d %c: %m%n"
-	 * </pre>
-	 *
-	 * After parsing all these options, the following configuration can be
-	 * found under $this->config['appenders']['myAppender']:
-	 * <pre>
-	 * array(
-	 * 	'class' => ConsoleAppender,
-	 * 	'threshold' => info,
-	 * 	'params' => array(
-	 * 		'target' => 'stdout'
-	 * 	),
-	 * 	'layout' => array(
-	 * 		'class' => 'ConsoleAppender',
-	 * 		'params' => array(
-	 * 			'conversionPattern' => '%d %c: %m%n'
-	 * 		)
-	 * 	)
-	 * )
-	 * </pre>
-	 *
-	 * @param string $key
-	 * @param string $value
-	 */
-	private function parseAppender($key, $value) {
-
-		// Remove the appender prefix from key
-		$subKey = substr($key, strlen(self::APPENDER_PREFIX));
-
-		// Divide the string by dots
-		$parts = explode('.', $subKey);
-		$count = count($parts);
-
-		// The first part is always the appender name
-		$name = trim($parts[0]);
-
-		// Only one part - this line defines the appender class
-		if ($count == 1) {
-			$this->config['appenders'][$name]['class'] = $value;
-			return;
-		}
-
-		// Two parts - either a parameter, a threshold or layout class
-		else if ($count == 2) {
-
-			if ($parts[1] == 'layout') {
-				$this->config['appenders'][$name]['layout']['class'] = $value;
-				return;
-			} else if ($parts[1] == 'threshold') {
-				$this->config['appenders'][$name]['threshold'] = $value;
-				return;
-			} else {
-				$this->config['appenders'][$name]['params'][$parts[1]] = $value;
-				return;
-			}
-		}
-
-		// Three parts - this can only be a layout parameter
-		else if ($count == 3) {
-			if ($parts[1] == 'layout') {
-				$this->config['appenders'][$name]['layout']['params'][$parts[2]] = $value;
-				return;
-			}
-		}
-
-		trigger_error("log4php: Don't know how to parse the following line: \"$key = $value\". Skipping.");
-	}
-
-	/**
-	 * Parses a renderer definition.
-	 *
-	 * Renderers are defined as:
-	 * <pre>
-	 * log4php.renderer.<renderedClass> = <renderingClass>
-	 * </pre>
-	 *
-	 * @param string $key log4php.renderer.<renderedClass>
-	 * @param string $value <renderingClass>
-	 */
-	private function parseRenderer($key, $value) {
-		// Remove the appender prefix from key
-		$renderedClass = substr($key, strlen(self::APPENDER_PREFIX));
-		$renderingClass = $value;
-
-		$this->config['renderers'][] = compact('renderedClass', 'renderingClass');
-	}
-
-	/** Helper method. Returns true if $str begins with $sub. */
-	private function beginsWith($str, $sub) {
-		return (strncmp($str, $sub, strlen($sub)) == 0);
-	}
+class IniAdapter implements AdapterInterface
+{
+    /** Name to assign to the root logger. */
+    const ROOT_LOGGER_NAME = "root";
+
+    /** Prefix used for defining logger additivity. */
+    const ADDITIVITY_PREFIX = "log4php.additivity.";
+
+    /** Prefix used for defining logger threshold. */
+    const THRESHOLD_PREFIX = "log4php.threshold";
+
+    /** Prefix used for defining the root logger. */
+    const ROOT_LOGGER_PREFIX = "log4php.rootLogger";
+
+    /** Prefix used for defining a logger. */
+    const LOGGER_PREFIX = "log4php.logger.";
+
+    /** Prefix used for defining an appender. */
+    const APPENDER_PREFIX = "log4php.appender.";
+
+    /** Prefix used for defining a renderer. */
+    const RENDERER_PREFIX = "log4php.renderer.";
+
+    /** Holds the configuration. */
+    private $config = array();
+
+    /**
+     * Loads and parses the INI configuration file.
+     *
+     * @param  string          $url Path to the config file.
+     * @throws LoggerException
+     */
+    private function load($url)
+    {
+        if (!file_exists($url)) {
+            throw new LoggerException("File [$url] does not exist.");
+        }
+
+        $properties = @parse_ini_file($url, true);
+        if ($properties === false) {
+            $error = error_get_last();
+            throw new LoggerException("Error parsing configuration file: {$error['message']}");
+        }
+
+        return $properties;
+    }
+
+    /**
+    * Converts the provided INI configuration file to a PHP array config.
+    *
+    * @param string $path Path to the config file.
+    * @throws LoggerException If the file cannot be loaded or parsed.
+    */
+    public function convert($path)
+    {
+        // Load the configuration
+        $properties = $this->load($path);
+
+        // Parse threshold
+        if (isset($properties[self::THRESHOLD_PREFIX])) {
+            $this->config['threshold'] = $properties[self::THRESHOLD_PREFIX];
+        }
+
+        // Parse root logger
+        if (isset($properties[self::ROOT_LOGGER_PREFIX])) {
+            $this->parseLogger($properties[self::ROOT_LOGGER_PREFIX], self::ROOT_LOGGER_NAME);
+        }
+
+        $appenders = array();
+
+        foreach ($properties as $key => $value) {
+            // Parse loggers
+            if ($this->beginsWith($key, self::LOGGER_PREFIX)) {
+                $name = substr($key, strlen(self::LOGGER_PREFIX));
+                $this->parseLogger($value, $name);
+            }
+
+            // Parse additivity
+            if ($this->beginsWith($key, self::ADDITIVITY_PREFIX)) {
+                $name = substr($key, strlen(self::ADDITIVITY_PREFIX));
+                $this->config['loggers'][$name]['additivity'] = $value;
+            }
+
+            // Parse appenders
+            else if ($this->beginsWith($key, self::APPENDER_PREFIX)) {
+                $this->parseAppender($key, $value);
+            }
+
+            // Parse renderers
+            else if ($this->beginsWith($key, self::RENDERER_PREFIX)) {
+                $this->parseRenderer($key, $value);
+            }
+        }
+
+        return $this->config;
+    }
+
+    /**
+     * Parses a logger definition.
+     *
+     * Loggers are defined in the following manner:
+     * <pre>
+     * log4php.logger.<name> = [<level>], [<appender-ref>, <appender-ref>, ...]
+     * </pre>
+     *
+     * @param string $value The configuration value (level and appender-refs).
+     * @param string $name  Logger name.
+     */
+    private function parseLogger($value, $name)
+    {
+        // Value is divided by commas
+        $parts = explode(',', $value);
+        if (empty($value) || empty($parts)) {
+            return;
+        }
+
+        // The first value is the logger level
+        $level = array_shift($parts);
+
+        // The remaining values are appender references
+        $appenders = array();
+        while ($appender = array_shift($parts)) {
+            $appender = trim($appender);
+            if (!empty($appender)) {
+                $appenders[] = trim($appender);
+            }
+        }
+
+        // Find the target configuration
+        if ($name == self::ROOT_LOGGER_NAME) {
+            $this->config['rootLogger']['level'] = trim($level);
+            $this->config['rootLogger']['appenders'] = $appenders;
+        } else {
+            $this->config['loggers'][$name]['level'] = trim($level);
+            $this->config['loggers'][$name]['appenders'] = $appenders;
+        }
+    }
+
+    /**
+     * Parses an configuration line pertaining to an appender.
+     *
+     * Parses the following patterns:
+     *
+     * Appender class:
+     * <pre>
+     * log4php.appender.<name> = <class>
+     * </pre>
+     *
+     * Appender parameter:
+     * <pre>
+     * log4php.appender.<name>.<param> = <value>
+     * </pre>
+     *
+      * Appender threshold:
+     * <pre>
+     * log4php.appender.<name>.threshold = <level>
+     * </pre>
+     *
+      * Appender layout:
+     * <pre>
+     * log4php.appender.<name>.layout = <layoutClass>
+     * </pre>
+     *
+     * Layout parameter:
+     * <pre>
+     * log4php.appender.<name>.layout.<param> = <value>
+     * </pre>
+     *
+     * For example, a full appender config might look like:
+     * <pre>
+     * log4php.appender.myAppender = ConsoleAppender
+     * log4php.appender.myAppender.threshold = info
+     * log4php.appender.myAppender.target = stdout
+     * log4php.appender.myAppender.layout = PatternLayout
+     * log4php.appender.myAppender.layout.conversionPattern = "%d %c: %m%n"
+     * </pre>
+     *
+     * After parsing all these options, the following configuration can be
+     * found under $this->config['appenders']['myAppender']:
+     * <pre>
+     * array(
+     * 	'class' => ConsoleAppender,
+     * 	'threshold' => info,
+     * 	'params' => array(
+     * 		'target' => 'stdout'
+     * 	),
+     * 	'layout' => array(
+     * 		'class' => 'ConsoleAppender',
+     * 		'params' => array(
+     * 			'conversionPattern' => '%d %c: %m%n'
+     * 		)
+     * 	)
+     * )
+     * </pre>
+     *
+     * @param string $key
+     * @param string $value
+     */
+    private function parseAppender($key, $value)
+    {
+        // Remove the appender prefix from key
+        $subKey = substr($key, strlen(self::APPENDER_PREFIX));
+
+        // Divide the string by dots
+        $parts = explode('.', $subKey);
+        $count = count($parts);
+
+        // The first part is always the appender name
+        $name = trim($parts[0]);
+
+        // Only one part - this line defines the appender class
+        if ($count == 1) {
+            $this->config['appenders'][$name]['class'] = $value;
+
+            return;
+        }
+
+        // Two parts - either a parameter, a threshold or layout class
+        else if ($count == 2) {
+
+            if ($parts[1] == 'layout') {
+                $this->config['appenders'][$name]['layout']['class'] = $value;
+
+                return;
+            } elseif ($parts[1] == 'threshold') {
+                $this->config['appenders'][$name]['threshold'] = $value;
+
+                return;
+            } else {
+                $this->config['appenders'][$name]['params'][$parts[1]] = $value;
+
+                return;
+            }
+        }
+
+        // Three parts - this can only be a layout parameter
+        else if ($count == 3) {
+            if ($parts[1] == 'layout') {
+                $this->config['appenders'][$name]['layout']['params'][$parts[2]] = $value;
+
+                return;
+            }
+        }
+
+        trigger_error("log4php: Don't know how to parse the following line: \"$key = $value\". Skipping.");
+    }
+
+    /**
+     * Parses a renderer definition.
+     *
+     * Renderers are defined as:
+     * <pre>
+     * log4php.renderer.<renderedClass> = <renderingClass>
+     * </pre>
+     *
+     * @param string $key   log4php.renderer.<renderedClass>
+     * @param string $value <renderingClass>
+     */
+    private function parseRenderer($key, $value)
+    {
+        // Remove the appender prefix from key
+        $renderedClass = substr($key, strlen(self::APPENDER_PREFIX));
+        $renderingClass = $value;
+
+        $this->config['renderers'][] = compact('renderedClass', 'renderingClass');
+    }
+
+    /** Helper method. Returns true if $str begins with $sub. */
+    private function beginsWith($str, $sub)
+    {
+        return (strncmp($str, $sub, strlen($sub)) == 0);
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Configuration/adapters/PhpAdapter.php
----------------------------------------------------------------------
diff --git a/src/Configuration/adapters/PhpAdapter.php b/src/Configuration/adapters/PhpAdapter.php
index 71d245b..6e22c1d 100644
--- a/src/Configuration/adapters/PhpAdapter.php
+++ b/src/Configuration/adapters/PhpAdapter.php
@@ -49,34 +49,34 @@ use Apache\Log4php\LoggerException;
  */
 class PhpAdapter implements AdapterInterface
 {
-	public function convert($url) {
-		if (!file_exists($url)) {
-			throw new LoggerException("File [$url] does not exist.");
-		}
+    public function convert($url)
+    {
+        if (!file_exists($url)) {
+            throw new LoggerException("File [$url] does not exist.");
+        }
 
-		// Load the config file
-		$data = @file_get_contents($url);
-		if ($data === false) {
-			$error = error_get_last();
-			throw new LoggerException("Error loading config file: {$error['message']}");
-		}
+        // Load the config file
+        $data = @file_get_contents($url);
+        if ($data === false) {
+            $error = error_get_last();
+            throw new LoggerException("Error loading config file: {$error['message']}");
+        }
 
-		$config = @eval('?>' . $data);
+        $config = @eval('?>' . $data);
 
-		if ($config === false) {
-			$error = error_get_last();
-			throw new LoggerException("Error parsing configuration: " . $error['message']);
-		}
+        if ($config === false) {
+            $error = error_get_last();
+            throw new LoggerException("Error parsing configuration: " . $error['message']);
+        }
 
-		if (empty($config)) {
-			throw new LoggerException("Invalid configuration: empty configuration array.");
-		}
+        if (empty($config)) {
+            throw new LoggerException("Invalid configuration: empty configuration array.");
+        }
 
-		if (!is_array($config)) {
-			throw new LoggerException("Invalid configuration: not an array.");
-		}
+        if (!is_array($config)) {
+            throw new LoggerException("Invalid configuration: not an array.");
+        }
 
-		return $config;
-	}
+        return $config;
+    }
 }
-

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Configuration/adapters/XmlAdapter.php
----------------------------------------------------------------------
diff --git a/src/Configuration/adapters/XmlAdapter.php b/src/Configuration/adapters/XmlAdapter.php
index d7495b8..829b6d9 100644
--- a/src/Configuration/adapters/XmlAdapter.php
+++ b/src/Configuration/adapters/XmlAdapter.php
@@ -27,251 +27,266 @@ use Apache\Log4php\LoggerException;
  */
 class XmlAdapter implements AdapterInterface
 {
-	/** Path to the XML schema used for validation. */
-	const SCHEMA_PATH = '/../xml/log4php.xsd';
-
-	private $config = array(
-		'appenders' => array(),
-		'loggers' => array(),
-		'renderers' => array(),
-	);
-
-	public function convert($url) {
-		$xml = $this->loadXML($url);
-
-		$this->parseConfiguration($xml);
-
-		// Parse the <root> node
-		if (isset($xml->root)) {
-			$this->parseRootLogger($xml->root);
-		}
-
-		// Process <logger> nodes
-		foreach($xml->logger as $logger) {
-			$this->parseLogger($logger);
-		}
-
-		// Process <appender> nodes
-		foreach($xml->appender as $appender) {
-			$this->parseAppender($appender);
-		}
-
-		// Process <renderer> nodes
-		foreach($xml->renderer as $rendererNode) {
-			$this->parseRenderer($rendererNode);
-		}
-
-		// Process <defaultRenderer> node
-		foreach($xml->defaultRenderer as $rendererNode) {
-			$this->parseDefaultRenderer($rendererNode);
-		}
-
-		return $this->config;
-	}
-
-	/**
-	 * Loads and validates the XML.
-	 * @param string $url Input XML.
-	 */
-	private function loadXML($url) {
-		if (!file_exists($url)) {
-			throw new LoggerException("File [$url] does not exist.");
-		}
-
-		libxml_clear_errors();
-		$oldValue = libxml_use_internal_errors(true);
-
-		// Load XML
-		$xml = @simplexml_load_file($url);
-		if ($xml === false) {
-
-			$errorStr = "";
-			foreach(libxml_get_errors() as $error) {
-				$errorStr .= $error->message;
-			}
-
-			throw new LoggerException("Error loading configuration file: " . trim($errorStr));
-		}
-
-		libxml_clear_errors();
-		libxml_use_internal_errors($oldValue);
-
-		return $xml;
-	}
-
-	/**
-	 * Parses the <configuration> node.
-	 */
-	private function parseConfiguration(\SimpleXMLElement $xml) {
-		$attributes = $xml->attributes();
-		if (isset($attributes['threshold'])) {
-			$this->config['threshold'] = (string) $attributes['threshold'];
-		}
-	}
-
-	/** Parses an <appender> node. */
-	private function parseAppender(\SimpleXMLElement $node) {
-		$name = $this->getAttributeValue($node, 'name');
-		if (empty($name)) {
-			$this->warn("An <appender> node is missing the required 'name' attribute. Skipping appender definition.");
-			return;
-		}
-
-		$appender = array();
-		$appender['class'] = $this->getAttributeValue($node, 'class');
-
-		if (isset($node['threshold'])) {
-			$appender['threshold'] = $this->getAttributeValue($node, 'threshold');
-		}
-
-		if (isset($node->layout)) {
-			$appender['layout']= $this->parseLayout($node->layout, $name);
-		}
-
-		if (count($node->param) > 0) {
-			$appender['params'] = $this->parseParameters($node);
-		}
-
-		foreach($node->filter as $filterNode) {
-			$appender['filters'][] = $this->parseFilter($filterNode);
-		}
-
-		$this->config['appenders'][$name] = $appender;
-	}
-
-	/** Parses a <layout> node. */
-	private function parseLayout(\SimpleXMLElement $node, $appenderName) {
-		$layout = array();
-		$layout['class'] = $this->getAttributeValue($node, 'class');
-
-		if (count($node->param) > 0) {
-			$layout['params'] = $this->parseParameters($node);
-		}
-
-		return $layout;
-	}
-
-	/** Parses any <param> child nodes returning them in an array. */
-	private function parseParameters($paramsNode) {
-		$params = array();
-
-		foreach($paramsNode->param as $paramNode) {
-			if (empty($paramNode['name'])) {
-				$this->warn("A <param> node is missing the required 'name' attribute. Skipping parameter.");
-				continue;
-			}
-
-			$name = $this->getAttributeValue($paramNode, 'name');
-			$value = $this->getAttributeValue($paramNode, 'value');
-
-			$params[$name] = $value;
-		}
-
-		return $params;
-	}
-
-	/** Parses a <root> node. */
-	private function parseRootLogger(\SimpleXMLElement $node) {
-		$logger = array();
-
-		if (isset($node->level)) {
-			$logger['level'] = $this->getAttributeValue($node->level, 'value');
-		}
-
-		$logger['appenders'] = $this->parseAppenderReferences($node);
-
-		$this->config['rootLogger'] = $logger;
-	}
-
-	/** Parses a <logger> node. */
-	private function parseLogger(\SimpleXMLElement $node) {
-		$logger = array();
-
-		$name = $this->getAttributeValue($node, 'name');
-		if (empty($name)) {
-			$this->warn("A <logger> node is missing the required 'name' attribute. Skipping logger definition.");
-			return;
-		}
-
-		if (isset($node->level)) {
-			$logger['level'] = $this->getAttributeValue($node->level, 'value');
-		}
-
-		if (isset($node['additivity'])) {
-			$logger['additivity'] = $this->getAttributeValue($node, 'additivity');
-		}
-
-		$logger['appenders'] = $this->parseAppenderReferences($node);
-
-		// Check for duplicate loggers
-		if (isset($this->config['loggers'][$name])) {
-			$this->warn("Duplicate logger definition [$name]. Overwriting.");
-		}
-
-		$this->config['loggers'][$name] = $logger;
-	}
-
-	/**
-	 * Parses a <logger> node for appender references and returns them in an array.
-	 *
-	 * Previous versions supported appender-ref, as well as appender_ref so both
-	 * are parsed for backward compatibility.
-	 */
-	private function parseAppenderReferences(\SimpleXMLElement $node) {
-		$refs = array();
-		foreach($node->appender_ref as $ref) {
-			$refs[] = $this->getAttributeValue($ref, 'ref');
-		}
-
-		foreach($node->{'appender-ref'} as $ref) {
-			$refs[] = $this->getAttributeValue($ref, 'ref');
-		}
-
-		return $refs;
-	}
-
-	/** Parses a <filter> node. */
-	private function parseFilter($filterNode) {
-		$filter = array();
-		$filter['class'] = $this->getAttributeValue($filterNode, 'class');
-
-		if (count($filterNode->param) > 0) {
-			$filter['params'] = $this->parseParameters($filterNode);
-		}
-
-		return $filter;
-	}
-
-	/** Parses a <renderer> node. */
-	private function parseRenderer(\SimpleXMLElement $node) {
-		$renderedClass = $this->getAttributeValue($node, 'renderedClass');
-		$renderingClass = $this->getAttributeValue($node, 'renderingClass');
-
-		$this->config['renderers'][] = compact('renderedClass', 'renderingClass');
-	}
-
-	/** Parses a <defaultRenderer> node. */
-	private function parseDefaultRenderer(\SimpleXMLElement $node) {
-		$renderingClass = $this->getAttributeValue($node, 'renderingClass');
-
-		// Warn on duplicates
-		if(isset($this->config['defaultRenderer'])) {
-			$this->warn("Duplicate <defaultRenderer> node. Overwriting.");
-		}
-
-		$this->config['defaultRenderer'] = $renderingClass;
-	}
-
-	// ******************************************
-	// ** Helper methods                       **
-	// ******************************************
-
-	private function getAttributeValue(\SimpleXMLElement $node, $name) {
-		return isset($node[$name]) ? (string) $node[$name] : null;
-	}
-
-	private function warn($message) {
-		trigger_error("log4php: " . $message, E_USER_WARNING);
-	}
+    /** Path to the XML schema used for validation. */
+    const SCHEMA_PATH = '/../xml/log4php.xsd';
+
+    private $config = array(
+        'appenders' => array(),
+        'loggers' => array(),
+        'renderers' => array(),
+    );
+
+    public function convert($url)
+    {
+        $xml = $this->loadXML($url);
+
+        $this->parseConfiguration($xml);
+
+        // Parse the <root> node
+        if (isset($xml->root)) {
+            $this->parseRootLogger($xml->root);
+        }
+
+        // Process <logger> nodes
+        foreach ($xml->logger as $logger) {
+            $this->parseLogger($logger);
+        }
+
+        // Process <appender> nodes
+        foreach ($xml->appender as $appender) {
+            $this->parseAppender($appender);
+        }
+
+        // Process <renderer> nodes
+        foreach ($xml->renderer as $rendererNode) {
+            $this->parseRenderer($rendererNode);
+        }
+
+        // Process <defaultRenderer> node
+        foreach ($xml->defaultRenderer as $rendererNode) {
+            $this->parseDefaultRenderer($rendererNode);
+        }
+
+        return $this->config;
+    }
+
+    /**
+     * Loads and validates the XML.
+     * @param string $url Input XML.
+     */
+    private function loadXML($url)
+    {
+        if (!file_exists($url)) {
+            throw new LoggerException("File [$url] does not exist.");
+        }
+
+        libxml_clear_errors();
+        $oldValue = libxml_use_internal_errors(true);
+
+        // Load XML
+        $xml = @simplexml_load_file($url);
+        if ($xml === false) {
+
+            $errorStr = "";
+            foreach (libxml_get_errors() as $error) {
+                $errorStr .= $error->message;
+            }
+
+            throw new LoggerException("Error loading configuration file: " . trim($errorStr));
+        }
+
+        libxml_clear_errors();
+        libxml_use_internal_errors($oldValue);
+
+        return $xml;
+    }
+
+    /**
+     * Parses the <configuration> node.
+     */
+    private function parseConfiguration(\SimpleXMLElement $xml)
+    {
+        $attributes = $xml->attributes();
+        if (isset($attributes['threshold'])) {
+            $this->config['threshold'] = (string) $attributes['threshold'];
+        }
+    }
+
+    /** Parses an <appender> node. */
+    private function parseAppender(\SimpleXMLElement $node)
+    {
+        $name = $this->getAttributeValue($node, 'name');
+        if (empty($name)) {
+            $this->warn("An <appender> node is missing the required 'name' attribute. Skipping appender definition.");
+
+            return;
+        }
+
+        $appender = array();
+        $appender['class'] = $this->getAttributeValue($node, 'class');
+
+        if (isset($node['threshold'])) {
+            $appender['threshold'] = $this->getAttributeValue($node, 'threshold');
+        }
+
+        if (isset($node->layout)) {
+            $appender['layout']= $this->parseLayout($node->layout, $name);
+        }
+
+        if (count($node->param) > 0) {
+            $appender['params'] = $this->parseParameters($node);
+        }
+
+        foreach ($node->filter as $filterNode) {
+            $appender['filters'][] = $this->parseFilter($filterNode);
+        }
+
+        $this->config['appenders'][$name] = $appender;
+    }
+
+    /** Parses a <layout> node. */
+    private function parseLayout(\SimpleXMLElement $node, $appenderName)
+    {
+        $layout = array();
+        $layout['class'] = $this->getAttributeValue($node, 'class');
+
+        if (count($node->param) > 0) {
+            $layout['params'] = $this->parseParameters($node);
+        }
+
+        return $layout;
+    }
+
+    /** Parses any <param> child nodes returning them in an array. */
+    private function parseParameters($paramsNode)
+    {
+        $params = array();
+
+        foreach ($paramsNode->param as $paramNode) {
+            if (empty($paramNode['name'])) {
+                $this->warn("A <param> node is missing the required 'name' attribute. Skipping parameter.");
+                continue;
+            }
+
+            $name = $this->getAttributeValue($paramNode, 'name');
+            $value = $this->getAttributeValue($paramNode, 'value');
+
+            $params[$name] = $value;
+        }
+
+        return $params;
+    }
+
+    /** Parses a <root> node. */
+    private function parseRootLogger(\SimpleXMLElement $node)
+    {
+        $logger = array();
+
+        if (isset($node->level)) {
+            $logger['level'] = $this->getAttributeValue($node->level, 'value');
+        }
+
+        $logger['appenders'] = $this->parseAppenderReferences($node);
+
+        $this->config['rootLogger'] = $logger;
+    }
+
+    /** Parses a <logger> node. */
+    private function parseLogger(\SimpleXMLElement $node)
+    {
+        $logger = array();
+
+        $name = $this->getAttributeValue($node, 'name');
+        if (empty($name)) {
+            $this->warn("A <logger> node is missing the required 'name' attribute. Skipping logger definition.");
+
+            return;
+        }
+
+        if (isset($node->level)) {
+            $logger['level'] = $this->getAttributeValue($node->level, 'value');
+        }
+
+        if (isset($node['additivity'])) {
+            $logger['additivity'] = $this->getAttributeValue($node, 'additivity');
+        }
+
+        $logger['appenders'] = $this->parseAppenderReferences($node);
+
+        // Check for duplicate loggers
+        if (isset($this->config['loggers'][$name])) {
+            $this->warn("Duplicate logger definition [$name]. Overwriting.");
+        }
+
+        $this->config['loggers'][$name] = $logger;
+    }
+
+    /**
+     * Parses a <logger> node for appender references and returns them in an array.
+     *
+     * Previous versions supported appender-ref, as well as appender_ref so both
+     * are parsed for backward compatibility.
+     */
+    private function parseAppenderReferences(\SimpleXMLElement $node)
+    {
+        $refs = array();
+        foreach ($node->appender_ref as $ref) {
+            $refs[] = $this->getAttributeValue($ref, 'ref');
+        }
+
+        foreach ($node->{'appender-ref'} as $ref) {
+            $refs[] = $this->getAttributeValue($ref, 'ref');
+        }
+
+        return $refs;
+    }
+
+    /** Parses a <filter> node. */
+    private function parseFilter($filterNode)
+    {
+        $filter = array();
+        $filter['class'] = $this->getAttributeValue($filterNode, 'class');
+
+        if (count($filterNode->param) > 0) {
+            $filter['params'] = $this->parseParameters($filterNode);
+        }
+
+        return $filter;
+    }
+
+    /** Parses a <renderer> node. */
+    private function parseRenderer(\SimpleXMLElement $node)
+    {
+        $renderedClass = $this->getAttributeValue($node, 'renderedClass');
+        $renderingClass = $this->getAttributeValue($node, 'renderingClass');
+
+        $this->config['renderers'][] = compact('renderedClass', 'renderingClass');
+    }
+
+    /** Parses a <defaultRenderer> node. */
+    private function parseDefaultRenderer(\SimpleXMLElement $node)
+    {
+        $renderingClass = $this->getAttributeValue($node, 'renderingClass');
+
+        // Warn on duplicates
+        if (isset($this->config['defaultRenderer'])) {
+            $this->warn("Duplicate <defaultRenderer> node. Overwriting.");
+        }
+
+        $this->config['defaultRenderer'] = $renderingClass;
+    }
+
+    // ******************************************
+    // ** Helper methods                       **
+    // ******************************************
+
+    private function getAttributeValue(\SimpleXMLElement $node, $name)
+    {
+        return isset($node[$name]) ? (string) $node[$name] : null;
+    }
+
+    private function warn($message)
+    {
+        trigger_error("log4php: " . $message, E_USER_WARNING);
+    }
 }
-

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Filters/AbstractFilter.php
----------------------------------------------------------------------
diff --git a/src/Filters/AbstractFilter.php b/src/Filters/AbstractFilter.php
index 81663e3..9b884a7 100644
--- a/src/Filters/AbstractFilter.php
+++ b/src/Filters/AbstractFilter.php
@@ -53,74 +53,78 @@ use Apache\Log4php\LoggingEvent;
  * <p>The philosophy of log4php filters is largely inspired from the
  * Linux ipchains.
  */
-abstract class AbstractFilter extends Configurable {
+abstract class AbstractFilter extends Configurable
+{
+    /**
+     * The log event must be logged immediately without consulting with
+     * the remaining filters, if any, in the chain.
+     */
+    const ACCEPT = 1;
 
-	/**
-	 * The log event must be logged immediately without consulting with
-	 * the remaining filters, if any, in the chain.
-	 */
-	const ACCEPT = 1;
+    /**
+     * This filter is neutral with respect to the log event. The
+     * remaining filters, if any, should be consulted for a final decision.
+     */
+    const NEUTRAL = 0;
 
-	/**
-	 * This filter is neutral with respect to the log event. The
-	 * remaining filters, if any, should be consulted for a final decision.
-	 */
-	const NEUTRAL = 0;
+    /**
+     * The log event must be dropped immediately without consulting
+     * with the remaining filters, if any, in the chain.
+     */
+    const DENY = -1;
 
-	/**
-	 * The log event must be dropped immediately without consulting
-	 * with the remaining filters, if any, in the chain.
-	 */
-	const DENY = -1;
+    /**
+     * @var AbstractFilter Points to the next {@link AbstractFilter} in the filter chain.
+     */
+    protected $next;
 
-	/**
-	 * @var AbstractFilter Points to the next {@link AbstractFilter} in the filter chain.
-	 */
-	protected $next;
+    /**
+     * Usually filters options become active when set. We provide a
+     * default do-nothing implementation for convenience.
+    */
+    public function activateOptions()
+    {
+    }
 
-	/**
-	 * Usually filters options become active when set. We provide a
-	 * default do-nothing implementation for convenience.
-	*/
-	public function activateOptions() {
-	}
+    /**
+     * Decide what to do.
+     * <p>If the decision is {@link AbstractFilter::DENY}, then the event will be
+     * dropped. If the decision is {@link AbstractFilter::NEUTRAL}, then the next
+     * filter, if any, will be invoked. If the decision is {@link AbstractFilter::ACCEPT} then
+     * the event will be logged without consulting with other filters in
+     * the chain.
+     *
+     * @param  LoggingEvent $event The {@link LoggingEvent} to decide upon.
+     * @return integer      {@link AbstractFilter::NEUTRAL} or {@link AbstractFilter::DENY}|{@link AbstractFilter::ACCEPT}
+     */
+    public function decide(LoggingEvent $event)
+    {
+        return self::NEUTRAL;
+    }
 
-	/**
-	 * Decide what to do.
-	 * <p>If the decision is {@link AbstractFilter::DENY}, then the event will be
-	 * dropped. If the decision is {@link AbstractFilter::NEUTRAL}, then the next
-	 * filter, if any, will be invoked. If the decision is {@link AbstractFilter::ACCEPT} then
-	 * the event will be logged without consulting with other filters in
-	 * the chain.
-	 *
-	 * @param LoggingEvent $event The {@link LoggingEvent} to decide upon.
-	 * @return integer {@link AbstractFilter::NEUTRAL} or {@link AbstractFilter::DENY}|{@link AbstractFilter::ACCEPT}
-	 */
-	public function decide(LoggingEvent $event) {
-		return self::NEUTRAL;
-	}
+    /**
+     * Adds a new filter to the filter chain this filter is a part of.
+     * If this filter has already and follow up filter, the param filter
+     * is passed on until it is the last filter in chain.
+     *
+     * @param $filter - the filter to add to this chain
+     */
+    public function addNext($filter)
+    {
+        if ($this->next !== null) {
+            $this->next->addNext($filter);
+        } else {
+            $this->next = $filter;
+        }
+    }
 
-	/**
-	 * Adds a new filter to the filter chain this filter is a part of.
-	 * If this filter has already and follow up filter, the param filter
-	 * is passed on until it is the last filter in chain.
-	 *
-	 * @param $filter - the filter to add to this chain
-	 */
-	public function addNext($filter) {
-		if($this->next !== null) {
-			$this->next->addNext($filter);
-		} else {
-			$this->next = $filter;
-		}
-	}
-
-	/**
-	 * Returns the next filter in this chain
-	 * @return the next filter
-	 */
-	public function getNext() {
-		return $this->next;
-	}
+    /**
+     * Returns the next filter in this chain
+     * @return the next filter
+     */
+    public function getNext()
+    {
+        return $this->next;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Filters/DenyAllFilter.php
----------------------------------------------------------------------
diff --git a/src/Filters/DenyAllFilter.php b/src/Filters/DenyAllFilter.php
index 1d34357..6781b55 100644
--- a/src/Filters/DenyAllFilter.php
+++ b/src/Filters/DenyAllFilter.php
@@ -30,16 +30,17 @@ use Apache\Log4php\LoggingEvent;
  *
  * @since 0.3
  */
-class DenyAllFilter extends AbstractFilter {
-
-	/**
-	 * Always returns the integer constant {@link AbstractFilter::DENY}
-	 * regardless of the {@link LoggingEvent} parameter.
-	 *
-	 * @param LoggingEvent $event The {@link LoggingEvent} to filter.
-	 * @return AbstractFilter::DENY Always returns {@link AbstractFilter::DENY}
-	 */
-	public function decide(LoggingEvent $event) {
-		return AbstractFilter::DENY;
-	}
+class DenyAllFilter extends AbstractFilter
+{
+    /**
+     * Always returns the integer constant {@link AbstractFilter::DENY}
+     * regardless of the {@link LoggingEvent} parameter.
+     *
+     * @param  LoggingEvent         $event The {@link LoggingEvent} to filter.
+     * @return AbstractFilter::DENY Always returns {@link AbstractFilter::DENY}
+     */
+    public function decide(LoggingEvent $event)
+    {
+        return AbstractFilter::DENY;
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Filters/LevelMatchFilter.php
----------------------------------------------------------------------
diff --git a/src/Filters/LevelMatchFilter.php b/src/Filters/LevelMatchFilter.php
index 4573c4c..2ace612 100644
--- a/src/Filters/LevelMatchFilter.php
+++ b/src/Filters/LevelMatchFilter.php
@@ -43,56 +43,59 @@ use Apache\Log4php\LoggingEvent;
  * {@example ../../examples/resources/filter_levelmatch.xml 18}
  * @since 0.6
  */
-class LevelMatchFilter extends AbstractFilter {
+class LevelMatchFilter extends AbstractFilter
+{
+    /**
+     * Indicates if this event should be accepted or denied on match
+     * @var boolean
+     */
+    protected $acceptOnMatch = true;
 
-	/**
-	 * Indicates if this event should be accepted or denied on match
-	 * @var boolean
-	 */
-	protected $acceptOnMatch = true;
+    /**
+     * The level, when to match
+     * @var Level
+     */
+    protected $levelToMatch;
 
-	/**
-	 * The level, when to match
-	 * @var Level
-	 */
-	protected $levelToMatch;
+    /**
+     * @param boolean $acceptOnMatch
+     */
+    public function setAcceptOnMatch($acceptOnMatch)
+    {
+        $this->setBoolean('acceptOnMatch', $acceptOnMatch);
+    }
 
-	/**
-	 * @param boolean $acceptOnMatch
-	 */
-	public function setAcceptOnMatch($acceptOnMatch) {
-		$this->setBoolean('acceptOnMatch', $acceptOnMatch);
-	}
+    /**
+     * @param string $l the level to match
+     */
+    public function setLevelToMatch($level)
+    {
+        $this->setLevel('levelToMatch', $level);
+    }
 
-	/**
-	 * @param string $l the level to match
-	 */
-	public function setLevelToMatch($level) {
-		$this->setLevel('levelToMatch', $level);
-	}
+    /**
+     * Return the decision of this filter.
+     *
+     * Returns {@link AbstractFilter::NEUTRAL} if the <b><var>LevelToMatch</var></b>
+     * option is not set or if there is not match.	Otherwise, if there is a
+     * match, then the returned decision is {@link AbstractFilter::ACCEPT} if the
+     * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The
+     * returned decision is {@link AbstractFilter::DENY} if the
+     * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>.
+     *
+     * @param  LoggingEvent $event
+     * @return integer
+     */
+    public function decide(LoggingEvent $event)
+    {
+        if ($this->levelToMatch === null) {
+            return AbstractFilter::NEUTRAL;
+        }
 
-	/**
-	 * Return the decision of this filter.
-	 *
-	 * Returns {@link AbstractFilter::NEUTRAL} if the <b><var>LevelToMatch</var></b>
-	 * option is not set or if there is not match.	Otherwise, if there is a
-	 * match, then the returned decision is {@link AbstractFilter::ACCEPT} if the
-	 * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The
-	 * returned decision is {@link AbstractFilter::DENY} if the
-	 * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>.
-	 *
-	 * @param LoggingEvent $event
-	 * @return integer
-	 */
-	public function decide(LoggingEvent $event) {
-		if($this->levelToMatch === null) {
-			return AbstractFilter::NEUTRAL;
-		}
-
-		if($this->levelToMatch->equals($event->getLevel())) {
-			return $this->acceptOnMatch ? AbstractFilter::ACCEPT : AbstractFilter::DENY;
-		} else {
-			return AbstractFilter::NEUTRAL;
-		}
-	}
+        if ($this->levelToMatch->equals($event->getLevel())) {
+            return $this->acceptOnMatch ? AbstractFilter::ACCEPT : AbstractFilter::DENY;
+        } else {
+            return AbstractFilter::NEUTRAL;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Filters/LevelRangeFilter.php
----------------------------------------------------------------------
diff --git a/src/Filters/LevelRangeFilter.php b/src/Filters/LevelRangeFilter.php
index d30f5ae..6eb62f5 100644
--- a/src/Filters/LevelRangeFilter.php
+++ b/src/Filters/LevelRangeFilter.php
@@ -60,77 +60,81 @@ use Apache\Log4php\LoggingEvent;
  * @author based on the org.apache.log4j.varia.LevelRangeFilte Java code by Ceki G&uuml;lc&uuml;
  * @since 0.6
  */
-class LevelRangeFilter extends AbstractFilter {
+class LevelRangeFilter extends AbstractFilter
+{
+    /**
+     * @var boolean
+     */
+    protected $acceptOnMatch = true;
 
-	/**
-	 * @var boolean
-	 */
-	protected $acceptOnMatch = true;
+    /**
+     * @var Level
+     */
+    protected $levelMin;
 
-	/**
-	 * @var Level
-	 */
-	protected $levelMin;
+    /**
+     * @var Level
+     */
+    protected $levelMax;
 
-	/**
-	 * @var Level
-	 */
-	protected $levelMax;
+    /**
+     * @param boolean $acceptOnMatch
+     */
+    public function setAcceptOnMatch($acceptOnMatch)
+    {
+        $this->setBoolean('acceptOnMatch', $acceptOnMatch);
+    }
 
-	/**
-	 * @param boolean $acceptOnMatch
-	 */
-	public function setAcceptOnMatch($acceptOnMatch) {
-		$this->setBoolean('acceptOnMatch', $acceptOnMatch);
-	}
+    /**
+     * @param string $l the level min to match
+     */
+    public function setLevelMin($level)
+    {
+        $this->setLevel('levelMin', $level);
+    }
 
-	/**
-	 * @param string $l the level min to match
-	 */
-	public function setLevelMin($level) {
-		$this->setLevel('levelMin', $level);
-	}
+    /**
+     * @param string $l the level max to match
+     */
+    public function setLevelMax($level)
+    {
+        $this->setLevel('levelMax', $level);
+    }
 
-	/**
-	 * @param string $l the level max to match
-	 */
-	public function setLevelMax($level) {
-		$this->setLevel('levelMax', $level);
-	}
+    /**
+     * Return the decision of this filter.
+     *
+     * @param  LoggingEvent $event
+     * @return integer
+     */
+    public function decide(LoggingEvent $event)
+    {
+        $level = $event->getLevel();
 
-	/**
-	 * Return the decision of this filter.
-	 *
-	 * @param LoggingEvent $event
-	 * @return integer
-	 */
-	public function decide(LoggingEvent $event) {
-		$level = $event->getLevel();
+        if ($this->levelMin !== null) {
+            if ($level->isGreaterOrEqual($this->levelMin) == false) {
+                // level of event is less than minimum
+                return AbstractFilter::DENY;
+            }
+        }
 
-		if($this->levelMin !== null) {
-			if($level->isGreaterOrEqual($this->levelMin) == false) {
-				// level of event is less than minimum
-				return AbstractFilter::DENY;
-			}
-		}
+        if ($this->levelMax !== null) {
+            if ($level->toInt() > $this->levelMax->toInt()) {
+                // level of event is greater than maximum
+                // Alas, there is no Level.isGreater method. and using
+                // a combo of isGreaterOrEqual && !Equal seems worse than
+                // checking the int values of the level objects..
+                return AbstractFilter::DENY;
+            }
+        }
 
-		if($this->levelMax !== null) {
-			if($level->toInt() > $this->levelMax->toInt()) {
-				// level of event is greater than maximum
-				// Alas, there is no Level.isGreater method. and using
-				// a combo of isGreaterOrEqual && !Equal seems worse than
-				// checking the int values of the level objects..
-				return AbstractFilter::DENY;
-			}
-		}
-
-		if($this->acceptOnMatch) {
-			// this filter set up to bypass later filters and always return
-			// accept if level in range
-			return AbstractFilter::ACCEPT;
-		} else {
-			// event is ok for this filter; allow later filters to have a look..
-			return AbstractFilter::NEUTRAL;
-		}
-	}
+        if ($this->acceptOnMatch) {
+            // this filter set up to bypass later filters and always return
+            // accept if level in range
+            return AbstractFilter::ACCEPT;
+        } else {
+            // event is ok for this filter; allow later filters to have a look..
+            return AbstractFilter::NEUTRAL;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Filters/StringMatchFilter.php
----------------------------------------------------------------------
diff --git a/src/Filters/StringMatchFilter.php b/src/Filters/StringMatchFilter.php
index 152c9c9..c6e6359 100644
--- a/src/Filters/StringMatchFilter.php
+++ b/src/Filters/StringMatchFilter.php
@@ -43,45 +43,49 @@ use Apache\Log4php\LoggingEvent;
  * {@example ../../examples/resources/filter_stringmatch.xml 18}
  * @since 0.3
  */
-class StringMatchFilter extends AbstractFilter {
+class StringMatchFilter extends AbstractFilter
+{
+    /**
+     * @var boolean
+     */
+    protected $acceptOnMatch = true;
 
-	/**
-	 * @var boolean
-	 */
-	protected $acceptOnMatch = true;
+    /**
+     * @var string
+     */
+    protected $stringToMatch;
 
-	/**
-	 * @var string
-	 */
-	protected $stringToMatch;
+    /**
+     * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false')
+     */
+    public function setAcceptOnMatch($acceptOnMatch)
+    {
+        $this->setBoolean('acceptOnMatch', $acceptOnMatch);
+    }
 
-	/**
-	 * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false')
-	 */
-	public function setAcceptOnMatch($acceptOnMatch) {
-		$this->setBoolean('acceptOnMatch', $acceptOnMatch);
-	}
+    /**
+     * @param string $s the string to match
+     */
+    public function setStringToMatch($string)
+    {
+        $this->setString('stringToMatch', $string);
+    }
 
-	/**
-	 * @param string $s the string to match
-	 */
-	public function setStringToMatch($string) {
-		$this->setString('stringToMatch', $string);
-	}
+    /**
+     * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
+     */
+    public function decide(LoggingEvent $event)
+    {
+        $msg = $event->getRenderedMessage();
 
-	/**
-	 * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
-	 */
-	public function decide(LoggingEvent $event) {
-		$msg = $event->getRenderedMessage();
+        if ($msg === null or $this->stringToMatch === null) {
+            return AbstractFilter::NEUTRAL;
+        }
 
-		if($msg === null or $this->stringToMatch === null) {
-			return AbstractFilter::NEUTRAL;
-		}
+        if (strpos($msg, $this->stringToMatch) !== false ) {
+            return ($this->acceptOnMatch) ? AbstractFilter::ACCEPT : AbstractFilter::DENY;
+        }
 
-		if(strpos($msg, $this->stringToMatch) !== false ) {
-			return ($this->acceptOnMatch) ? AbstractFilter::ACCEPT : AbstractFilter::DENY;
-		}
-		return AbstractFilter::NEUTRAL;
-	}
+        return AbstractFilter::NEUTRAL;
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Helpers/FormattingInfo.php
----------------------------------------------------------------------
diff --git a/src/Helpers/FormattingInfo.php b/src/Helpers/FormattingInfo.php
index 9f2bb3b..fb824b4 100644
--- a/src/Helpers/FormattingInfo.php
+++ b/src/Helpers/FormattingInfo.php
@@ -23,29 +23,29 @@ namespace Apache\Log4php\Helpers;
  * formatting modifiers in conversion modifiers.
  * @since 0.3
  */
-class FormattingInfo {
+class FormattingInfo
+{
+    /**
+     * Minimal output length. If output is shorter than this value, it will be
+     * padded with spaces.
+     */
+    public $min = 0;
 
-	/**
-	 * Minimal output length. If output is shorter than this value, it will be
-	 * padded with spaces.
-	 */
-	public $min = 0;
+    /**
+     * Maximum output length. If output is longer than this value, it will be
+     * trimmed.
+     */
+    public $max = PHP_INT_MAX;
 
-	/**
-	 * Maximum output length. If output is longer than this value, it will be
-	 * trimmed.
-	 */
-	public $max = PHP_INT_MAX;
+    /**
+     * Whether to pad the string from the left. If set to false, the string
+     * will be padded from the right.
+     */
+    public $padLeft = true;
 
-	/**
-	 * Whether to pad the string from the left. If set to false, the string
-	 * will be padded from the right.
-	 */
-	public $padLeft = true;
-
-	/**
-	 * Whether to trim the string from the left. If set to false, the string
-	 * will be trimmed from the right.
-	 */
-	public $trimLeft = false;
+    /**
+     * Whether to trim the string from the left. If set to false, the string
+     * will be trimmed from the right.
+     */
+    public $trimLeft = false;
 }


Mime
View raw message