@@ -839,7 +839,7 @@ public function calculateEphemerides(
839839 $ th = new Coordinate ($ transitHeight , -90.0 , 90.0 );
840840 }
841841 $ this ->_maxHeight = new Coordinate ($ transitHeight , -90.0 , 90.0 );
842- if (!isset ($ hasAstronomical ) && !isset ($ hasNautical )) {
842+ if (! isset ($ hasAstronomical ) && ! isset ($ hasNautical )) {
843843 // safety: if bounds weren't computed, set to null
844844 $ this ->_maxHeightAtNight = null ;
845845 } elseif (! $ hasAstronomical && ! $ hasNautical ) {
@@ -1407,12 +1407,12 @@ public function yearGraph(GeographicalCoordinates $geo_coords, Carbon $date, boo
14071407 $ black = imagecolorallocate ($ image , 0 , 0 , 0 );
14081408 imagefilledrectangle ($ image , 0 , 0 , 1000 , 400 , $ black );
14091409
1410- $ textcolor = imagecolorallocate ($ image , 255 , 255 , 255 );
1411- $ axiscolor = imagecolorallocate ($ image , 150 , 150 , 150 );
1410+ $ textcolor = imagecolorallocate ($ image , 255 , 255 , 255 );
1411+ $ axiscolor = imagecolorallocate ($ image , 150 , 150 , 150 );
14121412 // More saturated / darker blue fill and a brighter cyan border to make
14131413 // blue month regions stand out clearly.
1414- $ blue = imagecolorallocate ($ image , 0 , 38 , 153 ); // darker saturated blue
1415- $ blueBorder = imagecolorallocate ($ image , 0 , 160 , 255 ); // thin border color
1414+ $ blue = imagecolorallocate ($ image , 0 , 38 , 153 ); // darker saturated blue
1415+ $ blueBorder = imagecolorallocate ($ image , 0 , 160 , 255 ); // thin border color
14161416
14171417 // plotting area left..right
14181418 $ left = 70 ;
@@ -1441,15 +1441,15 @@ public function yearGraph(GeographicalCoordinates $geo_coords, Carbon $date, boo
14411441 // edge so the line visibly continues through to the year's end.
14421442 $ plotXs = $ xs ;
14431443
1444- $ monthMaxes = [];
1445- $ monthAllNoAstronomical = [];
1446- $ monthNoNautCounts = [];
1447- // Collect per-sample datapoints for plotting (ensure at least 5 per month)
1448- $ monthSamples = [];
1444+ $ monthMaxes = [];
1445+ $ monthAllNoAstronomical = [];
1446+ $ monthNoNautCounts = [];
1447+ // Collect per-sample datapoints for plotting (ensure at least 5 per month)
1448+ $ monthSamples = [];
14491449
1450- // Steps for sampling the night: every 10 minutes (6 steps/hour)
1451- $ stepsPerHour = 6 ;
1452- $ stepMinutes = 60 / $ stepsPerHour ; // 10
1450+ // Steps for sampling the night: every 10 minutes (6 steps/hour)
1451+ $ stepsPerHour = 6 ;
1452+ $ stepMinutes = 60 / $ stepsPerHour ; // 10
14531453
14541454 // How many samples per month to take (increase for higher resolution).
14551455 // Higher values increase accuracy but also CPU cost. Ten samples is a
@@ -1631,7 +1631,7 @@ public function yearGraph(GeographicalCoordinates $geo_coords, Carbon $date, boo
16311631 }
16321632 }
16331633
1634- $ noAstrByDay [$ day ] = !$ hasAstronomical ;
1634+ $ noAstrByDay [$ day ] = ! $ hasAstronomical ;
16351635 }
16361636
16371637 // Find contiguous runs of no-astronomical days and draw them. We map
@@ -1650,8 +1650,12 @@ public function yearGraph(GeographicalCoordinates $geo_coords, Carbon $date, boo
16501650 $ endFrac = $ runEnd / $ daysInYear ;
16511651 $ x1 = (int ) floor ($ left + $ startFrac * $ width ) - 1 ;
16521652 $ x2 = (int ) ceil ($ left + $ endFrac * $ width ) + 1 ;
1653- if ($ x1 < $ left ) $ x1 = $ left ;
1654- if ($ x2 > $ right ) $ x2 = $ right ;
1653+ if ($ x1 < $ left ) {
1654+ $ x1 = $ left ;
1655+ }
1656+ if ($ x2 > $ right ) {
1657+ $ x2 = $ right ;
1658+ }
16551659 imagefilledrectangle ($ image , $ x1 , 5 , $ x2 , 365 , $ blue );
16561660 imagerectangle ($ image , $ x1 , 5 , $ x2 , 365 , $ blueBorder );
16571661 $ inRun = false ;
@@ -1664,14 +1668,18 @@ public function yearGraph(GeographicalCoordinates $geo_coords, Carbon $date, boo
16641668 $ endFrac = $ runEnd / $ daysInYear ;
16651669 $ x1 = (int ) floor ($ left + $ startFrac * $ width ) - 1 ;
16661670 $ x2 = (int ) ceil ($ left + $ endFrac * $ width ) + 1 ;
1667- if ($ x1 < $ left ) $ x1 = $ left ;
1668- if ($ x2 > $ right ) $ x2 = $ right ;
1671+ if ($ x1 < $ left ) {
1672+ $ x1 = $ left ;
1673+ }
1674+ if ($ x2 > $ right ) {
1675+ $ x2 = $ right ;
1676+ }
16691677 imagefilledrectangle ($ image , $ x1 , 5 , $ x2 , 365 , $ blue );
16701678 imagerectangle ($ image , $ x1 , 5 , $ x2 , 365 , $ blueBorder );
16711679 }
16721680
16731681 // Draw month labels and horizontal axis
1674- $ monthNames = ['Jan ' ,'Feb ' ,'Mar ' ,'Apr ' ,'May ' ,'Jun ' ,'Jul ' ,'Aug ' ,'Sep ' ,'Oct ' ,'Nov ' ,'Dec ' ];
1682+ $ monthNames = ['Jan ' , 'Feb ' , 'Mar ' , 'Apr ' , 'May ' , 'Jun ' , 'Jul ' , 'Aug ' , 'Sep ' , 'Oct ' , 'Nov ' , 'Dec ' ];
16751683 for ($ m = 0 ; $ m < 12 ; $ m ++) {
16761684 $ labelX = (int ) $ xs [$ m ] - 10 ;
16771685 imagestring ($ image , 2 , $ labelX , 370 , $ monthNames [$ m ], $ textcolor );
@@ -1688,15 +1696,15 @@ public function yearGraph(GeographicalCoordinates $geo_coords, Carbon $date, boo
16881696 imagestring ($ image , 2 , $ labelXNextJan , 370 , 'Jan ' , $ textcolor );
16891697 imageline ($ image , (int ) $ right , 365 , (int ) $ right , 355 , $ axiscolor );
16901698
1691- // Draw Y axis markers (0,30,60,90)
1692- imagestring ($ image , 2 , 35 , 360 , '0 ' .chr (176 ), $ textcolor );
1693- imageline ($ image , $ left , 365 , $ right , 365 , $ axiscolor );
1694- imagestring ($ image , 2 , 35 , 240 , '30 ' .chr (176 ), $ textcolor );
1695- imageline ($ image , $ left , 245 , $ right , 245 , $ axiscolor );
1696- imagestring ($ image , 2 , 35 , 120 , '60 ' .chr (176 ), $ textcolor );
1697- imageline ($ image , $ left , 125 , $ right , 125 , $ axiscolor );
1698- imagestring ($ image , 2 , 35 , 0 , '90 ' .chr (176 ), $ textcolor );
1699- imageline ($ image , $ left , 5 , $ right , 5 , $ axiscolor );
1699+ // Draw Y axis markers (0,30,60,90)
1700+ imagestring ($ image , 2 , 35 , 360 , '0 ' .chr (176 ), $ textcolor );
1701+ imageline ($ image , $ left , 365 , $ right , 365 , $ axiscolor );
1702+ imagestring ($ image , 2 , 35 , 240 , '30 ' .chr (176 ), $ textcolor );
1703+ imageline ($ image , $ left , 245 , $ right , 245 , $ axiscolor );
1704+ imagestring ($ image , 2 , 35 , 120 , '60 ' .chr (176 ), $ textcolor );
1705+ imageline ($ image , $ left , 125 , $ right , 125 , $ axiscolor );
1706+ imagestring ($ image , 2 , 35 , 0 , '90 ' .chr (176 ), $ textcolor );
1707+ imageline ($ image , $ left , 5 , $ right , 5 , $ axiscolor );
17001708
17011709 // Draw a connected white line through all chronological samples
17021710 // collected across the year. This produces multiple datapoints per
@@ -1705,22 +1713,30 @@ public function yearGraph(GeographicalCoordinates $geo_coords, Carbon $date, boo
17051713 // maximum.
17061714 $ allSamples = [];
17071715 for ($ m = 1 ; $ m <= 12 ; $ m ++) {
1708- if (! isset ($ monthSamples [$ m - 1 ])) continue ;
1716+ if (! isset ($ monthSamples [$ m - 1 ])) {
1717+ continue ;
1718+ }
17091719 foreach ($ monthSamples [$ m - 1 ] as $ s ) {
17101720 $ sampleDate = Carbon::create ($ year , $ m , $ s ['day ' ], 12 , 0 , 0 , $ date ->timezone );
17111721 $ doy = $ sampleDate ->dayOfYear ;
17121722 $ frac = ($ doy - 1 ) / $ daysInYear ;
17131723 $ x = $ left + $ frac * $ width ;
17141724 $ alt = $ s ['val ' ];
17151725 $ y = 365 - $ alt * 4 ;
1716- if ($ y < 5 ) $ y = 5 ;
1717- if ($ y > 365 ) $ y = 365 ;
1726+ if ($ y < 5 ) {
1727+ $ y = 5 ;
1728+ }
1729+ if ($ y > 365 ) {
1730+ $ y = 365 ;
1731+ }
17181732 $ allSamples [] = ['doy ' => $ doy , 'x ' => (int ) $ x , 'y ' => (int ) $ y , 'val ' => $ alt ];
17191733 }
17201734 }
17211735
17221736 // They are already chronological by month/sample order, but sort to be safe
1723- usort ($ allSamples , function ($ a , $ b ) { return $ a ['doy ' ] <=> $ b ['doy ' ]; });
1737+ usort ($ allSamples , function ($ a , $ b ) {
1738+ return $ a ['doy ' ] <=> $ b ['doy ' ];
1739+ });
17241740
17251741 $ prevX = null ;
17261742 $ prevY = null ;
@@ -1754,8 +1770,8 @@ public function yearGraph(GeographicalCoordinates $geo_coords, Carbon $date, boo
17541770 imagepng ($ image );
17551771 $ rawImageBytes = ob_get_clean ();
17561772
1757- // rawImageBytes is PNG data
1758- return "<img src='data:image/png;base64, " .base64_encode ($ rawImageBytes )."' /> " ;
1773+ // rawImageBytes is PNG data
1774+ return "<img src='data:image/png;base64, " .base64_encode ($ rawImageBytes )."' /> " ;
17591775 }
17601776
17611777 /**
0 commit comments