Completed
Branch master (95506d)
by Jonathan
13:15
created
src/Webtrees/Cache.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
 	 *
115 115
 	 * @param string $value Value name
116 116
 	 * @param AbstractModule $mod Calling module
117
-	 * @return bool True is cached
117
+	 * @return boolean|null True is cached
118 118
 	 */
119 119
 	public static function isCached($value, AbstractModule $mod = null) {
120 120
 	    self::getInstance()->isCachedI($value, $mod);
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,9 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 */
82 82
 	protected function checkInit(){
83
-		if(!$this->is_init) $this->init();
83
+		if(!$this->is_init) {
84
+			$this->init();
85
+		}
84 86
 	}
85 87
 	
86 88
 	/**
@@ -93,7 +95,9 @@  discard block
 block discarded – undo
93 95
 	protected function getKeyName($value, AbstractModule $mod = null){
94 96
 	    $this->checkInit();
95 97
 		$mod_name = 'myartjaub';
96
-		if($mod != null) $mod_name = $mod->getName();
98
+		if($mod != null) {
99
+			$mod_name = $mod->getName();
100
+		}
97 101
 		return $mod_name.'_'.$value;
98 102
 	}
99 103
 
Please login to merge, or discard this patch.
src/Webtrees/Family.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	/**
53 53
 	 * Find the spouse of a person, using the Xref comparison.
54 54
 	 *
55
-	 * @param Individual $person
55
+	 * @param fw\Individual $person
56 56
 	 *
57 57
 	 * @return Individual|null
58 58
 	 */
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@
 block discarded – undo
44 44
 	* @return int Level of sources
45 45
 	* */
46 46
 	function isMarriageSourced(){
47
-		if($this->_ismarriagesourced != null) return $this->_ismarriagesourced;
47
+		if($this->_ismarriagesourced != null) {
48
+			return $this->_ismarriagesourced;
49
+		}
48 50
 		$this->_ismarriagesourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC');
49 51
 		return $this->_ismarriagesourced;
50 52
 	}
Please login to merge, or discard this patch.
src/Webtrees/Functions/Functions.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 * 
52 52
 	 * @param integer $num Numerator
53 53
 	 * @param integer $denom Denominator
54
-	 * @param float $default Default value if denominator null or 0
55
-	 * @return float Result of the safe division
54
+	 * @param integer $default Default value if denominator null or 0
55
+	 * @return integer Result of the safe division
56 56
 	 */
57 57
 	public static function safeDivision($num, $denom, $default = 0) {
58 58
 		if($denom && $denom!=0){
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param int $num Numerator
68 68
 	 * @param int $denom Denominator
69
-	 * @param float $default Default value if denominator null or 0
70
-	 * @return float Percentage
69
+	 * @param integer $default Default value if denominator null or 0
70
+	 * @return integer Percentage
71 71
 	 */
72 72
 	public static function getPercentage($num, $denom, $default = 0){
73 73
 		return 100 * self::safeDivision($num, $denom, $default);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param string $file The image to resize
80 80
 	 * @param int $target	The final max width/height
81
-	 * @return array array of ($width, $height). One of them must be $target
81
+	 * @return integer[] array of ($width, $height). One of them must be $target
82 82
 	 */
83 83
 	static public function getResizedImageSize($file, $target=25){
84 84
 		list($width, $height, $type, $attr) = getimagesize($file);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * Returns the generation associated with a Sosa number
234 234
 	 *
235 235
 	 * @param int $sosa Sosa number
236
-	 * @return number
236
+	 * @return integer
237 237
 	 */
238 238
 	public static function getGeneration($sosa){
239 239
 		return(int)log($sosa, 2)+1;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * Returns whether the image type is supported by the system, and if so, return the standardised type
247 247
 	 *
248 248
 	 * @param string $reqtype Extension to test
249
-	 * @return boolean|string Is supported?
249
+	 * @return false|string Is supported?
250 250
 	 */
251 251
 	public static function isImageTypeSupported($reqtype) {
252 252
 	    $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -116,16 +116,18 @@  discard block
 block discarded – undo
116 116
 		$len_chars = count($chars);
117 117
 		$token = '';
118 118
 		
119
-		for ($i = 0; $i < $length; $i++)
120
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
119
+		for ($i = 0; $i < $length; $i++) {
120
+					$token .= $chars[ mt_rand(0, $len_chars - 1) ];
121
+		}
121 122
 		
122 123
 		# Number of 32 char chunks
123 124
 		$chunks = ceil( strlen($token) / 32 );
124 125
 		$md5token = '';
125 126
 		
126 127
 		# Run each chunk through md5
127
-		for ( $i=1; $i<=$chunks; $i++ )
128
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
128
+		for ( $i=1; $i<=$chunks; $i++ ) {
129
+					$md5token .= md5( substr($token, $i * 32 - 32, 32) );
130
+		}
129 131
 		
130 132
 			# Trim the token
131 133
 		return substr($md5token, 0, $length);		
@@ -140,8 +142,9 @@  discard block
 block discarded – undo
140 142
 	 */
141 143
 	public static function encryptToSafeBase64($data){
142 144
 		$key = 'STANDARDKEYIFNOSERVER';
143
-		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE'])
144
-			$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
145
+		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) {
146
+					$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
147
+		}
145 148
 		$iv = mcrypt_create_iv(self::ENCRYPTION_IV_SIZE, MCRYPT_RAND);
146 149
 		$id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC,$iv);
147 150
 		$encrypted = base64_encode($iv.$id);
@@ -160,16 +163,19 @@  discard block
 block discarded – undo
160 163
 	 */
161 164
 	public static function decryptFromSafeBase64($encrypted){
162 165
 		$key = 'STANDARDKEYIFNOSERVER';
163
-		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE'])
164
-			$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
166
+		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) {
167
+					$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
168
+		}
165 169
 		$encrypted = str_replace('-', '+', $encrypted);
166 170
 		$encrypted = str_replace('_', '/', $encrypted);
167 171
 		$encrypted = str_replace('*', '=', $encrypted);
168 172
 		$encrypted = base64_decode($encrypted);
169
-		if(!$encrypted)
170
-			throw new InvalidArgumentException('The encrypted value is not in correct base64 format.');
171
-		if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) 
172
-			throw new InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
173
+		if(!$encrypted) {
174
+					throw new InvalidArgumentException('The encrypted value is not in correct base64 format.');
175
+		}
176
+		if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) {
177
+					throw new InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
178
+		}
173 179
 		$iv_dec = substr($encrypted, 0, self::ENCRYPTION_IV_SIZE);
174 180
 		$encrypted = substr($encrypted, self::ENCRYPTION_IV_SIZE);
175 181
 		$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv_dec);
@@ -210,7 +216,9 @@  discard block
 block discarded – undo
210 216
 	 * @return boolean True if path valid
211 217
 	 */
212 218
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
213
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
219
+		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) {
220
+			return true;
221
+		}
214 222
 		return false;
215 223
 	}
216 224
 	
Please login to merge, or discard this patch.
src/Webtrees/Functions/FunctionsPrint.php 2 patches
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * 
75 75
 	 * @param \Fisharebest\Webtrees\Place $place
76 76
 	 * @param string $icon_path
77
-	 * @param number $size
77
+	 * @param integer $size
78 78
 	 * @return string HTML code of the inserted flag
79 79
 	 */
80 80
 	public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) {
@@ -184,7 +184,6 @@  discard block
 block discarded – undo
184 184
 	/**
185 185
 	 * Format date to display short (just years)
186 186
 	 *
187
-	 * @param \Fisharebest\Webtrees\Fact $eventObj Fact to display date
188 187
 	 * @param boolean $anchor option to print a link to calendar
189 188
 	 * @return string HTML code for short date
190 189
 	 */
@@ -212,7 +211,6 @@  discard block
 block discarded – undo
212 211
 	/**
213 212
 	 * Format fact place to display short
214 213
 	 *
215
-	 * @param \Fisharebest\Webtrees\Fact $eventObj Fact to display date
216 214
 	 * @param string $format Format of the place
217 215
 	 * @param boolean $anchor option to print a link to placelist
218 216
 	 * @return string HTML code for short place
Please login to merge, or discard this patch.
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -160,7 +160,9 @@  discard block
 block discarded – undo
160 160
 	public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){
161 161
 		$html = '';
162 162
 		$tag = 'em';
163
-		if($isStrong) $tag = 'strong';
163
+		if($isStrong) {
164
+			$tag = 'strong';
165
+		}
164 166
 		if($individual && $individual->canShow()){
165 167
 			$dindi = new Individual($individual);
166 168
 			$html = $individual->getSexImage();
@@ -174,8 +176,7 @@  discard block
 block discarded – undo
174 176
 			$html .= '&nbsp;<span><small><em>'.$dindi->format_first_major_fact(WT_EVENTS_BIRT, 10).'</em></small></span>';
175 177
 			$html .= '&nbsp;<span><small><em>'.$dindi->format_first_major_fact(WT_EVENTS_DEAT, 10).'</em></small></span>';
176 178
 			$html .= '</a>';
177
-		}
178
-		else {
179
+		} else {
179 180
 			$html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>';
180 181
 		}
181 182
 		return $html;
@@ -195,8 +196,7 @@  discard block
 block discarded – undo
195 196
 		$date = $fact->getDate();
196 197
 		if($date->isOK()){
197 198
 			$html.=' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y');
198
-		}
199
-		else{
199
+		} else{
200 200
 			// 1 DEAT Y with no DATE => print YES
201 201
 			// 1 BIRT 2 SOUR @S1@ => print YES
202 202
 			// 1 DEAT N is not allowed
@@ -220,7 +220,9 @@  discard block
 block discarded – undo
220 220
 	public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){
221 221
 		$html='';
222 222
 		
223
-		if ($fact==null) return $html;
223
+		if ($fact==null) {
224
+			return $html;
225
+		}
224 226
 		$place = $fact->getPlace();
225 227
 		if($place){
226 228
 			$dplace = new Place($place);
@@ -339,7 +341,9 @@  discard block
 block discarded – undo
339 341
 					default:
340 342
 						break;
341 343
 				}
342
-				if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
344
+				if($image && $title) {
345
+					$html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
346
+				}
343 347
 				break;
344 348
 			default:
345 349
 				break;
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookInterfaces/CustomSimpleTagManager.php 1 patch
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -45,6 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @param string $element_name Element name from the edit interface, used to POST values for update
46 46
 	 * @param string $context Tag context
47 47
 	 * @param string $contextid Id of tag context
48
+	 * @return string
48 49
 	 */
49 50
 	public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null);
