Just realized that AtomicDryad wouldn't see my messages to you from github, so here are some thoughts:
Spoiler:
- Do you have a specific reason to use YAML as a conf language? If not, we can use a basic .ini or .json, which are much more common and would allow us to make away with the spyc dependency.
- I don't really understand flagFactory. Most of it seems to deal with sources, but every class inherit it. Why not make those classes call a static flagSources class as needed? Something like:
PHP Code:
class flagSources {
/**
* Array of flagSource objects
*/
static private $sources = array();
/**
* Add a new source
*/
static function add($source) {
if
self::$sources[$source->tag] = $source;
}
/**
* Do we have that source?
*/
static function has($source) {
return in_array($source, array_keys(self::$sources));
}
/**
* Return the source object
*/
static function getSource($sources) {
return self::$sources[$sources];
}
/**
* Get all sources
*/
static function getList() {
return self::$sources;
}
}
Some autoadd:
flagSource.class.php:
PHP Code:
abstract class flagSource {
private $tag = "";
private $name = "";
public function __construct() {
Sources::add($this);
}
}
ffnet.source.php:
PHP Code:
<?php
class FfnetSource extends flagSource {
private $tag = "ffnet";
private $name="Fanfiction.net";
}
new FfmlSource();
?>
- In the misc.class.php:
Those two functions are only ever called by the config class; so maybe move them in that class? Actually, maybe create a flagCLI class and move everything CLI-related in it, in preparation of a flagWEB class.
- in config.class.php:
Depending on the PHP configuration, $argc and $argv may not be available (it depends on register_argc_argv). Using $_SERVER['argc'] and $_SERVER['argv'] would ensure we have them, and as a bonus, we have less global variables.
- If we can bump the PHP minimal requirement to 5.3, we can also namespace the project, and do away with all the 'flag' prefixes. That would clear up the code somewhat.
Thoughts?
N.