File tree Expand file tree Collapse file tree 5 files changed +255
-6
lines changed Expand file tree Collapse file tree 5 files changed +255
-6
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ RUN apk add --no-cache $PHPIZE_DEPS git zip unzip linux-headers \
66 && pecl install xdebug \
77 && docker-php-ext-enable xdebug
88
9+ # Install watchexec for hot reloading
10+ RUN apk add --no-cache watchexec
11+
912# Set working directory
1013WORKDIR /app
1114
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ services:
1414 environment :
1515 - PORT=3010
1616 - PHP_ENV=development
17- # Using PHP development server that auto-reloads when files change
18- command : sh -c "php -S 0.0.0.0:3010 index.php"
17+ # Using watchexec for hot reloading when PHP files change
18+ command : sh -c "watchexec -e php -r -w . 'php - S 0.0.0.0:3010 index.php' "
1919 networks :
2020 - snorkell_network
2121
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 2424
2525# write the json to a file in pretty format
2626with open (f'{ current_directory } /samples/sample1.json' , 'w' ) as json_file :
27+ pass
2728 json .dump (response .json (), json_file , indent = 4 )
2829print (response .text )
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public function handleRequest()
4747 private function handleHealthCheck ()
4848 {
4949 http_response_code (200 );
50- echo json_encode (['status ' => 'hello from php ! ' , 'timestamp ' => time ()]);
50+ echo json_encode (['status ' => 'hello from Php ! ' , 'timestamp ' => time ()]);
5151 }
5252
5353 /**
@@ -68,7 +68,7 @@ private function handleParseRequest()
6868
6969 // Validate request data
7070 if (!$ requestData || !isset ($ requestData ['code ' ]) ||
71- !isset ($ requestData ['modifiedLines ' ]) || ! isset ( $ requestData [ ' fileType ' ])) {
71+ !isset ($ requestData ['fileType ' ])) {
7272 http_response_code (400 );
7373 echo json_encode (['error ' => 'Invalid request data ' ]);
7474 return ;
@@ -77,9 +77,12 @@ private function handleParseRequest()
7777 // Create parser and process code
7878 try {
7979 $ parser = new CodeParser ();
80+ // Set default empty string for modifiedLines if not provided
81+ $ modifiedLines = isset ($ requestData ['modifiedLines ' ]) ? $ requestData ['modifiedLines ' ] : '' ;
82+
8083 $ result = $ parser ->parseCode (
8184 $ requestData ['code ' ],
82- $ requestData [ ' modifiedLines ' ] ,
85+ $ modifiedLines ,
8386 $ requestData ['fileType ' ]
8487 );
8588
You can’t perform that action at this time.
0 commit comments