More yoda conditions
This commit is contained in:
@ -43,7 +43,7 @@ trait Billable {
|
||||
*/
|
||||
public function get_billing_address() {
|
||||
|
||||
if ($this->billing_address === null) {
|
||||
if (null === $this->billing_address) {
|
||||
$billing_address = $this->get_meta('wu_billing_address');
|
||||
|
||||
$this->billing_address = is_a($billing_address, '\WP_Ultimo\Objects\Billing_Address') ? $billing_address : $this->get_default_billing_address();
|
||||
|
@ -159,9 +159,9 @@ trait Limitable {
|
||||
|
||||
$sites = [];
|
||||
|
||||
if ($this->model === 'site') {
|
||||
if ('site' === $this->model) {
|
||||
$sites[] = $this;
|
||||
} elseif ($this->model === 'membership') {
|
||||
} elseif ('membership' === $this->model) {
|
||||
$sites = $this->get_sites();
|
||||
}
|
||||
|
||||
@ -242,12 +242,12 @@ trait Limitable {
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->model !== 'product') {
|
||||
if ('product' !== $this->model) {
|
||||
/*
|
||||
* Set the new permissions, based on the diff.
|
||||
*/
|
||||
$limitations = wu_array_recursive_diff($modules_to_save, $current_limitations->to_array());
|
||||
} elseif ($this->model === 'product' && $this->get_type() !== 'plan') {
|
||||
} elseif ('product' === $this->model && $this->get_type() !== 'plan') {
|
||||
$limitations = wu_array_recursive_diff($modules_to_save, Limitations::get_empty()->to_array());
|
||||
} else {
|
||||
$limitations = $modules_to_save;
|
||||
@ -264,15 +264,15 @@ trait Limitable {
|
||||
*/
|
||||
public function get_applicable_product_slugs() {
|
||||
|
||||
if ($this->model === 'product') {
|
||||
if ('product' === $this->model) {
|
||||
return [$this->get_slug()];
|
||||
}
|
||||
|
||||
$slugs = [];
|
||||
|
||||
if ($this->model === 'membership') {
|
||||
if ('membership' === $this->model) {
|
||||
$membership = $this;
|
||||
} elseif ($this->model === 'site') {
|
||||
} elseif ('site' === $this->model) {
|
||||
$membership = $this->get_membership();
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ trait Notable {
|
||||
*/
|
||||
public function get_notes() {
|
||||
|
||||
if ($this->notes === null) {
|
||||
if (null === $this->notes) {
|
||||
$this->notes = get_metadata($this->get_meta_data_table_name(), $this->get_id(), 'wu_note', false);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user