Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91180056
PhutilConsoleList.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 8, 17:16
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 10, 17:16 (2 d)
Engine
blob
Format
Raw Data
Handle
22213662
Attached To
rPHU libphutil
PhutilConsoleList.php
View Options
<?php
final
class
PhutilConsoleList
extends
PhutilConsoleView
{
private
$items
=
array
();
private
$wrap
=
true
;
private
$bullet
=
'-'
;
public
function
addItem
(
$item
)
{
$this
->
items
[]
=
$item
;
return
$this
;
}
public
function
addItems
(
array
$items
)
{
foreach
(
$items
as
$item
)
{
$this
->
addItem
(
$item
);
}
return
$this
;
}
public
function
getItems
()
{
return
$this
->
items
;
}
public
function
setBullet
(
$bullet
)
{
$this
->
bullet
=
$bullet
;
return
$this
;
}
public
function
getBullet
()
{
return
$this
->
bullet
;
}
public
function
setWrap
(
$wrap
)
{
$this
->
wrap
=
$wrap
;
return
$this
;
}
protected
function
drawView
()
{
$indent_depth
=
6
;
$indent_string
=
str_repeat
(
' '
,
$indent_depth
);
if
(
$this
->
bullet
!==
null
)
{
$bullet
=
$this
->
bullet
.
' '
;
$indent_depth
=
$indent_depth
+
phutil_utf8_console_strlen
(
$bullet
);
}
else
{
$bullet
=
''
;
}
$output
=
array
();
foreach
(
$this
->
getItems
()
as
$item
)
{
if
(
$this
->
wrap
)
{
$item
=
phutil_console_wrap
(
$item
,
$indent_depth
);
}
$output
[]
=
$indent_string
.
$bullet
.
$item
;
}
return
$this
->
drawLines
(
$output
);
}
}
Event Timeline
Log In to Comment