PHP 클래스 LdapTools\Ldif\LdifParser

저자: Chad Sikorra ([email protected])
파일 보기 프로젝트 열기: ldaptools/ldaptools

보호된 프로퍼티들

프로퍼티 타입 설명
$changeTypeMap A simple changetype to full class name mapping.
$commentQueue Any comments pending for the next entry in the LDIF.
$line The current line number we are on during parsing.
$lines string[]
$urlLoaders LdapTools\Ldif\UrlLoader\UrlLoaderInterface[] An array of UrlLoaders with the key set to the type of URL they handle.

공개 메소드들

메소드 설명
__construct ( )
hasUrlLoader ( string $type ) : boolean Check if a URL loader for a specific URL type exists.
parse ( string $ldif ) : Ldif Parses a string containing LDIF data and returns an object with the entries it contains.
removeUrlLoader ( string $type ) Remove a URL loader by its string type.
setUrlLoader ( string $type, LdapTools\Ldif\UrlLoader\UrlLoaderInterface $loader ) Set a URL loader to be used by the parser.

보호된 메소드들

메소드 설명
addCommentToQueueOrLdif ( Ldif $ldif ) Determine whether the comment should be added to the LDIF itself, or if it's a comment for an entry within the LDIF. If it's for an entry in the LDIF, then we make the assumption that we an empty line separates comments between the LDIF comments overall and the start of a comment for an entry. This seems like the most reasonable way to do it, though it still may not be perfect.
addDirectiveToEntry ( string $key, string $value, LdapTools\Ldif\Entry\LdifEntryInterface $entry ) Figures out what to add to the LDIF entry for a specific key/value directive given.
addModDnDirective ( LdifEntryModDn $entry, string $key, string $value )
addModifyDirective ( LdifEntryModify $entry, string $key, string $value )
cleanup ( ) Do a bit of cleanup post parsing.
currentLine ( ) : boolean | string
getBoolFromStringBool ( string $value ) : boolean Convert an expected string "true" or "false" to bool.
getBoolFromStringInt ( string $value ) : boolean Convert an expected string "0" or "1" to bool.
getContinuedValues ( $value ) : string Check for any continued values and concatenate them into one.
getKeyAndValue ( string $line ) : array
getLdapControl ( string $value ) : LdapControl Validate a control directive and get the value for the control and the criticality.
getLdifEntryObject ( string $dn, string $changeType ) : LdapTools\Ldif\Entry\LdifEntryInterface Get the LdifEntry for the changetype.
getValueFromUrl ( string $url ) : string Get the value of the URL data via a UrlLoader.
getValuesForModifyAction ( string $attribute, string $action ) : array
isComment ( ) : boolean Check if the current line is a comment.
isCommonDirective ( ) : boolean Check if the line is a directive common to any change type (ie. changetype or control).
isContinuedValue ( string $line ) : boolean Check if a line is a continuation of a previous value.
isEndOfEntry ( ) : boolean Check if we are at the end of a LDIF entry.
isEndOfLdif ( ) : boolean Check if we are at the end of the LDIF string.
isStartOfEntry ( ) : boolean Checks for the start of a LDIF entry on the current line.
nextLine ( boolean $advance = true ) : string | false
parseCommonDirectives ( $dn ) : LdapTools\Ldif\Entry\LdifEntryInterface Parses directives that are potentially common to all entries and returns the LdifEntry object. Common directives include: changetype, control
parseEntry ( ) : LdapTools\Ldif\Entry\LdifEntryInterface Parse an entry from the DN position until we reach the start of the next entry. Return the entry that was parsed.
setLdifVersion ( Ldif $ldif, integer $version )
setup ( string $ldif )
startsWith ( string $value, null | string $line = null ) : boolean Check if the current line starts with a specific value.
throwException ( string $message ) A simple helper to add additional information to the exception.
validateDirectiveInChange ( string $type, string $directive )

메소드 상세

__construct() 공개 메소드

public __construct ( )

addCommentToQueueOrLdif() 보호된 메소드

Determine whether the comment should be added to the LDIF itself, or if it's a comment for an entry within the LDIF. If it's for an entry in the LDIF, then we make the assumption that we an empty line separates comments between the LDIF comments overall and the start of a comment for an entry. This seems like the most reasonable way to do it, though it still may not be perfect.
protected addCommentToQueueOrLdif ( Ldif $ldif )
$ldif Ldif

addDirectiveToEntry() 보호된 메소드

Figures out what to add to the LDIF entry for a specific key/value directive given.
protected addDirectiveToEntry ( string $key, string $value, LdapTools\Ldif\Entry\LdifEntryInterface $entry )
$key string
$value string
$entry LdapTools\Ldif\Entry\LdifEntryInterface

addModDnDirective() 보호된 메소드

protected addModDnDirective ( LdifEntryModDn $entry, string $key, string $value )
$entry LdapTools\Ldif\Entry\LdifEntryModDn
$key string
$value string

addModifyDirective() 보호된 메소드

protected addModifyDirective ( LdifEntryModify $entry, string $key, string $value )
$entry LdapTools\Ldif\Entry\LdifEntryModify
$key string
$value string

cleanup() 보호된 메소드

Do a bit of cleanup post parsing.
protected cleanup ( )

currentLine() 보호된 메소드

protected currentLine ( ) : boolean | string
리턴 boolean | string

getBoolFromStringBool() 보호된 메소드

Convert an expected string "true" or "false" to bool.
protected getBoolFromStringBool ( string $value ) : boolean
$value string
리턴 boolean

getBoolFromStringInt() 보호된 메소드

Convert an expected string "0" or "1" to bool.
protected getBoolFromStringInt ( string $value ) : boolean
$value string
리턴 boolean

getContinuedValues() 보호된 메소드

Check for any continued values and concatenate them into one.
protected getContinuedValues ( $value ) : string
$value
리턴 string

getKeyAndValue() 보호된 메소드

protected getKeyAndValue ( string $line ) : array
$line string
리턴 array

getLdapControl() 보호된 메소드

Validate a control directive and get the value for the control and the criticality.
protected getLdapControl ( string $value ) : LdapControl
$value string
리턴 LdapTools\Connection\LdapControl

getLdifEntryObject() 보호된 메소드

Get the LdifEntry for the changetype.
protected getLdifEntryObject ( string $dn, string $changeType ) : LdapTools\Ldif\Entry\LdifEntryInterface
$dn string
$changeType string
리턴 LdapTools\Ldif\Entry\LdifEntryInterface

getValueFromUrl() 보호된 메소드

Get the value of the URL data via a UrlLoader.
protected getValueFromUrl ( string $url ) : string
$url string
리턴 string

getValuesForModifyAction() 보호된 메소드

protected getValuesForModifyAction ( string $attribute, string $action ) : array
$attribute string
$action string
리턴 array

hasUrlLoader() 공개 메소드

Check if a URL loader for a specific URL type exists.
public hasUrlLoader ( string $type ) : boolean
$type string
리턴 boolean

isComment() 보호된 메소드

Check if the current line is a comment.
protected isComment ( ) : boolean
리턴 boolean

isCommonDirective() 보호된 메소드

Check if the line is a directive common to any change type (ie. changetype or control).
protected isCommonDirective ( ) : boolean
리턴 boolean

isContinuedValue() 보호된 메소드

Check if a line is a continuation of a previous value.
protected isContinuedValue ( string $line ) : boolean
$line string
리턴 boolean

isEndOfEntry() 보호된 메소드

Check if we are at the end of a LDIF entry.
protected isEndOfEntry ( ) : boolean
리턴 boolean

isEndOfLdif() 보호된 메소드

Check if we are at the end of the LDIF string.
protected isEndOfLdif ( ) : boolean
리턴 boolean

isStartOfEntry() 보호된 메소드

Checks for the start of a LDIF entry on the current line.
protected isStartOfEntry ( ) : boolean
리턴 boolean

nextLine() 보호된 메소드

protected nextLine ( boolean $advance = true ) : string | false
$advance boolean Whether to advance the currently active line ahead or not.
리턴 string | false

parse() 공개 메소드

Parses a string containing LDIF data and returns an object with the entries it contains.
public parse ( string $ldif ) : Ldif
$ldif string
리턴 Ldif

parseCommonDirectives() 보호된 메소드

Parses directives that are potentially common to all entries and returns the LdifEntry object. Common directives include: changetype, control
protected parseCommonDirectives ( $dn ) : LdapTools\Ldif\Entry\LdifEntryInterface
$dn
리턴 LdapTools\Ldif\Entry\LdifEntryInterface

parseEntry() 보호된 메소드

Parse an entry from the DN position until we reach the start of the next entry. Return the entry that was parsed.
protected parseEntry ( ) : LdapTools\Ldif\Entry\LdifEntryInterface
리턴 LdapTools\Ldif\Entry\LdifEntryInterface

removeUrlLoader() 공개 메소드

Remove a URL loader by its string type.
public removeUrlLoader ( string $type )
$type string

setLdifVersion() 보호된 메소드

protected setLdifVersion ( Ldif $ldif, integer $version )
$ldif Ldif
$version integer

setUrlLoader() 공개 메소드

Set a URL loader to be used by the parser.
public setUrlLoader ( string $type, LdapTools\Ldif\UrlLoader\UrlLoaderInterface $loader )
$type string The URL type (ie. file, http, etc)
$loader LdapTools\Ldif\UrlLoader\UrlLoaderInterface

setup() 보호된 메소드

protected setup ( string $ldif )
$ldif string

startsWith() 보호된 메소드

Check if the current line starts with a specific value.
protected startsWith ( string $value, null | string $line = null ) : boolean
$value string
$line null | string
리턴 boolean

throwException() 보호된 메소드

A simple helper to add additional information to the exception.
protected throwException ( string $message )
$message string

validateDirectiveInChange() 보호된 메소드

protected validateDirectiveInChange ( string $type, string $directive )
$type string The changetype.
$directive string The directive used.

프로퍼티 상세

$changeTypeMap 보호되어 있는 프로퍼티

A simple changetype to full class name mapping.
protected $changeTypeMap

$commentQueue 보호되어 있는 프로퍼티

Any comments pending for the next entry in the LDIF.
protected $commentQueue

$line 보호되어 있는 프로퍼티

The current line number we are on during parsing.
protected $line

$lines 보호되어 있는 프로퍼티

protected string[] $lines
리턴 string[]

$urlLoaders 보호되어 있는 프로퍼티

An array of UrlLoaders with the key set to the type of URL they handle.
protected UrlLoaderInterface[],LdapTools\Ldif\UrlLoader $urlLoaders
리턴 LdapTools\Ldif\UrlLoader\UrlLoaderInterface[]