public function validate()
    {
        if ($this->count() > 1) {
            throw new DataException('There should be only one root node to configure for Atom Logger data.');
        }

        foreach ($this->getNodes() as $field => $value) {
            // Check for field name exists in the provided data.
            if (!in_array($field, $this->getFields())) {
                throw new DataException("The field \"{$field}\" is provided but is not in the required fields list.");
            }
        }

        return true;
    }
public function validate()
    {
        if ($this->count() > 1) {
            throw new DataException('There should be only one root node to configure for Atom Logger data.');
        }

        foreach ($this->getNodes() as $field => $value) {
            // Check for field name exists in the provided data.
            if (!in_array($field, $this->getFields())) {
                throw new DataException("The field \"{$field}\" is provided but is not in the required fields list.");
            }
        }

        return true;
    }
public function validate ( ) { if ( $ this -> count ( ) > 1 ) { throw new DataException ( 'There should be only one root node to configure for Atom Logger data.' ) ; } foreach ( $ this -> getNodes ( ) as $ field => $ value ) { // Check for field name exists in the provided data. if ( ! in_array ( $ field , $ this -> getFields ( ) ) ) { throw new DataException ( "The field \"{$field}\" is provided but is not in the required fields list." ) ; } } return true ; }
Validate the data to be correct for a request
Validate the data to be correct for a request