From f6f1d270419bbd9696974719b15b8c01b19b032b Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 6 Apr 2010 14:05:07 -0300 Subject: Config parse and check --- classes/SchemaDb.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) (limited to 'classes/SchemaDb.php') diff --git a/classes/SchemaDb.php b/classes/SchemaDb.php index 4cf77e6..2756026 100644 --- a/classes/SchemaDb.php +++ b/classes/SchemaDb.php @@ -2,14 +2,49 @@ class SchemaDb { /** - * Return a default example schema. + * Return the required database config. * - * @see IsisDb::default_schema() - */ - public function default_schema() { + * @return + * Array with required config. + */ + public function required() { $schema = array( 'db' => array( 'name' => 'dbname', + ), + 'fields' => array( + ), + ); + + return $schema; + } + + /** + * Return the optional database config. + * + * @return + * Array with optional config. + */ + public function optional() { + $schema = array( + 'db' => array( + 'charset' => 'charset', + ), + ); + + return $schema; + } + + /** + * Return an example schema. + * + * @see IsisDb::example() + */ + public function example() { + $required = SchemaDb::required(); + $optional = SchemaDb::optional(); + $schema = array( + 'db' => array( 'charset' => 'charset', ), 'fields' => array( @@ -26,6 +61,15 @@ class SchemaDb { ), ); + return array_merge_recursive($required, $optional, $schema); + } + + /** + * Check required fields. + * + * @todo + */ + function check($schema = NULL) { return $schema; } } -- cgit v1.2.3