Class Xyster_Orm_Xsql_Split

Description

A string exploder that won't split inside paretheses or double-quotes

  • copyright: Copyright (c) 2007-2008 Irrational Logic (http://irrationallogic.net)
  • license: New BSD License

Located in /Orm/Xsql/Split.php (line 24)


	
			
Variable Summary
static array $_splits
string $_needle
Method Summary
static Xyster_Orm_Xsql_Split Custom ( $needle)
static Xyster_Orm_Xsql_Split _factory (string $needle)
Xyster_Orm_Xsql_Split __construct (string $needle)
array split (string $haystack, [boolean $caseInsensitive = true])
Variables
static array $_splits = array() (line 39)
  • access: protected
string $_needle (line 29)
  • access: protected
int $_needleLength (line 34)
  • access: protected
Methods
static method Arrow (line 126)

Gets a splitter for the arrow ('->')

  • access: public
static Xyster_Orm_Xsql_Split Arrow ()
static method Comma (line 136)

Gets a splitter for a comma (',')

  • access: public
static Xyster_Orm_Xsql_Split Comma ()
static method Custom (line 146)

Gets a splitter for any string

  • access: public
static Xyster_Orm_Xsql_Split Custom ( $needle)
  • $needle
static method Space (line 156)

Gets a splitter for a space (' ')

  • access: public
static Xyster_Orm_Xsql_Split Space ()
static method _factory (line 167)

Creates a new splitter

  • access: protected
static Xyster_Orm_Xsql_Split _factory (string $needle)
  • string $needle
Constructor __construct (line 46)

Creates a new splitter

  • access: protected
Xyster_Orm_Xsql_Split __construct (string $needle)
  • string $needle
split (line 82)

Like explode(), but won't split inside of parentheses or double-quotes

This method will split a string into an array using a string as a seperator. If the seperator is contained within a pair of double-quotes or between matching parentheses, it will be ignored. If the seperator is not found, the method will return an array with one element containing the entire string.

Example:

  1.  $haystack 'A (great (test)) of "this method"';
  2.  $split Xyster_Orm_Xsql_Split::Space();
  3.  print_r($split->split(' '$haystack));

Would print:

 array (
    [0]=>A
    [1]=>(great (test))
    [2]=>of
    [3]=>"this method"
 )

  • return: Split parts of $haystack
  • access: public
array split (string $haystack, [boolean $caseInsensitive = true])
  • string $haystack: String to split
  • boolean $caseInsensitive: Whether to ignore case

Documentation generated on Mon, 19 May 2008 17:07:37 -0400 by phpDocumentor 1.4.2