/framework/core/cli/Importer.php
PHP | 58 lines | 48 code | 10 blank | 0 comment | 2 complexity | 628e88ef92e37d8c12840072d0d02d7c MD5 | raw file
1<?php 2class Importer 3{ 4 var $fp; 5 6 function importer() 7 { 8 } 9 10 function init() 11 { 12 } 13 14 function openFile($filename) 15 { 16 $this->fp = fopen($filename, 'r'); 17 } 18 19 function readLine() 20 { 21 trigger_error('virtual function'); 22 } 23 24 function parseLine($line) 25 { 26 trigger_error('virtual function'); 27 } 28 29 function processLine($lineData) 30 { 31 trigger_error('virtual function'); 32 } 33 34 function go($filename) 35 { 36 $this->init(); 37 $this->openFile($filename); 38 39 if($this->skipFirstLine()) 40 { 41 $line = $this->readLine(); 42 echo "skipping line: \n"; 43 print_r($line); 44 } 45 46 while($line = $this->readLine()) 47 { 48 if($lineData = $this->parseLine($line)) 49 $this->processLine($lineData); 50 } 51 $this->finish(); 52 } 53 54 function skipFirstLine() 55 { 56 return 0; 57 } 58}