Passed
Branch feature/2.1-geodispersion-dev (1d61a8)
by Jonathan
61:21
created
src/Webtrees/Functions/Functions.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public static function encodeFileSystemToUtf8($string){
186 186
 		if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
187
-		    return iconv('cp1252', 'utf-8//IGNORE',$string);
187
+			return iconv('cp1252', 'utf-8//IGNORE',$string);
188 188
 		}
189 189
 		return $string;
190 190
 	}
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
 	 * @return boolean|string Is supported?
250 250
 	 */
251 251
 	public static function isImageTypeSupported($reqtype) {
252
-	    $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
253
-	    $reqtype = strtolower($reqtype);
252
+		$supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
253
+		$reqtype = strtolower($reqtype);
254 254
 	
255
-	    if (empty($supportByGD[$reqtype])) {
256
-	        return false;
257
-	    }
255
+		if (empty($supportByGD[$reqtype])) {
256
+			return false;
257
+		}
258 258
 	
259
-	    $type = $supportByGD[$reqtype];
259
+		$type = $supportByGD[$reqtype];
260 260
 	
261
-	    if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
262
-	        return $type;
263
-	    }
261
+		if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
262
+			return $type;
263
+		}
264 264
 	
265
-	    return false;
265
+		return false;
266 266
 	}
267 267
 		
268 268
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string $text Text to display
34 34
 	 */
