* $result = new ezcConfigurationValidationResult( "settings", "site", * "settings/site.ini" ); * // a validation failed * $result->isValid = false; * $result->appendItem( $validationError ); * * * @package Configuration * @version 1.0beta2 */ class ezcConfigurationValidationResult { /** * 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. */ public $isValid = true; /** * A count on how many error items the validation process resulted in. The error * items can be accessed by traversing $resultList. */ private $errorCount = 0; /** * A count on how many warning items the validation process resulted in. The * warning items can be accessed by traversing $resultList. */ private $warningCount = 0; /** * Contains an array with ezcConfigurationValidationItem objects which are either * errors or warnings detected during the validation process. */ private $resultList = array(); /** * The location of the configuration which was validated. */ private $location = false; /** * The name of the configuration which was validated. */ private $name = false; /** * Similar to $name and $location but is the full path to the file being * read by the reader. */ private $pathName = false; /** * Constructs a validation result * * Initializes the validation result with some information on the configuration * file and an empty result list. * * @param string $location The main placement for the configuration as * returned by the reader. * @param string $name The name for the configuration as returned by the * reader. * @param string $pathName A full path to the file being read by the * reader. */ public function __construct( $location, $name, $pathName ) { $this->location = $location; $this->name = $name; $this->pathName = $pathName; } /** * Appends the validation item to the result list. * * @param ezcConfigurationValidationItem $item The error or warning item * which should be added to the end of the result list. */ public function appendItem( ezcConfigurationValidationItem $item ) { if ( $item->type == ezcConfigurationValidationItem::ERROR ) { $this->errorCount++; } else { $this->warningCount++; } $this->resultList[] = $item; } /** * Returns a list with validation items * * @return array(ezcConfigurationValidationItem) The list with items */ public function getResultList() { return $this->resultList; } /** * Returns the number of warnings * * @return int The number of warnings */ public function getWarningCount() { return $this->warningCount; } /** * Returns the number of errors * * @return int The number of errors */ public function getErrorCount() { return $this->errorCount; } } ?>