Skip to content

Commit a5f49ca

Browse files
committed
Revert "Issue #117 Fix datafield parsing with warnings"
This reverts commit 70ef3a0.
1 parent 70ef3a0 commit a5f49ca

File tree

2 files changed

+2
-51
lines changed

2 files changed

+2
-51
lines changed

src/DataFields.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ public function __toArray()
8080
*/
8181
public static function parse($input)
8282
{
83-
// Strip any warning blocks from top
84-
if (strncmp('WARNING:', $input, 8) === 0) {
85-
// Remove the 'WARNING:' line and all following lines starting with a space
86-
$input = preg_replace('/^WARNING:.*$[\n\r]+( .*$[\n\r]+)*/m', '', $input);
87-
}
8883
if (strncmp('---', $input, 3) === 0) {
8984
// Split blocks only if '---' is followed by 'FieldType'
9085
$blocks = preg_split(

tests/DataFieldsTest.php

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ class DataFieldsTest extends \PHPUnit\Framework\TestCase
66
public function testDataFieldParsing()
77
{
88
$dataFields = new DataFields($this->_testInput);
9+
//print_r($dataFields->__toArray());exit;
910
$this->assertEquals($this->_parsedResult, $dataFields->__toArray());
1011
}
1112

12-
public function testParsingOfDataFieldWithWarning()
13-
{
14-
$dataFields = new DataFields($this->_warningInput);
15-
$this->assertEquals($this->_parsedWarningResult, $dataFields->__toArray());
16-
}
17-
1813
protected $_testInput = <<<DATA
1914
---
2015
FieldType: Text
@@ -64,7 +59,6 @@ public function testParsingOfDataFieldWithWarning()
6459
---more:colons:
6560
and
6661
multi lines
67-
even indented
6862
6963
FieldJustification: Left
7064
DATA;
@@ -107,46 +101,8 @@ public function testParsingOfDataFieldWithWarning()
107101
'FieldNameAlt' => 'field5_alt',
108102
'FieldFlags' => 0,
109103
'FieldValue' => "field:with:colons\n\n---more:colons:\nand\nmulti lines\n",
110-
'FieldValueDefault' => "default:with:colons\n\n---more:colons:\nand\nmulti lines\n even indented\n",
104+
'FieldValueDefault' => "default:with:colons\n\n---more:colons:\nand\nmulti lines\n",
111105
'FieldJustification' => 'Left',
112106
]
113107
];
114-
115-
protected $_warningInput = <<<DATA
116-
WARNING: The creator of the input PDF:
117-
example_pdf_with_password.pdf
118-
has set an owner password (which is not required to handle this PDF).
119-
You did not supply this password. Please respect any copyright.
120-
---
121-
FieldType: Text
122-
FieldName: field1
123-
FieldNameAlt: field1_alt
124-
FieldFlags: 0
125-
FieldJustification: Left
126-
---
127-
FieldType: Text
128-
FieldName: field2
129-
FieldNameAlt: field2_alt
130-
FieldFlags: 0
131-
FieldValue: value:with:colons
132-
FieldJustification: Left
133-
DATA;
134-
135-
protected $_parsedWarningResult = [
136-
[
137-
'FieldType' => 'Text',
138-
'FieldName' => 'field1',
139-
'FieldNameAlt' => 'field1_alt',
140-
'FieldFlags' => 0,
141-
'FieldJustification' => 'Left',
142-
],
143-
[
144-
'FieldType' => 'Text',
145-
'FieldName' => 'field2',
146-
'FieldNameAlt' => 'field2_alt',
147-
'FieldFlags' => 0,
148-
'FieldValue' => 'value:with:colons',
149-
'FieldJustification' => 'Left',
150-
],
151-
];
152108
}

0 commit comments

Comments
 (0)