11<?php
2+
23namespace MultidocParser \Services ;
34
45use MultidocParser \DTO \CategoryDto ;
@@ -22,15 +23,15 @@ class OutputFileService
2223 */
2324 private $ categoryRenderer ;
2425
25- private $ outputDirectory = __DIR__ . '\.. \\' ;
26+ private $ outputDirectory = __DIR__ . '\.. \\' ;
2627
2728 private $ projectFileName = 'project.json ' ;
2829
2930 private $ categoryListFileName = 'categories.json ' ;
3031
3132
3233 public function __construct (
33- Filesystem $ fileService ,
34+ Filesystem $ fileService ,
3435 CategoryRenderer $ categoryRenderer
3536 )
3637 {
@@ -40,7 +41,7 @@ public function __construct(
4041
4142 public function prepareOutputFolder ($ outputPath )
4243 {
43- if (empty ($ outputPath )) {
44+ if (empty ($ outputPath )) {
4445 $ outputPath = self ::DEFAULT_OUTPUT_PATH ;
4546 }
4647 $ this ->outputDirectory = $ outputPath ;
@@ -56,12 +57,12 @@ public function exportProjectEntityToOutputFolder(ProjectDto $project)
5657 {
5758 $ this ->removeCurrentFilesInOutput ();
5859 $ this ->fileService ->dumpFile (
59- $ this ->outputDirectory . DIRECTORY_SEPARATOR . $ this ->projectFileName ,
60+ $ this ->outputDirectory . DIRECTORY_SEPARATOR . $ this ->projectFileName ,
6061 json_encode ($ project , JSON_PRETTY_PRINT )
6162 );
6263
6364 $ this ->fileService ->dumpFile (
64- $ this ->outputDirectory . DIRECTORY_SEPARATOR . $ this ->categoryListFileName ,
65+ $ this ->outputDirectory . DIRECTORY_SEPARATOR . $ this ->categoryListFileName ,
6566 json_encode (
6667 $ this ->categoryRenderer ->renderList ($ project ->categories ), JSON_PRETTY_PRINT )
6768 );
@@ -70,17 +71,17 @@ public function exportProjectEntityToOutputFolder(ProjectDto $project)
7071 private function removeCurrentFilesInOutput ()
7172 {
7273 $ this ->fileService ->remove (array (
73- $ this ->outputDirectory . DIRECTORY_SEPARATOR ,
74- $ this ->outputDirectory . DIRECTORY_SEPARATOR
74+ $ this ->outputDirectory . DIRECTORY_SEPARATOR ,
75+ $ this ->outputDirectory . DIRECTORY_SEPARATOR
7576 ));
7677 }
7778
7879 public function exportLogo (ProjectDto $ project , $ outputFolder )
7980 {
8081 if ($ project ->logo ) {
8182 $ this ->fileService ->copy (
82- $ project ->definitionFile . DIRECTORY_SEPARATOR . $ project ->logo ,
83- $ outputFolder. DIRECTORY_SEPARATOR . $ project ->logo ,
83+ $ project ->definitionFile . DIRECTORY_SEPARATOR . $ project ->logo ,
84+ $ outputFolder . DIRECTORY_SEPARATOR . $ project ->logo ,
8485 true
8586 );
8687 }
@@ -92,7 +93,7 @@ public function exportLogo(ProjectDto $project, $outputFolder)
9293 */
9394 public function exportExampleFiles ($ categoryList , $ outputFolder )
9495 {
95- foreach ($ categoryList as $ category ) {
96+ foreach ($ categoryList as $ category ) {
9697 if ($ category ->routeList ) {
9798 foreach ($ category ->routeList as $ route ) {
9899 $ this ->moveExampleFilesFromRoute ($ route , $ outputFolder );
@@ -110,7 +111,7 @@ public function exportExampleFiles($categoryList, $outputFolder)
110111 */
111112 private function moveExampleFilesFromRoute (RouteDto $ route , $ outputFolder )
112113 {
113- if ($ route ->request ->method == FileContentParserService::ROUTE_METHOD_POST ){
114+ if ($ route ->request ->method == FileContentParserService::ROUTE_METHOD_POST ) {
114115 /**
115116 * @var $paramList ParameterDto[]
116117 */
@@ -119,11 +120,11 @@ private function moveExampleFilesFromRoute(RouteDto $route, $outputFolder)
119120 if (empty ($ paramList )) {
120121 return ;
121122 }
122- foreach ($ paramList as $ parameter ) {
123- if ($ parameter ->data_type == FileContentParserService::PARAMETER_TYPE_FILE ){
123+ foreach ($ paramList as $ parameter ) {
124+ if ($ parameter ->data_type == FileContentParserService::PARAMETER_TYPE_FILE ) {
124125 $ this ->fileService ->copy (
125- $ route ->inputPath . DIRECTORY_SEPARATOR . $ parameter ->example ,
126- $ outputFolder. DIRECTORY_SEPARATOR . $ parameter ->example ,
126+ $ route ->inputPath . DIRECTORY_SEPARATOR . $ parameter ->example ,
127+ $ outputFolder . DIRECTORY_SEPARATOR . $ parameter ->example ,
127128 true
128129 );
129130 }
0 commit comments