| Conditions | 44 |
| Paths | 58 |
| Total Lines | 146 |
| Code Lines | 66 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 11 | public static function inArabic($theDate) |
||
| 12 | { |
||
| 13 | // Define The Zaman after or before |
||
| 14 | $theDate < Carbon::now() ? $zaman = "قبل " : $zaman = "بعد "; |
||
| 15 | $theDate = $theDate->diffForHumans(); |
||
| 16 | $dateArray = explode(" ", $theDate); |
||
| 17 | //return $dateArray; // ["1","day","ago"] |
||
| 18 | //$dateArray[0] is number, $dateArray[1] is the time period , $dateArray[2] is the word ago |
||
| 19 | // handl seconds |
||
| 20 | if($dateArray[1] == "second" || $dateArray[1] == "seconds" ) |
||
| 21 | { |
||
| 22 | if($dateArray[0] == 1) |
||
| 23 | { |
||
| 24 | return $zaman."ثانية واحدة"; |
||
| 25 | } |
||
| 26 | elseif($dateArray[0] == 2) |
||
| 27 | { |
||
| 28 | return $zaman. "ثانيتين"; |
||
| 29 | } |
||
| 30 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 31 | { |
||
| 32 | return $zaman. $dateArray[0] . " ثواني"; |
||
| 33 | } |
||
| 34 | else |
||
| 35 | { |
||
| 36 | return $zaman. $dateArray[0] . " ثانية"; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | // handl minutes |
||
| 40 | if($dateArray[1] == "minute" || $dateArray[1] == "minutes" ) |
||
| 41 | { |
||
| 42 | if($dateArray[0] == 1) |
||
| 43 | { |
||
| 44 | return $zaman."دقيقة واحدة"; |
||
| 45 | } |
||
| 46 | elseif($dateArray[0] == 2) |
||
| 47 | { |
||
| 48 | return $zaman. "دقيقتين"; |
||
| 49 | } |
||
| 50 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 51 | { |
||
| 52 | return $zaman. $dateArray[0] . " دقائق"; |
||
| 53 | } |
||
| 54 | else |
||
| 55 | { |
||
| 56 | return $zaman. $dateArray[0] . " دقيقة"; |
||
| 57 | } |
||
| 58 | } |
||
| 59 | // handl hours |
||
| 60 | if($dateArray[1] == "hour" || $dateArray[1] == "hours" ) |
||
| 61 | { |
||
| 62 | if($dateArray[0] == 1) |
||
| 63 | { |
||
| 64 | return $zaman."ساعة"; |
||
| 65 | } |
||
| 66 | elseif($dateArray[0] == 2) |
||
| 67 | { |
||
| 68 | return $zaman. "ساعتين"; |
||
| 69 | } |
||
| 70 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 71 | { |
||
| 72 | return $zaman. $dateArray[0] . " ساعات"; |
||
| 73 | } |
||
| 74 | else |
||
| 75 | { |
||
| 76 | return $zaman. $dateArray[0] . " ساعة"; |
||
| 77 | } |
||
| 78 | } |
||
| 79 | // handl days |
||
| 80 | if($dateArray[1] == "day" || $dateArray[1] == "days" ) |
||
| 81 | { |
||
| 82 | if($dateArray[0] == 1) |
||
| 83 | { |
||
| 84 | return $zaman." يوم"; |
||
| 85 | } |
||
| 86 | elseif($dateArray[0] == 2) |
||
| 87 | { |
||
| 88 | return $zaman. "يومين"; |
||
| 89 | } |
||
| 90 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 91 | { |
||
| 92 | return $zaman. $dateArray[0] . " أيام"; |
||
| 93 | } |
||
| 94 | else |
||
| 95 | { |
||
| 96 | return $zaman. $dateArray[0] . " يوم"; |
||
| 97 | } |
||
| 98 | } |
||
| 99 | // handl weeks |
||
| 100 | if($dateArray[1] == "week" || $dateArray[1] == "weeks" ) |
||
| 101 | { |
||
| 102 | if($dateArray[0] == 1) |
||
| 103 | { |
||
| 104 | return $zaman." أسبوع"; |
||
| 105 | } |
||
| 106 | elseif($dateArray[0] == 2) |
||
| 107 | { |
||
| 108 | return $zaman. " أسبوعين"; |
||
| 109 | } |
||
| 110 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 111 | { |
||
| 112 | return $zaman. $dateArray[0] . " أسابيع"; |
||
| 113 | } |
||
| 114 | else |
||
| 115 | { |
||
| 116 | return $zaman. $dateArray[0] . " أسبوع"; |
||
| 117 | } |
||
| 118 | } |
||
| 119 | // handl months |
||
| 120 | if($dateArray[1] == "month" || $dateArray[1] == "months" ) |
||
| 121 | { |
||
| 122 | if($dateArray[0] == 1) |
||
| 123 | { |
||
| 124 | return $zaman."شهر"; |
||
| 125 | } |
||
| 126 | elseif($dateArray[0] == 2) |
||
| 127 | { |
||
| 128 | return $zaman. " شهرين"; |
||
| 129 | } |
||
| 130 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 131 | { |
||
| 132 | return $zaman. $dateArray[0] . " شهور"; |
||
| 133 | } |
||
| 134 | else |
||
| 135 | { |
||
| 136 | return $zaman. $dateArray[0] . " شهر"; |
||
| 137 | } |
||
| 138 | } |
||
| 139 | // handl years |
||
| 140 | if($dateArray[1] == "year" || $dateArray[1] == "years" ) |
||
| 141 | { |
||
| 142 | if($dateArray[0] == 1) |
||
| 143 | { |
||
| 144 | return $zaman."سنة"; |
||
| 145 | } |
||
| 146 | elseif($dateArray[0] == 2) |
||
| 147 | { |
||
| 148 | return $zaman. " سنتين"; |
||
| 149 | } |
||
| 150 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 151 | { |
||
| 152 | return $zaman. $dateArray[0] . " سنوات"; |
||
| 153 | } |
||
| 154 | else |
||
| 155 | { |
||
| 156 | return $zaman. $dateArray[0] . " سنة"; |
||
| 157 | } |
||
| 162 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths