Locker\Helpers\Attachments::validateHeaders PHP Method

validateHeaders() private static method

Validates the attachment headers.
private static validateHeaders ( array $headers, array $sha_hashes )
$headers array
$sha_hashes array
    private static function validateHeaders(array $headers, array $sha_hashes)
    {
        if (!isset($headers['content-type'])) {
            throw new Exceptions\Exception('You need to set a content type for your attachments.');
        }
        //get the correct ext if valid
        $ext = array_search($headers['content-type'], FileTypes::getMap());
        if ($ext === false) {
            throw new Exceptions\Exception('This file type cannot be supported');
        }
        //check X-Experience-API-Hash is set, otherwise reject @todo
        if (!isset($headers['x-experience-api-hash']) || $headers['x-experience-api-hash'] == '') {
            throw new Exceptions\Exception('Attachments require an api hash.');
        }
    }