Skip to content

Commit

Permalink
fix: Fix function line breaks - trigger_error
Browse files Browse the repository at this point in the history
  • Loading branch information
kryswoj committed Aug 4, 2023
1 parent fb89f86 commit 1ff53f8
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 78 deletions.
5 changes: 1 addition & 4 deletions src/Abstracts/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ public function __construct($params = [])
{

if (!isset($params['label'], $params['name'])) {
trigger_error(
'Field requires label and name',
E_USER_ERROR
);
trigger_error('Field requires label and name', E_USER_ERROR);
}

$this->fieldTypeHtml = substr(
Expand Down
20 changes: 4 additions & 16 deletions src/Abstracts/MergeTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ public function __construct($params = [])
{

if (!isset($params['slug'], $params['name'], $params['resolver'])) {
trigger_error(
'Merge tag requires resolver',
E_USER_ERROR
);
trigger_error('Merge tag requires resolver', E_USER_ERROR);
}

if (!empty($params['slug'])) {
Expand Down Expand Up @@ -166,20 +163,14 @@ public function resolve()
);
} catch (\Throwable $t) {
$value = null;
trigger_error(
esc_html($t->getMessage()),
E_USER_NOTICE
);
trigger_error(esc_html($t->getMessage()), E_USER_NOTICE);
}

if (!empty($value) && !$this->validate($value)) {
$errorType = (defined('WP_DEBUG') && WP_DEBUG)
? E_USER_ERROR
: E_USER_NOTICE;
trigger_error(
'Resolved value is a wrong type',
$errorType
);
trigger_error('Resolved value is a wrong type', $errorType);
}

$this->resolved = true;
Expand Down Expand Up @@ -251,10 +242,7 @@ public function setResolver($resolver)
{

if (!is_callable($resolver)) {
trigger_error(
'Merge tag resolver has to be callable',
E_USER_ERROR
);
trigger_error('Merge tag resolver has to be callable', E_USER_ERROR);
}

$this->resolver = $resolver;
Expand Down
5 changes: 1 addition & 4 deletions src/Abstracts/Recipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ public function __construct($params = [])
}

if (!isset($params['default_value'])) {
trigger_error(
'Recipient requires default_value',
E_USER_ERROR
);
trigger_error('Recipient requires default_value', E_USER_ERROR);
}

$this->defaultValue = $params['default_value'];
Expand Down
10 changes: 2 additions & 8 deletions src/Abstracts/Trigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ public function clearMergeTags()
public function addAction($tag, $priority = 10, $acceptedArgs = 1)
{
if (empty($tag)) {
trigger_error(
'Action tag cannot be empty',
E_USER_ERROR
);
trigger_error('Action tag cannot be empty', E_USER_ERROR);
}

array_push(
Expand All @@ -169,10 +166,7 @@ public function removeAction($tag, $priority = 10, $deprecated = null)
{

if (empty($tag)) {
trigger_error(
'Action tag cannot be empty',
E_USER_ERROR
);
trigger_error('Action tag cannot be empty', E_USER_ERROR);
}

foreach ($this->actions as $actionIndex => $action) {
Expand Down
5 changes: 1 addition & 4 deletions src/Defaults/Field/MessageField.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ public function __construct($params = [])
{

if (!isset($params['message'])) {
trigger_error(
'MessageField requires message param',
E_USER_ERROR
);
trigger_error('MessageField requires message param', E_USER_ERROR);
}

$this->message = $params['message'];
Expand Down
5 changes: 1 addition & 4 deletions src/Defaults/Field/NonceField.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ public function __construct($params = [])
{

if (!isset($params['nonce_key'])) {
trigger_error(
'NonceField requires nonce_key param',
E_USER_ERROR
);
trigger_error('NonceField requires nonce_key param', E_USER_ERROR);
}

$this->nonceKey = $params['nonce_key'];
Expand Down
5 changes: 1 addition & 4 deletions src/Defaults/Field/RecipientsField.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ public function __construct($params = [])
{

if (!isset($params['carrier'])) {
trigger_error(
'RecipientsField requires carrier param',
E_USER_ERROR
);
trigger_error('RecipientsField requires carrier param', E_USER_ERROR);
}

$params = wp_parse_args(
Expand Down
14 changes: 4 additions & 10 deletions src/Defaults/Field/SectionRepeater.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,11 @@ public function __construct($params = [])
{

if (!isset($params['sections'])) {
trigger_error(
'SectionsRepeater requires sections param',
E_USER_ERROR
);
trigger_error('SectionsRepeater requires sections param', E_USER_ERROR);
}

if (!isset($params['section_labels'])) {
trigger_error(
'SectionsRepeater requires section labels param',
E_USER_ERROR
);
trigger_error('SectionsRepeater requires section labels param', E_USER_ERROR);
}

$this->sections = $params['sections'];
Expand Down Expand Up @@ -189,8 +183,8 @@ public function field()
'</div>
</template>';

$html .= '<a
href="#"
$html .= '<a
href="#"
class="button button-secondary add-new-repeater-field add-new-sections-field"
@click="addSection">';
$html .= esc_html($this->addButtonLabel);
Expand Down
5 changes: 1 addition & 4 deletions src/Defaults/Field/SectionsField.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ public function __construct($params = [])
{

if (!isset($params['sections'])) {
trigger_error(
'SectionsField requires sections param',
E_USER_ERROR
);
trigger_error('SectionsField requires sections param', E_USER_ERROR);
}

$this->sections = $params['sections'];
Expand Down
5 changes: 1 addition & 4 deletions src/Defaults/Trigger/Comment/CommentTrigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ public function __construct($params = [])
{

if (!isset($params['comment_type'], $params['slug'], $params['name'])) {
trigger_error(
'CommentTrigger requires comment_type, slug and name params.',
E_USER_ERROR
);
trigger_error('CommentTrigger requires comment_type, slug and name params.', E_USER_ERROR);
}

$this->commentType = $params['comment_type'];
Expand Down
5 changes: 1 addition & 4 deletions src/Defaults/Trigger/Post/PostTrigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ abstract class PostTrigger extends Abstracts\Trigger
public function __construct($params = [])
{
if (!isset($params['post_type'], $params['slug'])) {
trigger_error(
'PostTrigger requires post_type and slug params.',
E_USER_ERROR
);
trigger_error('PostTrigger requires post_type and slug params.', E_USER_ERROR);
}

$this->postType = $params['post_type'];
Expand Down
5 changes: 1 addition & 4 deletions src/Defaults/Trigger/Taxonomy/TermTrigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ abstract class TermTrigger extends Abstracts\Trigger
public function __construct($params = [])
{
if (!isset($params['taxonomy'], $params['slug'])) {
trigger_error(
'TaxonomyTrigger requires taxonomy slug and trigger slug.',
E_USER_ERROR
);
trigger_error('TaxonomyTrigger requires taxonomy slug and trigger slug.', E_USER_ERROR);
}

$this->taxonomy = WpObjectHelper::getTaxonomy($params['taxonomy']);
Expand Down
5 changes: 1 addition & 4 deletions src/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ public static function error(string $message, string $exceptionClass = 'Exceptio
throw new $exceptionClass($message);
}

trigger_error(
esc_html($message),
E_USER_WARNING
);
trigger_error(esc_html($message), E_USER_WARNING);
}
}
5 changes: 1 addition & 4 deletions src/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,7 @@ function notificationRegisterSettings($callback, $priority = 10)
{

if (!is_callable($callback)) {
trigger_error(
'You have to pass callable while registering the settings',
E_USER_ERROR
);
trigger_error('You have to pass callable while registering the settings', E_USER_ERROR);
}

add_action(
Expand Down

0 comments on commit 1ff53f8

Please sign in to comment.