Hello,
phpdocx doesn't include a method to detect if a PDF is encrypted or not, on https://www.phpdocx.com/documentation/api-documentation you can see all available methods. Anyway, as it's throwing an exception you could catch it or use Fileinfo from PHP (http://php.net/manual/en/book.fileinfo.php) to get the mime-type of files.
Regards.