diff options
Diffstat (limited to 'lib/sfIsisImporterStats.class.php')
-rw-r--r-- | lib/sfIsisImporterStats.class.php | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/lib/sfIsisImporterStats.class.php b/lib/sfIsisImporterStats.class.php new file mode 100644 index 0000000..d7dae34 --- /dev/null +++ b/lib/sfIsisImporterStats.class.php @@ -0,0 +1,78 @@ +<?php + +/** + * Statistics gathering for importing procedures. + */ +class sfIsisImporterStats +{ + /** + * @var $instance Singleton instance + */ + private static $instance = null; + + /** + * Get the singleton instance. + */ + public static function getInstance() + { + if(self::$instance == null) { + self::$instance = new self; + } + + return self::$instance; + } + + /** + * Constructor. + */ + private function __construct() + { + $this->stats = array(); + } + + /** + * Simple accumulator. + * + * @param string $section Section name + */ + public function increase($section) + { + $this->stats[$section]++; + } + + /** + * Compute soundex. + * + * @param string $name Name + */ + public function soundex($name) { + $this->stats['sounded'][soundex($name)] = $name; + } + + /** + * Compute metaphone. + * + * @param string $name Name + */ + public function metaphone($name) { + $this->stats['sounded'][metaphone($name)] = $name; + } + + /** + * Compute similar words indexes. + * + * @param string $name Name + */ + public function similar($name) { + $this->soundex($name); + $this->metaphone($name); + } + + /** + * Display statistics. + * + * @todo Write and test + */ + public function display() { + } +} |