PHP Class Baum\SetValidator

Afficher le fichier Open project: gazsp/baum Class Usage Examples

Protected Properties

Свойство Type Description
$node Node Node instance for reference.

Méthodes publiques

Méthode Description
__construct ( Node $node ) : void Create a new \Baum\SetValidator class instance.
fails ( ) : boolean Determine if validation fails.
passes ( ) : boolean Determine if the validation passes.

Méthodes protégées

Méthode Description
duplicatesExistForColumn ( string $column ) : boolean Checks if duplicate values for the column specified exist. Takes the Nested Set scope columns into account (if appropiate).
groupRootsByScope ( mixed $roots ) : array Given a list of root nodes, it returns an array in which the keys are the array of the actual scope column values and the values are the root nodes inside that scope themselves.
isEachRootValid ( mixed $roots ) : boolean Check that each root node in the list supplied satisfies that its bounds values (lft, rgt indexes) are less than the next.
keyForScope ( Baum\Node $node ) : string Builds a single string for the given scope columns values. Useful for making array keys for grouping.
validateBounds ( ) : boolean Validates bounds of the nested tree structure. It will perform checks on the lft, rgt and parent_id columns. Mainly that they're not null, rights greater than lefts, and that they're within the bounds of the parent.
validateDuplicates ( ) : boolean Checks that there are no duplicates for the lft and rgt columns.
validateRoots ( ) : boolean For each root of the whole nested set tree structure, checks that their lft and rgt bounds are properly set.
validateRootsByScope ( mixed $roots ) : boolean Check that each root node in the list supplied satisfies that its bounds values (lft, rgt indexes) are less than the next *within each scope*.

Method Details

__construct() public méthode

Create a new \Baum\SetValidator class instance.
public __construct ( Node $node ) : void
$node Node
Résultat void

duplicatesExistForColumn() protected méthode

Checks if duplicate values for the column specified exist. Takes the Nested Set scope columns into account (if appropiate).
protected duplicatesExistForColumn ( string $column ) : boolean
$column string
Résultat boolean

fails() public méthode

Determine if validation fails.
public fails ( ) : boolean
Résultat boolean

groupRootsByScope() protected méthode

Given a list of root nodes, it returns an array in which the keys are the array of the actual scope column values and the values are the root nodes inside that scope themselves.
protected groupRootsByScope ( mixed $roots ) : array
$roots mixed
Résultat array

isEachRootValid() protected méthode

Check that each root node in the list supplied satisfies that its bounds values (lft, rgt indexes) are less than the next.
protected isEachRootValid ( mixed $roots ) : boolean
$roots mixed
Résultat boolean

keyForScope() protected méthode

Builds a single string for the given scope columns values. Useful for making array keys for grouping.
protected keyForScope ( Baum\Node $node ) : string
$node Baum\Node
Résultat string

passes() public méthode

Determine if the validation passes.
public passes ( ) : boolean
Résultat boolean

validateBounds() protected méthode

Validates bounds of the nested tree structure. It will perform checks on the lft, rgt and parent_id columns. Mainly that they're not null, rights greater than lefts, and that they're within the bounds of the parent.
protected validateBounds ( ) : boolean
Résultat boolean

validateDuplicates() protected méthode

Checks that there are no duplicates for the lft and rgt columns.
protected validateDuplicates ( ) : boolean
Résultat boolean

validateRoots() protected méthode

For each root of the whole nested set tree structure, checks that their lft and rgt bounds are properly set.
protected validateRoots ( ) : boolean
Résultat boolean

validateRootsByScope() protected méthode

Check that each root node in the list supplied satisfies that its bounds values (lft, rgt indexes) are less than the next *within each scope*.
protected validateRootsByScope ( mixed $roots ) : boolean
$roots mixed
Résultat boolean

Property Details

$node protected_oe property

Node instance for reference.
protected Node,Baum $node
Résultat Node