Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / view / phui / PHUISegmentBarView.php
blob632c5327eb3987f4b3d4330ad6c97b535c02d993
1 <?php
3 final class PHUISegmentBarView extends AphrontTagView {
5 private $label;
6 private $segments = array();
8 public function setLabel($label) {
9 $this->label = $label;
10 return $this;
13 public function newSegment() {
14 $segment = new PHUISegmentBarSegmentView();
15 $this->segments[] = $segment;
16 return $segment;
19 protected function canAppendChild() {
20 return false;
23 protected function getTagAttributes() {
24 return array(
25 'class' => 'phui-segment-bar-view',
29 protected function getTagContent() {
30 require_celerity_resource('phui-segment-bar-view-css');
32 $label = $this->label;
33 if (strlen($label)) {
34 $label = phutil_tag(
35 'div',
36 array(
37 'class' => 'phui-segment-bar-label',
39 $label);
42 $segments = $this->segments;
44 $position = 0;
45 foreach ($segments as $segment) {
46 $segment->setPosition($position);
47 $position += $segment->getWidth();
50 $segments = array_reverse($segments);
52 $segments = phutil_tag(
53 'div',
54 array(
55 'class' => 'phui-segment-bar-segments',
57 $segments);
59 return array(
60 $label,
61 $segments,