From: Michael M Slusarz Date: Mon, 6 Sep 2010 19:36:52 +0000 (-0600) Subject: H4 phpdoc and formatting cleanups X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0436560b3f50dc543260e41685de1a9ae4627b90;p=horde.git H4 phpdoc and formatting cleanups --- diff --git a/framework/Log/lib/Horde/Log.php b/framework/Log/lib/Horde/Log.php index 08d065c2f..9f4a1583e 100644 --- a/framework/Log/lib/Horde/Log.php +++ b/framework/Log/lib/Horde/Log.php @@ -7,7 +7,7 @@ * one were written by Mike Naberezny and Chuck Hagenbuch. * * @category Horde - * @package Horde_Log + * @package Log * @author Mike Naberezny * @author Chuck Hagenbuch * @license http://opensource.org/licenses/bsd-license.php BSD @@ -15,7 +15,7 @@ /** * @category Horde - * @package Horde_Log + * @package Log */ class Horde_Log { diff --git a/framework/Log/lib/Horde/Log/Exception.php b/framework/Log/lib/Horde/Log/Exception.php index aa18ca9f4..07f051ec6 100644 --- a/framework/Log/lib/Horde/Log/Exception.php +++ b/framework/Log/lib/Horde/Log/Exception.php @@ -6,16 +6,18 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @package Horde_Log * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log */ /** - * @package Horde_Log * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log */ class Horde_Log_Exception extends Exception {} diff --git a/framework/Log/lib/Horde/Log/Filter.php b/framework/Log/lib/Horde/Log/Filter.php index 8a0b297d7..6d3799777 100644 --- a/framework/Log/lib/Horde/Log/Filter.php +++ b/framework/Log/lib/Horde/Log/Filter.php @@ -6,21 +6,22 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @category Horde + * @subpackage Filters + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ interface Horde_Log_Filter { @@ -38,8 +39,10 @@ interface Horde_Log_Filter * Returns Horde_Log_Filter::ACCEPT to accept the message, * Horde_Log_Filter::IGNORE to ignore it. * - * @param array $event Log event - * @return boolean accepted? + * @param array $event Log event. + * + * @return boolean Accepted? */ public function accept($event); + } diff --git a/framework/Log/lib/Horde/Log/Filter/Constraint.php b/framework/Log/lib/Horde/Log/Filter/Constraint.php index d7e42b8f5..6a22d9667 100644 --- a/framework/Log/lib/Horde/Log/Filter/Constraint.php +++ b/framework/Log/lib/Horde/Log/Filter/Constraint.php @@ -1,21 +1,21 @@ + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author James Pepin - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** * Filters log events using defined constraints on one or more fields of the - * $event array + * $event array. * - * @category Horde - * @package Horde_Log + * @author James Pepin + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author James Pepin - * @license http://opensource.org/licenses/bsd-license.php BSD * * @todo Implement constraint objects for the different types of filtering ie * regex,required,type..etc.. so we can add different constaints ad infinitum. @@ -23,11 +23,15 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter { /** + * Constraint list. + * * @var array */ protected $_constraints = array(); /** + * Default constraint coupler. + * * @var Horde_Constraint_Coupler * @default Horde_Constraint_And */ @@ -36,24 +40,27 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter /** * Constructor * - * @param Horde_Constraint_Coupler $coupler The default kind of constraint - * to use to couple multiple constraints. Defaults to And. + * @param Horde_Constraint_Coupler $coupler The default kind of + * constraint to use to couple + * multiple constraints. + * Defaults to And. */ public function __construct(Horde_Constraint_Coupler $coupler = null) { - if (is_null($coupler)) { - $coupler = new Horde_Constraint_And(); - } - $this->_coupler = $coupler; + $this->_coupler = is_null($coupler) + ? new Horde_Constraint_And() + : $coupler; } /** * Add a constraint to the filter * - * @param string $field The field to apply the constraint to - * @param Horde_Constraint $constraint The constraint to apply + * @param string $field The field to apply the constraint + * to. + * @param Horde_Constraint $constraint The constraint to apply. * - * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining + * @return Horde_Log_Filter_Constraint A reference to $this to allow + * method chaining. */ public function addConstraint($field, Horde_Constraint $constraint) { @@ -61,6 +68,7 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter $this->_constraints[$field] = clone($this->_coupler); } $this->_constraints[$field]->addConstraint($constraint); + return $this; } @@ -70,14 +78,15 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter * Takes a field name and a regex, if the regex does not match then the * event is filtered. * - * @param string $field The name of the field that should be part of the event - * @param string $regex The regular expression to filter by - * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining + * @param string $field The name of the field that should be part of the + * event. + * @param string $regex The regular expression to filter by. + * @return Horde_Log_Filter_Constraint A reference to $this to allow + * method chaining. */ public function addRegex($field, $regex) { - $constraint = new Horde_Constraint_PregMatch($regex); - return $this->addConstraint($field, $constraint); + return $this->addConstraint($field, new Horde_Constraint_PregMatch($regex)); } /** @@ -85,26 +94,29 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter * * If the field does not exist on the event, then it is filtered. * - * @param string $field The name of the field that should be part of the event - * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining + * @param string $field The name of the field that should be part of the + * event. + * + * @return Horde_Log_Filter_Constraint A reference to $this to allow + * method chaining. */ public function addRequiredField($field) { - $notNull = new Horde_Constraint_Not(new Horde_Constraint_Null()); - return $this->addConstraint($field, $notNull); + return $this->addConstraint($field, new Horde_Constraint_Not(new Horde_Constraint_Null())); } /** * Adds all arguments passed as required fields * - * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining + * @return Horde_Log_Filter_Constraint A reference to $this to allow + * method chaining. */ public function addRequiredFields() { - $fields = func_get_args(); - foreach ($fields as $f) { + foreach (func_get_args() as $f) { $this->addRequiredField($f); } + return $this; } @@ -112,8 +124,9 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter * Returns Horde_Log_Filter::ACCEPT to accept the message, * Horde_Log_Filter::IGNORE to ignore it. * - * @param array $event Log event - * @return boolean accepted? + * @param array $event Log event. + * + * @return boolean accepted? */ public function accept($event) { @@ -123,6 +136,8 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter return Horde_Log_Filter::IGNORE; } } + return Horde_Log_Filter::ACCEPT; } + } diff --git a/framework/Log/lib/Horde/Log/Filter/Level.php b/framework/Log/lib/Horde/Log/Filter/Level.php index 4a7a248e4..f01984988 100644 --- a/framework/Log/lib/Horde/Log/Filter/Level.php +++ b/framework/Log/lib/Horde/Log/Filter/Level.php @@ -6,23 +6,27 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Filter_Level implements Horde_Log_Filter { /** + * Filter level. + * * @var integer */ protected $_level; @@ -30,12 +34,14 @@ class Horde_Log_Filter_Level implements Horde_Log_Filter /** * Filter out any log messages greater than $level. * - * @param integer $level Maximum log level to pass through the filter + * @param integer $level Maximum log level to pass through the filter. + * + * @throws InvalidArgumentException */ public function __construct($level) { - if (! is_integer($level)) { - throw new Horde_Log_Exception('Level must be an integer'); + if (!is_integer($level)) { + throw new InvalidArgumentException('Level must be an integer'); } $this->_level = $level; @@ -45,11 +51,13 @@ class Horde_Log_Filter_Level implements Horde_Log_Filter * Returns Horde_Log_Filter::ACCEPT to accept the message, * Horde_Log_Filter::IGNORE to ignore it. * - * @param array $event Log event - * @return boolean accepted? + * @param array $event Log event. + * + * @return boolean Accepted? */ public function accept($event) { - return $event['level'] <= $this->_level; + return ($event['level'] <= $this->_level); } + } diff --git a/framework/Log/lib/Horde/Log/Filter/Message.php b/framework/Log/lib/Horde/Log/Filter/Message.php index e0da1ee4c..ccbd93862 100644 --- a/framework/Log/lib/Horde/Log/Filter/Message.php +++ b/framework/Log/lib/Horde/Log/Filter/Message.php @@ -6,25 +6,27 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Filter_Message implements Horde_Log_Filter { /** + * Filter regex. + * * @var string */ protected $_regexp; @@ -32,14 +34,16 @@ class Horde_Log_Filter_Message implements Horde_Log_Filter /** * Filter out any log messages not matching $regexp. * - * @param string $regexp Regular expression to test the log message - * @throws Horde_Log_Exception Invalid regular expression + * @param string $regexp Regular expression to test the log message. + * + * @throws InvalidArgumentException Invalid regular expression. */ public function __construct($regexp) { if (@preg_match($regexp, '') === false) { - throw new Horde_Log_Exception("Invalid regular expression '$regexp'"); + throw new InvalidArgumentException('Invalid regular expression ' . $regexp); } + $this->_regexp = $regexp; } @@ -47,11 +51,13 @@ class Horde_Log_Filter_Message implements Horde_Log_Filter * Returns Horde_Log_Filter::ACCEPT to accept the message, * Horde_Log_Filter::IGNORE to ignore it. * - * @param array $event Log event - * @return boolean accepted? + * @param array $event Log event. + * + * @return boolean Accepted? */ public function accept($event) { - return preg_match($this->_regexp, $event['message']) > 0; + return (preg_match($this->_regexp, $event['message']) > 0); } + } diff --git a/framework/Log/lib/Horde/Log/Filter/Suppress.php b/framework/Log/lib/Horde/Log/Filter/Suppress.php index 2b3f9cba9..23f7008c3 100644 --- a/framework/Log/lib/Horde/Log/Filter/Suppress.php +++ b/framework/Log/lib/Horde/Log/Filter/Suppress.php @@ -6,25 +6,27 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Filters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Filter_Suppress implements Horde_Log_Filter { /** + * Accept all events? + * * @var boolean */ protected $_accept = Horde_Log_Filter::ACCEPT; @@ -32,26 +34,24 @@ class Horde_Log_Filter_Suppress implements Horde_Log_Filter /** * This is a simple boolean filter. * - * Call suppress(true) to suppress all log events. - * Call suppress(false) to accept all log events. - * - * @param boolean $suppress Should all log events be suppressed? - * @return void + * @param boolean $suppress Should all log events be suppressed? */ public function suppress($suppress) { - $this->_accept = (! $suppress); + $this->_accept = !$suppress; } /** * Returns Horde_Log_Filter::ACCEPT to accept the message, * Horde_Log_Filter::IGNORE to ignore it. * - * @param array $event event data - * @return boolean accepted? + * @param array $event Event data. + * + * @return boolean Accepted? */ public function accept($event) { return $this->_accept; } + } diff --git a/framework/Log/lib/Horde/Log/Formatter.php b/framework/Log/lib/Horde/Log/Formatter.php index 1d97ae7e1..f69225f3d 100644 --- a/framework/Log/lib/Horde/Log/Formatter.php +++ b/framework/Log/lib/Horde/Log/Formatter.php @@ -6,25 +6,29 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @package Horde_Log * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log */ /** - * @package Horde_Log * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log */ interface Horde_Log_Formatter { /** * Formats an event to be written by the handler. * - * @param array $event Log event - * @return string formatted line + * @param array $event Log event. + * + * @return string Formatted line. */ public function format($event); + } diff --git a/framework/Log/lib/Horde/Log/Formatter/Simple.php b/framework/Log/lib/Horde/Log/Formatter/Simple.php index 1fc3a3d3b..1cc033358 100644 --- a/framework/Log/lib/Horde/Log/Formatter/Simple.php +++ b/framework/Log/lib/Horde/Log/Formatter/Simple.php @@ -6,26 +6,26 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Formatters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Formatters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Formatter_Simple implements Horde_Log_Formatter { /** - * Format string + * Format string. * * @var string */ @@ -34,25 +34,25 @@ class Horde_Log_Formatter_Simple implements Horde_Log_Formatter /** * Constructor. * - * @param array $options Configuration Options: + * @param array $options Configuration options: *
      * 'format' - (string) The log template.
      * 
