format: Refactor format factory to non-static class

The format factory can be based on the abstract factory class if it
wasn't static. This allows for higher abstraction and makes future
extensions possible. Also, not all parts of RSS-Bridge need to work
on the same instance of the factory.

References #1001
This commit is contained in:
logmanoriginal 2019-06-18 19:15:20 +02:00
parent 2460b67886
commit fc8421ed50
7 changed files with 32 additions and 95 deletions

View file

@ -61,7 +61,7 @@ require_once PATH_LIB . 'FactoryAbstract.php';
require_once PATH_LIB . 'FeedItem.php';
require_once PATH_LIB . 'Debug.php';
require_once PATH_LIB . 'Exceptions.php';
require_once PATH_LIB . 'Format.php';
require_once PATH_LIB . 'FormatFactory.php';
require_once PATH_LIB . 'FormatAbstract.php';
require_once PATH_LIB . 'BridgeFactory.php';
require_once PATH_LIB . 'BridgeAbstract.php';
@ -84,12 +84,3 @@ require_once PATH_LIB . 'contents.php';
define('MAX_FILE_SIZE', 10000000); /* Allow larger files for simple_html_dom */
require_once PATH_LIB_VENDOR . 'simplehtmldom/simple_html_dom.php';
require_once PATH_LIB_VENDOR . 'php-urljoin/src/urljoin.php';
// Initialize static members
try {
Format::setWorkingDir(PATH_LIB_FORMATS);
} catch(Exception $e) {
error_log($e);
header('Content-type: text/plain', true, 500);
die($e->getMessage());
}