Warning, file /webapps/ocs-webserver/library/Zend/Log/Filter/Priority.php was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Log 0017 * @subpackage Filter 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** Zend_Log_Filter_Abstract */ 0024 // require_once 'Zend/Log/Filter/Abstract.php'; 0025 0026 /** 0027 * @category Zend 0028 * @package Zend_Log 0029 * @subpackage Filter 0030 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0031 * @license http://framework.zend.com/license/new-bsd New BSD License 0032 * @version $Id$ 0033 */ 0034 class Zend_Log_Filter_Priority extends Zend_Log_Filter_Abstract 0035 { 0036 /** 0037 * @var integer 0038 */ 0039 protected $_priority; 0040 0041 /** 0042 * @var string 0043 */ 0044 protected $_operator; 0045 0046 /** 0047 * Filter logging by $priority. By default, it will accept any log 0048 * event whose priority value is less than or equal to $priority. 0049 * 0050 * @param integer $priority Priority 0051 * @param string $operator Comparison operator 0052 * @return void 0053 * @throws Zend_Log_Exception 0054 */ 0055 public function __construct($priority, $operator = null) 0056 { 0057 if (! is_int($priority)) { 0058 // require_once 'Zend/Log/Exception.php'; 0059 throw new Zend_Log_Exception('Priority must be an integer'); 0060 } 0061 0062 $this->_priority = $priority; 0063 $this->_operator = $operator === null ? '<=' : $operator; 0064 } 0065 0066 /** 0067 * Create a new instance of Zend_Log_Filter_Priority 0068 * 0069 * @param array|Zend_Config $config 0070 * @return Zend_Log_Filter_Priority 0071 */ 0072 static public function factory($config) 0073 { 0074 $config = self::_parseConfig($config); 0075 $config = array_merge(array( 0076 'priority' => null, 0077 'operator' => null, 0078 ), $config); 0079 0080 // Add support for constants 0081 if (!is_numeric($config['priority']) && isset($config['priority']) && defined($config['priority'])) { 0082 $config['priority'] = constant($config['priority']); 0083 } 0084 0085 return new self( 0086 (int) $config['priority'], 0087 $config['operator'] 0088 ); 0089 } 0090 0091 /** 0092 * Returns TRUE to accept the message, FALSE to block it. 0093 * 0094 * @param array $event event data 0095 * @return boolean accepted? 0096 */ 0097 public function accept($event) 0098 { 0099 return version_compare($event['priority'], $this->_priority, $this->_operator); 0100 } 0101 }