50 51
 	
@@ -53,6 +54,7 @@  discard block
 block discarded – undo
53 54
 	 * 
54 55
 	 * @param string $context Context of the edition
55 56
 	 * @param int $level Level to which add the tags
57
+	 * @return void
56 58
 	 */
57 59
 	public function hAddSimpleTag($context, $level);
58 60
 
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookInterfaces/FactSourceTextExtender.php 1 patch
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -19,6 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * Insert some content before the fact source text.
20 20
 	 * 
21 21
 	 * @param string $srec Source fact record
22
+	 * @return string
22 23
 	 */
23 24
 	public function hFactSourcePrepend($srec);
24 25
 	
@@ -26,6 +27,7 @@  discard block
 block discarded – undo
26 27
 	 * Insert some content after the fact source text.
27 28
 	 * 
28 29
 	 * @param string $srec Source fact record
30
+	 * @return void
29 31
 	 */
30 32
 	public function hFactSourceAppend($srec);
31 33
 	
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookInterfaces/RecordNameTextExtender.php 1 patch
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -21,6 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * Insert some content before the record name text.
22 22
 	 * 
23 23
 	 * @param GedcomRecord $grec Gedcom record
24
+	 * @return void
24 25
 	 */
25 26
 	public function hRecordNamePrepend(GedcomRecord $grec);
