Factorize imagick version extraction
Add docblocks