protected function processDir(Participant $p, $dir_path) { $files = scandir($dir_path); foreach ($files as $file) { $billrun_key = Billrun_Util::regexFirstValue($p->billrun_key_regex, $file); $account_id = Billrun_Util::regexFirstValue($p->account_id_regex, $file); if ($billrun_key !== FALSE && $account_id !== FALSE) { if ($this->included_accounts && !in_array($account_id, $this->included_accounts)) { continue; } if ($this->excluded_accounts && in_array($account_id, $this->excluded_accounts)) { continue; } $p->processed_files[$billrun_key][intval($account_id)] = $file; } } }
/** * Get the data the is stored in the file name. * @return an array containing the sequence data. ie: * array(seq => 00001, date => 20130101 ) */ public function getFilenameData($filename) { return array('seq' => Billrun_Util::regexFirstValue(Billrun_Factory::config()->getConfigValue($this->getType() . ".sequence_regex.seq", "/(\\d+)/"), $filename), 'date' => Billrun_Util::regexFirstValue(Billrun_Factory::config()->getConfigValue($this->getType() . ".sequence_regex.date", "/(20\\d{4})/"), $filename), 'time' => Billrun_Util::regexFirstValue(Billrun_Factory::config()->getConfigValue($this->getType() . ".sequence_regex.time", "/\\D(\\d{4,6})\\D/"), $filename)); }