From 0dd03eae9962ae6de0bfa1ab79f7fa6e3569f366 Mon Sep 17 00:00:00 2001 From: rvogel Date: Thu, 20 Jan 2022 13:05:03 +0100 Subject: [PATCH] Apply CS fixes --- src/Analyzer/ConfluenceAnalyzer.php | 8 ++++---- src/Composer/ConfluenceComposer.php | 4 ++-- src/Converter/ConfluenceConverter.php | 2 +- src/Converter/Processor/StructuredMacroProcessorBase.php | 4 ++-- src/Utility/TitleBuilder.php | 1 - .../Converter/Processor/StructuredMacroColumnTest.php | 2 +- .../Converter/Processor/StructuredMacroPanelTest.php | 2 +- .../Converter/Processor/StructuredMacroSectionTest.php | 2 +- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Analyzer/ConfluenceAnalyzer.php b/src/Analyzer/ConfluenceAnalyzer.php index 150626b..a0e21d7 100644 --- a/src/Analyzer/ConfluenceAnalyzer.php +++ b/src/Analyzer/ConfluenceAnalyzer.php @@ -133,7 +133,7 @@ private function makeSpacesMap() { $spaceKey = $this->helper->getPropertyValue( 'key', $space ); if ( substr( $spaceKey, 0, 1 ) === '~' ) { - //User namespaces + // User namespaces $userName = substr( $spaceKey, 1, strlen( $spaceKey ) - 1 ); $spaceKey = 'User' . ucfirst( $userName ); $this->output->writeln( "\033[31m- $spaceKey (ID:$spaceId) - protected user namespace\033[39m" ); @@ -195,7 +195,7 @@ private function makePagenamesMap() { // We need to preserve the spaceID, so we can properly resolve cross-space links // in the `convert` stage $this->pageConfluenceTitle = "$spaceId---{$this->pageConfluenceTitle}"; - $this->pageConfluenceTitle = str_replace( ' ', '_', $this->pageConfluenceTitle ); //Some normalization + $this->pageConfluenceTitle = str_replace( ' ', '_', $this->pageConfluenceTitle ); // Some normalization $this->customBuckets->addData( 'pages-titles-map', $this->pageConfluenceTitle, $targetTitle, false, true ); // Also add pages IDs in Confluence to full page title mapping. @@ -285,7 +285,7 @@ private function makeAttachmentTargetFilename( $attachment, $containerTitle ) { } $fileKey = "{$this->pageConfluenceTitle}---$fileName"; - $fileKey = str_replace( ' ', '_', $fileKey ); //Some normalization + $fileKey = str_replace( ' ', '_', $fileKey ); // Some normalization $this->customBuckets->addData( 'filenames-to-filetitles-map', $fileKey, $targetName, false, true ); return $targetName; @@ -317,7 +317,7 @@ private function makeAttachmentReference( $attachment ) { } $path = $basePath . "/" . $containerId . '/' . $attachmentId . '/' . $attachmentVersion; - if( !file_exists( $path ) ) { + if ( !file_exists( $path ) ) { return ''; } diff --git a/src/Composer/ConfluenceComposer.php b/src/Composer/ConfluenceComposer.php index 13704c1..eb1cd0b 100644 --- a/src/Composer/ConfluenceComposer.php +++ b/src/Composer/ConfluenceComposer.php @@ -103,7 +103,7 @@ public function buildXML( Builder $builder ) { private function appendDefaultPages( Builder $builder ) { $path = pathinfo( __DIR__ . '/_defaultpages/' ); $dir = parse_url( $path['dirname'] ); - $basepath = $dir['host'].':/' . $dir['path']; + $basepath = $dir['host'] . ':/' . $dir['path']; $files = glob( "$basepath/*/*" ); foreach ( $files as $file ) { $namespacePrefix = basename( dirname( $file ) ); @@ -121,7 +121,7 @@ private function appendDefaultPages( Builder $builder ) { private function addDefaultFiles() { $path = pathinfo( __DIR__ . '/_defaultfiles/' ); $dir = parse_url( $path['dirname'] ); - $basepath = $dir['host'].':/' . $dir['path']; + $basepath = $dir['host'] . ':/' . $dir['path']; $files = glob( "$basepath/*" ); foreach ( $files as $file ) { $fileName = basename( $file ); diff --git a/src/Converter/ConfluenceConverter.php b/src/Converter/ConfluenceConverter.php index ff8a897..9a8592a 100644 --- a/src/Converter/ConfluenceConverter.php +++ b/src/Converter/ConfluenceConverter.php @@ -21,9 +21,9 @@ use HalloWelt\MigrateConfluence\Converter\Processor\ConvertStatusMacro; use HalloWelt\MigrateConfluence\Converter\Processor\ConvertTipMacro; use HalloWelt\MigrateConfluence\Converter\Processor\ConvertWarningMacro; +use HalloWelt\MigrateConfluence\Converter\Processor\PreserveTableAttributes; use HalloWelt\MigrateConfluence\Converter\Processor\StructuredMacroColumn; use HalloWelt\MigrateConfluence\Converter\Processor\StructuredMacroPanel; -use HalloWelt\MigrateConfluence\Converter\Processor\PreserveTableAttributes; use HalloWelt\MigrateConfluence\Converter\Processor\StructuredMacroSection; use HalloWelt\MigrateConfluence\Utility\ConversionDataLookup; use SplFileInfo; diff --git a/src/Converter/Processor/StructuredMacroProcessorBase.php b/src/Converter/Processor/StructuredMacroProcessorBase.php index 5a3ec49..bb84dc3 100644 --- a/src/Converter/Processor/StructuredMacroProcessorBase.php +++ b/src/Converter/Processor/StructuredMacroProcessorBase.php @@ -46,7 +46,7 @@ public function process( DOMDocument $dom ): void { */ private function macroParams( $macro, $macroReplacement ): void { $params = []; - foreach( $macro->childNodes as $childNode ) { + foreach ( $macro->childNodes as $childNode ) { if ( $childNode->nodeName === 'ac:parameter' ) { $paramName = $childNode->getAttribute( 'ac:name' ); $params[$paramName] = $childNode->nodeValue; @@ -65,7 +65,7 @@ private function macroParams( $macro, $macroReplacement ): void { * @return void */ private function macroBody( $macro, $macroReplacement ): void { - foreach( $macro->childNodes as $childNode ) { + foreach ( $macro->childNodes as $childNode ) { if ( $childNode->nodeName === 'ac:rich-text-body' ) { foreach ( $childNode->childNodes as $node ) { $newNode = $node->cloneNode( true ); diff --git a/src/Utility/TitleBuilder.php b/src/Utility/TitleBuilder.php index 95127fe..6b9c232 100644 --- a/src/Utility/TitleBuilder.php +++ b/src/Utility/TitleBuilder.php @@ -50,7 +50,6 @@ public function buildTitle( $pageNode ) { $this->builder->appendTitleSegment( $title ); } - return $this->builder->invertTitleSegments()->build(); } diff --git a/tests/phpunit/Converter/Processor/StructuredMacroColumnTest.php b/tests/phpunit/Converter/Processor/StructuredMacroColumnTest.php index 4561b2f..b03b0ec 100644 --- a/tests/phpunit/Converter/Processor/StructuredMacroColumnTest.php +++ b/tests/phpunit/Converter/Processor/StructuredMacroColumnTest.php @@ -15,7 +15,7 @@ protected function getExpectedOutput(): string { return file_get_contents( dirname( dirname( __DIR__ ) ) . '/data/structuredmacrocolumntest-output.xml' ); } - protected function getProcessorToTest(): IProcessor { + protected function getProcessorToTest(): IProcessor { return new StructuredMacroColumn(); } } diff --git a/tests/phpunit/Converter/Processor/StructuredMacroPanelTest.php b/tests/phpunit/Converter/Processor/StructuredMacroPanelTest.php index fdd3588..5cfdc81 100644 --- a/tests/phpunit/Converter/Processor/StructuredMacroPanelTest.php +++ b/tests/phpunit/Converter/Processor/StructuredMacroPanelTest.php @@ -15,7 +15,7 @@ protected function getExpectedOutput(): string { return file_get_contents( dirname( dirname( __DIR__ ) ) . '/data/structuredmacropaneltest-output.xml' ); } - protected function getProcessorToTest(): IProcessor { + protected function getProcessorToTest(): IProcessor { return new StructuredMacroPanel(); } } diff --git a/tests/phpunit/Converter/Processor/StructuredMacroSectionTest.php b/tests/phpunit/Converter/Processor/StructuredMacroSectionTest.php index 127b702..03b5d61 100644 --- a/tests/phpunit/Converter/Processor/StructuredMacroSectionTest.php +++ b/tests/phpunit/Converter/Processor/StructuredMacroSectionTest.php @@ -15,7 +15,7 @@ protected function getExpectedOutput(): string { return file_get_contents( dirname( dirname( __DIR__ ) ) . '/data/structuredmacrosectiontest-output.xml' ); } - protected function getProcessorToTest(): IProcessor { + protected function getProcessorToTest(): IProcessor { return new StructuredMacroSection(); } }