PHPCS fixes in includes/log-handlers/class-wc-log-handler-email.php

This commit is contained in:
Rodrigo Primo 2018-03-07 10:49:32 -03:00
parent 2d4afdc1d8
commit 3d93e5d545
1 changed files with 15 additions and 9 deletions

View File

@ -1,6 +1,12 @@
<?php <?php
/**
* Class WC_Log_Handler_Email file.
*
* @package WooCommerce\Log Handlers
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
/** /**
@ -23,8 +29,6 @@ if ( ! defined( 'ABSPATH' ) ) {
* @class WC_Log_Handler_Email * @class WC_Log_Handler_Email
* @version 1.0.0 * @version 1.0.0
* @package WooCommerce/Classes/Log_Handlers * @package WooCommerce/Classes/Log_Handlers
* @category Class
* @author WooThemes
*/ */
class WC_Log_Handler_Email extends WC_Log_Handler { class WC_Log_Handler_Email extends WC_Log_Handler {
@ -61,7 +65,7 @@ class WC_Log_Handler_Email extends WC_Log_Handler {
* *
* @param string|array $recipients Optional. Email(s) to receive log messages. Defaults to site admin email. * @param string|array $recipients Optional. Email(s) to receive log messages. Defaults to site admin email.
* @param string $threshold Optional. Minimum level that should receive log messages. * @param string $threshold Optional. Minimum level that should receive log messages.
* Default 'alert'. One of: emergency|alert|critical|error|warning|notice|info|debug * Default 'alert'. One of: emergency|alert|critical|error|warning|notice|info|debug.
*/ */
public function __construct( $recipients = null, $threshold = 'alert' ) { public function __construct( $recipients = null, $threshold = 'alert' ) {
if ( null === $recipients ) { if ( null === $recipients ) {
@ -83,7 +87,7 @@ class WC_Log_Handler_Email extends WC_Log_Handler {
/** /**
* Set handler severity threshold. * Set handler severity threshold.
* *
* @param string $level emergency|alert|critical|error|warning|notice|info|debug * @param string $level emergency|alert|critical|error|warning|notice|info|debug.
*/ */
public function set_threshold( $level ) { public function set_threshold( $level ) {
$this->threshold = WC_Log_Levels::get_level_severity( $level ); $this->threshold = WC_Log_Levels::get_level_severity( $level );
@ -92,7 +96,7 @@ class WC_Log_Handler_Email extends WC_Log_Handler {
/** /**
* Determine whether handler should handle log. * Determine whether handler should handle log.
* *
* @param string $level emergency|alert|critical|error|warning|notice|info|debug * @param string $level emergency|alert|critical|error|warning|notice|info|debug.
* @return bool True if the log should be handled. * @return bool True if the log should be handled.
*/ */
protected function should_handle( $level ) { protected function should_handle( $level ) {
@ -103,7 +107,7 @@ class WC_Log_Handler_Email extends WC_Log_Handler {
* Handle a log entry. * Handle a log entry.
* *
* @param int $timestamp Log timestamp. * @param int $timestamp Log timestamp.
* @param string $level emergency|alert|critical|error|warning|notice|info|debug * @param string $level emergency|alert|critical|error|warning|notice|info|debug.
* @param string $message Log message. * @param string $message Log message.
* @param array $context Optional. Additional information for log handlers. * @param array $context Optional. Additional information for log handlers.
* *
@ -148,6 +152,7 @@ class WC_Log_Handler_Email extends WC_Log_Handler {
$log_count = count( $this->logs ); $log_count = count( $this->logs );
return sprintf( return sprintf(
/* translators: 1: Site name 2: Maximum level 3: Log count */
_n( _n(
'[%1$s] %2$s: %3$s WooCommerce log message', '[%1$s] %2$s: %3$s WooCommerce log message',
'[%1$s] %2$s: %3$s WooCommerce log messages', '[%1$s] %2$s: %3$s WooCommerce log messages',
@ -179,6 +184,7 @@ class WC_Log_Handler_Email extends WC_Log_Handler {
. $entries . $entries
. PHP_EOL . PHP_EOL
. PHP_EOL . PHP_EOL
/* translators: %s: Site name */
. sprintf( __( 'Visit %s admin area:', 'woocommerce' ), $site_name ) . sprintf( __( 'Visit %s admin area:', 'woocommerce' ), $site_name )
. PHP_EOL . PHP_EOL
. admin_url(); . admin_url();
@ -187,7 +193,7 @@ class WC_Log_Handler_Email extends WC_Log_Handler {
/** /**
* Adds an email to the list of recipients. * Adds an email to the list of recipients.
* *
* @param string email Email address to add * @param string $email Email address to add.
*/ */
public function add_email( $email ) { public function add_email( $email ) {
array_push( $this->recipients, $email ); array_push( $this->recipients, $email );
@ -197,7 +203,7 @@ class WC_Log_Handler_Email extends WC_Log_Handler {
* Add log message. * Add log message.
* *
* @param int $timestamp Log timestamp. * @param int $timestamp Log timestamp.
* @param string $level emergency|alert|critical|error|warning|notice|info|debug * @param string $level emergency|alert|critical|error|warning|notice|info|debug.
* @param string $message Log message. * @param string $message Log message.
* @param array $context Additional information for log handlers. * @param array $context Additional information for log handlers.
*/ */