26 27
 	
@@ -28,6 +29,7 @@  discard block
 block discarded – undo
28 29
 	 * Insert some content after the record name text.
29 30
 	 * 
30 31
 	 * @param GedcomRecord $grec Gedcom record
32
+	 * @return string
31 33
 	 */
32 34
 	public function hRecordNameAppend(GedcomRecord $grec);
33 35
 	
Please login to merge, or discard this patch.
src/Webtrees/Individual.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * Returns an estimated birth place based on statistics on the base
94 94
 	 *
95 95
 	 * @param boolean $perc Should the coefficient of reliability be returned
96
-	 * @return string|array Estimated birth place if found, null otherwise
96
+	 * @return string Estimated birth place if found, null otherwise
97 97
 	 */
98 98
 	public function getEstimatedBirthPlace($perc=false){
99 99
 		if($bplace = $this->gedcomrecord->getBirthPlace()){
@@ -110,7 +110,6 @@  discard block
 block discarded – undo
110 110
 	/**
111 111
 	 * Returns a significant place for the individual
112 112
 	 *
113
-	 * @param boolean $perc Should the coefficient of reliability be returned
114 113
 	 * @return string|array Estimated birth place if found, null otherwise
115 114
 	 */
116 115
 	public function getSignificantPlace(){
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@  discard block
 block discarded – undo
66 66
 				$ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2);
67 67
 				if($ct2>0){
68 68
 					$this->_titles[$match2[1][0]][]= trim($match2[2][0]);
69
-				}
70
-				else{
69
+				} else{
71 70
 					$this->_titles[$titlefact->getValue()][]='';
72 71
 				}
73 72
 			}
@@ -99,8 +98,7 @@  discard block
 block discarded – undo
99 98
 		if($bplace = $this->gedcomrecord->getBirthPlace()){
100 99
 			if($perc){
101 100
 				return array ($bplace, 1);
102
-			}
103
-			else{
101
+			} else{
104 102
 				return $bplace;
105 103
 			}
106 104
 		}
@@ -169,7 +167,9 @@  discard block
 block discarded – undo
169 167
 	 * @return int Level of sources
170 168
 	 * */
171 169
 	public function isBirthSourced(){
172
-		if($this->_isbirthsourced != null) return $this->_isbirthsourced;
170
+		if($this->_isbirthsourced != null) {
171
+			return $this->_isbirthsourced;
172
+		}
173 173
 		$this->_isbirthsourced = $this->isFactSourced(WT_EVENTS_BIRT);
174 174
 		return $this->_isbirthsourced;
175 175
 	}
@@ -180,7 +180,9 @@  discard block
 block discarded – undo
180 180
 	* @return int Level of sources
181 181
 	* */
182 182
 	public function isDeathSourced(){
183
-		if($this->_isdeathsourced != null) return $this->_isdeathsourced;
183
+		if($this->_isdeathsourced != null) {
184
+			return $this->_isdeathsourced;
185
+		}
184 186
 		$this->_isdeathsourced = $this->isFactSourced(WT_EVENTS_DEAT);
185 187
 		return $this->_isdeathsourced;
186 188
 	}
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/AbstractTask.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
      * Set parameters of the Task
111 111
      *
112 112
      * @param bool $is_enabled Status of the task
113
-     * @param \DateTime $lastupdated Time of the last task run
113
+     * @param \DateTime $last_updated Time of the last task run
114 114
      * @param bool $last_result Result of the last run, true for success, false for failure
115 115
      * @param int $frequency Frequency of execution in minutes
116 116
      * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -236,7 +236,9 @@  discard block
 block discarded – undo
236 236
 	 * @return bool
237 237
 	 */
238 238
 	public function save() {
239
-	    if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
239
+	    if(!$this->provider) {
240
+	    	throw new \Exception('The task has not been initialised with a provider.');
241
+	    }
240 242
 		return $this->provider->updateTask($this);
241 243
 	}
242 244
 	
@@ -246,8 +248,9 @@  discard block
 block discarded – undo
246 248
      */
247 249
     public function execute(){
248 250
     
249
-        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
250
-            $this->is_running = false;
251
+        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) {
252
+                    $this->is_running = false;
253
+        }
251 254
     
252 255
         if(!$this->is_running){  //TODO put in place a time_out for running...
253 256
             //TODO Log the executions in the logs
@@ -261,7 +264,9 @@  discard block
 block discarded – undo
261 264
                 $this->last_updated = new \DateTime();
262 265
                 if($this->nb_occurrences > 0){
263 266
                     $this->nb_occurrences--;
264
-                    if($this->nb_occurrences == 0) $this->is_enabled = false;
267
+                    if($this->nb_occurrences == 0) {
268
+                    	$this->is_enabled = false;
269
+                    }
265 270
                 }
266 271
             }
267 272
             $this->is_running = false;
Please login to merge, or discard this patch.