Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SomeCommand
- {
- public $headerFields = [
- 'STATEMENT_COUNTER', 'PATIENT_ID', 'PRACTICE_NAME', 'PRACTICE_ADDRESS_1', 'PRACTICE_ADDRESS_2',
- 'PRACTICE_CITY', 'PRACTICE_STATE', 'PRACTICE_ZIP', 'PRACTICE_PHONE', 'PATIENTC_CONTROL_NUM', 'PATIENT_NAME',
- 'RESPONSIBLE_NAME', 'RESPONSIBLE_PHONE', 'PATIENT_ADDRESS1', 'PATIENT_ADDRESS_2', 'PATIENT_CITY', 'PATIENT_STATE',
- 'PATIENT_ZIP', 'PATIENT_STATEMENT_ID', 'PRIMARY_INSURANCE', 'INSURED_NAME', 'SECONDARY_INSURANCE', 'SECONDARY_INSURED_NAME',
- 'STATEMENT_BAL', 'STATEMENT_BAL_0_to_30', 'STATEMENT_BAL_30_to_60', 'STATEMENT_BAL_60_to_90', 'STATEMENT_BAL_90_to_120',
- 'STATEMENT_BAL_120', 'SYSDATE', 'LAST_PAID_DATE', 'LAST_PAID_AMT', 'BILLER_PHONE', 'SYSDATE_plus_15', 'CREDIT_CARD_VAL'
- ];
- public function createPattern($fields, $type)
- {
- $ret = "/" . $type . '*';
- foreach ($fields as $field) {
- $ret .= "(?P<" . strtolower($field) . ">\S+)\*";
- }
- $ret .= "/";
- return $ret;
- }
- public function run($args)
- {
- $headerPattern = $this->createPattern($this->headerFields, 'STH');
- echo "Pattern is: " . $headerPattern . "\n";
- $input = $this->createTestHeaderInput('test');
- echo "Input is: " . $input . "\n";
- preg_match($headerPattern, $input, $matches);
- print_r($matches);die;
- }
- private function createTestHeaderInput($word)
- {
- $x = sizeof($this->headerFields);
- return "STH*" . str_repeat($word . '*', $x) . '~';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement