diff options
author | Silvio <silvio@devlet.com.br> | 2010-06-07 17:48:34 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-06-07 17:48:34 -0300 |
commit | 0f3203c9c25b2c936ba8ebdf2fd2548209213620 (patch) | |
tree | c6f8b556bb81817304f24051a3bfd7abf751f1fd /classes | |
parent | b3b87bf51fddd21130bf8975036ee82f66ad042b (diff) | |
download | cinisis-0f3203c9c25b2c936ba8ebdf2fd2548209213620.tar.gz cinisis-0f3203c9c25b2c936ba8ebdf2fd2548209213620.tar.bz2 |
Misc fixes
Diffstat (limited to 'classes')
-rw-r--r-- | classes/BiblioIsisDb.php | 13 | ||||
-rw-r--r-- | classes/CinisisDb.php | 4 | ||||
-rw-r--r-- | classes/IsisDb.php | 2 | ||||
-rw-r--r-- | classes/SchemaDb.php | 4 |
4 files changed, 16 insertions, 7 deletions
diff --git a/classes/BiblioIsisDb.php b/classes/BiblioIsisDb.php index 6ae5827..36c0bbc 100644 --- a/classes/BiblioIsisDb.php +++ b/classes/BiblioIsisDb.php @@ -92,7 +92,9 @@ class BiblioIsisDb implements IsisDb { $data = $this->tag($results); // Charset conversion. - array_walk_recursive($data, array(__CLASS__, 'charset')); + if (is_array($data)) { + array_walk_recursive($data, array(__CLASS__, 'charset')); + } // Return the result. return $data; @@ -122,7 +124,7 @@ class BiblioIsisDb implements IsisDb { * * @see IsisDb::check() */ - public function check($schema, $section = NULL) { + static function check($schema, $section = NULL) { // Check API availability. if (!class_exists('Perl')) { throw new Exception('Could not find Perl class. Please check your php-perl installation.'); @@ -144,11 +146,18 @@ class BiblioIsisDb implements IsisDb { * * @return * Tagged database result. + * + * @todo + * Alternative handling for when $key is not set. */ function tag($results) { foreach ($results as $key => $value) { // Key '000' used to hold MFN. if ($key != '000') { + if (!isset($this->format['fields'][$key])) { + return; + } + $name = $this->format['fields'][$key]['name']; $data[$name] = $this->repetition($key, $value); diff --git a/classes/CinisisDb.php b/classes/CinisisDb.php index c0adeb9..63416b6 100644 --- a/classes/CinisisDb.php +++ b/classes/CinisisDb.php @@ -92,7 +92,7 @@ class CinisisDb { * @return * Array with configuration or FALSE on error. */ - public function check($config) { + static function check($config) { // Set default database backend if needed. if (!isset($config['implementation'])) { $config['implementation'] = 'PhpIsis'; @@ -130,7 +130,7 @@ class CinisisDb { * @return * Return the assembled file path. */ - public function file($config = NULL, $section = 'config') { + static function file($config = NULL, $section = 'config') { // Check config format (array, NULL or relative config path). if (is_array($config)) { return $config; diff --git a/classes/IsisDb.php b/classes/IsisDb.php index 1e63f38..43a51dc 100644 --- a/classes/IsisDb.php +++ b/classes/IsisDb.php @@ -59,5 +59,5 @@ interface IsisDb { * @return * Database schema or FALSE if error. */ - function check($schema, $section = NULL); + static function check($schema, $section = NULL); } diff --git a/classes/SchemaDb.php b/classes/SchemaDb.php index c00ae66..db9ca30 100644 --- a/classes/SchemaDb.php +++ b/classes/SchemaDb.php @@ -11,7 +11,7 @@ class SchemaDb { * @return * Array with required config. */ - public function required() { + static function required() { $schema = array( 'db' => array( 'name' => 'dbname', @@ -73,7 +73,7 @@ class SchemaDb { * * @see IsisDb::check() */ - function check($schema, $section = NULL) { + static function check($schema, $section = NULL) { if ($section === NULL) { $section = SchemaDb::required(); } |