35
-	static public function promptAlert($text){
35
+	static public function promptAlert($text) {
36 36
 		echo '<script>';
37
-		echo 'alert("',fw\Filter::escapeHtml($text),'")';
37
+		echo 'alert("', fw\Filter::escapeHtml($text), '")';
38 38
 		echo '</script>';
39 39
 	}
40 40
 	
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @return float Result of the safe division
48 48
 	 */
49 49
 	public static function safeDivision($num, $denom, $default = 0) {
50
-		if($denom && $denom!=0){
50
+		if ($denom && $denom != 0) {
51 51
 			return $num / $denom;
52 52
 		}
53 53
 		return $default;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @param float $default Default value if denominator null or 0
62 62
 	 * @return float Percentage
63 63
 	 */
64
-	public static function getPercentage($num, $denom, $default = 0){
64
+	public static function getPercentage($num, $denom, $default = 0) {
65 65
 		return 100 * self::safeDivision($num, $denom, $default);
66 66
 	}
67 67
 	
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @param int $target	The final max width/height
73 73
 	 * @return array array of ($width, $height). One of them must be $target
74 74
 	 */
75
-	static public function getResizedImageSize($file, $target=25){
76
-		list($width, $height, , ) = getimagesize($file);
75
+	static public function getResizedImageSize($file, $target = 25) {
76
+		list($width, $height,,) = getimagesize($file);
77 77
 		$max = max($width, $height);
78 78
 		$rapp = $target / $max;
79 79
 		$width = intval($rapp * $width);
@@ -103,21 +103,21 @@  discard block
 block discarded – undo
103 103
 	 * @param int $length Length of the token, default to 32
104 104
 	 * @return string Random token
105 105
 	 */
106
-	public static function generateRandomToken($length=32) {
106
+	public static function generateRandomToken($length = 32) {
107 107
 		$chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
108 108
 		$len_chars = count($chars);
109 109
 		$token = '';
110 110
 		
111 111
 		for ($i = 0; $i < $length; $i++)
112
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
112
+			$token .= $chars[mt_rand(0, $len_chars - 1)];
113 113
 		
114 114
 		# Number of 32 char chunks
115
-		$chunks = ceil( strlen($token) / 32 );
115
+		$chunks = ceil(strlen($token) / 32);
116 116
 		$md5token = '';
117 117
 		
118 118
 		# Run each chunk through md5
119
-		for ( $i=1; $i<=$chunks; $i++ )
120
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
119
+		for ($i = 1; $i <= $chunks; $i++)
120
+			$md5token .= md5(substr($token, $i * 32 - 32, 32));
121 121
 		
122 122
 			# Trim the token
123 123
 		return substr($md5token, 0, $length);		
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	 * @param string $string Filesystem encoded string to encode
130 130
 	 * @return string UTF-8 encoded string
131 131
 	 */
132
-	public static function encodeFileSystemToUtf8($string){
132
+	public static function encodeFileSystemToUtf8($string) {
133 133
 		if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
134
-		    return iconv('cp1252', 'utf-8//IGNORE',$string);
134
+		    return iconv('cp1252', 'utf-8//IGNORE', $string);
135 135
 		}
136 136
 		return $string;
137 137
 	}
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 * @param string $string UTF-8 encoded string to encode
143 143
 	 * @return string Filesystem encoded string
144 144
 	 */
145
-	public static function encodeUtf8ToFileSystem($string){
145
+	public static function encodeUtf8ToFileSystem($string) {
146 146
 		if (preg_match('//u', $string) && strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
147
-			return iconv('utf-8', 'cp1252//IGNORE' ,  $string);
147
+			return iconv('utf-8', 'cp1252//IGNORE', $string);
148 148
 		}
149 149
 		return $string;
150 150
 	}
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return boolean True if path valid
158 158
 	 */
159 159
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
160
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
160
+		if (strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
161 161
 		return false;
162 162
 	}
163 163
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -108,16 +108,18 @@  discard block
 block discarded – undo
108 108
 		$len_chars = count($chars);
109 109
 		$token = '';
110 110
 		
111
-		for ($i = 0; $i < $length; $i++)
112
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
111
+		for ($i = 0; $i < $length; $i++) {
112
+					$token .= $chars[ mt_rand(0, $len_chars - 1) ];
113
+		}
113 114
 		
114 115
 		# Number of 32 char chunks
115 116
 		$chunks = ceil( strlen($token) / 32 );
116 117
 		$md5token = '';
117 118
 		
118 119
 		# Run each chunk through md5
119
-		for ( $i=1; $i<=$chunks; $i++ )
120
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
120
+		for ( $i=1; $i<=$chunks; $i++ ) {
121
+					$md5token .= md5( substr($token, $i * 32 - 32, 32) );
122
+		}
121 123
 		
122 124
 			# Trim the token
123 125
 		return substr($md5token, 0, $length);		
@@ -157,7 +159,9 @@  discard block
 block discarded – undo
157 159
 	 * @return boolean True if path valid
158 160
 	 */
159 161
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
160
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
162
+		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) {
163
+			return true;
164
+		}
161 165
 		return false;
162 166
 	}
163 167
 
Please login to merge, or discard this patch.
src/Webtrees/Family.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@
 block discarded – undo
30 30
 	 * @param string $gedcom
31 31
 	 * @return NULL|\MyArtJaub\Webtrees\Family
32 32
 	 */
33
-	public static function getIntance($xref, Tree $tree, $gedcom = null){
33
+	public static function getIntance($xref, Tree $tree, $gedcom = null) {
34 34
 		$dfam = null;
35 35
 		$fam = fw\Family::getInstance($xref, $tree, $gedcom);
36
-		if($fam){
36
+		if ($fam) {
37 37
 			$dfam = new Family($fam);
38 38
 		}
39 39
 		return $dfam;
Please login to merge, or discard this patch.
src/Webtrees/GedcomRecord.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 			if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) {
68 68
 				switch ($style) {
69 69
 					case 10:
70
-					    return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .'&nbsp;'. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>';
70
+						return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .'&nbsp;'. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>';
71 71
 					default:
72 72
 						return $this->gedcomrecord->formatFirstMajorFact($facts, $style);
73 73
 				}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @param \Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in The GedcomRecord to extend
29 29
 	 */
30
-	public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in){
30
+	public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in) {
31 31
 		$this->gedcomrecord = $gedcomrecord_in;
32 32
 	}
33 33
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @return \Fisharebest\Webtrees\GedcomRecord Embedded gedcom record
38 38
 	 */
39
-	public function getDerivedRecord(){
39
+	public function getDerivedRecord() {
40 40
 		return $this->gedcomrecord;
41 41
 	}
42 42
 	
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) {
68 68
 				switch ($style) {
69 69
 					case 10:
70
-					    return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .'&nbsp;'. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>';
70
+					    return '<i>'.$fact->getLabel().' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact).'&nbsp;'.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1').'</i>';
71 71
 					default:
72 72
 						return $this->gedcomrecord->formatFirstMajorFact($facts, $style);
73 73
 				}
Please login to merge, or discard this patch.
src/Webtrees/Contracts/GeoDispersion/ModulePlaceMapperProviderInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
  */
20 20
 interface ModulePlaceMapperProviderInterface
21 21
 {
22
-    /**
23
-     * List place mappers provided by the module as an array.
24
-     *
25
-     * @return string[] List of tasks
26
-     */
27
-    public function listPlaceMappers(): array;
22
+	/**
23
+	 * List place mappers provided by the module as an array.
24
+	 *
25
+	 * @return string[] List of tasks
26
+	 */
27
+	public function listPlaceMappers(): array;
28 28
 }
Please login to merge, or discard this patch.
src/Webtrees/Contracts/GeoDispersion/PlaceMapperInterface.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -21,47 +21,47 @@
 block discarded – undo
21 21
  */
22 22
 interface PlaceMapperInterface
23 23
 {   
24
-    /**
25
-     * Boot the Place mapper
26
-     */
27
-    function boot(): void;
24
+	/**
25
+	 * Boot the Place mapper
26
+	 */
27
+	function boot(): void;
28 28
     
29
-    /**
30
-     * Get the configuration associated to the mapper
31
-     * 
32
-     * @return PlaceMapperConfigInterface
33
-     */
34
-    function config(): PlaceMapperConfigInterface;
29
+	/**
30
+	 * Get the configuration associated to the mapper
31
+	 * 
32
+	 * @return PlaceMapperConfigInterface
33
+	 */
34
+	function config(): PlaceMapperConfigInterface;
35 35
     
36
-    /**
37
-     * Set the configured associated to the mapper
38
-     * 
39
-     * @param PlaceMapperConfigInterface $config
40
-     */
41
-    function setConfig(PlaceMapperConfigInterface $config): void;
36
+	/**
37
+	 * Set the configured associated to the mapper
38
+	 * 
39
+	 * @param PlaceMapperConfigInterface $config
40
+	 */
41
+	function setConfig(PlaceMapperConfigInterface $config): void;
42 42
     
43
-    /**
44
-     * Get the data associated to the mapper, for a specific key
45
-     * 
46
-     * @param string $key
47
-     * @return null|mixed
48
-     */
49
-    function data(string $key);
43
+	/**
44
+	 * Get the data associated to the mapper, for a specific key
45
+	 * 
46
+	 * @param string $key
47
+	 * @return null|mixed
48
+	 */
49
+	function data(string $key);
50 50
     
51
-    /**
52
-     * Set the data associated to the mapper, for a specific key
53
-     * 
54
-     * @param string $key
55
-     * @param mixed $data
56
-     */
57
-    function setData(string $key, $data): void;
51
+	/**
52
+	 * Set the data associated to the mapper, for a specific key
53
+	 * 
54
+	 * @param string $key
55
+	 * @param mixed $data
56
+	 */
57
+	function setData(string $key, $data): void;
58 58
     
59
-    /**
60
-     * Return the property value of the feature identifying a place in a GeoJson map.
61
-     * 
62
-     * @param Place $place
63
-     * @param string $feature_property
64
-     * @return string|NULL
65
-     */
66
-    function map(Place $place, string $feature_property) : ?string;
59
+	/**
60
+	 * Return the property value of the feature identifying a place in a GeoJson map.
61
+	 * 
62
+	 * @param Place $place
63
+	 * @param string $feature_property
64
+	 * @return string|NULL
65
+	 */
66
+	function map(Place $place, string $feature_property) : ?string;
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
Webtrees/Contracts/GeoDispersion/ModuleMapDefinitionProviderInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
  */
20 20
 interface ModuleMapDefinitionProviderInterface
21 21
 {
22
-    /**
23
-     * List map definitions provided by the module as an array.
24
-     *
25
-     * @return MapDefinitionInterface[] List of map definitions
26
-     */
27
-    public function listMapDefinition(): array;
22
+	/**
23
+	 * List map definitions provided by the module as an array.
24
+	 *
25
+	 * @return MapDefinitionInterface[] List of map definitions
26
+	 */
27
+	public function listMapDefinition(): array;
28 28
 }
Please login to merge, or discard this patch.
src/Webtrees/Contracts/GeoDispersion/PlaceMapperConfigInterface.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,28 +20,28 @@
 block discarded – undo
20 20
  */
21 21
 interface PlaceMapperConfigInterface extends JsonSerializable
22 22
 {
23
-    /**
24
-     * Deserialise the mapper configuration from a string or an array
25
-     * 
26
-     * @param mixed $config
27
-     * @return self
28
-     */
29
-    function jsonDeserialize($config): self;
23
+	/**
24
+	 * Deserialise the mapper configuration from a string or an array
25
+	 * 
26
+	 * @param mixed $config
27
+	 * @return self
28
+	 */
29
+	function jsonDeserialize($config): self;
30 30
     
31
-    /**
32
-     * Check if the configuration contains a specific key
33
-     * 
34
-     * @param string $key
35
-     * @return bool
36
-     */
37
-    function has(string $key): bool;
31
+	/**
32
+	 * Check if the configuration contains a specific key
33
+	 * 
34
+	 * @param string $key
35
+	 * @return bool
36
+	 */
37
+	function has(string $key): bool;
38 38
     
39
-    /**
40
-     * Return the configuration associated with a key, or a default value if none found.
41
-     * 
42
-     * @param string $key
43
-     * @param mixed|null $default
44
-     * @return mixed|null
45
-     */
46
-    function get(string $key, $default = null);
39
+	/**
40
+	 * Return the configuration associated with a key, or a default value if none found.
41
+	 * 
42
+	 * @param string $key
43
+	 * @param mixed|null $default
44
+	 * @return mixed|null
45
+	 */
46
+	function get(string $key, $default = null);
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Contracts/GeoDispersion/ModuleGeoAnalysisProviderInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@
 block discarded – undo
20 20
 interface ModuleGeoAnalysisProviderInterface
21 21
 {
22 22
 
23
-    /**
24
-     * List geographical analyses provided by the module as an array.
25
-     *
26
-     * @return string[] List of tasks
27
-     */
28
-    public function listGeoAnalyses(): array;
23
+	/**
24
+	 * List geographical analyses provided by the module as an array.
25
+	 *
26
+	 * @return string[] List of tasks
27
+	 */
28
+	public function listGeoAnalyses(): array;
29 29
 }
Please login to merge, or discard this patch.
src/Webtrees/Contracts/GeoDispersion/GeoAnalysisInterface.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,26 +21,26 @@
 block discarded – undo
21 21
  */
22 22
 interface GeoAnalysisInterface
23 23
 {
24
-    /**
25
-     * Get the geographical dispersion analysis title
26
-     * 
27
-     * @return string
28
-     */
29
-    function title(): string;
24
+	/**
25
+	 * Get the geographical dispersion analysis title
26
+	 * 
27
+	 * @return string
28
+	 */
29
+	function title(): string;
30 30
     
31
-    /**
32
-     * Gets the function to translate 
33
-     * 
34
-     * @return callable(int $count): string
35
-     */
36
-    function itemsDescription(): callable;
31
+	/**
32
+	 * Gets the function to translate 
33
+	 * 
34
+	 * @return callable(int $count): string
35
+	 */
36
+	function itemsDescription(): callable;
37 37
     
38
-    /**
39
-     * Get the results of the geographical dispersion analysis
40
-     * 
41
-     * @param Tree $tree
42
-     * @param int $depth
43
-     * @return GeoAnalysisResults
44
-     */
45
-    function results(Tree $tree, int $depth): GeoAnalysisResults;
38
+	/**
39
+	 * Get the results of the geographical dispersion analysis
40
+	 * 
41
+	 * @param Tree $tree
42
+	 * @param int $depth
43
+	 * @return GeoAnalysisResults
44
+	 */
45
+	function results(Tree $tree, int $depth): GeoAnalysisResults;
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.