Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIInfoView.php
Show All 13 Lines | final class PHUIInfoView extends AphrontTagView { | ||||
private $errors = array(); | private $errors = array(); | ||||
private $severity = null; | private $severity = null; | ||||
private $id; | private $id; | ||||
private $buttons = array(); | private $buttons = array(); | ||||
private $isHidden; | private $isHidden; | ||||
private $flush; | private $flush; | ||||
private $icon; | private $icon; | ||||
/** | |||||
* Set a title | |||||
* | |||||
* @param string|null $title | |||||
* @return self | |||||
*/ | |||||
public function setTitle($title) { | public function setTitle($title) { | ||||
$this->title = $title; | $this->title = $title; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setSeverity($severity) { | public function setSeverity($severity) { | ||||
$this->severity = $severity; | $this->severity = $severity; | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | if (count($errors) > 1) { | ||||
$list); | $list); | ||||
} else if (count($errors) == 1) { | } else if (count($errors) == 1) { | ||||
$list = head($this->errors); | $list = head($this->errors); | ||||
} else { | } else { | ||||
$list = null; | $list = null; | ||||
} | } | ||||
$title = $this->title; | $title = $this->title; | ||||
if ($title || strlen($title)) { | if ($title || phutil_nonempty_string($title)) { | ||||
valerio.bozzolan: Interesting.
I cannot think about any case where `$title` is false but `strlen($title)` would… | |||||
Done Inline Actions✅ I tested $title locally with phlog() in various places and it seems it's always null or a string like "Issue Resolved" etc. The phutil_nonempty_string() will report alien values, and that is OK. valerio.bozzolan: ✅ I tested `$title` locally with `phlog()` in various places and it seems it's always null or a… | |||||
$title = phutil_tag( | $title = phutil_tag( | ||||
'h1', | 'h1', | ||||
array( | array( | ||||
'class' => 'phui-info-view-head', | 'class' => 'phui-info-view-head', | ||||
), | ), | ||||
$title); | $title); | ||||
} else { | } else { | ||||
$title = null; | $title = null; | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
Interesting.
I cannot think about any case where $title is false but strlen($title) would be true