completed PHPDoc, added PhpStorm compatible typehints, changed handling of XML fetching to allow both methods to be tried