Skip to content

Commit f482f26

Browse files
committed
CS Fixer
1 parent 46e61d4 commit f482f26

File tree

2 files changed

+19
-30
lines changed

2 files changed

+19
-30
lines changed

src/PhpWord/TemplateProcessor.php

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -761,12 +761,6 @@ public function cloneRow($search, $numberOfClones): void
761761

762762
/**
763763
* Delete a table row in a template document.
764-
*
765-
* @param string $search
766-
*
767-
* @return void
768-
*
769-
* @throws \PhpOffice\PhpWord\Exception\Exception
770764
*/
771765
public function deleteRow(string $search): void
772766
{
@@ -776,7 +770,7 @@ public function deleteRow(string $search): void
776770

777771
$tagPos = strpos($this->tempDocumentMainPart, $search);
778772
if (!$tagPos) {
779-
throw new Exception(sprintf("Can not delete row %s, template variable not found or variable contains markup.", $search));
773+
throw new Exception(sprintf('Can not delete row %s, template variable not found or variable contains markup.', $search));
780774
}
781775

782776
$tableStart = $this->findTableStart($tagPos);
@@ -1151,21 +1145,21 @@ protected function getDocumentContentTypesName()
11511145

11521146
/**
11531147
* Find the start position of the nearest table before $offset.
1154-
*
1155-
* @param integer $offset
1156-
*
1157-
* @return integer
1158-
*
1159-
* @throws \PhpOffice\PhpWord\Exception\Exception
11601148
*/
11611149
protected function findTableStart(int $offset): int
11621150
{
1163-
$rowStart = strrpos($this->tempDocumentMainPart, '<w:tbl ',
1164-
((strlen($this->tempDocumentMainPart) - $offset) * -1));
1151+
$rowStart = strrpos(
1152+
$this->tempDocumentMainPart,
1153+
'<w:tbl ',
1154+
((strlen($this->tempDocumentMainPart) - $offset) * -1)
1155+
);
11651156

11661157
if (!$rowStart) {
1167-
$rowStart = strrpos($this->tempDocumentMainPart, '<w:tbl>',
1168-
((strlen($this->tempDocumentMainPart) - $offset) * -1));
1158+
$rowStart = strrpos(
1159+
$this->tempDocumentMainPart,
1160+
'<w:tbl>',
1161+
((strlen($this->tempDocumentMainPart) - $offset) * -1)
1162+
);
11691163
}
11701164
if (!$rowStart) {
11711165
throw new Exception('Can not find the start position of the table.');
@@ -1175,12 +1169,8 @@ protected function findTableStart(int $offset): int
11751169
}
11761170

11771171
/**
1178-
* Find the end position of the nearest table row after $offset.
1179-
*
1180-
* @param integer $offset
1181-
*
1182-
* @return integer
1183-
*/
1172+
* Find the end position of the nearest table row after $offset.
1173+
*/
11841174
protected function findTableEnd(int $offset): int
11851175
{
11861176
return strpos($this->tempDocumentMainPart, '</w:tbl>', $offset) + 7;

tests/PhpWordTests/TemplateProcessorTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,30 +183,29 @@ public function testXslStyleSheetCanNotBeAppliedOnFailureOfLoadingXmlFromTemplat
183183
}
184184

185185
/**
186-
* @covers ::getVariables
187186
* @covers ::deleteRow
187+
* @covers ::getVariables
188188
* @covers ::saveAs
189-
* @test
190189
*/
191190
public function testDeleteRow(): void
192191
{
193192
$templateProcessor = new TemplateProcessor(__DIR__ . '/_files/templates/delete-row.docx');
194193

195-
$this->assertEquals(
196-
array('deleteMe', 'deleteMeToo'),
194+
self::assertEquals(
195+
['deleteMe', 'deleteMeToo'],
197196
$templateProcessor->getVariables()
198197
);
199198

200199
$docName = 'delete-row-test-result.docx';
201200
$templateProcessor->deleteRow('deleteMe');
202-
$this->assertEquals(
203-
array(),
201+
self::assertEquals(
202+
[],
204203
$templateProcessor->getVariables()
205204
);
206205
$templateProcessor->saveAs($docName);
207206
$docFound = file_exists($docName);
208207
unlink($docName);
209-
$this->assertTrue($docFound);
208+
self::assertTrue($docFound);
210209
}
211210

212211
/**

0 commit comments

Comments
 (0)