Explorar o código

[ZF-10859] Zend_Log

- Fixed phpdocs.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23574 44c647ce-9c0f-0410-b52a-842ac1e357ba
ramon %!s(int64=15) %!d(string=hai) anos
pai
achega
2cb42568e9

+ 15 - 8
library/Zend/Log.php

@@ -84,7 +84,7 @@ class Zend_Log
 
     /**
      *
-     * @var array
+     * @var array|boolean
      */
     protected $_errorHandlerMap        = false;
 
@@ -98,6 +98,7 @@ class Zend_Log
      * Class constructor.  Create a new logger
      *
      * @param Zend_Log_Writer_Abstract|null  $writer  default writer
+     * @return void
      */
     public function __construct(Zend_Log_Writer_Abstract $writer = null)
     {
@@ -115,6 +116,7 @@ class Zend_Log
      *
      * @param  array|Zend_Config Array or instance of Zend_Config
      * @return Zend_Log
+     * @throws Zend_Log_Exception
      */
     static public function factory($config = array())
     {
@@ -147,6 +149,7 @@ class Zend_Log
      *
      * @param  array $spec config array with writer spec
      * @return Zend_Log_Writer_Abstract
+     * @throws Zend_Log_Exception
      */
     protected function _constructWriterFromConfig($config)
     {
@@ -174,6 +177,7 @@ class Zend_Log
      *
      * @param  array|Zend_Config $config Zend_Config or Array
      * @return Zend_Log_Filter_Interface
+     * @throws Zend_Log_Exception
      */
     protected function _constructFilterFromConfig($config)
     {
@@ -198,6 +202,7 @@ class Zend_Log
      * @param mixed $config Zend_Config or Array
      * @param string $namespace
      * @return object
+     * @throws Zend_Log_Exception
      */
     protected function _constructFromConfig($type, $config, $namespace)
     {
@@ -237,6 +242,7 @@ class Zend_Log
      * @param string $type filter|writer
      * @param string $defaultNamespace
      * @return string full classname
+     * @throws Zend_Log_Exception
      */
     protected function getClassName($config, $type, $defaultNamespace)
     {
@@ -261,7 +267,7 @@ class Zend_Log
      * @param  string   $message   Message to log
      * @param  integer  $priority  Priority of message
      * @return array Event array
-     **/
+     */
     protected function _packEvent($message, $priority)
     {
         return array_merge(array(
@@ -387,7 +393,7 @@ class Zend_Log
      *
      * @param  string   $name      Name of priority
      * @param  integer  $priority  Numeric priority
-     * @throws Zend_Log_InvalidArgumentException
+     * @throws Zend_Log_Exception
      */
     public function addPriority($name, $priority)
     {
@@ -410,12 +416,13 @@ class Zend_Log
      * Before a message will be received by any of the writers, it
      * must be accepted by all filters added with this method.
      *
-     * @param  int|Zend_Log_Filter_Interface $filter
-     * @return void
+     * @param  int|Zend_Config|array|Zend_Log_Filter_Interface $filter
+     * @return Zend_Log
+     * @throws Zend_Log_Exception
      */
     public function addFilter($filter)
     {
-        if (is_integer($filter)) {
+        if (is_int($filter)) {
             /** @see Zend_Log_Filter_Priority */
             require_once 'Zend/Log/Filter/Priority.php';
             $filter = new Zend_Log_Filter_Priority($filter);
@@ -438,7 +445,7 @@ class Zend_Log
      * message and writing it out to storage.
      *
      * @param  mixed $writer Zend_Log_Writer_Abstract or Config array
-     * @return void
+     * @return Zend_Log
      */
     public function addWriter($writer)
     {
@@ -464,7 +471,7 @@ class Zend_Log
      *
      * @param  $name    Name of the field
      * @param  $value   Value of the field
-     * @return void
+     * @return Zend_Log
      */
     public function setEventItem($name, $value)
     {

+ 1 - 1
library/Zend/Log/Filter/Message.php

@@ -42,6 +42,7 @@ class Zend_Log_Filter_Message extends Zend_Log_Filter_Abstract
      * Filter out any log messages not matching $regexp.
      *
      * @param  string  $regexp     Regular expression to test the log message
+     * @return void
      * @throws Zend_Log_Exception
      */
     public function __construct($regexp)
@@ -58,7 +59,6 @@ class Zend_Log_Filter_Message extends Zend_Log_Filter_Abstract
      *
      * @param  array|Zend_Config $config
      * @return Zend_Log_Filter_Message
-     * @throws Zend_Log_Exception
      */
     static public function factory($config)
     {

+ 3 - 3
library/Zend/Log/Filter/Priority.php

@@ -49,11 +49,12 @@ class Zend_Log_Filter_Priority extends Zend_Log_Filter_Abstract
      *
      * @param  integer  $priority  Priority
      * @param  string   $operator  Comparison operator
+     * @return void
      * @throws Zend_Log_Exception
      */
-    public function __construct($priority, $operator = NULL)
+    public function __construct($priority, $operator = null)
     {
-        if (! is_integer($priority)) {
+        if (! is_int($priority)) {
             require_once 'Zend/Log/Exception.php';
             throw new Zend_Log_Exception('Priority must be an integer');
         }
@@ -67,7 +68,6 @@ class Zend_Log_Filter_Priority extends Zend_Log_Filter_Abstract
      *
      * @param  array|Zend_Config $config
      * @return Zend_Log_Filter_Priority
-     * @throws Zend_Log_Exception
      */
     static public function factory($config)
     {

+ 1 - 0
library/Zend/Log/Formatter/Simple.php

@@ -44,6 +44,7 @@ class Zend_Log_Formatter_Simple implements Zend_Log_Formatter_Interface
      * Class constructor
      *
      * @param  null|string  $format  Format specifier for log messages
+     * @return void
      * @throws Zend_Log_Exception
      */
     public function __construct($format = null)

+ 4 - 3
library/Zend/Log/Formatter/Xml.php

@@ -34,12 +34,12 @@ require_once 'Zend/Log/Formatter/Interface.php';
 class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
 {
     /**
-     * @var Relates XML elements to log data field keys.
+     * @var string Name of root element
      */
     protected $_rootElement;
 
     /**
-     * @var Relates XML elements to log data field keys.
+     * @var array Relates XML elements to log data field keys.
      */
     protected $_elementMap;
 
@@ -52,8 +52,9 @@ class Zend_Log_Formatter_Xml implements Zend_Log_Formatter_Interface
      * Class constructor
      *
      * @param string $rootElement Name of root element
-     * @param array $elementMap
+     * @param array $elementMap Relates XML elements to log data field keys
      * @param string $encoding Encoding to use (defaults to UTF-8)
+     * @return void
      */
     public function __construct($rootElement = 'logEntry', $elementMap = null, $encoding = 'UTF-8')
     {

+ 4 - 3
library/Zend/Log/Writer/Abstract.php

@@ -40,6 +40,7 @@ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface
 
     /**
      * Formats the log message before writing.
+     *
      * @var Zend_Log_Formatter_Interface
      */
     protected $_formatter;
@@ -48,7 +49,7 @@ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface
      * Add a filter specific to this writer.
      *
      * @param  Zend_Log_Filter_Interface  $filter
-     * @return void
+     * @return Zend_Log_Writer_Abstract
      */
     public function addFilter($filter)
     {
@@ -69,7 +70,7 @@ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface
     /**
      * Log a message to this writer.
      *
-     * @param  array     $event  log data event
+     * @param  array $event log data event
      * @return void
      */
     public function write($event)
@@ -88,7 +89,7 @@ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface
      * Set a new formatter for this writer
      *
      * @param  Zend_Log_Formatter_Interface $formatter
-     * @return void
+     * @return Zend_Log_Writer_Abstract
      */
     public function setFormatter(Zend_Log_Formatter_Interface $formatter)
     {

+ 6 - 0
library/Zend/Log/Writer/Db.php

@@ -35,12 +35,14 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
 {
     /**
      * Database adapter instance
+     *
      * @var Zend_Db_Adapter
      */
     private $_db;
 
     /**
      * Name of the log table in the database
+     *
      * @var string
      */
     private $_table;
@@ -58,6 +60,7 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
      * @param Zend_Db_Adapter $db   Database adapter instance
      * @param string $table         Log table in database
      * @param array $columnMap
+     * @return void
      */
     public function __construct($db, $table, $columnMap = null)
     {
@@ -95,6 +98,9 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract
 
     /**
      * Formatting is not possible on this writer
+     *
+     * @return void
+     * @throws Zend_Log_Exception
      */
     public function setFormatter(Zend_Log_Formatter_Interface $formatter)
     {

+ 5 - 2
library/Zend/Log/Writer/Firebug.php

@@ -43,9 +43,9 @@ require_once 'Zend/Wildfire/Plugin/FirePhp.php';
  */
 class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract
 {
-
     /**
      * Maps logging priorities to logging display styles
+     *
      * @var array
      */
     protected $_priorityStyles = array(Zend_Log::EMERG  => Zend_Wildfire_Plugin_FirePhp::ERROR,
@@ -59,18 +59,22 @@ class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract
 
     /**
      * The default logging style for un-mapped priorities
+     *
      * @var string
      */
     protected $_defaultPriorityStyle = Zend_Wildfire_Plugin_FirePhp::LOG;
 
     /**
      * Flag indicating whether the log writer is enabled
+     *
      * @var boolean
      */
     protected $_enabled = true;
 
     /**
      * Class constructor
+     *
+     * @return void
      */
     public function __construct()
     {
@@ -86,7 +90,6 @@ class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract
      *
      * @param  array|Zend_Config $config
      * @return Zend_Log_Writer_Firebug
-     * @throws Zend_Log_Exception
      */
     static public function factory($config)
     {

+ 3 - 0
library/Zend/Log/Writer/Mail.php

@@ -185,6 +185,7 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
      *
      * @param array $config
      * @return Zend_Mail
+     * @throws Zend_Log_Exception
      */
     protected static function _constructMailFromConfig(array $config)
     {
@@ -233,6 +234,7 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
      *
      * @param array $config
      * @return Zend_Layout
+     * @throws Zend_Log_Exception
      */
     protected function _constructLayoutFromConfig(array $config)
     {
@@ -331,6 +333,7 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract
      *
      * @param  string $subject Subject prepend text.
      * @return Zend_Log_Writer_Mail
+     * @throws Zend_Log_Exception
      */
     public function setSubjectPrependText($subject)
     {

+ 4 - 1
library/Zend/Log/Writer/Mock.php

@@ -35,11 +35,15 @@ class Zend_Log_Writer_Mock extends Zend_Log_Writer_Abstract
 {
     /**
      * array of log events
+     *
+     * @var array
      */
     public $events = array();
 
     /**
      * shutdown called?
+     *
+     * @var boolean
      */
     public $shutdown = false;
 
@@ -69,7 +73,6 @@ class Zend_Log_Writer_Mock extends Zend_Log_Writer_Abstract
      *
      * @param  array|Zend_Config $config
      * @return Zend_Log_Writer_Mock
-     * @throws Zend_Log_Exception
      */
     static public function factory($config)
     {

+ 0 - 1
library/Zend/Log/Writer/Null.php

@@ -48,7 +48,6 @@ class Zend_Log_Writer_Null extends Zend_Log_Writer_Abstract
      *
      * @param  array|Zend_Config $config
      * @return Zend_Log_Writer_Null
-     * @throws Zend_Log_Exception
      */
     static public function factory($config)
     {

+ 10 - 7
library/Zend/Log/Writer/Stream.php

@@ -38,6 +38,7 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
 {
     /**
      * Holds the PHP stream to log to.
+     *
      * @var null|stream
      */
     protected $_stream = null;
@@ -45,13 +46,15 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
     /**
      * Class Constructor
      *
-     * @param  streamOrUrl     Stream or URL to open as a stream
-     * @param  mode            Mode, only applicable if a URL is given
+     * @param array|string|resource $streamOrUrl Stream or URL to open as a stream
+     * @param string|null $mode Mode, only applicable if a URL is given
+     * @return void
+     * @throws Zend_Log_Exception
      */
-    public function __construct($streamOrUrl, $mode = NULL)
+    public function __construct($streamOrUrl, $mode = null)
     {
         // Setting the default
-        if ($mode === NULL) {
+        if (null === $mode) {
             $mode = 'a';
         }
 
@@ -83,11 +86,10 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
     }
 
     /**
-     * Create a new instance of Zend_Log_Writer_Mock
+     * Create a new instance of Zend_Log_Writer_Stream
      *
      * @param  array|Zend_Config $config
-     * @return Zend_Log_Writer_Mock
-     * @throws Zend_Log_Exception
+     * @return Zend_Log_Writer_Stream
      */
     static public function factory($config)
     {
@@ -122,6 +124,7 @@ class Zend_Log_Writer_Stream extends Zend_Log_Writer_Abstract
      *
      * @param  array  $event  event data
      * @return void
+     * @throws Zend_Log_Exception
      */
     protected function _write($event)
     {

+ 12 - 7
library/Zend/Log/Writer/Syslog.php

@@ -39,6 +39,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
 {
     /**
      * Maps Zend_Log priorities to PHP's syslog priorities
+     *
      * @var array
      */
     protected $_priorities = array(
@@ -54,36 +55,41 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
 
     /**
      * The default log priority - for unmapped custom priorities
+     *
      * @var string
      */
     protected $_defaultPriority = LOG_NOTICE;
 
     /**
      * Last application name set by a syslog-writer instance
+     *
      * @var string
      */
     protected static $_lastApplication;
 
     /**
      * Last facility name set by a syslog-writer instance
+     *
      * @var string
      */
     protected static $_lastFacility;
 
     /**
      * Application name used by this syslog-writer instance
+     *
      * @var string
      */
     protected $_application = 'Zend_Log';
 
     /**
      * Facility used by this syslog-writer instance
+     *
      * @var int
      */
     protected $_facility = LOG_USER;
 
     /**
-     * _validFacilities
+     * Types of program available to logging of message
      *
      * @var array
      */
@@ -92,7 +98,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
     /**
      * Class constructor
      *
-     * @param  array $options Array of options; may include "application" and "facility" keys
+     * @param  array $params Array of options; may include "application" and "facility" keys
      * @return void
      */
     public function __construct(array $params = array())
@@ -117,7 +123,6 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
      *
      * @param  array|Zend_Config $config
      * @return Zend_Log_Writer_Syslog
-     * @throws Zend_Log_Exception
      */
     static public function factory($config)
     {
@@ -176,7 +181,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
      * Set syslog facility
      *
      * @param  int $facility Syslog facility
-     * @return void
+     * @return Zend_Log_Writer_Syslog
      * @throws Zend_Log_Exception for invalid log facility
      */
     public function setFacility($facility)
@@ -210,7 +215,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
      * Set application name
      *
      * @param  string $application Application name
-     * @return void
+     * @return Zend_Log_Writer_Syslog
      */
     public function setApplicationName($application)
     {
@@ -235,7 +240,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
     /**
      * Write a message to syslog.
      *
-     * @param  array $event  event data
+     * @param  array $event event data
      * @return void
      */
     protected function _write($event)
@@ -259,4 +264,4 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
 
         syslog($priority, $message);
     }
-}
+}

+ 9 - 8
library/Zend/Log/Writer/ZendMonitor.php

@@ -35,18 +35,20 @@ class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract
 {
     /**
      * Is Zend Monitor enabled?
-     * @var bool
+     *
+     * @var boolean
      */
     protected $_isEnabled = true;
 
     /**
      * Is this for a Zend Server intance?
-     * @var bool
+     *
+     * @var boolean
      */
     protected $_isZendServer = false;
 
     /**
-     * @throws Zend_Log_Exception if Zend Monitor extension not present
+     * @return void
      */
     public function __construct()
     {
@@ -62,8 +64,7 @@ class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract
      * Create a new instance of Zend_Log_Writer_ZendMonitor
      *
      * @param  array|Zend_Config $config
-     * @return Zend_Log_Writer_Syslog
-     * @throws Zend_Log_Exception
+     * @return Zend_Log_Writer_ZendMonitor
      */
     static public function factory($config)
     {
@@ -77,7 +78,7 @@ class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract
      * fail silently. You can query this method to determine if the log
      * writer is enabled.
      *
-     * @return bool
+     * @return boolean
      */
     public function isEnabled()
     {
@@ -87,7 +88,7 @@ class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract
     /**
      * Log a message to this writer.
      *
-     * @param  array $event  log data event
+     * @param  array $event log data event
      * @return void
      */
     public function write($event)
@@ -102,7 +103,7 @@ class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract
     /**
      * Write a message to the log.
      *
-     * @param  array  $event  log data event
+     * @param  array  $event log data event
      * @return void
      */
     protected function _write($event)