Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1431704
Group.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Group.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
VarRepresentation\Node
;
use
RuntimeException
;
use
VarRepresentation\Node
;
/**
* A group of 1 or more strings/nodes
*/
class
Group
extends
Node
{
/** @var list<string|Node> the parts, e.g. '-' '1' */
protected
$parts
;
/**
* @param list<string|node> $parts
*/
public
function
__construct
(
array
$parts
)
{
if
(
\count
(
$parts
)
===
0
)
{
throw
new
RuntimeException
(
__METHOD__
.
' passed no parts'
);
}
$this
->
parts
=
$parts
;
}
/**
* Create a node or a group from a list of Node|string parts
* @param list<string|Node> $parts
*/
public
static
function
fromParts
(
array
$parts
):
Node
{
if
(
\count
(
$parts
)
===
1
&&
$parts
[
0
]
instanceof
Node
)
{
return
$parts
[
0
];
}
return
new
self
(
$parts
);
}
public
function
toIndentedString
(
int
$depth
):
string
{
$result
=
''
;
foreach
(
$this
->
parts
as
$part
)
{
$result
.=
\is_string
(
$part
)
?
$part
:
$part
->
toIndentedString
(
$depth
);
}
return
$result
;
}
public
function
__toString
():
string
{
return
\implode
(
''
,
$this
->
parts
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 20:59 (1 d, 7 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8d/a9/0cbeee38b1e7e07a944c861b13f6
Default Alt Text
Group.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment