PHP Класс LdapTools\Ldif\LdifParser

Автор: Chad Sikorra ([email protected])
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$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[]