+ * + * @throws InvalidArgumentException */ public function __construct($options = null) { - if (is_array($options) && isset($options['format'])) { - $format = $options['format']; - } else { - $format = $options; - } + $format = (is_array($options) && isset($options['format'])) + ? $options['format'] + : $options; if (is_null($format)) { $format = '%timestamp% %levelName%: %message%' . PHP_EOL; } if (!is_string($format)) { - throw new Horde_Log_Exception('Format must be a string'); + throw new InvalidArgumentException('Format must be a string'); } $this->_format = $format; @@ -61,8 +61,9 @@ class Horde_Log_Formatter_Simple implements Horde_Log_Formatter /** * Formats an event to be written by the handler. * - * @param array $event Log event - * @return string formatted line + * @param array $event Log event. + * + * @return string Formatted line. */ public function format($event) { diff --git a/framework/Log/lib/Horde/Log/Formatter/Xml.php b/framework/Log/lib/Horde/Log/Formatter/Xml.php index e50c3e992..4f6b4157a 100644 --- a/framework/Log/lib/Horde/Log/Formatter/Xml.php +++ b/framework/Log/lib/Horde/Log/Formatter/Xml.php @@ -6,30 +6,42 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Formatters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Formatters - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Formatter_Xml implements Horde_Log_Formatter { - protected $_options = array('elementEntry' => 'log', - 'elementTimestamp' => 'timestamp', - 'elementMessage' => 'message', - 'elementLevel' => 'level', - 'lineEnding' => PHP_EOL); + /** + * Config options. + * + * @var array + */ + protected $_options = array( + 'elementEntry' => 'log', + 'elementTimestamp' => 'timestamp', + 'elementMessage' => 'message', + 'elementLevel' => 'level', + 'lineEnding' => PHP_EOL + ); + /** + * Constructor. + * + * TODO + */ public function __construct($options = array()) { $this->_options = array_merge($this->_options, $options); @@ -38,8 +50,9 @@ class Horde_Log_Formatter_Xml implements Horde_Log_Formatter /** * Formats an event to be written by the handler. * - * @param array $event Log event - * @return string XML string + * @param array $event Log event. + * + * @return string XML string. */ public function format($event) { @@ -50,10 +63,7 @@ class Horde_Log_Formatter_Xml implements Horde_Log_Formatter $elt->appendChild(new DOMElement($this->_options['elementMessage'], $event['message'])); $elt->appendChild(new DOMElement($this->_options['elementLevel'], $event['level'])); - $xml = $dom->saveXML(); - $xml = preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $xml); - - return $xml . $this->_options['lineEnding']; + return preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $dom->saveXML()) . $this->_options['lineEnding']; } } diff --git a/framework/Log/lib/Horde/Log/Handler/Base.php b/framework/Log/lib/Horde/Log/Handler/Base.php index 2bba7ea61..c5bd332a3 100644 --- a/framework/Log/lib/Horde/Log/Handler/Base.php +++ b/framework/Log/lib/Horde/Log/Handler/Base.php @@ -6,58 +6,58 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ abstract class Horde_Log_Handler_Base { /** - * @var array of key/value pair options + * Options. + * + * @var array */ protected $_options = array(); /** - * @var array of Horde_Log_Filter + * List of filter objects. + * + * @var array */ protected $_filters = array(); /** * Add a filter specific to this handler. * - * @param Horde_Log_Filter $filter - * @return void + * @param Horde_Log_Filter $filter Filter to add. */ public function addFilter($filter) { - if (is_integer($filter)) { - $filter = new Horde_Log_Filter_Level($filter); - } - - $this->_filters[] = $filter; + $this->_filters[] = is_integer($filter) + ? new Horde_Log_Filter_Level($filter) + : $filter; } /** * Log a message to this handler. * - * @param array $event Log event - * @return void + * @param array $event Log event. */ public function log($event) { - // if any local filter rejects the message, don't log it. + // If any local filter rejects the message, don't log it. foreach ($this->_filters as $filter) { if (!$filter->accept($event)) { return; @@ -70,14 +70,17 @@ abstract class Horde_Log_Handler_Base /** * Sets an option specific to the implementation of the log handler. * - * @param $optionKey Key name for the option to be changed. Keys are handler-specific - * @param $optionValue New value to assign to the option - * @return bool True + * @param string $optionKey Key name for the option to be changed. Keys + * are handler-specific. + * @param mixed $optionValue New value to assign to the option + * + * @return boolean True. + * @throws Horde_Log_Exception */ public function setOption($optionKey, $optionValue) { if (!isset($this->_options[$optionKey])) { - throw new Horde_Log_Exception("Unknown option \"$optionKey\"."); + throw new Horde_Log_Exception('Unknown option "' . $optionKey . '".'); } $this->_options[$optionKey] = $optionValue; @@ -85,10 +88,10 @@ abstract class Horde_Log_Handler_Base } /** - * Buffer a message to be stored in the storage - * implemented by this handler. + * Buffer a message to be stored in the storage. * - * @param array $event Log event + * @param array $event Log event. */ abstract public function write($event); + } diff --git a/framework/Log/lib/Horde/Log/Handler/Db.php b/framework/Log/lib/Horde/Log/Handler/Db.php index 6c545331d..c3cff3d7a 100644 --- a/framework/Log/lib/Horde/Log/Handler/Db.php +++ b/framework/Log/lib/Horde/Log/Handler/Db.php @@ -6,61 +6,67 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Handler_Db extends Horde_Log_Handler_Base { /** - * Database adapter instance + * Database adapter instance. + * * @var Horde_Db_Adapter */ private $_db; /** - * Name of the log table in the database + * Name of the log table in the database. + * * @var string */ private $_table; /** - * Options to be set by setOption(). Sets the field names in the database table. + * Options to be set by setOption(). + * Sets the field names in the database table. * * @var array */ - protected $_options = array('fieldMessage' => 'message', - 'fieldLevel' => 'level'); + protected $_options = array( + 'fieldMessage' => 'message', + 'fieldLevel' => 'level' + ); /** - * Class constructor + * Constructor. * - * @param Horde_Db_Adapter $db Database adapter instance - * @param string $table Log table in database + * @param Horde_Db_Adapter $db Database adapter instance. + * @param string $table Log table in database. */ public function __construct($db, $table) { - $this->_db = $db; + $this->_db = $db; $this->_table = $table; } /** * Write a message to the log. * - * @param array $event Log event - * @return bool Always True + * @param array $event Log event. + * + * @return bool True. */ public function write($event) { @@ -70,6 +76,7 @@ class Horde_Log_Handler_Db extends Horde_Log_Handler_Base ); $this->_db->insert($this->_table, $fields); + return true; } diff --git a/framework/Log/lib/Horde/Log/Handler/Firebug.php b/framework/Log/lib/Horde/Log/Handler/Firebug.php index 67be282d6..f9e97615d 100644 --- a/framework/Log/lib/Horde/Log/Handler/Firebug.php +++ b/framework/Log/lib/Horde/Log/Handler/Firebug.php @@ -2,47 +2,51 @@ /** * Horde Log package * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Handler_Firebug extends Horde_Log_Handler_Base { /** * Formats the log message before writing. + * * @var Horde_Log_Formatter */ protected $_formatter; /** - * Options to be set by setOption(). Sets the field names in the database table. + * Options to be set by setOption(). * * @var array */ - protected $_options = array('buffering' => false); + protected $_options = array( + 'buffering' => false + ); /** * Array of buffered output. + * * @var string */ protected $_buffer = array(); /** * Mapping of log priorities to Firebug methods. + * * @var array - * @access private */ protected static $_methods = array( Horde_Log::EMERG => 'error', @@ -58,25 +62,25 @@ class Horde_Log_Handler_Firebug extends Horde_Log_Handler_Base /** * Class Constructor * - * @param Horde_Log_Formatter $formatter Log formatter + * @param Horde_Log_Formatter $formatter Log formatter. */ public function __construct(Horde_Log_Formatter $formatter = null) { - if (is_null($formatter)) { - $formatter = new Horde_Log_Formatter_Simple(); - } - $this->_formatter = $formatter; + $this->_formatter = is_null($formatter) + ? new Horde_Log_Formatter_Simple() + : $formatter; } /** - * Write a message to the firebug console. This function really just writes - * the message to the buffer. If buffering is enabled, the + * Write a message to the firebug console. This function really just + * writes the message to the buffer. If buffering is enabled, the * message won't be output until the buffer is flushed. If * buffering is not enabled, the buffer will be flushed * immediately. * - * @param array $event Log event - * @return bool Always True + * @param array $event Log event. + * + * @return boolean True. */ public function write($event) { @@ -90,6 +94,7 @@ class Horde_Log_Handler_Firebug extends Horde_Log_Handler_Base } /** + * Flush the buffer. */ public function flush() { @@ -101,17 +106,19 @@ class Horde_Log_Handler_Firebug extends Horde_Log_Handler_Base foreach ($this->_buffer as $event) { $line = trim($this->_formatter->format($event)); - // normalize line breaks + // Normalize line breaks. $line = str_replace("\r\n", "\n", $line); - // escape line breaks + // Escape line breaks $line = str_replace("\n", "\\n\\\n", $line); - // escape quotes + // Escape quotes. $line = str_replace('"', '\\"', $line); - // firebug call - $method = isset(self::$_methods[$event['level']]) ? self::$_methods[$event['level']] : 'log'; + // Firebug call. + $method = isset(self::$_methods[$event['level']]) + ? self::$_methods[$event['level']] + : 'log'; $output[] = 'console.' . $method . '("' . $line . '");'; } diff --git a/framework/Log/lib/Horde/Log/Handler/Mock.php b/framework/Log/lib/Horde/Log/Handler/Mock.php index eb83512e1..f98d2435b 100644 --- a/framework/Log/lib/Horde/Log/Handler/Mock.php +++ b/framework/Log/lib/Horde/Log/Handler/Mock.php @@ -6,39 +6,42 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Handler_Mock extends Horde_Log_Handler_Base { /** - * array of log events + * Log events. + * + * @var array */ public $events = array(); /** - * shutdown called? + * Was shutdown called? + * + * @var boolean */ public $shutdown = false; /** * Write a message to the log. * - * @param array $event event data - * @return void + * @param array $event Event data. */ public function write($event) { @@ -47,8 +50,6 @@ class Horde_Log_Handler_Mock extends Horde_Log_Handler_Base /** * Record shutdown - * - * @return void */ public function shutdown() { diff --git a/framework/Log/lib/Horde/Log/Handler/Null.php b/framework/Log/lib/Horde/Log/Handler/Null.php index 0e0bbc5f0..657800cf4 100644 --- a/framework/Log/lib/Horde/Log/Handler/Null.php +++ b/framework/Log/lib/Horde/Log/Handler/Null.php @@ -6,30 +6,32 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Handler_Null extends Horde_Log_Handler_Base { /** - * Write a message to the log buffer + * Write a message to the log buffer. + * + * @return boolean True. */ public function write($event) { return true; } -} \ No newline at end of file +} diff --git a/framework/Log/lib/Horde/Log/Handler/Scribe.php b/framework/Log/lib/Horde/Log/Handler/Scribe.php index a6602c4cb..8638f9464 100644 --- a/framework/Log/lib/Horde/Log/Handler/Scribe.php +++ b/framework/Log/lib/Horde/Log/Handler/Scribe.php @@ -2,71 +2,75 @@ /** * Horde Log package * - * @category Horde - * @package Horde_Log - * @subpackage Handlers * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log + * @subpackage Handlers */ /** - * @category Horde - * @package Horde_Log - * @subpackage Handlers * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log + * @subpackage Handlers */ class Horde_Log_Handler_Scribe extends Horde_Log_Handler_Base { /** - * Scribe client + * Scribe client. + * * @var Horde_Scribe_Client */ protected $_scribe; /** * Formats the log message before writing. + * * @var Horde_Log_Formatter */ protected $_formatter; /** * Options to be set by setOption(). + * * @var array */ protected $_options = array( - 'category' => 'default', 'addNewline' => false, + 'category' => 'default' ); /** - * Class Constructor + * Constructor. * - * @param Horde_Scribe_Client $scribe Scribe client - * @param Horde_Log_Formatter $formatter Log formatter + * @param Horde_Scribe_Client $scribe Scribe client. + * @param Horde_Log_Formatter $formatter Log formatter. */ public function __construct(Horde_Scribe_Client $scribe, Horde_Log_Formatter $formatter = null) { - if (is_null($formatter)) { - $formatter = new Horde_Log_Formatter_Simple(); - } - + $this->_formatter = is_null($formatter) + ? new Horde_Log_Formatter_Simple() + : $formatter; $this->_scribe = $scribe; - $this->_formatter = $formatter; } /** * Write a message to the log. * - * @param array $event Log event - * @return bool Always True + * @param array $event Log event. + * + * @return boolean True. */ public function write($event) { - $category = isset($event['category']) ? $event['category'] : $this->_options['category']; + $category = isset($event['category']) + ? $event['category'] + : $this->_options['category']; $message = $this->_formatter->format($event); if (!$this->_options['addNewline']) { @@ -77,4 +81,5 @@ class Horde_Log_Handler_Scribe extends Horde_Log_Handler_Base return true; } + } diff --git a/framework/Log/lib/Horde/Log/Handler/Stream.php b/framework/Log/lib/Horde/Log/Handler/Stream.php index 54fc2a101..82b2b37b4 100644 --- a/framework/Log/lib/Horde/Log/Handler/Stream.php +++ b/framework/Log/lib/Horde/Log/Handler/Stream.php @@ -6,32 +6,34 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage Handlers - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base { /** * Formats the log message before writing. + * * @var Horde_Log_Formatter */ protected $_formatter; /** * Holds the PHP stream to log to. + * * @var null|stream */ protected $_stream = null; @@ -53,18 +55,20 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base /** * Class Constructor * - * @param mixed $streamOrUrl Stream or URL to open as a stream. - * @param string $mode Mode, only applicable if a URL is given. + * @param mixed $streamOrUrl Stream or URL to open as a + * stream. + * @param string $mode Mode, only applicable if a URL + * is given. * @param Horde_Log_Formatter $formatter Log formatter. + * + * @throws Horde_Log_Exception */ public function __construct($streamOrUrl, $mode = 'a+', Horde_Log_Formatter $formatter = null) { - if (is_null($formatter)) { - $formatter = new Horde_Log_Formatter_Simple(); - } - - $this->_formatter = $formatter; + $this->_formatter = is_null($formatter) + ? new Horde_Log_Formatter_Simple() + : $formatter; $this->_mode = $mode; $this->_streamOrUrl = $streamOrUrl; @@ -85,6 +89,8 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base /** * Wakup function - reattaches stream. + * + * @throws Horde_Log_Exception */ public function __wakeup() { @@ -97,8 +103,10 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base /** * Write a message to the log. * - * @param array $event Log event - * @return bool Always True + * @param array $event Log event. + * + * @return boolean True. + * @throws Horde_Log_Exception */ public function write($event) { diff --git a/framework/Log/lib/Horde/Log/Handler/Syslog.php b/framework/Log/lib/Horde/Log/Handler/Syslog.php index d216451d5..9aea28fb0 100644 --- a/framework/Log/lib/Horde/Log/Handler/Syslog.php +++ b/framework/Log/lib/Horde/Log/Handler/Syslog.php @@ -2,49 +2,54 @@ /** * Horde Log package * - * @category Horde - * @package Horde_Log - * @subpackage Handlers * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log + * @subpackage Handlers */ /** - * @category Horde - * @package Horde_Log - * @subpackage Handlers * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log + * @subpackage Handlers */ class Horde_Log_Handler_Syslog extends Horde_Log_Handler_Base { /** - * Options to be set by setOption(). Sets openlog and syslog options. + * Options to be set by setOption(). + * Sets openlog and syslog options. + * * @var array */ protected $_options = array( - 'ident' => false, - 'facility' => LOG_USER, - 'openlogOptions' => false, 'defaultPriority' => LOG_ERR, + 'facility' => LOG_USER, + 'ident' => false, + 'openlogOptions' => false ); /** - * Last ident set by a syslog-handler instance + * Last ident set by a syslog-handler instance. + * * @var string */ protected static $_lastIdent; /** - * Last facility name set by a syslog-handler instance + * Last facility name set by a syslog-handler instance. + * * @var string */ protected static $_lastFacility; /** - * Map of log levels to syslog priorities + * Map of log levels to syslog priorities. + * * @var array */ protected $_priorities = array( @@ -61,18 +66,20 @@ class Horde_Log_Handler_Syslog extends Horde_Log_Handler_Base /** * Write a message to the log. * - * @param array $event Log event - * @return bool Always True + * @param array $event Log event. + * + * @return boolean True. + * @throws Horde_Log_Exception */ public function write($event) { - if ($this->_options['ident'] !== self::$_lastIdent || - $this->_options['facility'] !== self::$_lastFacility) { + if (($this->_options['ident'] !== $this->_lastIdent) || + ($this->_options['facility'] !== $this->_lastFacility)) { $this->_initializeSyslog(); } $priority = $this->_toSyslog($event['level']); - if (! syslog($priority, $event['message'])) { + if (!syslog($priority, $event['message'])) { throw new Horde_Log_Exception('Unable to log message'); } @@ -82,30 +89,33 @@ class Horde_Log_Handler_Syslog extends Horde_Log_Handler_Base /** * Translate a log level to a syslog LOG_* priority. * - * @param integer $level + * @param integer $level Log level. * - * @return integer A LOG_* constant + * @return integer A LOG_* constant. */ protected function _toSyslog($level) { if (isset($this->_priorities[$level])) { return $this->_priorities[$level]; } + return $this->_options['defaultPriority']; } /** - * Initialize syslog / set ident and facility + * Initialize syslog / set ident and facility. * - * @param string $ident ident - * @param string $facility syslog facility - * @return void + * @param string $ident Ident. + * @param string $facility Syslog facility. + * + * @throws Horde_Log_Exception */ protected function _initializeSyslog() { - self::$_lastIdent = $this->_options['ident']; - self::$_lastFacility = $this->_options['facility']; - if (! openlog($this->_options['ident'], $this->_options['openlogOptions'], $this->_options['facility'])) { + $this->_lastIdent = $this->_options['ident']; + $_this->lastFacility = $this->_options['facility']; + + if (!openlog($this->_options['ident'], $this->_options['openlogOptions'], $this->_options['facility'])) { throw new Horde_Log_Exception('Unable to open syslog'); } } diff --git a/framework/Log/lib/Horde/Log/Logger.php b/framework/Log/lib/Horde/Log/Logger.php index 15a56bd28..dd27d166c 100644 --- a/framework/Log/lib/Horde/Log/Logger.php +++ b/framework/Log/lib/Horde/Log/Logger.php @@ -6,19 +6,19 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log */ /** - * @category Horde - * @package Horde_Log * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * * @method void LOGLEVEL() LOGLEVEL($event) Log an event at LOGLEVEL, where LOGLEVEL has been added with addLevel() or already exists * @method void emerg() emerg($event) Log an event at the EMERG log level @@ -33,45 +33,52 @@ class Horde_Log_Logger { /** - * @var array of log levels where the keys are the - * level priorities and the values are the level names + * Log levels where the keys are the level priorities and the values are + * the level names. + * + * @var array */ private $_levels = array(); /** - * @var array of Horde_Log_Handler_Base objects + * Horde_Log_Handler_Base objects. + * + * @var array */ private $_handlers = array(); /** - * @var array of Horde_Log_Filter objects + * Horde_Log_Filter objects. + * + * @var array */ private $_filters = array(); /** - * Class constructor. Create a new logger + * Constructor. * - * @param Horde_Log_Handler_Base|null $handler default handler + * @param Horde_Log_Handler_Base|null $handler Default handler. */ public function __construct($handler = null) { $r = new ReflectionClass('Horde_Log'); $this->_levels = array_flip($r->getConstants()); - if ($handler !== null) { + if (!is_null($handler)) { $this->addHandler($handler); } } /** * Undefined method handler allows a shortcut: - * $log->levelName('message') - * instead of - * $log->log('message', Horde_Log_LEVELNAME) + *
+     * $log->levelName('message');
+     *   instead of
+     * $log->log('message', Horde_Log_LEVELNAME);
+     * 
* - * @param string $method log level name - * @param string $params message to log - * @return void + * @param string $method Log level name. + * @param string $params Message to log. */ public function __call($method, $params) { @@ -86,9 +93,9 @@ class Horde_Log_Logger /** * Log a message at a level * - * @param mixed $event Message to log, either an array or a string - * @param integer $level Log level of message, required if $message is a string - * @return void + * @param mixed $event Message to log, either an array or a string. + * @param integer $level Log level of message, required if $message is a + * string. */ public function log($event, $level = null) { @@ -104,11 +111,10 @@ class Horde_Log_Logger throw new Horde_Log_Exception('Event array did not contain a message'); } if (!isset($event['level'])) { - if ($level === null) { + if (is_null($level)) { throw new Horde_Log_Exception('Event array did not contain a log level'); - } else { - $event['level'] = $level; } + $event['level'] = $level; } } else { // Create an event array from the message and level @@ -120,7 +126,8 @@ class Horde_Log_Logger throw new Horde_Log_Exception('Bad log level: ' . $event['level']); } - // Fill in the level name and timestamp for filters, formatters, handlers + // Fill in the level name and timestamp for filters, formatters, + // handlers. $event['levelName'] = $this->_levels[$event['level']]; if (!isset($event['timestamp'])) { @@ -142,8 +149,10 @@ class Horde_Log_Logger /** * Does this logger have the level $name already? * - * @param string $name The level name to check for - * @return boolean Whether the logger already has the specific level name + * @param string $name The level name to check for. + * + * @return boolean Whether the logger already has the specific level + * name. */ public function hasLevel($name) { @@ -153,9 +162,8 @@ class Horde_Log_Logger /** * Add a custom log level * - * @param string $name Name of level - * @param integer $level Numeric level - * @return void + * @param string $name Name of level. + * @param integer $level Numeric level. */ public function addLevel($name, $level) { @@ -174,24 +182,20 @@ class Horde_Log_Logger * Before a message will be received by any of the handlers, it * must be accepted by all filters added with this method. * - * @param Horde_Log_Filter $filter - * @return void + * @param Horde_Log_Filter $filter Filter to add. */ public function addFilter($filter) { - if (is_integer($filter)) { - $filter = new Horde_Log_Filter_Level($filter); - } - - $this->_filters[] = $filter; + $this->_filters[] = is_integer($filter) + ? new Horde_Log_Filter_Level($filter) + : $filter; } /** * Add a handler. A handler is responsible for taking a log * message and writing it out to storage. * - * @param Horde_Log_Handler_Base $handler - * @return void + * @param Horde_Log_Handler_Base $handler Handler to add. */ public function addHandler($handler) { diff --git a/framework/Log/test/Horde/Log/AllTests.php b/framework/Log/test/Horde/Log/AllTests.php index 86aeb24a1..11b53c36f 100644 --- a/framework/Log/test/Horde/Log/AllTests.php +++ b/framework/Log/test/Horde/Log/AllTests.php @@ -6,12 +6,12 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** @@ -27,7 +27,8 @@ if (!defined('PHPUnit_MAIN_METHOD')) { require_once 'Horde/Test/AllTests.php'; /** - * @package Horde_Log + * @category Horde + * @package Log * @subpackage UnitTests */ class Horde_Log_AllTests extends Horde_Test_AllTests diff --git a/framework/Log/test/Horde/Log/Filter/ChainingTest.php b/framework/Log/test/Horde/Log/Filter/ChainingTest.php index 4927fde6d..17580400c 100644 --- a/framework/Log/test/Horde/Log/Filter/ChainingTest.php +++ b/framework/Log/test/Horde/Log/Filter/ChainingTest.php @@ -6,21 +6,21 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Filter_ChainingTest extends PHPUnit_Framework_TestCase { diff --git a/framework/Log/test/Horde/Log/Filter/ConstraintTest.php b/framework/Log/test/Horde/Log/Filter/ConstraintTest.php index 0e51483ee..ea0d7d9f4 100644 --- a/framework/Log/test/Horde/Log/Filter/ConstraintTest.php +++ b/framework/Log/test/Horde/Log/Filter/ConstraintTest.php @@ -2,19 +2,19 @@ /** * Horde Log package * - * @category Horde - * @package Horde_Log + * @author James Pepin + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author James Pepin - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author James Pepin + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author James Pepin - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Filter_ConstraintTest extends Horde_Test_Case { diff --git a/framework/Log/test/Horde/Log/Filter/LevelTest.php b/framework/Log/test/Horde/Log/Filter/LevelTest.php index 76bca92fb..e0aeac141 100644 --- a/framework/Log/test/Horde/Log/Filter/LevelTest.php +++ b/framework/Log/test/Horde/Log/Filter/LevelTest.php @@ -6,21 +6,21 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Filter_LevelTest extends PHPUnit_Framework_TestCase { @@ -48,7 +48,7 @@ class Horde_Log_Filter_LevelTest extends PHPUnit_Framework_TestCase new Horde_Log_Filter_Level('foo'); $this->fail(); } catch (Exception $e) { - $this->assertType('Horde_Log_Exception', $e); + $this->assertType('InvalidArgumentException', $e); $this->assertRegExp('/must be an integer/i', $e->getMessage()); } } diff --git a/framework/Log/test/Horde/Log/Filter/MessageTest.php b/framework/Log/test/Horde/Log/Filter/MessageTest.php index c2aa1d29c..7eb76e1f1 100644 --- a/framework/Log/test/Horde/Log/Filter/MessageTest.php +++ b/framework/Log/test/Horde/Log/Filter/MessageTest.php @@ -6,21 +6,21 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Filter_MessageTest extends PHPUnit_Framework_TestCase { @@ -30,7 +30,7 @@ class Horde_Log_Filter_MessageTest extends PHPUnit_Framework_TestCase try { $filter = new Horde_Log_Filter_Message('invalid regexp'); $this->fail(); - } catch (Horde_Log_Exception $e) { + } catch (InvalidArgumentException $e) { $this->assertRegexp('/invalid reg/i', $e->getMessage()); } } diff --git a/framework/Log/test/Horde/Log/Filter/SuppressTest.php b/framework/Log/test/Horde/Log/Filter/SuppressTest.php index a6b4fb4d8..9dca48288 100644 --- a/framework/Log/test/Horde/Log/Filter/SuppressTest.php +++ b/framework/Log/test/Horde/Log/Filter/SuppressTest.php @@ -6,29 +6,29 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD - */ + */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD - */ -class Horde_Log_Filter_SuppressTest extends PHPUnit_Framework_TestCase + */ +class Horde_Log_Filter_SuppressTest extends PHPUnit_Framework_TestCase { public function setUp() { $this->filter = new Horde_Log_Filter_Suppress(); } - + public function testSuppressIsInitiallyOff() { $this->assertTrue($this->filter->accept(array())); @@ -47,7 +47,7 @@ class Horde_Log_Filter_SuppressTest extends PHPUnit_Framework_TestCase $this->assertTrue($this->filter->accept(array())); $this->assertTrue($this->filter->accept(array())); } - + public function testSuppressCanBeReset() { $this->filter->suppress(true); diff --git a/framework/Log/test/Horde/Log/Formatter/SimpleTest.php b/framework/Log/test/Horde/Log/Formatter/SimpleTest.php index 3926cf448..d18c2ab01 100644 --- a/framework/Log/test/Horde/Log/Formatter/SimpleTest.php +++ b/framework/Log/test/Horde/Log/Formatter/SimpleTest.php @@ -6,21 +6,21 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Formatter_SimpleTest extends PHPUnit_Framework_TestCase { @@ -30,7 +30,7 @@ class Horde_Log_Formatter_SimpleTest extends PHPUnit_Framework_TestCase new Horde_Log_Formatter_Simple(1); $this->fail(); } catch (Exception $e) { - $this->assertType('Horde_Log_Exception', $e); + $this->assertType('InvalidArgumentException', $e); $this->assertRegExp('/must be a string/i', $e->getMessage()); } } diff --git a/framework/Log/test/Horde/Log/Formatter/XmlTest.php b/framework/Log/test/Horde/Log/Formatter/XmlTest.php index 266b38353..248436988 100644 --- a/framework/Log/test/Horde/Log/Formatter/XmlTest.php +++ b/framework/Log/test/Horde/Log/Formatter/XmlTest.php @@ -6,19 +6,19 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log */ /** - * @category Horde - * @package Horde_Log * @author Mike Naberezny * @author Chuck Hagenbuch + * @category Horde * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log */ class Horde_Log_Formatter_XmlTest extends PHPUnit_Framework_TestCase { diff --git a/framework/Log/test/Horde/Log/Handler/DbTest.php b/framework/Log/test/Horde/Log/Handler/DbTest.php index 282a004ae..61e7c2eba 100644 --- a/framework/Log/test/Horde/Log/Handler/DbTest.php +++ b/framework/Log/test/Horde/Log/Handler/DbTest.php @@ -6,21 +6,21 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Handler_DbTest extends PHPUnit_Framework_TestCase { @@ -81,4 +81,4 @@ class Horde_Log_Handler_DbTest_MockDbAdapter { $this->calls[$method][] = $params; } -} \ No newline at end of file +} diff --git a/framework/Log/test/Horde/Log/Handler/FirebugTest.php b/framework/Log/test/Horde/Log/Handler/FirebugTest.php index 7824ee33f..ee6dc1cdf 100644 --- a/framework/Log/test/Horde/Log/Handler/FirebugTest.php +++ b/framework/Log/test/Horde/Log/Handler/FirebugTest.php @@ -6,21 +6,21 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Handler_FirebugTest extends PHPUnit_Framework_TestCase { diff --git a/framework/Log/test/Horde/Log/Handler/NullTest.php b/framework/Log/test/Horde/Log/Handler/NullTest.php index 2fb78183b..d5590eb1f 100644 --- a/framework/Log/test/Horde/Log/Handler/NullTest.php +++ b/framework/Log/test/Horde/Log/Handler/NullTest.php @@ -6,21 +6,21 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Handler_NullTest extends PHPUnit_Framework_TestCase { diff --git a/framework/Log/test/Horde/Log/Handler/StreamTest.php b/framework/Log/test/Horde/Log/Handler/StreamTest.php index eeb56eaaa..c072d154a 100644 --- a/framework/Log/test/Horde/Log/Handler/StreamTest.php +++ b/framework/Log/test/Horde/Log/Handler/StreamTest.php @@ -6,21 +6,21 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_Handler_StreamTest extends PHPUnit_Framework_TestCase { diff --git a/framework/Log/test/Horde/Log/LogTest.php b/framework/Log/test/Horde/Log/LogTest.php index 26a38d91e..942fc5aa8 100644 --- a/framework/Log/test/Horde/Log/LogTest.php +++ b/framework/Log/test/Horde/Log/LogTest.php @@ -6,21 +6,21 @@ * (http://framework.zend.com). Both that package and this * one were written by Mike Naberezny and Chuck Hagenbuch. * - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ /** - * @category Horde - * @package Horde_Log + * @author Mike Naberezny + * @author Chuck Hagenbuch + * @category Horde + * @license http://opensource.org/licenses/bsd-license.php BSD + * @package Log * @subpackage UnitTests - * @author Mike Naberezny - * @author Chuck Hagenbuch - * @license http://opensource.org/licenses/bsd-license.php BSD */ class Horde_Log_LogTest extends PHPUnit_Framework_TestCase {