tp TouchPointWP Utilities StringableArray - TenthPres/TouchPoint-WP GitHub Wiki

tp\TouchPointWP\Utilities\StringableArray

A collection of things that can be cast to a string by gluing them together with a simple implode().

  • Class name: StringableArray
  • Namespace: \tp\TouchPointWP\Utilities
  • Parent class: ArrayObject

Methods

__construct

mixed tp\TouchPointWP\Utilities\StringableArray::__construct(string separator, object|array array, int flags, string iteratorClass)

StringableArray constructor.

  • Visibility: public

Arguments

  • separator string* array object|array* flags int* iteratorClass string

Returns

  • mixed

count

int tp\TouchPointWP\Utilities\StringableArray::count()

Length of array.

  • Visibility: public

Returns

  • int -

prepend

mixed tp\TouchPointWP\Utilities\StringableArray::prepend(mixed value, null key)

Append to the start of the array.

  • Visibility: public

Arguments

  • value mixed* key null

Returns

  • mixed

contains

bool tp\TouchPointWP\Utilities\StringableArray::contains(mixed needle)

Determine if the stringable array (haystack) contains the given needle

  • Visibility: public

Arguments

  • needle mixed

Returns

  • bool -

__toString

string tp\TouchPointWP\Utilities\StringableArray::__toString()

Standard method to stringify.

  • Visibility: public

Returns

  • string -

join

string tp\TouchPointWP\Utilities\StringableArray::join(string|null separator)

Link the items together with a given separator, which may be different from the separator used in the constructor.

  • Visibility: public

Arguments

  • separator string|null

Returns

  • string -

toListString

string tp\TouchPointWP\Utilities\StringableArray::toListString(int limit, bool andOthers)

Convert the array to a list string with ampersands and such.

  • Visibility: public

Arguments

  • limit int* andOthers bool

Returns

  • string -