Fix properties with trailing underscore

[MAILPOET-2715]
This commit is contained in:
Jan Jakeš
2020-02-17 14:46:11 +01:00
committed by Jack Kitterhing
parent ec6ecdb79e
commit e185121f43
29 changed files with 42 additions and 42 deletions

View File

@ -12,7 +12,7 @@ use MailPoet\WP\Functions as WPFunctions;
*/ */
class CustomField extends Model { class CustomField extends Model {
public static $_table = MP_CUSTOM_FIELDS_TABLE; public static $_table = MP_CUSTOM_FIELDS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
const TYPE_DATE = 'date'; const TYPE_DATE = 'date';
const TYPE_TEXT = 'text'; const TYPE_TEXT = 'text';
const TYPE_TEXTAREA = 'textarea'; const TYPE_TEXTAREA = 'textarea';

View File

@ -12,7 +12,7 @@ use MailPoet\WP\Functions as WPFunctions;
*/ */
class DynamicSegmentFilter extends Model { class DynamicSegmentFilter extends Model {
public static $_table = MP_DYNAMIC_SEGMENTS_FILTERS_TABLE; public static $_table = MP_DYNAMIC_SEGMENTS_FILTERS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public function save() { public function save() {
if (is_null($this->filterData)) { if (is_null($this->filterData)) {

View File

@ -12,7 +12,7 @@ use MailPoet\WP\Functions as WPFunctions;
*/ */
class Form extends Model { class Form extends Model {
public static $_table = MP_FORMS_TABLE; public static $_table = MP_FORMS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public function getSettings() { public function getSettings() {
return WPFunctions::get()->isSerialized($this->settings) ? unserialize($this->settings) : $this->settings; return WPFunctions::get()->isSerialized($this->settings) ? unserialize($this->settings) : $this->settings;

View File

@ -3,6 +3,6 @@
namespace MailPoet\Models; namespace MailPoet\Models;
class Log extends Model { class Log extends Model {
public static $_table = MP_LOG_TABLE; public static $_table = MP_LOG_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
} }

View File

@ -3,7 +3,7 @@
namespace MailPoet\Models; namespace MailPoet\Models;
class MappingToExternalEntities extends Model { class MappingToExternalEntities extends Model {
public static $_table = MP_MAPPING_TO_EXTERNAL_ENTITIES_TABLE; public static $_table = MP_MAPPING_TO_EXTERNAL_ENTITIES_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function create($data = []) { public static function create($data = []) {
$relation = parent::create(); $relation = parent::create();

View File

@ -133,8 +133,8 @@ use MailPoet\WP\Functions as WPFunctions;
class Model extends \MailPoetVendor\Sudzy\ValidModel { class Model extends \MailPoetVendor\Sudzy\ValidModel {
const DUPLICATE_RECORD = 23000; const DUPLICATE_RECORD = 23000;
public static $_table; public static $_table; // phpcs:ignore PSR2.Classes.PropertyDeclaration
protected $_errors; protected $_errors; // phpcs:ignore PSR2.Classes.PropertyDeclaration
protected $newRecord; protected $newRecord;
public function __construct() { public function __construct() {

View File

@ -45,7 +45,7 @@ use function MailPoetVendor\array_column;
*/ */
class Newsletter extends Model { class Newsletter extends Model {
public static $_table = MP_NEWSLETTERS_TABLE; public static $_table = MP_NEWSLETTERS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
const TYPE_AUTOMATIC = NewsletterEntity::TYPE_AUTOMATIC; const TYPE_AUTOMATIC = NewsletterEntity::TYPE_AUTOMATIC;
const TYPE_STANDARD = NewsletterEntity::TYPE_STANDARD; const TYPE_STANDARD = NewsletterEntity::TYPE_STANDARD;
const TYPE_WELCOME = NewsletterEntity::TYPE_WELCOME; const TYPE_WELCOME = NewsletterEntity::TYPE_WELCOME;

View File

@ -10,6 +10,6 @@ namespace MailPoet\Models;
* @property int|null $clicksCount * @property int|null $clicksCount
*/ */
class NewsletterLink extends Model { class NewsletterLink extends Model {
public static $_table = MP_NEWSLETTER_LINKS_TABLE; public static $_table = MP_NEWSLETTER_LINKS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
const UNSUBSCRIBE_LINK_SHORT_CODE = '[link:subscription_unsubscribe_url]'; const UNSUBSCRIBE_LINK_SHORT_CODE = '[link:subscription_unsubscribe_url]';
} }

View File

@ -9,7 +9,7 @@ namespace MailPoet\Models;
* @property string $updatedAt * @property string $updatedAt
*/ */
class NewsletterOption extends Model { class NewsletterOption extends Model {
public static $_table = MP_NEWSLETTER_OPTION_TABLE; public static $_table = MP_NEWSLETTER_OPTION_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function createOrUpdate($data = []) { public static function createOrUpdate($data = []) {
if (!is_array($data) || empty($data['newsletter_id']) || empty($data['option_field_id'])) { if (!is_array($data) || empty($data['newsletter_id']) || empty($data['option_field_id'])) {

View File

@ -10,7 +10,7 @@ use MailPoet\WP\Functions as WPFunctions;
*/ */
class NewsletterOptionField extends Model { class NewsletterOptionField extends Model {
public static $_table = MP_NEWSLETTER_OPTION_FIELDS_TABLE; public static $_table = MP_NEWSLETTER_OPTION_FIELDS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();

View File

@ -8,7 +8,7 @@ namespace MailPoet\Models;
* @property string $updatedAt * @property string $updatedAt
*/ */
class NewsletterPost extends Model { class NewsletterPost extends Model {
public static $_table = MP_NEWSLETTER_POSTS_TABLE; public static $_table = MP_NEWSLETTER_POSTS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function getNewestNewsletterPost($newsletterId) { public static function getNewestNewsletterPost($newsletterId) {
return self::where('newsletter_id', $newsletterId) return self::where('newsletter_id', $newsletterId)

View File

@ -8,5 +8,5 @@ namespace MailPoet\Models;
* @property string $updatedAt * @property string $updatedAt
*/ */
class NewsletterSegment extends Model { class NewsletterSegment extends Model {
public static $_table = MP_NEWSLETTER_SEGMENT_TABLE; public static $_table = MP_NEWSLETTER_SEGMENT_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
} }

View File

@ -14,7 +14,7 @@ use MailPoet\WP\Functions as WPFunctions;
* @property int|null $readonly * @property int|null $readonly
*/ */
class NewsletterTemplate extends Model { class NewsletterTemplate extends Model {
public static $_table = MP_NEWSLETTER_TEMPLATES_TABLE; public static $_table = MP_NEWSLETTER_TEMPLATES_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
const RECENTLY_SENT_CATEGORIES = '["recent"]'; const RECENTLY_SENT_CATEGORIES = '["recent"]';
const RECENTLY_SENT_COUNT = 12; const RECENTLY_SENT_COUNT = 12;

View File

@ -20,7 +20,7 @@ use MailPoetVendor\Idiorm\ORM;
* @property string|array|null $meta * @property string|array|null $meta
*/ */
class ScheduledTask extends Model { class ScheduledTask extends Model {
public static $_table = MP_SCHEDULED_TASKS_TABLE; public static $_table = MP_SCHEDULED_TASKS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
const STATUS_COMPLETED = ScheduledTaskEntity::STATUS_COMPLETED; const STATUS_COMPLETED = ScheduledTaskEntity::STATUS_COMPLETED;
const STATUS_SCHEDULED = ScheduledTaskEntity::STATUS_SCHEDULED; const STATUS_SCHEDULED = ScheduledTaskEntity::STATUS_SCHEDULED;
const STATUS_PAUSED = ScheduledTaskEntity::STATUS_PAUSED; const STATUS_PAUSED = ScheduledTaskEntity::STATUS_PAUSED;

View File

@ -22,8 +22,8 @@ class ScheduledTaskSubscriber extends Model {
const SENDING_STATUS_FAILED = 'failed'; const SENDING_STATUS_FAILED = 'failed';
const SENDING_STATUS_UNPROCESSED = 'unprocessed'; const SENDING_STATUS_UNPROCESSED = 'unprocessed';
public static $_table = MP_SCHEDULED_TASK_SUBSCRIBERS_TABLE; public static $_table = MP_SCHEDULED_TASK_SUBSCRIBERS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static $_id_column = ['task_id', 'subscriber_id']; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps public static $_id_column = ['task_id', 'subscriber_id']; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps,PSR2.Classes.PropertyDeclaration
public function task() { public function task() {
return $this->hasOne(__NAMESPACE__ . '\ScheduledTask', 'id', 'task_id'); return $this->hasOne(__NAMESPACE__ . '\ScheduledTask', 'id', 'task_id');

View File

@ -17,7 +17,7 @@ use MailPoet\WP\Functions as WPFunctions;
*/ */
class Segment extends Model { class Segment extends Model {
public static $_table = MP_SEGMENTS_TABLE; public static $_table = MP_SEGMENTS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
const TYPE_WP_USERS = SegmentEntity::TYPE_WP_USERS; const TYPE_WP_USERS = SegmentEntity::TYPE_WP_USERS;
const TYPE_WC_USERS = SegmentEntity::TYPE_WC_USERS; const TYPE_WC_USERS = SegmentEntity::TYPE_WC_USERS;
const TYPE_DEFAULT = SegmentEntity::TYPE_DEFAULT; const TYPE_DEFAULT = SegmentEntity::TYPE_DEFAULT;

View File

@ -23,7 +23,7 @@ use MailPoet\WP\Functions as WPFunctions;
*/ */
class SendingQueue extends Model { class SendingQueue extends Model {
public static $_table = MP_SENDING_QUEUES_TABLE; public static $_table = MP_SENDING_QUEUES_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
const STATUS_COMPLETED = SendingQueueEntity::STATUS_COMPLETED; const STATUS_COMPLETED = SendingQueueEntity::STATUS_COMPLETED;
const STATUS_SCHEDULED = SendingQueueEntity::STATUS_SCHEDULED; const STATUS_SCHEDULED = SendingQueueEntity::STATUS_SCHEDULED;
const STATUS_PAUSED = SendingQueueEntity::STATUS_PAUSED; const STATUS_PAUSED = SendingQueueEntity::STATUS_PAUSED;

View File

@ -12,7 +12,7 @@ use DateTimeInterface;
* @property int $count * @property int $count
*/ */
class StatisticsClicks extends Model { class StatisticsClicks extends Model {
public static $_table = MP_STATISTICS_CLICKS_TABLE; public static $_table = MP_STATISTICS_CLICKS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function createOrUpdateClickCount($linkId, $subscriberId, $newsletterId, $queueId) { public static function createOrUpdateClickCount($linkId, $subscriberId, $newsletterId, $queueId) {
$statistics = self::where('link_id', $linkId) $statistics = self::where('link_id', $linkId)

View File

@ -3,7 +3,7 @@
namespace MailPoet\Models; namespace MailPoet\Models;
class StatisticsForms extends Model { class StatisticsForms extends Model {
public static $_table = MP_STATISTICS_FORMS_TABLE; public static $_table = MP_STATISTICS_FORMS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function getTotalSignups($formId = false) { public static function getTotalSignups($formId = false) {
return self::where('form_id', $formId)->count(); return self::where('form_id', $formId)->count();

View File

@ -6,7 +6,7 @@ namespace MailPoet\Models;
* @property string|null $sentAt * @property string|null $sentAt
*/ */
class StatisticsNewsletters extends Model { class StatisticsNewsletters extends Model {
public static $_table = MP_STATISTICS_NEWSLETTERS_TABLE; public static $_table = MP_STATISTICS_NEWSLETTERS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function createMultiple(array $data) { public static function createMultiple(array $data) {
$values = []; $values = [];

View File

@ -8,7 +8,7 @@ namespace MailPoet\Models;
* @property int $queueId * @property int $queueId
*/ */
class StatisticsOpens extends Model { class StatisticsOpens extends Model {
public static $_table = MP_STATISTICS_OPENS_TABLE; public static $_table = MP_STATISTICS_OPENS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function getOrCreate($subscriberId, $newsletterId, $queueId) { public static function getOrCreate($subscriberId, $newsletterId, $queueId) {
$statistics = self::where('subscriber_id', $subscriberId) $statistics = self::where('subscriber_id', $subscriberId)

View File

@ -8,7 +8,7 @@ namespace MailPoet\Models;
* @property int $queueId * @property int $queueId
*/ */
class StatisticsUnsubscribes extends Model { class StatisticsUnsubscribes extends Model {
public static $_table = MP_STATISTICS_UNSUBSCRIBES_TABLE; public static $_table = MP_STATISTICS_UNSUBSCRIBES_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function getOrCreate($subscriberId, $newsletterId, $queueId) { public static function getOrCreate($subscriberId, $newsletterId, $queueId) {
$statistics = self::where('subscriber_id', $subscriberId) $statistics = self::where('subscriber_id', $subscriberId)

View File

@ -14,7 +14,7 @@ use WC_Order;
* @property float $orderPriceTotal * @property float $orderPriceTotal
*/ */
class StatisticsWooCommercePurchases extends Model { class StatisticsWooCommercePurchases extends Model {
public static $_table = MP_STATISTICS_WOOCOMMERCE_PURCHASES_TABLE; public static $_table = MP_STATISTICS_WOOCOMMERCE_PURCHASES_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function createOrUpdateByClickDataAndOrder(StatisticsClicks $click, WC_Order $order) { public static function createOrUpdateByClickDataAndOrder(StatisticsClicks $click, WC_Order $order) {
// search by subscriber and newsletter IDs (instead of click itself) to avoid duplicities // search by subscriber and newsletter IDs (instead of click itself) to avoid duplicities

View File

@ -32,7 +32,7 @@ use function MailPoetVendor\array_column;
*/ */
class Subscriber extends Model { class Subscriber extends Model {
public static $_table = MP_SUBSCRIBERS_TABLE; public static $_table = MP_SUBSCRIBERS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
const STATUS_SUBSCRIBED = 'subscribed'; const STATUS_SUBSCRIBED = 'subscribed';
const STATUS_UNSUBSCRIBED = 'unsubscribed'; const STATUS_UNSUBSCRIBED = 'unsubscribed';

View File

@ -12,7 +12,7 @@ use function MailPoetVendor\array_column;
* @property string $value * @property string $value
*/ */
class SubscriberCustomField extends Model { class SubscriberCustomField extends Model {
public static $_table = MP_SUBSCRIBER_CUSTOM_FIELD_TABLE; public static $_table = MP_SUBSCRIBER_CUSTOM_FIELD_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function createOrUpdate($data = []) { public static function createOrUpdate($data = []) {
$customField = CustomField::findOne($data['custom_field_id']); $customField = CustomField::findOne($data['custom_field_id']);

View File

@ -6,5 +6,5 @@ namespace MailPoet\Models;
* @property string $ip * @property string $ip
*/ */
class SubscriberIP extends Model { class SubscriberIP extends Model {
public static $_table = MP_SUBSCRIBER_IPS_TABLE; public static $_table = MP_SUBSCRIBER_IPS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
} }

View File

@ -10,7 +10,7 @@ namespace MailPoet\Models;
*/ */
class SubscriberSegment extends Model { class SubscriberSegment extends Model {
public static $_table = MP_SUBSCRIBER_SEGMENT_TABLE; public static $_table = MP_SUBSCRIBER_SEGMENT_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public function subscriber() { public function subscriber() {
return $this->has_one(__NAMESPACE__ . '\Subscriber', 'id', 'subscriber_id'); return $this->has_one(__NAMESPACE__ . '\Subscriber', 'id', 'subscriber_id');

View File

@ -3,7 +3,7 @@
namespace MailPoet\Settings; namespace MailPoet\Settings;
class Hosts { class Hosts {
private static $_smtp = [ private static $smtp = [
'AmazonSES' => [ 'AmazonSES' => [
'name' => 'Amazon SES', 'name' => 'Amazon SES',
'emails' => 100, 'emails' => 100,
@ -29,7 +29,7 @@ class Hosts {
], ],
]; ];
private static $_web = [ private static $web = [
'1and1' => [ '1and1' => [
'name' => '1and1', 'name' => '1and1',
'emails' => 30, 'emails' => 30,
@ -213,10 +213,10 @@ class Hosts {
]; ];
public static function getWebHosts() { public static function getWebHosts() {
return static::$_web; return static::$web;
} }
public static function getSMTPHosts() { public static function getSMTPHosts() {
return static::$_smtp; return static::$smtp;
} }
} }

View File

@ -8,10 +8,10 @@ use MailPoetVendor\Twig\TwigFunction;
class Assets extends AbstractExtension { class Assets extends AbstractExtension {
const CDN_URL = 'https://ps.w.org/mailpoet/'; const CDN_URL = 'https://ps.w.org/mailpoet/';
private $_globals; private $globals;
public function __construct($globals) { public function __construct($globals) {
$this->_globals = $globals; $this->globals = $globals;
} }
public function getFunctions() { public function getFunctions() {
@ -51,8 +51,8 @@ class Assets extends AbstractExtension {
foreach ($stylesheets as $stylesheet) { foreach ($stylesheets as $stylesheet) {
$output[] = sprintf( $output[] = sprintf(
'<link rel="stylesheet" type="text/css" href="%s/dist/css/%s" />', '<link rel="stylesheet" type="text/css" href="%s/dist/css/%s" />',
$this->_globals['assets_url'], $this->globals['assets_url'],
$this->getAssetFilename($this->_globals['assets_manifest_css'], $stylesheet) $this->getAssetFilename($this->globals['assets_manifest_css'], $stylesheet)
); );
} }
@ -76,20 +76,20 @@ class Assets extends AbstractExtension {
public function getJavascriptScriptUrl($script) { public function getJavascriptScriptUrl($script) {
return sprintf( return sprintf(
'%s/%s/%s', '%s/%s/%s',
$this->_globals['assets_url'], $this->globals['assets_url'],
strpos($script, 'lib/') === 0 ? 'js' : 'dist/js', strpos($script, 'lib/') === 0 ? 'js' : 'dist/js',
$this->getAssetFileName($this->_globals['assets_manifest_js'], $script) $this->getAssetFileName($this->globals['assets_manifest_js'], $script)
); );
} }
public function generateImageUrl($path) { public function generateImageUrl($path) {
return $this->appendVersionToUrl( return $this->appendVersionToUrl(
$this->_globals['assets_url'] . '/img/' . $path $this->globals['assets_url'] . '/img/' . $path
); );
} }
public function appendVersionToUrl($url) { public function appendVersionToUrl($url) {
return WPFunctions::get()->addQueryArg('mailpoet_version', $this->_globals['version'], $url); return WPFunctions::get()->addQueryArg('mailpoet_version', $this->globals['version'], $url);
} }
public function getAssetFileName($manifest, $asset) { public function getAssetFileName($manifest, $asset) {
@ -98,6 +98,6 @@ class Assets extends AbstractExtension {
public function generateCdnUrl($path) { public function generateCdnUrl($path) {
$useCdn = defined('MAILPOET_USE_CDN') ? MAILPOET_USE_CDN : true; $useCdn = defined('MAILPOET_USE_CDN') ? MAILPOET_USE_CDN : true;
return ($useCdn ? self::CDN_URL : $this->_globals['base_url'] . '/plugin_repository/') . "assets/$path"; return ($useCdn ? self::CDN_URL : $this->globals['base_url'] . '/plugin_repository/') . "assets/$path";
} }
} }