/framework/core/cli/Importer.php

http://zoop.googlecode.com/ · PHP · 58 lines · 48 code · 10 blank · 0 comment · 2 complexity · 628e88ef92e37d8c12840072d0d02d7c MD5 · raw file

  1. <?php
  2. class Importer
  3. {
  4. var $fp;
  5. function importer()
  6. {
  7. }
  8. function init()
  9. {
  10. }
  11. function openFile($filename)
  12. {
  13. $this->fp = fopen($filename, 'r');
  14. }
  15. function readLine()
  16. {
  17. trigger_error('virtual function');
  18. }
  19. function parseLine($line)
  20. {
  21. trigger_error('virtual function');
  22. }
  23. function processLine($lineData)
  24. {
  25. trigger_error('virtual function');
  26. }
  27. function go($filename)
  28. {
  29. $this->init();
  30. $this->openFile($filename);
  31. if($this->skipFirstLine())
  32. {
  33. $line = $this->readLine();
  34. echo "skipping line: \n";
  35. print_r($line);
  36. }
  37. while($line = $this->readLine())
  38. {
  39. if($lineData = $this->parseLine($line))
  40. $this->processLine($lineData);
  41. }
  42. $this->finish();
  43. }
  44. function skipFirstLine()
  45. {
  46. return 0;
  47. }
  48. }