@@ -23,9 +23,9 @@ |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | function clean($string) { |
26 | - $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens. |
|
26 | + $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens. |
|
27 | 27 | |
28 | - return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. |
|
28 | + return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. |
|
29 | 29 | } |
30 | 30 | |
31 | 31 |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Gen name with initials with help of fullname |
4 | -function genNameWithInitials($fullname = null){ |
|
4 | +function genNameWithInitials($fullname = null) { |
|
5 | 5 | $names = explode(' ', $fullname); |
6 | - $length = count($names); |
|
6 | + $length = count($names); |
|
7 | 7 | $Initials = ''; |
8 | - if($length > 1){ |
|
9 | - for ($i = 0; ($length-1) > $i; $i++) { |
|
10 | - $Initials = $Initials . '' . mb_substr($names[$i], 0, 1, "UTF-8"); |
|
8 | + if ($length > 1) { |
|
9 | + for ($i = 0; ($length - 1) > $i; $i++) { |
|
10 | + $Initials = $Initials.''.mb_substr($names[$i], 0, 1, "UTF-8"); |
|
11 | 11 | } |
12 | - $nameWithInitials = $Initials . ' ' . $names[$length - 1]; |
|
13 | - }else{ |
|
12 | + $nameWithInitials = $Initials.' '.$names[$length - 1]; |
|
13 | + }else { |
|
14 | 14 | $nameWithInitials = $fullname; |
15 | 15 | } |
16 | 16 | return $nameWithInitials; |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | -function getMatchingKeys($array){ |
|
32 | +function getMatchingKeys($array) { |
|
33 | 33 | $keys = []; |
34 | - foreach ($array as $key => $value){ |
|
35 | - if(strstr($key , 'option')) |
|
34 | + foreach ($array as $key => $value) { |
|
35 | + if (strstr($key, 'option')) |
|
36 | 36 | $keys[] = $key; |
37 | 37 | } |
38 | 38 | return $keys; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return (bool) preg_match('/^[0-9a-f]{40}$/i', $str); |
43 | 43 | } |
44 | 44 | |
45 | -function isEmpty($value){ |
|
45 | +function isEmpty($value) { |
|
46 | 46 | return $value['institution_optional_subject'] !== null; |
47 | 47 | } |
48 | 48 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $i = 0; |
52 | 52 | $key_array = array(); |
53 | 53 | |
54 | - foreach($array as $val) { |
|
54 | + foreach ($array as $val) { |
|
55 | 55 | if (!in_array($val[$key], $key_array)) { |
56 | 56 | $key_array[$i] = $val[$key]; |
57 | 57 | $temp_array[$i] = $val; |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | -function merge_two_arrays($array1,$array2) { |
|
66 | +function merge_two_arrays($array1, $array2) { |
|
67 | 67 | |
68 | 68 | $data = array(); |
69 | - $arrayAB = array_merge($array1,$array2); |
|
69 | + $arrayAB = array_merge($array1, $array2); |
|
70 | 70 | |
71 | 71 | foreach ($arrayAB as $value) { |
72 | 72 | dd($arrayAB); |
@@ -74,25 +74,25 @@ discard block |
||
74 | 74 | if (!isset($data[$id])) { |
75 | 75 | $data[$id] = array(); |
76 | 76 | } |
77 | - $data[$id] = array_merge($data[$id],$value); |
|
77 | + $data[$id] = array_merge($data[$id], $value); |
|
78 | 78 | } |
79 | 79 | return $data; |
80 | 80 | } |
81 | 81 | |
82 | -function array_value_recursive($key, array $arr){ |
|
82 | +function array_value_recursive($key, array $arr) { |
|
83 | 83 | $val = array(); |
84 | 84 | array_walk_recursive($arr, function($v, $k) use($key, &$val){ |
85 | - if($k == $key) array_push($val, $v); |
|
85 | + if ($k == $key) array_push($val, $v); |
|
86 | 86 | }); |
87 | 87 | return count($val) > 1 ? $val : array_pop($val); |
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | -function merge_error_by_row($errors,$key){ |
|
91 | +function merge_error_by_row($errors, $key) { |
|
92 | 92 | $temp_array = array(); |
93 | 93 | $i = 0; |
94 | 94 | |
95 | - foreach($errors as $keys => $val) { |
|
95 | + foreach ($errors as $keys => $val) { |
|
96 | 96 | if (!in_array($val[$key], $temp_array)) { |
97 | 97 | $temp_array[$keys]['errors'][] = $val; |
98 | 98 | } |
@@ -108,17 +108,17 @@ discard block |
||
108 | 108 | * bind error messages to the excel file |
109 | 109 | */ |
110 | 110 | |
111 | -function append_errors_to_excel($error, $count, $reader){ |
|
111 | +function append_errors_to_excel($error, $count, $reader) { |
|
112 | 112 | $active_sheet = $reader->getActiveSheet(); |
113 | 113 | $prev_value = $active_sheet->getCell('A'.$error['row'])->getValue(); |
114 | - $active_sheet->setCellValue('A'. ($error['row']) , $prev_value.','.implode(',',$error['errors'])); |
|
115 | - $active_sheet->getStyle('A'. ($error['row']))->getAlignment()->setWrapText(true); |
|
114 | + $active_sheet->setCellValue('A'.($error['row']), $prev_value.','.implode(',', $error['errors'])); |
|
115 | + $active_sheet->getStyle('A'.($error['row']))->getAlignment()->setWrapText(true); |
|
116 | 116 | $columns = Illuminate\Support\Facades\Config::get('excel.columns'); |
117 | 117 | |
118 | - $column = array_keys($columns,$error['attribute']); |
|
119 | - if(!empty($column)){ |
|
120 | - $column = $column[0]+1; |
|
121 | - $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column,$error['row']); |
|
118 | + $column = array_keys($columns, $error['attribute']); |
|
119 | + if (!empty($column)) { |
|
120 | + $column = $column[0] + 1; |
|
121 | + $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column, $error['row']); |
|
122 | 122 | $active_cell = ($selectedCells->getActiveCell()); |
123 | 123 | |
124 | 124 | $active_sheet->getStyle($active_cell) |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | -function rows($error){ |
|
133 | +function rows($error) { |
|
134 | 134 | return $error['row']; |
135 | 135 | } |
136 | 136 | |
137 | -function rowIndex($row){ |
|
137 | +function rowIndex($row) { |
|
138 | 138 | return $row->getRowIndex(); |
139 | 139 | } |
140 | 140 | |
141 | -function removeRows($row,$param){ |
|
142 | - if(in_array($row,$param['rows'])){ |
|
141 | +function removeRows($row, $param) { |
|
142 | + if (in_array($row, $param['rows'])) { |
|
143 | 143 | $param['reader']->getActiveSheet()->removeRow($row); |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | -function colorizeCell($column,$error,$active_sheet){ |
|
148 | - $column = array_keys($column,$error['attribute']); |
|
149 | - $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column,$error['row']); |
|
147 | +function colorizeCell($column, $error, $active_sheet) { |
|
148 | + $column = array_keys($column, $error['attribute']); |
|
149 | + $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column, $error['row']); |
|
150 | 150 | $active_cell = ($selectedCells->getActiveCell()); |
151 | 151 | |
152 | 152 | $active_sheet->getStyle($active_cell) |
@@ -158,14 +158,14 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | -function errors_unique_array($item,$key){ |
|
161 | +function errors_unique_array($item, $key) { |
|
162 | 162 | |
163 | - $search = array_filter($item,function ($data) use ($item){ |
|
164 | - return isset($data['row']) && ($data['row'] == $item->row()); |
|
163 | + $search = array_filter($item, function($data) use ($item){ |
|
164 | + return isset($data['row']) && ($data['row'] == $item->row()); |
|
165 | 165 | }); |
166 | 166 | |
167 | - if($search){ |
|
168 | - array_push($search[0]['errors'],implode(',',$item->errors())); |
|
167 | + if ($search) { |
|
168 | + array_push($search[0]['errors'], implode(',', $item->errors())); |
|
169 | 169 | $errors = $search; |
170 | 170 | } |
171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | function isEmptyRow($row) { |
176 | - foreach($row as $cell){ |
|
176 | + foreach ($row as $cell) { |
|
177 | 177 | if (null !== $cell) return false; |
178 | 178 | } |
179 | 179 | return true; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $Initials = $Initials . '' . mb_substr($names[$i], 0, 1, "UTF-8"); |
11 | 11 | } |
12 | 12 | $nameWithInitials = $Initials . ' ' . $names[$length - 1]; |
13 | - }else{ |
|
13 | + } else{ |
|
14 | 14 | $nameWithInitials = $fullname; |
15 | 15 | } |
16 | 16 | return $nameWithInitials; |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | function getMatchingKeys($array){ |
33 | 33 | $keys = []; |
34 | 34 | foreach ($array as $key => $value){ |
35 | - if(strstr($key , 'option')) |
|
36 | - $keys[] = $key; |
|
35 | + if(strstr($key , 'option')) { |
|
36 | + $keys[] = $key; |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | return $keys; |
39 | 40 | } |
@@ -82,7 +83,9 @@ discard block |
||
82 | 83 | function array_value_recursive($key, array $arr){ |
83 | 84 | $val = array(); |
84 | 85 | array_walk_recursive($arr, function($v, $k) use($key, &$val){ |
85 | - if($k == $key) array_push($val, $v); |
|
86 | + if($k == $key) { |
|
87 | + array_push($val, $v); |
|
88 | + } |
|
86 | 89 | }); |
87 | 90 | return count($val) > 1 ? $val : array_pop($val); |
88 | 91 | } |
@@ -174,7 +177,9 @@ discard block |
||
174 | 177 | |
175 | 178 | function isEmptyRow($row) { |
176 | 179 | foreach($row as $cell){ |
177 | - if (null !== $cell) return false; |
|
180 | + if (null !== $cell) { |
|
181 | + return false; |
|
182 | + } |
|
178 | 183 | } |
179 | 184 | return true; |
180 | 185 | } |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | |
14 | 14 | public function check($value, $hashedValue, array $options = []) |
15 | 15 | { |
16 | - return password_verify ($value , $hashedValue); |
|
16 | + return password_verify($value, $hashedValue); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
20 | 20 | public function make($value, array $options = []) |
21 | 21 | { |
22 | - return password_hash($value,PASSWORD_DEFAULT,$options); |
|
22 | + return password_hash($value, PASSWORD_DEFAULT, $options); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function needsRehash($hashedValue, array $options = []) |
29 | 29 | { |
30 | - return password_needs_rehash($hashedValue,$options); |
|
30 | + return password_needs_rehash($hashedValue, $options); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 |