WrappedString
Automatically compact sequentially-outputted strings that share a common prefix / suffix pair.
Loading...
Searching...
No Matches
Wikimedia\WrappedStringList Class Reference

Public Member Functions

 __construct ( $sep, array $wraps)
 
 __toString ()
 

Static Public Member Functions

static join ( $sep, array $lists)
 Join a several wrapped strings with a separator between each.
 

Static Protected Member Functions

static compact (array $lists, $outerSep)
 Merge consecutive lists with the same separator.
 

Protected Attributes

 $sep
 
 $wraps
 

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\WrappedStringList::__construct (   $sep,
array  $wraps 
)
Parameters
string$sep
(string|WrappedString|WrappedStringList)[]$wraps

Member Function Documentation

◆ __toString()

Wikimedia\WrappedStringList::__toString ( )
Returns
string

◆ compact()

static Wikimedia\WrappedStringList::compact ( array  $lists,
  $outerSep 
)
staticprotected

Merge consecutive lists with the same separator.

Does not modify the given array or any of the objects in it.

Parameters
(string|WrappedString|WrappedStringList)[]$lists
string$outerSepSeparator that the caller intends to use when joining the strings
Returns
string[] Compacted list to be treated as strings (may contain WrappedString and WrappedStringList objects)

◆ join()

static Wikimedia\WrappedStringList::join (   $sep,
array  $lists 
)
static

Join a several wrapped strings with a separator between each.

Parameters
string$sep
(string|WrappedString|WrappedStringList)[]$lists
Returns
string

The documentation for this class was generated from the following file: