| Conditions | 37 |
| Paths | 58 |
| Total Lines | 146 |
| Code Lines | 67 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 2 | 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 |
||
| 12 | public static function inArabic($theDate) |
||
| 13 | { |
||
| 14 | // Define The Zaman after or before |
||
| 15 | $theDate < Carbon::now() ? $zaman = "قبل " : $zaman = "بعد "; |
||
| 16 | $theDate = $theDate->diffForHumans(); |
||
| 17 | $dateArray = explode(" ", $theDate); //return $dateArray; // ["1","day","ago"] |
||
| 18 | //$dateArray[0] is number, $dateArray[1] is the time period , $dateArray[2] is the word ago |
||
| 19 | $time = $dateArray[1]; |
||
| 20 | // handl seconds |
||
| 21 | if((new self)->isSecond($time)) |
||
| 22 | { |
||
| 23 | if($dateArray[0] == 1) |
||
| 24 | { |
||
| 25 | return $zaman."ثانية واحدة"; |
||
| 26 | } |
||
| 27 | elseif($dateArray[0] == 2) |
||
| 28 | { |
||
| 29 | return $zaman. "ثانيتين"; |
||
| 30 | } |
||
| 31 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 32 | { |
||
| 33 | return $zaman. $dateArray[0] . " ثواني"; |
||
| 34 | } |
||
| 35 | else |
||
| 36 | { |
||
| 37 | return $zaman. $dateArray[0] . " ثانية"; |
||
| 38 | } |
||
| 39 | } |
||
| 40 | // handl minutes |
||
| 41 | if((new self)->isMinute($time)) |
||
| 42 | { |
||
| 43 | if($dateArray[0] == 1) |
||
| 44 | { |
||
| 45 | return $zaman."دقيقة واحدة"; |
||
| 46 | } |
||
| 47 | elseif($dateArray[0] == 2) |
||
| 48 | { |
||
| 49 | return $zaman. "دقيقتين"; |
||
| 50 | } |
||
| 51 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 52 | { |
||
| 53 | return $zaman. $dateArray[0] . " دقائق"; |
||
| 54 | } |
||
| 55 | else |
||
| 56 | { |
||
| 57 | return $zaman. $dateArray[0] . " دقيقة"; |
||
| 58 | } |
||
| 59 | } |
||
| 60 | // handl hours |
||
| 61 | if((new self)->isHour($time)) |
||
| 62 | { |
||
| 63 | if($dateArray[0] == 1) |
||
| 64 | { |
||
| 65 | return $zaman."ساعة"; |
||
| 66 | } |
||
| 67 | elseif($dateArray[0] == 2) |
||
| 68 | { |
||
| 69 | return $zaman. "ساعتين"; |
||
| 70 | } |
||
| 71 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 72 | { |
||
| 73 | return $zaman. $dateArray[0] . " ساعات"; |
||
| 74 | } |
||
| 75 | else |
||
| 76 | { |
||
| 77 | return $zaman. $dateArray[0] . " ساعة"; |
||
| 78 | } |
||
| 79 | } |
||
| 80 | // handl days |
||
| 81 | if((new self)->isDay($time)) |
||
| 82 | { |
||
| 83 | if($dateArray[0] == 1) |
||
| 84 | { |
||
| 85 | return $zaman." يوم"; |
||
| 86 | } |
||
| 87 | elseif($dateArray[0] == 2) |
||
| 88 | { |
||
| 89 | return $zaman. "يومين"; |
||
| 90 | } |
||
| 91 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 92 | { |
||
| 93 | return $zaman. $dateArray[0] . " أيام"; |
||
| 94 | } |
||
| 95 | else |
||
| 96 | { |
||
| 97 | return $zaman. $dateArray[0] . " يوم"; |
||
| 98 | } |
||
| 99 | } |
||
| 100 | // handl weeks |
||
| 101 | if((new self)->isWeek($time)) |
||
| 102 | { |
||
| 103 | if($dateArray[0] == 1) |
||
| 104 | { |
||
| 105 | return $zaman." أسبوع"; |
||
| 106 | } |
||
| 107 | elseif($dateArray[0] == 2) |
||
| 108 | { |
||
| 109 | return $zaman. " أسبوعين"; |
||
| 110 | } |
||
| 111 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 112 | { |
||
| 113 | return $zaman. $dateArray[0] . " أسابيع"; |
||
| 114 | } |
||
| 115 | else |
||
| 116 | { |
||
| 117 | return $zaman. $dateArray[0] . " أسبوع"; |
||
| 118 | } |
||
| 119 | } |
||
| 120 | // handl months |
||
| 121 | if((new self)->isMonth($time)) |
||
| 122 | { |
||
| 123 | if($dateArray[0] == 1) |
||
| 124 | { |
||
| 125 | return $zaman."شهر"; |
||
| 126 | } |
||
| 127 | elseif($dateArray[0] == 2) |
||
| 128 | { |
||
| 129 | return $zaman. " شهرين"; |
||
| 130 | } |
||
| 131 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 132 | { |
||
| 133 | return $zaman. $dateArray[0] . " شهور"; |
||
| 134 | } |
||
| 135 | else |
||
| 136 | { |
||
| 137 | return $zaman. $dateArray[0] . " شهر"; |
||
| 138 | } |
||
| 139 | } |
||
| 140 | // handl years |
||
| 141 | if((new self)->isYear($time)) |
||
| 142 | { |
||
| 143 | if($dateArray[0] == 1) |
||
| 144 | { |
||
| 145 | return $zaman."سنة"; |
||
| 146 | } |
||
| 147 | elseif($dateArray[0] == 2) |
||
| 148 | { |
||
| 149 | return $zaman. " سنتين"; |
||
| 150 | } |
||
| 151 | elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
||
| 152 | { |
||
| 153 | return $zaman. $dateArray[0] . " سنوات"; |
||
| 154 | } |
||
| 155 | else |
||
| 156 | { |
||
| 157 | return $zaman. $dateArray[0] . " سنة"; |
||
| 158 | } |
||
| 205 |
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