Skip to content
Permalink
Browse files

Use null coalescing operator where trivially possible

  • Loading branch information...
flack committed Jul 26, 2019
1 parent e040bea commit e42b8ed2b6ae4eadd6cf72eeb23eac96e469db33
@@ -59,7 +59,7 @@ public function execute()
$db_comment = new net_nehmer_comments_comment();
$db_comment->objectguid = $article->guid;
$db_comment->metadata->published = $comment->get_date('Y-m-d H:i:s');
$db_comment->author = isset($author_info['full_name']) ? $author_info['full_name'] : $author_info['username'];
$db_comment->author = $author_info['full_name'] ?? $author_info['username'];
$db_comment->status = $this->_config->get('atom_comments_initial_status');
$db_comment->remoteid = $comment->get_id();
@@ -63,9 +63,9 @@ private function get_salesproject($person_guid)
*/
public function handle_create()
{
$person_guid = isset($this->_request['params']['person_guid']) ? $this->_request['params']['person_guid'] : false;
$person_guid = $this->_request['params']['person_guid'] ?? false;
$product_id = isset($this->_request['params']['product_id']) ? intval($this->_request['params']['product_id']) : false;
$run_cycle = isset($this->_request['params']['run_cycle']) ? $this->_request['params']['run_cycle'] : false;
$run_cycle = $this->_request['params']['run_cycle'] ?? false;
// check param
if (!$person_guid || !$product_id) {
@@ -201,7 +201,7 @@ public function image_row(FormView $view, array $data)
public function form_widget_simple(FormView $view, array $data)
{
$type = isset($data['type']) ? $data['type'] : 'text';
$type = $data['type'] ?? 'text';
if ($view->vars['readonly'] && $type !== 'hidden') {
$data['type'] = 'hidden';
return $data['value'] . $this->renderer->block($view, 'form_widget_simple', $data);
@@ -221,7 +221,7 @@ public function form_widget_simple(FormView $view, array $data)
public function button_widget(FormView $view, array $data)
{
$type = isset($data['type']) ? $data['type'] : 'button';
$type = $data['type'] ?? 'button';
if (!$data['label']) {
$data['label'] = $data['name'];
}
@@ -231,22 +231,22 @@ public function button_widget(FormView $view, array $data)
public function hidden_widget(FormView $view, array $data)
{
return $this->renderer->block($view, 'form_widget_simple', ['type' => isset($data['type']) ? $data['type'] : "hidden"]);
return $this->renderer->block($view, 'form_widget_simple', ['type' => $data['type'] ?? "hidden"]);
}
public function email_widget(FormView $view, array $data)
{
return $this->renderer->block($view, 'form_widget_simple', ['type' => isset($data['type']) ? $data['type'] : "email"]);
return $this->renderer->block($view, 'form_widget_simple', ['type' => $data['type'] ?? "email"]);
}
public function password_widget(FormView $view, array $data)
{
return $this->renderer->block($view, 'form_widget_simple', ['type' => isset($data['type']) ? $data['type'] : "password"]);
return $this->renderer->block($view, 'form_widget_simple', ['type' => $data['type'] ?? "password"]);
}
public function url_widget(FormView $view, array $data)
{
return $this->renderer->block($view, 'form_widget_simple', ['type' => isset($data['type']) ? $data['type'] : "url"]);
return $this->renderer->block($view, 'form_widget_simple', ['type' => $data['type'] ?? "url"]);
}
public function autocomplete_widget(FormView $view, array $data)
@@ -449,7 +449,7 @@ public function image_widget(FormView $view, array $data)
$string = '<div ' . $this->renderer->block($view, 'widget_container_attributes') . '>';
$string .= '<table class="midcom_datamanager_table_photo"><tr><td>';
$preview = null;
$objects = isset($data['value']['objects']) ? $data['value']['objects'] : [];
$objects = $data['value']['objects'] ?? [];
foreach ($objects as $identifier => $info) {
$preview = $info;
if ($identifier == 'thumbnail') {
@@ -507,13 +507,13 @@ public function subform_widget(FormView $view, array $data)
public function submit_widget(FormView $view, array $data)
{
$data['type'] = isset($data['type']) ? $data['type'] : 'submit';
$data['type'] = $data['type'] ?? 'submit';
return $this->renderer->block($view, 'button_widget', $data);
}
public function delete_widget(FormView $view, array $data)
{
$data['type'] = isset($data['type']) ? $data['type'] : 'delete';
$data['type'] = $data['type'] ?? 'delete';
return $this->renderer->block($view, 'button_widget', $data);
}
@@ -561,7 +561,7 @@ public function form_label(FormView $view, array $data)
$label_attr = $data['label_attr'];
if ($data['required'] && !$view->vars['readonly']) {
$label_attr['class'] = trim((isset($label_attr['class']) ? $label_attr['class'] : '') . ' required');
$label_attr['class'] = trim(($label_attr['class'] ?? '') . ' required');
$data['label'] .= ' <span class="field_required_start">*</span>';
}
if (!$data['compound']) {
@@ -120,7 +120,7 @@ public function form_label(FormView $view, array $data)
return '';
}
$label_attr = $data['label_attr'];
$label_attr['class'] = trim('title ' . (isset($label_attr['class']) ? $label_attr['class'] : ''));
$label_attr['class'] = trim('title ' . ($label_attr['class'] ?? ''));
if (!$data['label']) {
$data['label'] = $data['name'];
}

0 comments on commit e42b8ed

Please sign in to comment.
You can’t perform that action at this time.