PathNavigator
[ class tree: PathNavigator ] [ index: PathNavigator ] [ all elements ]

Class: Text_PathNavigator

Source Location: /Text_PathNavigator-0.2.0/Text/PathNavigator.php

Class Overview


Text_PathNavigator


Author(s):

Version:

  • Release: @package_version@

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 30]
Text_PathNavigator


[ Top ]


Class Variables

$currentIdx =  0

[line 55]

Current path segment index (Iterator implementation)
  • Access: protected

Type:   int


[ Top ]

$path =

[line 43]

Normalized path string
  • Access: protected

Type:   string


[ Top ]

$segments = array()

[line 49]

Normalized path after explode() on $slash
  • Access: protected

Type:   array


[ Top ]

$slash =

[line 37]

Directory separator, i.e, forward or backward slash
  • Access: protected

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 66]

string __construct( array|string $path, [string $slash = DIRECTORY_SEPARATOR])

Constructs a new Text_PathNavigator object
  • Access: public

Parameters:

array|string   $path   —  Path string or array of path segments
string   $slash   —  character used to separate path segments

[ Top ]

after   [line 156]

Text_PathNavigator after( string $pattern)

Returns path substring following the given regular expression
  • Access: public

Parameters:

string   $pattern   —  regular expression to use for matching

[ Top ]

before   [line 172]

Text_PathNavigator before( string $pattern)

Returns path substring preceding the given regular expression
  • Access: public

Parameters:

string   $pattern   —  regular expression to use for matching

[ Top ]

between   [line 189]

Text_PathNavigator between( string $start, string $end)

Returns path substring between the given regular expressions $start and $end
  • Access: public

Parameters:

string   $start   —  regular expression
string   $end   —  regular expression

[ Top ]

cd   [line 251]

Text_PathNavigator cd( mixed $path)

Navigates from this path to another using the specified relative path.
  • Access: public

Parameters:

mixed   $path   —  relative path

[ Top ]

count   [line 349]

int count( )

Returns the number of path segments (Countable implementation)
  • Access: public

[ Top ]

current   [line 359]

string current( )

Returns current path segment (Iterator implementation)
  • Access: public

[ Top ]

key   [line 369]

int key( )

Returns index of current path segment (Iterator implementation)
  • Access: public

[ Top ]

map   [line 284]

array map( string $template)

Maps path segments to variable names given in $template.

Suitable for use with PHP's extract() function.

  • Access: public

Parameters:

string   $template   —  e.g., '/controller/method/'

[ Top ]

next   [line 379]

void next( )

Advances to next path segment (Iterator implementation)
  • Access: public

[ Top ]

normalizePath   [line 92]

string normalizePath( array|string $path)

Removes all leading and trailing slashes from given path string/segment array.
  • Access: protected

Parameters:

array|string   $path   —  Path string or array of path segments

[ Top ]

offsetExists   [line 300]

boolean offsetExists( int $i)

Check if a particular segment exists (ArrayAccess implementation)
  • Access: public

Parameters:

int   $i   —  path segment index

[ Top ]

offsetGet   [line 312]

string offsetGet( int $i)

Get a particular segment (ArrayAccess implementation)
  • Access: public

Parameters:

int   $i   —  path segment index

[ Top ]

offsetSet   [line 339]

void offsetSet( int $i, string $val)

Throws Exception for the purpose of immutability (ArrayAccess implementation)
  • Throws: Exception for the purpose of immutability
  • Access: public

Parameters:

int   $i   —  path segment index
string   $val   —  path segment

[ Top ]

offsetUnset   [line 325]

void offsetUnset( int $i)

Throws Exception for the purpose of immutability (ArrayAccess implementation)
  • Throws: Exception for the purpose of immutability
  • Access: public

Parameters:

int   $i   —  path segment index

[ Top ]

relativeTo   [line 204]

Text_PathNavigator relativeTo( mixed $path)

Returns this path relative to another one. Assumes both paths are absolute.

If located in a path $p2, we could navigate to this one using $p2->cd($this->relativeTo($p2))

  • Access: public

Parameters:

mixed   $path   —  new path will be expressed in relation to this

[ Top ]

rewind   [line 389]

void rewind( )

Rewinds to first path segment (Iterator implementation)
  • Access: public

[ Top ]

slice   [line 136]

PEAR_Text_PathNavigator slice( [int $offset = 0], [int $length = null])

Slices current path and returns it as a new Text_PathNavigator object
  • Access: public

Parameters:

int   $offset   —  If offset is non-negative, the new path will start
int   $length   —  If length is given and is positive, the new path

[ Top ]

valid   [line 399]

bool valid( )

Checks if current path segment index is valid (Iterator implementation)
  • Access: public

[ Top ]

__toString   [line 80]

string __toString( )

Returns path string
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:48:42 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.