-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Introduce AbstractFlexFormRector (#3994)
- Loading branch information
1 parent
27b3bf9
commit f3f8d2a
Showing
14 changed files
with
358 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ssch\TYPO3Rector\Rector\FlexForm; | ||
|
||
use DOMDocument; | ||
use DOMElement; | ||
use DOMNodeList; | ||
use DOMXPath; | ||
|
||
abstract class AbstractFlexFormRector | ||
{ | ||
protected DOMDocument $domDocument; | ||
|
||
protected bool $domDocumentHasBeenChanged = false; | ||
|
||
public function transform(DOMDocument $domDocument): bool | ||
{ | ||
$this->domDocument = $domDocument; | ||
|
||
$xpath = new DOMXPath($domDocument); | ||
|
||
/** @var DOMNodeList<DOMElement> $elements */ | ||
$elements = $xpath->query('//config'); | ||
|
||
if ($elements->count() === 0) { | ||
return false; | ||
} | ||
|
||
foreach ($elements as $element) { | ||
$this->refactorColumn($element); | ||
} | ||
|
||
return $this->domDocumentHasBeenChanged; | ||
} | ||
|
||
abstract protected function refactorColumn(?DOMElement $configElement): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.