lib/bagit_manifest.php
public function validate(&$errors)
    {
        $errLen = count($errors);

        // That the manifest file does exist;
        if (! file_exists($this->fileName)) {
            $basename = basename($this->fileName);
            array_push(
                $errors,
                array($basename, "$basename does not exist.")
            );
            // There's no manifest file, so we might as well bail now.
            return false;
        }

        // That the files in the hash mapping do exist; and
        // That the hashes in the mapping are correct.
        foreach ($this->data as $fileName => $hash) {
            $fullPath = $this->pathPrefix . $fileName;
            if (! file_exists($fullPath)) {
                array_push(
                    $errors,
                    array($fileName, 'Missing data file.')
                );
            } else if ($this->calculateHash($fullPath) != $hash) {
                array_push(
                    $errors,
                    array($fileName, 'Checksum mismatch.')
                );
            }
        }

        return ($errLen == count($errors));
    }
public function validate(&$errors)
    {
        $errLen = count($errors);

        // That the manifest file does exist;
        if (! file_exists($this->fileName)) {
            $basename = basename($this->fileName);
            array_push(
                $errors,
                array($basename, "$basename does not exist.")
            );
            // There's no manifest file, so we might as well bail now.
            return false;
        }

        // That the files in the hash mapping do exist; and
        // That the hashes in the mapping are correct.
        foreach ($this->data as $fileName => $hash) {
            $fullPath = $this->pathPrefix . $fileName;
            if (! file_exists($fullPath)) {
                array_push(
                    $errors,
                    array($fileName, 'Missing data file.')
                );
            } else if ($this->calculateHash($fullPath) != $hash) {
                array_push(
                    $errors,
                    array($fileName, 'Checksum mismatch.')
                );
            }
        }

        return ($errLen == count($errors));
    }
public function validate ( & $ errors ) { $ errLen = count ( $ errors ) ; // That the manifest file does exist; if ( ! file_exists ( $ this -> fileName ) ) { $ basename = basename ( $ this -> fileName ) ; array_push ( $ errors , array ( $ basename , "$basename does not exist." ) ) ; // There's no manifest file, so we might as well bail now. return false ; } // That the files in the hash mapping do exist; and // That the hashes in the mapping are correct. foreach ( $ this -> data as $ fileName => $ hash ) { $ fullPath = $ this -> pathPrefix . $ fileName ; if ( ! file_exists ( $ fullPath ) ) { array_push ( $ errors , array ( $ fileName , 'Missing data file.' ) ) ; } else if ( $ this -> calculateHash ( $ fullPath ) != $ hash ) { array_push ( $ errors , array ( $ fileName , 'Checksum mismatch.' ) ) ; } } return ( $ errLen == count ( $ errors ) ) ; }
This validates the data in the manifest.

This tests three things:
<ol>
<li>That the manifest file does exist;</li>
<li>That the files in the hash mapping do exist; and</li>
<li>That the hashes in the mapping are correct.</li>
</ol>

Problems will be added to the errors.

@param array &$errors A list of error messages. Messages about any
errors in validation will be appended to this.

@return boolean Does this validate or not?
This validates the data in the manifest .