Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcConfigurationValidationResult

Configuration::ezcConfigurationValidationResult

Class ezcConfigurationValidationResult

Provides the result of an ezcConfigurationFileReader::validate() operation.

It contains the result of the validation process. The reader will create the result with location information and the validation items which is returned to the caller.

Instantiate an object of this class and append items using appendItem(). The caller can then access the result using getResultList().

The reader will typically create the result with:

  1.  $validationError = new ezcConfigurationValidationItem(
  2.      ezcConfigurationValidationItem::ERROR,
  3.      'test-file.php', 2, 4, 'typo', 'One ] too many'
  4.  );
  5.  
  6.  $result = new ezcConfigurationValidationResult(
  7.      "settings", "site", "settings/site.ini"
  8.  );
  9.  
  10.  $result->appendItem( $validationError );

After the reader is done parsing, the validation results can be examined with:

  1.  echo "Warnings: ", $result->getWarningCount(), "\n";
  2.  echo "Errors:   ", $result->getErrorCount(), "\n";
  3.  foreach ( $result->getResultList() as $item )
  4.  {
  5.      printf( "In '%s' on line '%d', position: '%d': %s\n",
  6.          $item->file, $item->line, $item->column, $item->details
  7.      );
  8.  }

Source for this file: /Configuration/src/validation_result.php

Version:   //autogen//

Member Variables

public mixed $isValid = true
Holds information on whether the validation process was a success or not, will be true if successful and false if unsuccessful.

The validation process will determine when a configuration is valid, for instance if a stricter validation is run it will set it as invalid even if it contains warnings.

Method Summary

public ezcConfigurationValidationResult __construct( $location , $name , $pathName )
Constructs a validation result
public void appendItem( $item )
Appends the validation item to the result list.
public int getErrorCount( )
Returns the number of errors
public array(ezcConfigurationValidationItem) getResultList( )
Returns a list with validation items
public int getWarningCount( )
Returns the number of warnings

Methods

__construct

ezcConfigurationValidationResult __construct( string $location , string $name , string $pathName )

Constructs a validation result

Initializes the validation result with some information on the configuration file and an empty result list.

Parameters:
Name Type Description
$location string The main placement for the configuration as returned by the reader.
$name string The name for the configuration as returned by the reader.
$pathName string A full path to the file being read by the reader.

appendItem

void appendItem( ezcConfigurationValidationItem $item )

Appends the validation item to the result list.

Parameters:
Name Type Description
$item ezcConfigurationValidationItem The error or warning item which should be added to the end of the result list.

getErrorCount

int getErrorCount( )

Returns the number of errors

getResultList

array(ezcConfigurationValidationItem) getResultList( )

Returns a list with validation items

getWarningCount

int getWarningCount( )

Returns the number of warnings

Documentation generated by phpDocumentor 1.4.3