aboutsummaryrefslogtreecommitdiff
path: root/classes/IsisAudit.php
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-08-18 15:22:43 -0300
committerSilvio <silvio@devlet.com.br>2010-08-18 15:22:43 -0300
commitad8d8568b683e6935bec64abe88f79bf31706dd7 (patch)
tree43d00493cf8676acbcf4bec74bf44c717107ecd6 /classes/IsisAudit.php
parent219aa7f6b4a19b723b0c25683801b1b5d502e9f4 (diff)
downloadcinisis-ad8d8568b683e6935bec64abe88f79bf31706dd7.tar.gz
cinisis-ad8d8568b683e6935bec64abe88f79bf31706dd7.tar.bz2
Adding audit and finder classes, cleanup and organization
Diffstat (limited to 'classes/IsisAudit.php')
-rw-r--r--classes/IsisAudit.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/classes/IsisAudit.php b/classes/IsisAudit.php
new file mode 100644
index 0000000..79cbe26
--- /dev/null
+++ b/classes/IsisAudit.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * Methods for auditing an Isis database.
+ */
+class IsisAudit extends IsisFinder {
+ /**
+ * Run a standard audit procedure.
+ *
+ * @todo
+ * Test.
+ */
+ public function run() {
+ foreach ($this->format['fields'] as $field) {
+ $field_name = $this->getFieldName($field);
+ $repetition = $this->nextRepetition(null, $field_name);
+
+ // Check for repetitions.
+ if ($field['repeat'] && !$repetition)
+ {
+ echo "Field $field_name is configured for repetitions but no repetitions found.\n";
+ }
+ elseif (!$field['repeat'] && $repetition) {
+ echo "Field $field_name is not configured for repetitions but a repetition was found.\n";
+ }
+
+ // Check for subfields.
+ foreach ($field['subfields'] as $subfield) {
+ $subfield_name = $this->getSubfieldName($field, $subfield);
+ $next_subfield = $isis->nextSubfield(null, $field_name, $subfield_name);
+
+ if (!$next_subfield) {
+ echo "No occurrences found for field $field_name and subfield $subfield_name\n";
+ }
+ }
+ }
+ }
+}