|
2 | 2 |
|
3 | 3 | namespace deepskylog\AstronomyLibrary\Commands; |
4 | 4 |
|
5 | | -use Illuminate\Console\Command; |
6 | | -use deepskylog\AstronomyLibrary\Models\CometsOrbitalElements; |
7 | 5 | use deepskylog\AstronomyLibrary\Models\AsteroidsOrbitalElements; |
| 6 | +use deepskylog\AstronomyLibrary\Models\CometsOrbitalElements; |
| 7 | +use Illuminate\Console\Command; |
8 | 8 |
|
9 | 9 | class UpdateOrbitalElements extends Command |
10 | 10 | { |
@@ -45,20 +45,20 @@ public function handle() |
45 | 45 | // Remove the old entries |
46 | 46 | CometsOrbitalElements::truncate(); |
47 | 47 |
|
48 | | - $cnt = 0; |
| 48 | + $cnt = 0; |
49 | 49 | // Loop over the orbital elements line by line |
50 | 50 | foreach (preg_split("/((\r?\n)|(\r\n?))/", $contents) as $line) { |
51 | 51 | if ($cnt > 1) { |
52 | 52 | // The first 43 characters are the name |
53 | | - $name = trim(substr($line, 0, 43)); |
| 53 | + $name = trim(substr($line, 0, 43)); |
54 | 54 | // Character 44 - 51 is the epoch |
55 | 55 | $epoch = intval(substr($line, 44, 8)) + 2400000.5; |
56 | 56 | // Character 52 - 63 is q: perihelion distance in AU |
57 | | - $q = floatval(substr($line, 52, 12)); |
| 57 | + $q = floatval(substr($line, 52, 12)); |
58 | 58 | // Character 64 - 75 is e, the eccentricity of the orbit |
59 | | - $e = floatval(substr($line, 64, 11)); |
| 59 | + $e = floatval(substr($line, 64, 11)); |
60 | 60 | // Character 75 - 85 is i, the inclination of the orbit |
61 | | - $i = floatval(substr($line, 75, 10)); |
| 61 | + $i = floatval(substr($line, 75, 10)); |
62 | 62 | // w: The argument of perihelion |
63 | 63 | $w = floatval(substr($line, 85, 10)); |
64 | 64 | // node: Longitude of the ascending node |
@@ -95,22 +95,22 @@ public function handle() |
95 | 95 | // Remove the old entries |
96 | 96 | AsteroidsOrbitalElements::truncate(); |
97 | 97 |
|
98 | | - $cnt = 0; |
| 98 | + $cnt = 0; |
99 | 99 | // Loop over the orbital elements line by line |
100 | 100 | foreach (preg_split("/((\r?\n)|(\r\n?))/", $contents) as $line) { |
101 | 101 | if ($cnt > 1) { |
102 | 102 | // Character 0 - 6 is the number |
103 | 103 | $number = intval(substr($line, 0, 6)); |
104 | 104 | // Characters 7 - 25 is the name |
105 | | - $name = trim(substr($line, 7, 18)); |
| 105 | + $name = trim(substr($line, 7, 18)); |
106 | 106 | // Character 25 - 31 is the epoch |
107 | 107 | $epoch = intval(substr($line, 25, 6)) + 2400000.5; |
108 | 108 | // Character 31 - 42 is a: semi-major axis in AU |
109 | | - $a = floatval(substr($line, 31, 11)); |
| 109 | + $a = floatval(substr($line, 31, 11)); |
110 | 110 | // Character 42 - 53 is e, the eccentricity of the orbit |
111 | | - $e = floatval(substr($line, 42, 11)); |
| 111 | + $e = floatval(substr($line, 42, 11)); |
112 | 112 | // Character 53 - 63 is i, the inclination of the orbit |
113 | | - $i = floatval(substr($line, 53, 10)); |
| 113 | + $i = floatval(substr($line, 53, 10)); |
114 | 114 | // w: The argument of perihelion |
115 | 115 | $w = floatval(substr($line, 63, 10)); |
116 | 116 | // node: Longitude of the ascending node |
|
0 commit comments