Add public keyword to methods

[MAILPOET-2413]
This commit is contained in:
Amine Ben hammou
2019-12-26 12:56:49 +01:00
committed by wxa
parent ec409042d5
commit 43df66d162
823 changed files with 4440 additions and 4440 deletions

View File

@ -3,7 +3,7 @@
namespace MailPoet\Newsletter\Editor;
class LayoutHelper {
static function row($blocks, $styles = []) {
public static function row($blocks, $styles = []) {
if (empty($styles['backgroundColor'])) {
$styles['backgroundColor'] = 'transparent';
}
@ -15,7 +15,7 @@ class LayoutHelper {
];
}
static function col($blocks, $styles = []) {
public static function col($blocks, $styles = []) {
if (empty($styles['backgroundColor'])) {
$styles['backgroundColor'] = 'transparent';
}

View File

@ -6,7 +6,7 @@ use MailPoet\WP\Functions as WPFunctions;
class MetaInformationManager {
function appendMetaInformation($content, $post, $args) {
public function appendMetaInformation($content, $post, $args) {
// Append author and categories above and below contents
foreach (['above', 'below'] as $position) {
$position_field = $position . 'Text';

View File

@ -13,13 +13,13 @@ class PostContentManager {
/** @var WooCommerceHelper */
private $woocommerce_helper;
function __construct(WooCommerceHelper $woocommerce_helper = null) {
public function __construct(WooCommerceHelper $woocommerce_helper = null) {
$wp = new WPFunctions;
$this->max_excerpt_length = $wp->applyFilters('mailpoet_newsletter_post_excerpt_length', $this->max_excerpt_length);
$this->woocommerce_helper = $woocommerce_helper ?: new WooCommerceHelper();
}
function getContent($post, $displayType) {
public function getContent($post, $displayType) {
if ($displayType === 'titleOnly') {
return '';
}
@ -38,7 +38,7 @@ class PostContentManager {
return self::stripShortCodes($post->post_content);
}
function filterContent($content, $display_type, $with_post_class = true) {
public function filterContent($content, $display_type, $with_post_class = true) {
$content = self::convertEmbeddedContent($content);
// convert h4 h5 h6 to h3

View File

@ -7,12 +7,12 @@ class PostListTransformer {
private $args;
private $transformer;
function __construct($args) {
public function __construct($args) {
$this->args = $args;
$this->transformer = new PostTransformer($args);
}
function transform($posts) {
public function transform($posts) {
$results = [];
$use_divider = filter_var($this->args['showDivider'], FILTER_VALIDATE_BOOLEAN);

View File

@ -13,7 +13,7 @@ class PostTransformer {
/** @var string */
private $image_position;
function __construct($args, PostTransformerContentsExtractor $extractor = null) {
public function __construct($args, PostTransformerContentsExtractor $extractor = null) {
$this->args = $args;
$this->with_layout = isset($args['withLayout']) ? (bool)filter_var($args['withLayout'], FILTER_VALIDATE_BOOLEAN) : false;
$this->image_position = 'left';
@ -23,7 +23,7 @@ class PostTransformer {
$this->extractor = $extractor;
}
function getDivider() {
public function getDivider() {
if (empty($this->with_layout)) {
return $this->args['divider'];
}
@ -32,7 +32,7 @@ class PostTransformer {
]);
}
function transform($post) {
public function transform($post) {
if (empty($this->with_layout)) {
return $this->getStructure($post);
}

View File

@ -16,13 +16,13 @@ class PostTransformerContentsExtractor {
/** @var WooCommerceHelper */
private $woocommerce_helper;
function __construct($args) {
public function __construct($args) {
$this->args = $args;
$this->wp = new WPFunctions();
$this->woocommerce_helper = new WooCommerceHelper();
}
function getContent($post, $with_post_class, $display_type) {
public function getContent($post, $with_post_class, $display_type) {
$content_manager = new PostContentManager();
$meta_manager = new MetaInformationManager();
@ -66,7 +66,7 @@ class PostTransformerContentsExtractor {
return $image_info;
}
function getFeaturedImage($post) {
public function getFeaturedImage($post) {
$post_id = $post->ID;
$post_title = $this->sanitizeTitle($post->post_title);
$image_full_width = (bool)filter_var($this->args['imageFullWidth'], FILTER_VALIDATE_BOOLEAN);
@ -124,7 +124,7 @@ class PostTransformerContentsExtractor {
];
}
function getTitle($post) {
public function getTitle($post) {
$title = $this->sanitizeTitle($post->post_title);
if (filter_var($this->args['titleIsLink'], FILTER_VALIDATE_BOOLEAN)) {
@ -181,7 +181,7 @@ class PostTransformerContentsExtractor {
return $content;
}
function isProduct($post) {
public function isProduct($post) {
return $post->post_type === 'product';
}

View File

@ -8,7 +8,7 @@ use pQuery\DomNode;
class StructureTransformer {
function transform($content, $image_full_width) {
public function transform($content, $image_full_width) {
$root = pQuery::parseStr($content);
$this->hoistImagesToRoot($root);

View File

@ -8,11 +8,11 @@ class TitleListTransformer {
private $args;
function __construct($args) {
public function __construct($args) {
$this->args = $args;
}
function transform($posts) {
public function transform($posts) {
$results = array_map(function($post) {
return $this->getPostTitle($post);
}, $posts);

View File

@ -6,7 +6,7 @@ class Transformer {
private $transformer;
function __construct($args) {
public function __construct($args) {
$title_list_only = $args['displayType'] === 'titleOnly' && $args['titleFormat'] === 'ul';
if ($title_list_only) $transformer = new TitleListTransformer($args);
@ -14,7 +14,7 @@ class Transformer {
$this->transformer = $transformer;
}
function transform($posts) {
public function transform($posts) {
return $this->transformer->transform($posts);
}
}