Skip to content

Commit 1d60733

Browse files
committed
fixed comments
1 parent dd649d6 commit 1d60733

File tree

2 files changed

+81
-74
lines changed

2 files changed

+81
-74
lines changed

Conversions/TemperatureConversions.php

Lines changed: 60 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?php
22

3-
/* This function converts the submitted
4-
temperature (Celsius) and converts it into
5-
Fahrenheit.
6-
7-
@author Marco https://github.com/MaarcooC
8-
@param float $celsius
9-
@throws \Exception
10-
@return float */
11-
3+
/**
4+
* This function converts the submitted
5+
* temperature (Celsius) and converts it into
6+
* Fahrenheit.
7+
*
8+
* @author Marco https://github.com/MaarcooC
9+
* @param float $celsius
10+
* @throws \Exception
11+
* @return float
12+
*/
1213
function CelsiusToFahrenheit($celsius)
1314
{
1415
if (!is_numeric($celsius)) {
@@ -18,15 +19,16 @@ function CelsiusToFahrenheit($celsius)
1819
return round(($celsius * 9 / 5) + 32, 1);
1920
}
2021

21-
/* This function converts the submitted
22-
temperature (Fahrenheit) and converts it into
23-
Celsius.
24-
25-
@author Marco https://github.com/MaarcooC
26-
@param float $fahrenheit
27-
@throws \Exception
28-
@return float */
29-
22+
/**
23+
* This function converts the submitted
24+
* temperature (Fahrenheit) and converts it into
25+
* Celsius.
26+
*
27+
* @author Marco https://github.com/MaarcooC
28+
* @param float $fahrenheit
29+
* @throws \Exception
30+
* @return float
31+
*/
3032
function FahrenheitToCelsius($fahrenheit)
3133
{
3234
if (!is_numeric($fahrenheit)) {
@@ -36,15 +38,16 @@ function FahrenheitToCelsius($fahrenheit)
3638
return round(($fahrenheit - 32) * 5 / 9, 1);
3739
}
3840

39-
/* This function converts the submitted
40-
temperature (Celsius) and converts it into
41-
Kelvin.
42-
43-
@author Marco https://github.com/MaarcooC
44-
@param float $celsius
45-
@throws \Exception
46-
@return float */
47-
41+
/**
42+
* This function converts the submitted
43+
* temperature (Celsius) and converts it into
44+
* Kelvin.
45+
*
46+
* @author Marco https://github.com/MaarcooC
47+
* @param float $celsius
48+
* @throws \Exception
49+
* @return float
50+
*/
4851
function CelsiusToKelvin($celsius)
4952
{
5053
if (!is_numeric($celsius)) {
@@ -54,15 +57,16 @@ function CelsiusToKelvin($celsius)
5457
return round(($celsius + 273.15), 2);
5558
}
5659

57-
/* This function converts the submitted
58-
temperature (Kelvin) and converts it into
59-
Celsius.
60-
61-
@author Marco https://github.com/MaarcooC
62-
@param float $kelvin
63-
@throws \Exception
64-
@return float */
65-
60+
/**
61+
* This function converts the submitted
62+
* temperature (Kelvin) and converts it into
63+
* Celsius.
64+
*
65+
* @author Marco https://github.com/MaarcooC
66+
* @param float $kelvin
67+
* @throws \Exception
68+
* @return float
69+
*/
6670
function KelvinToCelsius($kelvin)
6771
{
6872
if (!is_numeric($kelvin)) {
@@ -72,15 +76,16 @@ function KelvinToCelsius($kelvin)
7276
return round(($kelvin - 273.15), 2);
7377
}
7478

75-
/* This function converts the submitted
76-
temperature (Kelvin) and converts it into
77-
Fahrenheit.
78-
79-
@author Marco https://github.com/MaarcooC
80-
@param float $kelvin
81-
@throws \Exception
82-
@return float */
83-
79+
/**
80+
* This function converts the submitted
81+
* temperature (Kelvin) and converts it into
82+
* Fahrenheit.
83+
*
84+
* @author Marco https://github.com/MaarcooC
85+
* @param float $kelvin
86+
* @throws \Exception
87+
* @return float
88+
*/
8489
function KelvinToFahrenheit($kelvin)
8590
{
8691
if (!is_numeric($kelvin)) {
@@ -90,15 +95,16 @@ function KelvinToFahrenheit($kelvin)
9095
return round(($kelvin - 273.15) * 1.8 + 32, 2);
9196
}
9297

93-
/* This function converts the submitted
94-
temperature (Fahrenheit) and converts it into
95-
kelvin.
96-
97-
@author Marco https://github.com/MaarcooC
98-
@param float $fahrenheit
99-
@throws \Exception
100-
@return float */
101-
98+
/**
99+
* This function converts the submitted
100+
* temperature (Fahrenheit) and converts it into
101+
* kelvin.
102+
*
103+
* @author Marco https://github.com/MaarcooC
104+
* @param float $fahrenheit
105+
* @throws \Exception
106+
* @return float
107+
*/
102108
function FahrenheitToKelvin($fahrenheit)
103109
{
104110
if (!is_numeric($fahrenheit)) {

Maths/PerfectNumber.php

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
<?php
22

3-
/* This function returns true
4-
if the submitted number is perfect,
5-
false if it is not.
6-
7-
A perfect number is a positive integer that is
8-
equal to the sum of its positive proper
9-
divisors, excluding the number itself.
10-
11-
About perfect numbers: https://en.wikipedia.org/wiki/Perfect_number
12-
13-
@author Marco https://github.com/MaarcooC
14-
@param int $number
15-
@return bool */
16-
3+
/**
4+
This function returns true
5+
* if the submitted number is perfect,
6+
* false if it is not.
7+
*
8+
* A perfect number is a positive integer that is
9+
* equal to the sum of its positive proper
10+
* divisors, excluding the number itself.
11+
*
12+
* About perfect numbers: https://en.wikipedia.org/wiki/Perfect_number
13+
*
14+
* @author Marco https://github.com/MaarcooC
15+
* @param int $number
16+
* @return bool
17+
*/
1718
function perfect_number($number)
1819
{
19-
// Input validation
20+
/*Input validation*/
2021
if (!is_int($number) || $number <= 1) {
21-
// Return false for non-integer or non-positive numbers
22+
/*Return false for non-integer or non-positive numbers*/
2223
return false;
2324
}
2425

25-
$divisorsSum = 1; // 1 is a common divisor for every number
26+
$divisorsSum = 1; /*1 is a common divisor for every number*/
2627

27-
// Check for divisors up to the square root of the number
28+
/*Check for divisors up to the square root of the number*/
2829
for ($i = 2; $i * $i <= $number; $i++) {
2930
if ($number % $i == 0) {
30-
$divisorsSum += $i; // add i to the sum of divisors
31-
if ($i != $number / $i) { // add the complement divisor
31+
$divisorsSum += $i; /*add i to the sum of divisors*/
32+
if ($i != $number / $i) { /*add the complement divisor*/
3233
$divisorsSum += $number / $i;
3334
}
3435
}

0 commit comments

Comments
 (0)