Passed
Push — master ( 9fd6b6...ce1e09 )
by Jonathan
05:22
created
src/Webtrees/Module/PatronymicLineage/Model/LineageBuilder.php 2 patches
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -54,30 +54,30 @@  discard block
 block discarded – undo
54 54
 	public function buildLineages() {				
55 55
 		$indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false);
56 56
 		
57
-		if(count($indis) == 0) return null;
57
+		if (count($indis) == 0) return null;
58 58
 		
59 59
 		$root_lineages = array();
60 60
 		
61
-		foreach($indis as $indi) {
61
+		foreach ($indis as $indi) {
62 62
 			$pid = $indi->getXref();
63
-			if(!isset($this->used_indis[$pid])){
63
+			if (!isset($this->used_indis[$pid])) {
64 64
 				//Find the root of the lineage
65 65
 				/** @var Fisharebest\Webtrees\Individual $indiFirst  */
66
-				$indiFirst= $this->getLineageRootIndividual($indi);
67
-				if($indiFirst){
66
+				$indiFirst = $this->getLineageRootIndividual($indi);
67
+				if ($indiFirst) {
68 68
 					$this->used_indis[$indiFirst->getXref()] = true;
69
-					if($indiFirst->canShow()){
69
+					if ($indiFirst->canShow()) {
70 70
 						//Check if the root individual has brothers and sisters, without parents
71 71
 						$indiChildFamily = $indiFirst->getPrimaryChildFamily();
72
-						if($indiChildFamily !== null){
72
+						if ($indiChildFamily !== null) {
73 73
 							$root_node = new LineageRootNode(null); 
74 74
 							$root_node->addFamily($indiChildFamily);
75 75
 						}
76
-						else{
76
+						else {
77 77
 							$root_node = new LineageRootNode($indiFirst);
78 78
 						}
79 79
 						$root_node = $this->buildLineage($root_node);		
80
-						if($root_node) $root_lineages[] = $root_node;
80
+						if ($root_node) $root_lineages[] = $root_node;
81 81
 					}
82 82
 				}
83 83
 			}
@@ -94,45 +94,45 @@  discard block
 block discarded – undo
94 94
 	 * @return (Individual|null) Root individual
95 95
 	 */
96 96
 	protected function getLineageRootIndividual(Individual $indi) {
97
-		$is_first=false;
97
+		$is_first = false;
98 98
 		$dindi = new \MyArtJaub\Webtrees\Individual($indi);
99
-		$indi_surname=$dindi->getUnprotectedPrimarySurname();
99
+		$indi_surname = $dindi->getUnprotectedPrimarySurname();
100 100
 		$resIndi = $indi;
101
-		while(!$is_first){
101
+		while (!$is_first) {
102 102
 			//Get the individual parents family
103
-			$fam=$resIndi->getPrimaryChildFamily();
104
-			if($fam){
105
-				$husb=$fam->getHusband();
106
-				$wife=$fam->getWife();
103
+			$fam = $resIndi->getPrimaryChildFamily();
104
+			if ($fam) {
105
+				$husb = $fam->getHusband();
106
+				$wife = $fam->getWife();
107 107
 				//If the father exists, take him
108
-				if($husb){
108
+				if ($husb) {
109 109
 					$dhusb = new \MyArtJaub\Webtrees\Individual($husb);
110
-					$dhusb->isNewAddition() ? $is_first = true : $resIndi=$husb;
110
+					$dhusb->isNewAddition() ? $is_first = true : $resIndi = $husb;
111 111
 				}
112 112
 				//If only a mother exists
113
-				else if($wife){
113
+				else if ($wife) {
114 114
 					$dwife = new \MyArtJaub\Webtrees\Individual($wife);
115
-					$wife_surname=$dwife->getUnprotectedPrimarySurname();
115
+					$wife_surname = $dwife->getUnprotectedPrimarySurname();
116 116
 					//Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical)
117
-					if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){
118
-						$resIndi=$wife;
117
+					if (!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0) {
118
+						$resIndi = $wife;
119 119
 					}
120
-					else{
121
-						$is_first=true;
120
+					else {
121
+						$is_first = true;
122 122
 					}
123 123
 				}
124
-				else{
125
-					$is_first=true;
124
+				else {
125
+					$is_first = true;
126 126
 				}
127 127
 			}
128
-			else{
129
-				$is_first=true;
128
+			else {
129
+				$is_first = true;
130 130
 			}
131 131
 		}
132
-		if(isset($this->used_indis[$resIndi->getXref()])){
132
+		if (isset($this->used_indis[$resIndi->getXref()])) {
133 133
 			return null;
134 134
 		}
135
-		else{
135
+		else {
136 136
 			return $resIndi;
137 137
 		}
138 138
 	}
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	 * @return LineageNode Computed lineage
146 146
 	 */
147 147
 	protected function buildLineage(LineageNode $node) {
148
-		if($node === null) return;
148
+		if ($node === null) return;
149 149
 		
150 150
 		$indi_surname = null;
151 151
 		
152 152
 		$indi_node = $node->getIndividual();			
153
-		if($indi_node) {
154
-			if(count($node->getFamiliesNodes()) == 0) {
153
+		if ($indi_node) {
154
+			if (count($node->getFamiliesNodes()) == 0) {
155 155
 				$indiSpouseFamilies = $indi_node->getSpouseFamilies();
156
-				foreach($indiSpouseFamilies as $indiSpouseFamily) {
156
+				foreach ($indiSpouseFamilies as $indiSpouseFamily) {
157 157
 					$node->addFamily($indiSpouseFamily);
158 158
 				}
159 159
 			}
@@ -162,62 +162,62 @@  discard block
 block discarded – undo
162 162
 			$indi_surname = $dindi_node->getUnprotectedPrimarySurname();
163 163
 			
164 164
 			//Get the estimated birth place and put it in the place table
165
-			$place=$dindi_node->getEstimatedBirthPlace(false);
166
-			if($place && strlen($place) > 0){
167
-				$place=trim($place);
165
+			$place = $dindi_node->getEstimatedBirthPlace(false);
166
+			if ($place && strlen($place) > 0) {
167
+				$place = trim($place);
168 168
 				$node->getRootNode()->addPlace(new Place($place, $this->tree));
169 169
 			}
170 170
 				
171 171
 			//Tag the individual as used
172
-			$this->used_indis[$indi_node->getXref()]=true;
172
+			$this->used_indis[$indi_node->getXref()] = true;
173 173
 		}
174 174
 		
175
-		foreach($node->getFamiliesNodes() as $family) {
175
+		foreach ($node->getFamiliesNodes() as $family) {
176 176
 			$spouse_surname = null;
177
-			if($indi_node && $spouse = $family->getSpouse($indi_node)) {
177
+			if ($indi_node && $spouse = $family->getSpouse($indi_node)) {
178 178
 				$dspouse = new \MyArtJaub\Webtrees\Individual($spouse);
179
-				$spouse_surname=$dspouse->getUnprotectedPrimarySurname();
179
+				$spouse_surname = $dspouse->getUnprotectedPrimarySurname();
180 180
 			}
181 181
 			
182 182
 			$children = $family->getChildren();
183 183
 
184
-			$nbChildren=0;
185
-			$nbNatural=0;
184
+			$nbChildren = 0;
185
+			$nbNatural = 0;
186 186
 			
187
-			foreach($children as $child){
187
+			foreach ($children as $child) {
188 188
 				$dchild = new \MyArtJaub\Webtrees\Individual($child);
189
-				$child_surname=$dchild->getUnprotectedPrimarySurname();
189
+				$child_surname = $dchild->getUnprotectedPrimarySurname();
190 190
 				
191
-				if(!$dchild->isNewAddition()) {
191
+				if (!$dchild->isNewAddition()) {
192 192
 					$nbChildren++;
193 193
 					//If the root individual is the mother
194
-					if($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) {
194
+					if ($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) {
195 195
 						//Print only lineages of children with the same surname as their mother (supposing they are natural children)
196
-						if(!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)){
197
-							if(I18N::strcasecmp($child_surname, $indi_surname) == 0){
196
+						if (!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)) {
197
+							if (I18N::strcasecmp($child_surname, $indi_surname) == 0) {
198 198
 								$nbNatural++;
199 199
 								$node_child = new LineageNode($child, $node->getRootNode());							
200 200
 								$node_child = $this->buildLineage($node_child);
201
-								if($node_child) $node->addChild($family, $node_child);
201
+								if ($node_child) $node->addChild($family, $node_child);
202 202
 							}
203 203
 						}
204 204
 					}
205 205
 					//If the root individual is the father
206 206
 					else {
207 207
 						//Print if the children does not bear the same name as his mother (and different from his father)
208
-						if( strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 ||
208
+						if (strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 ||
209 209
 							I18N::strcasecmp($child_surname, $indi_surname) == 0 ||
210
-							I18N::strcasecmp($child_surname, $spouse_surname) != 0 )
210
+							I18N::strcasecmp($child_surname, $spouse_surname) != 0)
211 211
 						{
212 212
 							$nbNatural++;
213 213
 							$node_child = new LineageNode($child, $node->getRootNode());							
214 214
 							$node_child = $this->buildLineage($node_child);
215
-							if($node_child) $node->addChild($family, $node_child);
215
+							if ($node_child) $node->addChild($family, $node_child);
216 216
 						}
217 217
 						else {
218 218
 							$nbNatural++;
219 219
 							$node_child = new LineageNode($child, $node->getRootNode(), $child_surname);
220
-							if($node_child) $node->addChild($family, $node_child);
220
+							if ($node_child) $node->addChild($family, $node_child);
221 221
 						}
222 222
 					}
223 223
 				}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 
227 227
 			//Do not print other children
228
-			if(($nbChildren-$nbNatural)>0){
228
+			if (($nbChildren - $nbNatural) > 0) {
229 229
 				$node->addChild($family, null);
230 230
 			}
231 231
 		}
Please login to merge, or discard this patch.
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 	public function buildLineages() {				
55 55
 		$indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false);
56 56
 		
57
-		if(count($indis) == 0) return null;
57
+		if(count($indis) == 0) {
58
+			return null;
59
+		}
58 60
 		
59 61
 		$root_lineages = array();
60 62
 		
@@ -72,12 +74,13 @@  discard block
 block discarded – undo
72 74
 						if($indiChildFamily !== null){
73 75
 							$root_node = new LineageRootNode(null); 
74 76
 							$root_node->addFamily($indiChildFamily);
75
-						}
76
-						else{
77
+						} else{
77 78
 							$root_node = new LineageRootNode($indiFirst);
78 79
 						}
79 80
 						$root_node = $this->buildLineage($root_node);		
80
-						if($root_node) $root_lineages[] = $root_node;
81
+						if($root_node) {
82
+							$root_lineages[] = $root_node;
83
+						}
81 84
 					}
82 85
 				}
83 86
 			}
@@ -116,23 +119,19 @@  discard block
 block discarded – undo
116 119
 					//Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical)
117 120
 					if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){
118 121
 						$resIndi=$wife;
119
-					}
120
-					else{
122
+					} else{
121 123
 						$is_first=true;
122 124
 					}
123
-				}
124
-				else{
125
+				} else{
125 126
 					$is_first=true;
126 127
 				}
127
-			}
128
-			else{
128
+			} else{
129 129
 				$is_first=true;
130 130
 			}
131 131
 		}
132 132
 		if(isset($this->used_indis[$resIndi->getXref()])){
133 133
 			return null;
134
-		}
135
-		else{
134
+		} else{
136 135
 			return $resIndi;
137 136
 		}
138 137
 	}
@@ -145,7 +144,9 @@  discard block
 block discarded – undo
145 144
 	 * @return LineageNode Computed lineage
146 145
 	 */
147 146
 	protected function buildLineage(LineageNode $node) {
148
-		if($node === null) return;
147
+		if($node === null) {
148
+			return;
149
+		}
149 150
 		
150 151
 		$indi_surname = null;
151 152
 		
@@ -198,7 +199,9 @@  discard block
 block discarded – undo
198 199
 								$nbNatural++;
199 200
 								$node_child = new LineageNode($child, $node->getRootNode());							
200 201
 								$node_child = $this->buildLineage($node_child);
201
-								if($node_child) $node->addChild($family, $node_child);
202
+								if($node_child) {
203
+									$node->addChild($family, $node_child);
204
+								}
202 205
 							}
203 206
 						}
204 207
 					}
@@ -212,12 +215,15 @@  discard block
 block discarded – undo
212 215
 							$nbNatural++;
213 216
 							$node_child = new LineageNode($child, $node->getRootNode());							
214 217
 							$node_child = $this->buildLineage($node_child);
215
-							if($node_child) $node->addChild($family, $node_child);
216
-						}
217
-						else {
218
+							if($node_child) {
219
+								$node->addChild($family, $node_child);
220
+							}
221
+						} else {
218 222
 							$nbNatural++;
219 223
 							$node_child = new LineageNode($child, $node->getRootNode(), $child_surname);
220
-							if($node_child) $node->addChild($family, $node_child);
224
+							if($node_child) {
225
+								$node->addChild($family, $node_child);
226
+							}
221 227
 						}
222 228
 					}
223 229
 				}
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/Model/CertificateFileProvider.php 2 patches
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -20,111 +20,111 @@
 block discarded – undo
20 20
  */
21 21
 class CertificateFileProvider implements CertificateProviderInterface {
22 22
     
23
-    /**
24
-     * Relative path to the root certificate folder
25
-     * @var string $root_path
26
-     */
27
-    protected $root_path;
23
+	/**
24
+	 * Relative path to the root certificate folder
25
+	 * @var string $root_path
26
+	 */
27
+	protected $root_path;
28 28
     
29
-    /**
30
-     * Reference tree
31
-     * @var Tree $tree
32
-     */
33
-    protected $tree;
29
+	/**
30
+	 * Reference tree
31
+	 * @var Tree $tree
32
+	 */
33
+	protected $tree;
34 34
     
35
-    /**
36
-     * Cached list of certificates' cities.
37
-     * @var (null|array) $cities_list
38
-     */
39
-    protected $cities_list = null;
35
+	/**
36
+	 * Cached list of certificates' cities.
37
+	 * @var (null|array) $cities_list
38
+	 */
39
+	protected $cities_list = null;
40 40
     
41
-    /**
42
-     * Constructor for the File Provider
43
-     * @param string $root_path
44
-     * @param Tree $tree
45
-     */
46
-    public function __construct($root_path, Tree $tree) {
47
-        $this->root_path = $root_path;
48
-        $this->tree = $tree;
49
-    }
41
+	/**
42
+	 * Constructor for the File Provider
43
+	 * @param string $root_path
44
+	 * @param Tree $tree
45
+	 */
46
+	public function __construct($root_path, Tree $tree) {
47
+		$this->root_path = $root_path;
48
+		$this->tree = $tree;
49
+	}
50 50
         
51
-    /**
52
-     * {@inhericDoc}
53
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory()
54
-     */
55
-    public function getRealCertificatesDirectory(){
56
-        return WT_DATA_DIR . $this->root_path;
57
-    }
51
+	/**
52
+	 * {@inhericDoc}
53
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory()
54
+	 */
55
+	public function getRealCertificatesDirectory(){
56
+		return WT_DATA_DIR . $this->root_path;
57
+	}
58 58
     
59
-    /**
60
-     * {@inhericDoc}
61
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList()
62
-     */
63
-    public function getCitiesList(){
64
-        if(!isset($this->cities_list) || is_null($this->cities_list)){
65
-            $certdir = $this->getRealCertificatesDirectory();
66
-            $this->cities_list = array();
59
+	/**
60
+	 * {@inhericDoc}
61
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList()
62
+	 */
63
+	public function getCitiesList(){
64
+		if(!isset($this->cities_list) || is_null($this->cities_list)){
65
+			$certdir = $this->getRealCertificatesDirectory();
66
+			$this->cities_list = array();
67 67
     
68
-            $dir = opendir($certdir);
68
+			$dir = opendir($certdir);
69 69
             
70
-            while($entry = readdir($dir)){
71
-                if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){
72
-                    $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry);
73
-                }
74
-            }
75
-            sort($this->cities_list);
76
-        }
77
-        return $this->cities_list;
78
-    }
70
+			while($entry = readdir($dir)){
71
+				if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){
72
+					$this->cities_list[]= Functions::encodeFileSystemToUtf8($entry);
73
+				}
74
+			}
75
+			sort($this->cities_list);
76
+		}
77
+		return $this->cities_list;
78
+	}
79 79
     
80
-    /**
81
-     * {@inhericDoc}
82
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList()
83
-     */
84
-    public function getCertificatesList($selCity){
80
+	/**
81
+	 * {@inhericDoc}
82
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList()
83
+	 */
84
+	public function getCertificatesList($selCity){
85 85
     
86
-        $selCity = Functions::encodeUtf8ToFileSystem($selCity);
86
+		$selCity = Functions::encodeUtf8ToFileSystem($selCity);
87 87
     
88
-        $certdir = $this->getRealCertificatesDirectory();
89
-        $tabCertif= array();
88
+		$certdir = $this->getRealCertificatesDirectory();
89
+		$tabCertif= array();
90 90
     
91
-        if(is_dir($certdir.$selCity)){
92
-            $dir=opendir($certdir.$selCity);
93
-            while($entry = readdir($dir)){
94
-                if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){
95
-                    $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry);
96
-                    $certificate = new Certificate($path, $this->tree, $this);
97
-                    if(Functions::isImageTypeSupported($certificate->extension())){
98
-                        $tabCertif[] = 	$certificate;
99
-                    }
100
-                }
101
-            }
102
-        }
103
-        return $tabCertif;
104
-    }
91
+		if(is_dir($certdir.$selCity)){
92
+			$dir=opendir($certdir.$selCity);
93
+			while($entry = readdir($dir)){
94
+				if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){
95
+					$path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry);
96
+					$certificate = new Certificate($path, $this->tree, $this);
97
+					if(Functions::isImageTypeSupported($certificate->extension())){
98
+						$tabCertif[] = 	$certificate;
99
+					}
100
+				}
101
+			}
102
+		}
103
+		return $tabCertif;
104
+	}
105 105
     
106
-    /**
107
-     * {@inhericDoc}
108
-     * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith()
109
-     */
110
-    public function getCertificatesListBeginWith($city, $contains, $limit= 9999){
111
-        $tabFiles= array();
112
-        $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/';
113
-        $contains = utf8_decode($contains);
114
-        $nbCert = 0;
106
+	/**
107
+	 * {@inhericDoc}
108
+	 * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith()
109
+	 */
110
+	public function getCertificatesListBeginWith($city, $contains, $limit= 9999){
111
+		$tabFiles= array();
112
+		$dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/';
113
+		$contains = utf8_decode($contains);
114
+		$nbCert = 0;
115 115
     
116
-        if(is_dir($dirPath)){
117
-            $dir=opendir($dirPath);
118
-            while(($entry = readdir($dir)) && $nbCert < $limit){
119
-                if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){
120
-                    $tabFiles[]= Functions::encodeFileSystemToUtf8($entry);
121
-                    $nbCert++;
122
-                }
123
-            }
124
-        }
125
-        sort($tabFiles);
126
-        return $tabFiles;
127
-    }
116
+		if(is_dir($dirPath)){
117
+			$dir=opendir($dirPath);
118
+			while(($entry = readdir($dir)) && $nbCert < $limit){
119
+				if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){
120
+					$tabFiles[]= Functions::encodeFileSystemToUtf8($entry);
121
+					$nbCert++;
122
+				}
123
+			}
124
+		}
125
+		sort($tabFiles);
126
+		return $tabFiles;
127
+	}
128 128
     
129 129
 }
130 130
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
      * {@inhericDoc}
53 53
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory()
54 54
      */
55
-    public function getRealCertificatesDirectory(){
56
-        return WT_DATA_DIR . $this->root_path;
55
+    public function getRealCertificatesDirectory() {
56
+        return WT_DATA_DIR.$this->root_path;
57 57
     }
58 58
     
59 59
     /**
60 60
      * {@inhericDoc}
61 61
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList()
62 62
      */
63
-    public function getCitiesList(){
64
-        if(!isset($this->cities_list) || is_null($this->cities_list)){
63
+    public function getCitiesList() {
64
+        if (!isset($this->cities_list) || is_null($this->cities_list)) {
65 65
             $certdir = $this->getRealCertificatesDirectory();
66 66
             $this->cities_list = array();
67 67
     
68 68
             $dir = opendir($certdir);
69 69
             
70
-            while($entry = readdir($dir)){
71
-                if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){
72
-                    $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry);
70
+            while ($entry = readdir($dir)) {
71
+                if ($entry != '.' && $entry != '..' && is_dir($certdir.$entry)) {
72
+                    $this->cities_list[] = Functions::encodeFileSystemToUtf8($entry);
73 73
                 }
74 74
             }
75 75
             sort($this->cities_list);
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
      * {@inhericDoc}
82 82
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList()
83 83
      */
84
-    public function getCertificatesList($selCity){
84
+    public function getCertificatesList($selCity) {
85 85
     
86 86
         $selCity = Functions::encodeUtf8ToFileSystem($selCity);
87 87
     
88 88
         $certdir = $this->getRealCertificatesDirectory();
89
-        $tabCertif= array();
89
+        $tabCertif = array();
90 90
     
91
-        if(is_dir($certdir.$selCity)){
92
-            $dir=opendir($certdir.$selCity);
93
-            while($entry = readdir($dir)){
94
-                if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){
91
+        if (is_dir($certdir.$selCity)) {
92
+            $dir = opendir($certdir.$selCity);
93
+            while ($entry = readdir($dir)) {
94
+                if ($entry != '.' && $entry != '..' && !is_dir($certdir.$entry.'/')) {
95 95
                     $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry);
96 96
                     $certificate = new Certificate($path, $this->tree, $this);
97
-                    if(Functions::isImageTypeSupported($certificate->extension())){
98
-                        $tabCertif[] = 	$certificate;
97
+                    if (Functions::isImageTypeSupported($certificate->extension())) {
98
+                        $tabCertif[] = $certificate;
99 99
                     }
100 100
                 }
101 101
             }
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
      * {@inhericDoc}
108 108
      * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith()
109 109
      */
110
-    public function getCertificatesListBeginWith($city, $contains, $limit= 9999){
111
-        $tabFiles= array();
112
-        $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/';
110
+    public function getCertificatesListBeginWith($city, $contains, $limit = 9999) {
111
+        $tabFiles = array();
112
+        $dirPath = $this->getRealCertificatesDirectory().Functions::encodeUtf8ToFileSystem($city).'/';
113 113
         $contains = utf8_decode($contains);
114 114
         $nbCert = 0;
115 115
     
116
-        if(is_dir($dirPath)){
117
-            $dir=opendir($dirPath);
118
-            while(($entry = readdir($dir)) && $nbCert < $limit){
119
-                if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){
120
-                    $tabFiles[]= Functions::encodeFileSystemToUtf8($entry);
116
+        if (is_dir($dirPath)) {
117
+            $dir = opendir($dirPath);
118
+            while (($entry = readdir($dir)) && $nbCert < $limit) {
119
+                if ($entry != '.' && $entry != '..' && $entry != 'Thumbs.db' && !is_dir($dirPath.$entry.'/') && stripos($entry, $contains) !== false) {
120
+                    $tabFiles[] = Functions::encodeFileSystemToUtf8($entry);
121 121
                     $nbCert++;
122 122
                 }
123 123
             }
Please login to merge, or discard this patch.
src/Webtrees/Functions/FunctionsPrint.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return string HTML code of the inserted flag
80 80
 	 */
81 81
 	public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) {
82
-	    return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />';
82
+		return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />';
83 83
 	}
84 84
 	
85 85
 	/**
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 * @return boolean
356 356
 	 */
357 357
 	public static function isDateWithinChartsRange(Date $date) {
358
-	    return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030;
358
+		return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030;
359 359
 	}
360 360
 
361 361
 }
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @return string List of elements
33 33
 	 */
34 34
 	public static function getListFromArray(array $array) {
35
-		$n=count($array);
35
+		$n = count($array);
36 36
 		switch ($n) {
37 37
 			case 0:
38 38
 				return '';
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 			default:
42 42
 				return implode(
43 43
 						/* I18N: list separator */ I18N::translate(', '), 
44
-						array_slice($array, 0, $n-1)
45
-					) .
46
-					/* I18N: last list separator, " and " in English, " et " in French  */ I18N::translate(' and ') . 
47
-					$array[$n-1];
44
+						array_slice($array, 0, $n - 1)
45
+					).
46
+					/* I18N: last list separator, " and " in English, " et " in French  */ I18N::translate(' and '). 
47
+					$array[$n - 1];
48 48
 		}
49 49
 	}
50 50
 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 			\MyArtJaub\Webtrees\Map\MapProviderInterface $mapProvider
61 61
 	) {
62 62
 		$place = $fact->getPlace();
63
-		if(!$place->isEmpty()) {
64
-			$iconPlace= $mapProvider->getPlaceIcon($place);	
65
-			if($iconPlace && strlen($iconPlace) > 0){
66
-				return	'<div class="fact_flag">'. self::htmlPlaceIcon($place, $iconPlace, 50). '</div>';
63
+		if (!$place->isEmpty()) {
64
+			$iconPlace = $mapProvider->getPlaceIcon($place);	
65
+			if ($iconPlace && strlen($iconPlace) > 0) {
66
+				return	'<div class="fact_flag">'.self::htmlPlaceIcon($place, $iconPlace, 50).'</div>';
67 67
 			}
68 68
 		}
69 69
 		return '';
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param number $size
78 78
 	 * @return string HTML code of the inserted flag
79 79
 	 */
80
-	public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) {
81
-	    return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />';
80
+	public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path, $size = 50) {
81
+	    return '<img class="flag_gm_h'.$size.'" src="'.$icon_path.'" title="'.$place->getGedcomName().'" alt="'.$place->getGedcomName().'" />';
82 82
 	}
83 83
 	
84 84
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		$minimum = PHP_INT_MAX;
97 97
 		$maximum = 1;
98 98
 		foreach ($list as $params) {
99
-			if(array_key_exists('count', $params)) {
99
+			if (array_key_exists('count', $params)) {
100 100
 				$maximum = max($maximum, $params['count']);
101 101
 				$minimum = min($minimum, $params['count']);
102 102
 			}
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 				$size = 75.0 + 125.0 * ($count - $minimum) / ($maximum - $minimum);
115 115
 			}
116 116
 			
117
-			$html .= '<a style="font-size:' . $size . '%" href="' . $url . '">';
117
+			$html .= '<a style="font-size:'.$size.'%" href="'.$url.'">';
118 118
 			if ($totals) {
119
-				$html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $text . '</span>', I18N::number($count));
119
+				$html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">'.$text.'</span>', I18N::number($count));
120 120
 			} else {
121 121
 				$html .= $text;
122 122
 			}
123 123
 			$html .= '</a>';
124 124
 		}
125
-		return '<div class="tag_cloud">' . $html . '</div>';
125
+		return '<div class="tag_cloud">'.$html.'</div>';
126 126
 	}
127 127
 	
128 128
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 * @param bool $isStrong Bolden the name ?
158 158
 	 * @return string HTML Code for individual item
159 159
 	 */
160
-	public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){
160
+	public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true) {
161 161
 		$html = '';
162 162
 		$tag = 'em';
163
-		if($isStrong) $tag = 'strong';
164
-		if($individual && $individual->canShow()){
163
+		if ($isStrong) $tag = 'strong';
164
+		if ($individual && $individual->canShow()) {
165 165
 			$dindi = new Individual($individual);
166 166
 			$html = $individual->getSexImage();
167 167
 			$html .= '<a class="list_item" href="'.
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 			$html .= '</a>';
177 177
 		}
178 178
 		else {
179
-			$html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>';
179
+			$html .= '<span class=\"list_item\"><'.$tag.'>'.I18N::translate('Private').'</'.$tag.'></span>';
180 180
 		}
181 181
 		return $html;
182 182
 	}
@@ -188,20 +188,20 @@  discard block
 block discarded – undo
188 188
 	 * @param boolean $anchor option to print a link to calendar
189 189
 	 * @return string HTML code for short date
190 190
 	 */
191
-	public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor=false) {
192
-		$html='';
191
+	public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor = false) {
192
+		$html = '';
193 193
 		$date = $fact->getDate();
194
-		if($date->isOK()){
195
-			$html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y');
194
+		if ($date->isOK()) {
195
+			$html .= ' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y');
196 196
 		}
197
-		else{
197
+		else {
198 198
 			// 1 DEAT Y with no DATE => print YES
199 199
 			// 1 BIRT 2 SOUR @S1@ => print YES
200 200
 			// 1 DEAT N is not allowed
201 201
 			// It is not proper GEDCOM form to use a N(o) value with an event tag to infer that it did not happen.
202 202
 			$factdetail = explode(' ', trim($fact->getGedcom()));
203 203
 			if (isset($factdetail) && (count($factdetail) == 3 && strtoupper($factdetail[2]) == 'Y') || (count($factdetail) == 4 && $factdetail[2] == 'SOUR')) {
204
-				$html.=I18N::translate('yes');
204
+				$html .= I18N::translate('yes');
205 205
 			}
206 206
 		}
207 207
 		return $html;
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 	 * @param boolean $anchor option to print a link to placelist
216 216
 	 * @return string HTML code for short place
217 217
 	 */
218
-	public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){
219
-		$html='';
218
+	public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor = false) {
219
+		$html = '';
220 220
 		
221 221
 		if ($fact === null) return $html;
222 222
 		$place = $fact->getPlace();
223
-		if($place){
223
+		if ($place) {
224 224
 			$dplace = new Place($place);
225 225
 			$html .= $dplace->htmlFormattedName($format, $anchor);
226 226
 		}
@@ -238,21 +238,21 @@  discard block
 block discarded – undo
238 238
 	 * @param string $size CSS size for the icon. A CSS style css_$size is required
239 239
 	 * @return string HTML code for the formatted Sosa numbers
240 240
 	 */
241
-	public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small'){
241
+	public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small') {
242 242
 		$html = '';
243
-		switch($format){
243
+		switch ($format) {
244 244
 			case 1:
245
-				if(count($sosatab)>0){
245
+				if (count($sosatab) > 0) {
246 246
 					$html = '<i class="icon-maj-sosa_'.$size.'" title="'.I18N::translate('Sosa').'"></i>';
247 247
 				}
248 248
 				break;
249 249
 			case 2:
250
-				if(count($sosatab)>0){
250
+				if (count($sosatab) > 0) {
251 251
 					ksort($sosatab);
252 252
 					$tmp_html = array();
253 253
 					foreach ($sosatab as $sosa => $gen) {
254 254
 						$tmp_html[] = sprintf(
255
-								'<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i>&nbsp;<strong>%2$d&nbsp;'.I18N::translate('(G%s)', $gen) .'</strong>',
255
+								'<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i>&nbsp;<strong>%2$d&nbsp;'.I18N::translate('(G%s)', $gen).'</strong>',
256 256
 								$size,
257 257
 								$sosa
258 258
 							);
@@ -278,15 +278,15 @@  discard block
 block discarded – undo
278 278
 	 * @param string $size CSS size for the icon. A CSS style css_$size is required
279 279
 	 * @return string HTML code for IsSourced icon
280 280
 	 */
281
-	public static function formatIsSourcedIcon($sourceType, $isSourced, $tag='EVEN', $format = 1, $size='normal'){
282
-		$html='';
283
-		$image=null;
284
-		$title=null;
285
-		switch($format){
281
+	public static function formatIsSourcedIcon($sourceType, $isSourced, $tag = 'EVEN', $format = 1, $size = 'normal') {
282
+		$html = '';
283
+		$image = null;
284
+		$title = null;
285
+		switch ($format) {
286 286
 			case 1:
287
-				switch($sourceType){
287
+				switch ($sourceType) {
288 288
 					case 'E':
289
-						switch($isSourced){
289
+						switch ($isSourced) {
290 290
 							case 0:
291 291
 								$image = 'event_unknown';
292 292
 								$title = I18N::translate('%s not found', GedcomTag::getLabel($tag));
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 						}
317 317
 						break;
318 318
 					case 'R':
319
-						switch($isSourced){
319
+						switch ($isSourced) {
320 320
 							case -1:
321 321
 								$image = 'record_notsourced';
322 322
 								$title = I18N::translate('%s not sourced', GedcomTag::getLabel($tag));
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 					default:
337 337
 						break;
338 338
 				}
339
-				if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
339
+				if ($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
340 340
 				break;
341 341
 			default:
342 342
 				break;
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->formatFirstMajorFact(WT_EVENTS_BIRT, 10).'</em></small></span>';
175 177
 			$html .= '&nbsp;<span><small><em>'.$dindi->formatFirstMajorFact(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;
@@ -193,8 +194,7 @@  discard block
 block discarded – undo
193 194
 		$date = $fact->getDate();
194 195
 		if($date->isOK()){
195 196
 			$html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y');
196
-		}
197
-		else{
197
+		} else{
198 198
 			// 1 DEAT Y with no DATE => print YES
199 199
 			// 1 BIRT 2 SOUR @S1@ => print YES
200 200
 			// 1 DEAT N is not allowed
@@ -218,7 +218,9 @@  discard block
 block discarded – undo
218 218
 	public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){
219 219
 		$html='';
220 220
 		
221
-		if ($fact === null) return $html;
221
+		if ($fact === null) {
222
+			return $html;
223
+		}
222 224
 		$place = $fact->getPlace();
223 225
 		if($place){
224 226
 			$dplace = new Place($place);
@@ -336,7 +338,9 @@  discard block
 block discarded – undo
336 338
 					default:
337 339
 						break;
338 340
 				}
339
-				if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
341
+				if($image && $title) {
342
+					$html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>';
343
+				}
340 344
 				break;
341 345
 			default:
342 346
 				break;
Please login to merge, or discard this patch.
src/Webtrees/Family.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 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;
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	*
45 45
 	* @return int Level of sources
46 46
 	* */
47
-	function isMarriageSourced(){
48
-		if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced;
47
+	function isMarriageSourced() {
48
+		if ($this->is_marriage_sourced !== null) return $this->is_marriage_sourced;
49 49
 		$this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC');
50 50
 		return $this->is_marriage_sourced;
51 51
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@
 block discarded – undo
45 45
 	* @return int Level of sources
46 46
 	* */
47 47
 	function isMarriageSourced(){
48
-		if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced;
48
+		if($this->is_marriage_sourced !== null) {
49
+			return $this->is_marriage_sourced;
50
+		}
49 51
 		$this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC');
50 52
 		return $this->is_marriage_sourced;
51 53
 	}
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@
 block discarded – undo
40 40
 	}
41 41
 	
42 42
 	/**
43
-	* Check if this family's marriages are sourced
44
-	*
45
-	* @return int Level of sources
46
-	* */
43
+	 * Check if this family's marriages are sourced
44
+	 *
45
+	 * @return int Level of sources
46
+	 * */
47 47
 	function isMarriageSourced(){
48 48
 		if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced;
49 49
 		$this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC');
Please login to merge, or discard this patch.
src/Webtrees/Individual.php 3 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -113,29 +113,29 @@  discard block
 block discarded – undo
113 113
 	 * @return string|array Estimated birth place if found, null otherwise
114 114
 	 */
115 115
 	public function getSignificantPlace(){
116
-	    if($bplace = $this->gedcomrecord->getBirthPlace()){
117
-	        return $bplace;
118
-	    }
116
+		if($bplace = $this->gedcomrecord->getBirthPlace()){
117
+			return $bplace;
118
+		}
119 119
 	
120
-	    foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) {
121
-	        if ($rplace) {
122
-	            return $rplace;
123
-	        }
124
-	    }
120
+		foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) {
121
+			if ($rplace) {
122
+				return $rplace;
123
+			}
124
+		}
125 125
 	
126
-	    if($dplace = $this->gedcomrecord->getDeathPlace()){
127
-	        return $dplace;
128
-	    }
126
+		if($dplace = $this->gedcomrecord->getDeathPlace()){
127
+			return $dplace;
128
+		}
129 129
 	
130
-	    foreach($this->gedcomrecord->getSpouseFamilies() as $fams) {
131
-	        foreach ($fams->getAllEventPlaces('RESI') as $rplace) {
132
-	            if ($rplace) {
133
-	                return $rplace;
134
-	            }
135
-	        }
136
-	    }
130
+		foreach($this->gedcomrecord->getSpouseFamilies() as $fams) {
131
+			foreach ($fams->getAllEventPlaces('RESI') as $rplace) {
132
+				if ($rplace) {
133
+					return $rplace;
134
+				}
135
+			}
136
+		}
137 137
 	
138
-	    return null;
138
+		return null;
139 139
 	}
140 140
 	
141 141
 	/**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return boolean Is the individual a Sosa ancestor
145 145
 	 */
146 146
 	public function isSosa(){
147
-	    return count($this->getSosaNumbers()) > 0;
147
+		return count($this->getSosaNumbers()) > 0;
148 148
 	}
149 149
 	
150 150
 	/**
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 	 * @return array List of Sosa numbers
156 156
 	 */
157 157
 	public function getSosaNumbers(){
158
-	    if($this->sosa === null) {
159
-	        $provider = new SosaProvider($this->gedcomrecord->getTree());
160
-	        $this->sosa = $provider->getSosaNumbers($this->gedcomrecord);	        
161
-	    }
162
-	    return $this->sosa;
158
+		if($this->sosa === null) {
159
+			$provider = new SosaProvider($this->gedcomrecord->getTree());
160
+			$this->sosa = $provider->getSosaNumbers($this->gedcomrecord);	        
161
+		}
162
+		return $this->sosa;
163 163
 	}
164 164
 		
165 165
 	/** 
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	}
175 175
 	
176 176
 	/**
177
-	* Check if this individual's death is sourced
178
-	*
179
-	* @return int Level of sources
180
-	* */
177
+	 * Check if this individual's death is sourced
178
+	 *
179
+	 * @return int Level of sources
180
+	 * */
181 181
 	public function isDeathSourced(){
182 182
 		if($this->is_death_sourced !== null) return $this->is_death_sourced;
183 183
 		$this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT);
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 class Individual extends GedcomRecord {
22 22
 
23 23
 	/** @var array|null List of titles the individal holds */	
24
-	protected $titles=null;
24
+	protected $titles = null;
25 25
 	
26 26
 	/** @var string|null Individual's primary surname, without any privacy applied to it */
27 27
 	protected $unprotected_prim_surname = null;
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 * @param null|string $gedcom
44 44
 	 * @return null|Individual
45 45
 	 */
46
-	public static function getIntance($xref, Tree $tree, $gedcom = null){
46
+	public static function getIntance($xref, Tree $tree, $gedcom = null) {
47 47
 		$indi = \Fisharebest\Webtrees\Individual::getInstance($xref, $tree, $gedcom);
48
-		if($indi){
48
+		if ($indi) {
49 49
 			return new Individual($indi);
50 50
 		}
51 51
 		return null;
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
 	 * 
57 57
 	 * @return array Array of titles
58 58
 	 */
59
-	public function getTitles(){
60
-		if(is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)){
59
+	public function getTitles() {
60
+		if (is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)) {
61 61
 			$pattern = '/(.*) (('.$module->getSetting('MAJ_TITLE_PREFIX', '').')(.*))/';
62
-			$this->titles=array();
62
+			$this->titles = array();
63 63
 			$titlefacts = $this->gedcomrecord->getFacts('TITL');
64
-			foreach($titlefacts as $titlefact){
64
+			foreach ($titlefacts as $titlefact) {
65 65
 				$ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2);
66
-				if($ct2>0){
67
-					$this->titles[$match2[1][0]][]= trim($match2[2][0]);
66
+				if ($ct2 > 0) {
67
+					$this->titles[$match2[1][0]][] = trim($match2[2][0]);
68 68
 				}
69
-				else{
70
-					$this->titles[$titlefact->getValue()][]='';
69
+				else {
70
+					$this->titles[$titlefact->getValue()][] = '';
71 71
 				}
72 72
 			}
73 73
 		}
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 * @return string Primary surname
82 82
 	 */
83 83
 	public function getUnprotectedPrimarySurname() {
84
-		if(!$this->unprotected_prim_surname){
85
-			$tmp=$this->gedcomrecord->getAllNames();
84
+		if (!$this->unprotected_prim_surname) {
85
+			$tmp = $this->gedcomrecord->getAllNames();
86 86
 			$this->unprotected_prim_surname = $tmp[$this->gedcomrecord->getPrimaryName()]['surname'];
87 87
 		}
88 88
 		return $this->unprotected_prim_surname;
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 	 * @param boolean $perc Should the coefficient of reliability be returned
95 95
 	 * @return string|array Estimated birth place if found, null otherwise
96 96
 	 */
97
-	public function getEstimatedBirthPlace($perc=false){
98
-		if($bplace = $this->gedcomrecord->getBirthPlace()){
99
-			if($perc){
100
-				return array ($bplace, 1);
97
+	public function getEstimatedBirthPlace($perc = false) {
98
+		if ($bplace = $this->gedcomrecord->getBirthPlace()) {
99
+			if ($perc) {
100
+				return array($bplace, 1);
101 101
 			}
102
-			else{
102
+			else {
103 103
 				return $bplace;
104 104
 			}
105 105
 		}
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * @param boolean $perc Should the coefficient of reliability be returned
113 113
 	 * @return string|array Estimated birth place if found, null otherwise
114 114
 	 */
115
-	public function getSignificantPlace(){
116
-	    if($bplace = $this->gedcomrecord->getBirthPlace()){
115
+	public function getSignificantPlace() {
116
+	    if ($bplace = $this->gedcomrecord->getBirthPlace()) {
117 117
 	        return $bplace;
118 118
 	    }
119 119
 	
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
 	        }
124 124
 	    }
125 125
 	
126
-	    if($dplace = $this->gedcomrecord->getDeathPlace()){
126
+	    if ($dplace = $this->gedcomrecord->getDeathPlace()) {
127 127
 	        return $dplace;
128 128
 	    }
129 129
 	
130
-	    foreach($this->gedcomrecord->getSpouseFamilies() as $fams) {
130
+	    foreach ($this->gedcomrecord->getSpouseFamilies() as $fams) {
131 131
 	        foreach ($fams->getAllEventPlaces('RESI') as $rplace) {
132 132
 	            if ($rplace) {
133 133
 	                return $rplace;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @return boolean Is the individual a Sosa ancestor
145 145
 	 */
146
-	public function isSosa(){
146
+	public function isSosa() {
147 147
 	    return count($this->getSosaNumbers()) > 0;
148 148
 	}
149 149
 	
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 	 * @uses \MyArtJaub\Webtrees\Functions\ModuleManager
155 155
 	 * @return array List of Sosa numbers
156 156
 	 */
157
-	public function getSosaNumbers(){
158
-	    if($this->sosa === null) {
157
+	public function getSosaNumbers() {
158
+	    if ($this->sosa === null) {
159 159
 	        $provider = new SosaProvider($this->gedcomrecord->getTree());
160 160
 	        $this->sosa = $provider->getSosaNumbers($this->gedcomrecord);	        
161 161
 	    }
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return int Level of sources
169 169
 	 * */
170
-	public function isBirthSourced(){
171
-		if($this->is_birth_sourced !== null) return $this->is_birth_sourced;
170
+	public function isBirthSourced() {
171
+		if ($this->is_birth_sourced !== null) return $this->is_birth_sourced;
172 172
 		$this->is_birth_sourced = $this->isFactSourced(WT_EVENTS_BIRT);
173 173
 		return $this->is_birth_sourced;
174 174
 	}
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	*
179 179
 	* @return int Level of sources
180 180
 	* */
181
-	public function isDeathSourced(){
182
-		if($this->is_death_sourced !== null) return $this->is_death_sourced;
181
+	public function isDeathSourced() {
182
+		if ($this->is_death_sourced !== null) return $this->is_death_sourced;
183 183
 		$this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT);
184 184
 		return $this->is_death_sourced;
185 185
 	}
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@  discard block
 block discarded – undo
65 65
 				$ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2);
66 66
 				if($ct2>0){
67 67
 					$this->titles[$match2[1][0]][]= trim($match2[2][0]);
68
-				}
69
-				else{
68
+				} else{
70 69
 					$this->titles[$titlefact->getValue()][]='';
71 70
 				}
72 71
 			}
@@ -98,8 +97,7 @@  discard block
 block discarded – undo
98 97
 		if($bplace = $this->gedcomrecord->getBirthPlace()){
99 98
 			if($perc){
100 99
 				return array ($bplace, 1);
101
-			}
102
-			else{
100
+			} else{
103 101
 				return $bplace;
104 102
 			}
105 103
 		}
@@ -168,7 +166,9 @@  discard block
 block discarded – undo
168 166
 	 * @return int Level of sources
169 167
 	 * */
170 168
 	public function isBirthSourced(){
171
-		if($this->is_birth_sourced !== null) return $this->is_birth_sourced;
169
+		if($this->is_birth_sourced !== null) {
170
+			return $this->is_birth_sourced;
171
+		}
172 172
 		$this->is_birth_sourced = $this->isFactSourced(WT_EVENTS_BIRT);
173 173
 		return $this->is_birth_sourced;
174 174
 	}
@@ -179,7 +179,9 @@  discard block
 block discarded – undo
179 179
 	* @return int Level of sources
180 180
 	* */
181 181
 	public function isDeathSourced(){
182
-		if($this->is_death_sourced !== null) return $this->is_death_sourced;
182
+		if($this->is_death_sourced !== null) {
183
+			return $this->is_death_sourced;
184
+		}
183 185
 		$this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT);
184 186
 		return $this->is_death_sourced;
185 187
 	}
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/AbstractTask.php 3 patches
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -20,253 +20,253 @@
 block discarded – undo
20 20
  */
21 21
 abstract class AbstractTask {
22 22
     
23
-    /**
24
-     * Time out for runnign tasks, in seconds. Default 5 min
25
-     * @var int TASK_TIME_OUT
26
-     */
27
-    const TASK_TIME_OUT = 300;
23
+	/**
24
+	 * Time out for runnign tasks, in seconds. Default 5 min
25
+	 * @var int TASK_TIME_OUT
26
+	 */
27
+	const TASK_TIME_OUT = 300;
28 28
               
29
-    /**
30
-     * Task provider
31
-     * @var TaskProviderInterface $provider
32
-     */
29
+	/**
30
+	 * Task provider
31
+	 * @var TaskProviderInterface $provider
32
+	 */
33 33
 	protected $provider;
34 34
 			
35 35
 	/**
36 36
 	 * Task name
37 37
 	 * @var string $name
38 38
 	 */
39
-    protected $name;
39
+	protected $name;
40 40
     
41
-    /**
42
-     * Status of the task
43
-     * @var bool $is_enabled
44
-     */
45
-    protected $is_enabled;
41
+	/**
42
+	 * Status of the task
43
+	 * @var bool $is_enabled
44
+	 */
45
+	protected $is_enabled;
46 46
     
47
-    /**
48
-     * Last updated date
49
-     * @var \DateTime $last_updated
50
-     */
51
-    protected $last_updated;
47
+	/**
48
+	 * Last updated date
49
+	 * @var \DateTime $last_updated
50
+	 */
51
+	protected $last_updated;
52 52
     
53
-    /**
54
-     * Last run result
55
-     * @var bool $last_result
56
-     */
57
-    protected $last_result;
53
+	/**
54
+	 * Last run result
55
+	 * @var bool $last_result
56
+	 */
57
+	protected $last_result;
58 58
     
59
-    /**
60
-     * Task run frequency
61
-     * @var int $frequency
62
-     */
63
-    protected $frequency;
59
+	/**
60
+	 * Task run frequency
61
+	 * @var int $frequency
62
+	 */
63
+	protected $frequency;
64 64
     
65
-    /**
66
-     * Task remaining runs
67
-     * @var int $nb_occurrences
68
-     */
69
-    protected $nb_occurrences;
65
+	/**
66
+	 * Task remaining runs
67
+	 * @var int $nb_occurrences
68
+	 */
69
+	protected $nb_occurrences;
70 70
     
71
-    /**
72
-     * Current running status of the task
73
-     * @var bool $is_running
74
-     */
75
-    protected $is_running;
71
+	/**
72
+	 * Current running status of the task
73
+	 * @var bool $is_running
74
+	 */
75
+	protected $is_running;
76 76
     
77
-    /**
78
-     * Constructor for the Admin task class
77
+	/**
78
+	 * Constructor for the Admin task class
79 79
 	 *
80 80
 	 * @param string $file Filename containing the task object
81 81
 	 * @param TaskProviderInterface $provider Provider for tasks
82
-     */
83
-    public function __construct($file, TaskProviderInterface $provider = null){
84
-        $this->name = trim(basename($file, '.php'));
82
+	 */
83
+	public function __construct($file, TaskProviderInterface $provider = null){
84
+		$this->name = trim(basename($file, '.php'));
85 85
 		$this->provider = $provider;
86
-    }
86
+	}
87 87
     
88
-    /**
89
-     * Get the provider.
90
-     *
91
-     * @return TaskProviderInterface 
92
-     */
93
-    public function getProvider(){
94
-        return $this->provider;
95
-    }
88
+	/**
89
+	 * Get the provider.
90
+	 *
91
+	 * @return TaskProviderInterface 
92
+	 */
93
+	public function getProvider(){
94
+		return $this->provider;
95
+	}
96 96
     
97
-    /**
98
-     * Set the provider.
99
-     *
100
-     * @param TaskProviderInterface $provider
101
-     * @return self Enable method-chaining
102
-     */
103
-    public function setProvider(TaskProviderInterface $provider){
104
-        $this->provider = $provider;
105
-        return $this;
106
-    }
97
+	/**
98
+	 * Set the provider.
99
+	 *
100
+	 * @param TaskProviderInterface $provider
101
+	 * @return self Enable method-chaining
102
+	 */
103
+	public function setProvider(TaskProviderInterface $provider){
104
+		$this->provider = $provider;
105
+		return $this;
106
+	}
107 107
     
108
-    /**
109
-     * Set parameters of the Task
110
-     *
111
-     * @param bool $is_enabled Status of the task
112
-     * @param \DateTime $lastupdated Time of the last task run
113
-     * @param bool $last_result Result of the last run, true for success, false for failure
114
-     * @param int $frequency Frequency of execution in minutes
115
-     * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited
116
-     * @param bool $is_running Indicates if the task is currently running
117
-     */
118
-    public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
119
-        $this->is_enabled = $is_enabled;
120
-        $this->last_updated = $last_updated;
121
-        $this->last_result = $last_result;
122
-        $this->frequency = $frequency;
123
-        $this->nb_occurrences = $nb_occur;
124
-        $this->is_running = $is_running;
125
-    }
108
+	/**
109
+	 * Set parameters of the Task
110
+	 *
111
+	 * @param bool $is_enabled Status of the task
112
+	 * @param \DateTime $lastupdated Time of the last task run
113
+	 * @param bool $last_result Result of the last run, true for success, false for failure
114
+	 * @param int $frequency Frequency of execution in minutes
115
+	 * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited
116
+	 * @param bool $is_running Indicates if the task is currently running
117
+	 */
118
+	public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
119
+		$this->is_enabled = $is_enabled;
120
+		$this->last_updated = $last_updated;
121
+		$this->last_result = $last_result;
122
+		$this->frequency = $frequency;
123
+		$this->nb_occurrences = $nb_occur;
124
+		$this->is_running = $is_running;
125
+	}
126 126
     
127
-    /**
128
-     * Get the name of the task
129
-     *
130
-     * @return string
131
-     */
132
-    public function getName(){
133
-        return $this->name;
134
-    }
127
+	/**
128
+	 * Get the name of the task
129
+	 *
130
+	 * @return string
131
+	 */
132
+	public function getName(){
133
+		return $this->name;
134
+	}
135 135
     
136 136
     
137
-    /**
138
-     * Return the status of the task in a boolean way
139
-     *
140
-     * @return boolean True if enabled
141
-     */
142
-    public function isEnabled(){
143
-        return $this->is_enabled;
144
-    }
137
+	/**
138
+	 * Return the status of the task in a boolean way
139
+	 *
140
+	 * @return boolean True if enabled
141
+	 */
142
+	public function isEnabled(){
143
+		return $this->is_enabled;
144
+	}
145 145
     
146
-    /**
147
-     * Get the last updated time.
148
-     *
149
-     * @return \DateTime
150
-     */
151
-    public function getLastUpdated(){
152
-        return $this->last_updated;
153
-    }
146
+	/**
147
+	 * Get the last updated time.
148
+	 *
149
+	 * @return \DateTime
150
+	 */
151
+	public function getLastUpdated(){
152
+		return $this->last_updated;
153
+	}
154 154
     
155
-    /**
156
-     * Check if the last result has been successful.
157
-     *
158
-     * @return bool
159
-     */
160
-    public function isLastRunSuccess(){
161
-        return $this->last_result;
162
-    }
155
+	/**
156
+	 * Check if the last result has been successful.
157
+	 *
158
+	 * @return bool
159
+	 */
160
+	public function isLastRunSuccess(){
161
+		return $this->last_result;
162
+	}
163 163
     
164
-    /**
165
-     * Get the task frequency.
166
-     *
167
-     * @return int
168
-     */
169
-    public function getFrequency(){
170
-        return $this->frequency;
171
-    }
164
+	/**
165
+	 * Get the task frequency.
166
+	 *
167
+	 * @return int
168
+	 */
169
+	public function getFrequency(){
170
+		return $this->frequency;
171
+	}
172 172
 	
173 173
 	/**
174
-     * Set the task frequency.
175
-     *
174
+	 * Set the task frequency.
175
+	 *
176 176
 	 * @param int $frequency
177
-     * @return self Enable method-chaining
178
-     */
179
-    public function setFrequency($frequency){
180
-        $this->frequency = $frequency;
177
+	 * @return self Enable method-chaining
178
+	 */
179
+	public function setFrequency($frequency){
180
+		$this->frequency = $frequency;
181 181
 		return $this;
182
-    }
182
+	}
183 183
     
184
-    /**
185
-     * Get the number of remaining occurrences.
186
-     *
187
-     * @return int
188
-     */
189
-    public function getRemainingOccurrences(){
190
-        return $this->nb_occurrences;
191
-    }
184
+	/**
185
+	 * Get the number of remaining occurrences.
186
+	 *
187
+	 * @return int
188
+	 */
189
+	public function getRemainingOccurrences(){
190
+		return $this->nb_occurrences;
191
+	}
192 192
 	
193 193
 	/**
194
-     * Set the number of remaining occurrences.
195
-     *
194
+	 * Set the number of remaining occurrences.
195
+	 *
196 196
 	 * @param int $nb_occur
197
-     * @return self Enable method-chaining
198
-     */
199
-    public function setRemainingOccurrences($nb_occur){
200
-        $this->nb_occurrences = $nb_occur;
197
+	 * @return self Enable method-chaining
198
+	 */
199
+	public function setRemainingOccurrences($nb_occur){
200
+		$this->nb_occurrences = $nb_occur;
201 201
 		return $this;
202
-    }
202
+	}
203 203
     
204
-    /**
205
-     * Check if the task if running.
206
-     *
207
-     * @return bool
208
-     */
209
-    public function isRunning(){
210
-        return $this->is_running;
211
-    }
204
+	/**
205
+	 * Check if the task if running.
206
+	 *
207
+	 * @return bool
208
+	 */
209
+	public function isRunning(){
210
+		return $this->is_running;
211
+	}
212 212
     
213 213
     
214
-    /**
215
-     * Return the name to display for the task
216
-     *
217
-     * @return string Title for the task
218
-     */
219
-    abstract public function getTitle();
214
+	/**
215
+	 * Return the name to display for the task
216
+	 *
217
+	 * @return string Title for the task
218
+	 */
219
+	abstract public function getTitle();
220 220
     
221
-    /**
222
-     * Return the default frequency for the execution of the task
223
-     *
224
-     * @return int Frequency for the execution of the task
225
-     */
226
-    abstract public function getDefaultFrequency();
221
+	/**
222
+	 * Return the default frequency for the execution of the task
223
+	 *
224
+	 * @return int Frequency for the execution of the task
225
+	 */
226
+	abstract public function getDefaultFrequency();
227 227
     
228
-    /**
229
-     * Execute the task's actions
230
-     */
231
-    abstract protected function executeSteps();
228
+	/**
229
+	 * Execute the task's actions
230
+	 */
231
+	abstract protected function executeSteps();
232 232
     
233 233
 	/**
234 234
 	 * Persist task state into database.
235 235
 	 * @return bool
236 236
 	 */
237 237
 	public function save() {
238
-	    if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
238
+		if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
239 239
 		return $this->provider->updateTask($this);
240 240
 	}
241 241
 	
242
-    /**
243
-     * Execute the task, default skeleton
244
-     *
245
-     */
246
-    public function execute(){
242
+	/**
243
+	 * Execute the task, default skeleton
244
+	 *
245
+	 */
246
+	public function execute(){
247 247
     
248
-        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
249
-            $this->is_running = false;
248
+		if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
249
+			$this->is_running = false;
250 250
     
251
-        if(!$this->is_running){
252
-            $this->last_result = false;
253
-            $this->is_running = true;
254
-            $this->save();
251
+		if(!$this->is_running){
252
+			$this->last_result = false;
253
+			$this->is_running = true;
254
+			$this->save();
255 255
     
256
-            Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
257
-            $this->last_result = $this->executeSteps();
258
-            if($this->last_result){
259
-                $this->last_updated = new \DateTime();
260
-                if($this->nb_occurrences > 0){
261
-                    $this->nb_occurrences--;
262
-                    if($this->nb_occurrences == 0) $this->is_enabled = false;
263
-                }
264
-            }
265
-            $this->is_running = false;
266
-            $this->save();
267
-            Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure'));
268
-        }
269
-    }
256
+			Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
257
+			$this->last_result = $this->executeSteps();
258
+			if($this->last_result){
259
+				$this->last_updated = new \DateTime();
260
+				if($this->nb_occurrences > 0){
261
+					$this->nb_occurrences--;
262
+					if($this->nb_occurrences == 0) $this->is_enabled = false;
263
+				}
264
+			}
265
+			$this->is_running = false;
266
+			$this->save();
267
+			Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure'));
268
+		}
269
+	}
270 270
     
271 271
     
272 272
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param string $file Filename containing the task object
81 81
 	 * @param TaskProviderInterface $provider Provider for tasks
82 82
      */
83
-    public function __construct($file, TaskProviderInterface $provider = null){
83
+    public function __construct($file, TaskProviderInterface $provider = null) {
84 84
         $this->name = trim(basename($file, '.php'));
85 85
 		$this->provider = $provider;
86 86
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return TaskProviderInterface 
92 92
      */
93
-    public function getProvider(){
93
+    public function getProvider() {
94 94
         return $this->provider;
95 95
     }
96 96
     
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param TaskProviderInterface $provider
101 101
      * @return self Enable method-chaining
102 102
      */
103
-    public function setProvider(TaskProviderInterface $provider){
103
+    public function setProvider(TaskProviderInterface $provider) {
104 104
         $this->provider = $provider;
105 105
         return $this;
106 106
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited
116 116
      * @param bool $is_running Indicates if the task is currently running
117 117
      */
118
-    public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
118
+    public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running) {
119 119
         $this->is_enabled = $is_enabled;
120 120
         $this->last_updated = $last_updated;
121 121
         $this->last_result = $last_result;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      *
130 130
      * @return string
131 131
      */
132
-    public function getName(){
132
+    public function getName() {
133 133
         return $this->name;
134 134
     }
135 135
     
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      *
140 140
      * @return boolean True if enabled
141 141
      */
142
-    public function isEnabled(){
142
+    public function isEnabled() {
143 143
         return $this->is_enabled;
144 144
     }
145 145
     
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      *
149 149
      * @return \DateTime
150 150
      */
151
-    public function getLastUpdated(){
151
+    public function getLastUpdated() {
152 152
         return $this->last_updated;
153 153
     }
154 154
     
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      *
158 158
      * @return bool
159 159
      */
160
-    public function isLastRunSuccess(){
160
+    public function isLastRunSuccess() {
161 161
         return $this->last_result;
162 162
     }
163 163
     
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      *
167 167
      * @return int
168 168
      */
169
-    public function getFrequency(){
169
+    public function getFrequency() {
170 170
         return $this->frequency;
171 171
     }
172 172
 	
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @param int $frequency
177 177
      * @return self Enable method-chaining
178 178
      */
179
-    public function setFrequency($frequency){
179
+    public function setFrequency($frequency) {
180 180
         $this->frequency = $frequency;
181 181
 		return $this;
182 182
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      *
187 187
      * @return int
188 188
      */
189
-    public function getRemainingOccurrences(){
189
+    public function getRemainingOccurrences() {
190 190
         return $this->nb_occurrences;
191 191
     }
192 192
 	
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * @param int $nb_occur
197 197
      * @return self Enable method-chaining
198 198
      */
199
-    public function setRemainingOccurrences($nb_occur){
199
+    public function setRemainingOccurrences($nb_occur) {
200 200
         $this->nb_occurrences = $nb_occur;
201 201
 		return $this;
202 202
     }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      *
207 207
      * @return bool
208 208
      */
209
-    public function isRunning(){
209
+    public function isRunning() {
210 210
         return $this->is_running;
211 211
     }
212 212
     
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @return bool
236 236
 	 */
237 237
 	public function save() {
238
-	    if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
238
+	    if (!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
239 239
 		return $this->provider->updateTask($this);
240 240
 	}
241 241
 	
@@ -243,23 +243,23 @@  discard block
 block discarded – undo
243 243
      * Execute the task, default skeleton
244 244
      *
245 245
      */
246
-    public function execute(){
246
+    public function execute() {
247 247
     
248
-        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
248
+        if ($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
249 249
             $this->is_running = false;
250 250
     
251
-        if(!$this->is_running){
251
+        if (!$this->is_running) {
252 252
             $this->last_result = false;
253 253
             $this->is_running = true;
254 254
             $this->save();
255 255
     
256 256
             Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
257 257
             $this->last_result = $this->executeSteps();
258
-            if($this->last_result){
258
+            if ($this->last_result) {
259 259
                 $this->last_updated = new \DateTime();
260
-                if($this->nb_occurrences > 0){
260
+                if ($this->nb_occurrences > 0) {
261 261
                     $this->nb_occurrences--;
262
-                    if($this->nb_occurrences == 0) $this->is_enabled = false;
262
+                    if ($this->nb_occurrences == 0) $this->is_enabled = false;
263 263
                 }
264 264
             }
265 265
             $this->is_running = false;
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -235,7 +235,9 @@  discard block
 block discarded – undo
235 235
 	 * @return bool
236 236
 	 */
237 237
 	public function save() {
238
-	    if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
238
+	    if(!$this->provider) {
239
+	    	throw new \Exception('The task has not been initialised with a provider.');
240
+	    }
239 241
 		return $this->provider->updateTask($this);
240 242
 	}
241 243
 	
@@ -245,8 +247,9 @@  discard block
 block discarded – undo
245 247
      */
246 248
     public function execute(){
247 249
     
248
-        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
249
-            $this->is_running = false;
250
+        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) {
251
+                    $this->is_running = false;
252
+        }
250 253
     
251 254
         if(!$this->is_running){
252 255
             $this->last_result = false;
@@ -259,7 +262,9 @@  discard block
 block discarded – undo
259 262
                 $this->last_updated = new \DateTime();
260 263
                 if($this->nb_occurrences > 0){
261 264
                     $this->nb_occurrences--;
262
-                    if($this->nb_occurrences == 0) $this->is_enabled = false;
265
+                    if($this->nb_occurrences == 0) {
266
+                    	$this->is_enabled = false;
267
+                    }
263 268
                 }
264 269
             }
265 270
             $this->is_running = false;
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookProviderInterface.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -16,51 +16,51 @@
 block discarded – undo
16 16
  */
17 17
 interface HookProviderInterface {
18 18
 
19
-    /**
20
-     * Return an instance of the hook linked to the specifed function / context
21
-     *
22
-     * @param string $hook_function
23
-     * @param string $hook_context
24
-     * @return Hook
25
-     */
26
-    public function get($hook_function, $hook_context = null);
19
+	/**
20
+	 * Return an instance of the hook linked to the specifed function / context
21
+	 *
22
+	 * @param string $hook_function
23
+	 * @param string $hook_context
24
+	 * @return Hook
25
+	 */
26
+	public function get($hook_function, $hook_context = null);
27 27
     
28
-    /**
29
-     * Return whether the Hook module is active and the table has been created.
30
-     *
31
-     * @uses \MyArtJaub\Webtrees\Module\ModuleManager to check if the module is operational
32
-     * @return bool True if module active and table created, false otherwise
33
-     */
34
-    public function isModuleOperational();
28
+	/**
29
+	 * Return whether the Hook module is active and the table has been created.
30
+	 *
31
+	 * @uses \MyArtJaub\Webtrees\Module\ModuleManager to check if the module is operational
32
+	 * @return bool True if module active and table created, false otherwise
33
+	 */
34
+	public function isModuleOperational();
35 35
     
36
-    /**
37
-     * Get the list of possible hooks in the list of modules files.
38
-     * A hook will be registered:
39
-     * 		- for all modules already registered in Webtrees
40
-     * 		- if the module implements HookSubscriberInterface
41
-     * 		- if the method exist within the module
42
-     *
43
-     * @return Array List of possible hooks, with the priority
44
-     */
45
-    public function getPossibleHooks();
36
+	/**
37
+	 * Get the list of possible hooks in the list of modules files.
38
+	 * A hook will be registered:
39
+	 * 		- for all modules already registered in Webtrees
40
+	 * 		- if the module implements HookSubscriberInterface
41
+	 * 		- if the method exist within the module
42
+	 *
43
+	 * @return Array List of possible hooks, with the priority
44
+	 */
45
+	public function getPossibleHooks();
46 46
     
47
-    /**
48
-     * Get the list of hooks intalled in webtrees, with their id, status and priority.
49
-     *
50
-     * @return array List of installed hooks
51
-     */
52
-    public function getRawInstalledHooks();
47
+	/**
48
+	 * Get the list of hooks intalled in webtrees, with their id, status and priority.
49
+	 *
50
+	 * @return array List of installed hooks
51
+	 */
52
+	public function getRawInstalledHooks();
53 53
     
54
-    /**
55
-     * Get the list of hooks intalled in webtrees, with their id, status and priority.
56
-     *
57
-     * @return Array List of installed hooks, with id, status and priority
58
-     */
59
-    public function getInstalledHooks();
54
+	/**
55
+	 * Get the list of hooks intalled in webtrees, with their id, status and priority.
56
+	 *
57
+	 * @return Array List of installed hooks, with id, status and priority
58
+	 */
59
+	public function getInstalledHooks();
60 60
     
61
-    /**
62
-     * Update the list of hooks, identifying missing ones and removed ones.
63
-     */
64
-    public function updateHooks();
61
+	/**
62
+	 * Update the list of hooks, identifying missing ones and removed ones.
63
+	 */
64
+	public function updateHooks();
65 65
     
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Controller/IndividualController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param \Fisharebest\Webtrees\Controller\IndividualController $ctrl_individual_in The Individual Controller to extend
34 34
 	 */
35
-	public function __construct(fw\Controller\IndividualController $ctrl_individual_in){
35
+	public function __construct(fw\Controller\IndividualController $ctrl_individual_in) {
36 36
 		$this->ctrl_individual = $ctrl_individual_in;
37 37
 		$this->dindi = new mw\Individual($this->ctrl_individual->getSignificantIndividual());
38 38
 	}
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * 
44 44
 	 * @uses \MyArtJaub\Webtrees\Hook\Hook
45 45
 	 */
46
-	public function printHeaderExtensions(){
46
+	public function printHeaderExtensions() {
47 47
 		$hook_extend_indi_header_left = new mw\Hook\Hook('hExtendIndiHeaderLeft');
48 48
 		$hook_extend_indi_header_right = new mw\Hook\Hook('hExtendIndiHeaderRight');
49 49
 		$hook_extend_indi_header_left = $hook_extend_indi_header_left->execute($this->ctrl_individual);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		echo '<div id="indi_perso_header">',
53 53
 			'<div id="indi_perso_header_left">';
54 54
 		foreach ($hook_extend_indi_header_left as $div) {
55
-			if(count($div)==2){
55
+			if (count($div) == 2) {
56 56
 				echo '<div id="', $div[0], '" class="indi_perso_header_left_div">',
57 57
 					$div[1], '</div>';
58 58
 			}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		echo '</div>',
61 61
 			'<div id="indi_perso_header_right">';
62 62
 		foreach ($hook_extend_indi_header_right as $div) {
63
-			if(count($div)==2){
63
+			if (count($div) == 2) {
64 64
 				echo '<div id="', $div[0], '" class="indi_perso_header_right_div">',
65 65
 					$div[1], '</div>';
66 66
 			}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @uses \MyArtJaub\Webtrees\Hook\Hook
77 77
 	 */
78
-	public function printHeaderExtraIcons(){
78
+	public function printHeaderExtraIcons() {
79 79
 		$hook_extend_indi_header_icons = new Hook('hExtendIndiHeaderIcons');
80 80
 		$hook_extend_indi_header_icons = $hook_extend_indi_header_icons->execute($this->ctrl_individual);
81 81
 		
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Schema/Migration0.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@
 block discarded – undo
24 24
 	 */
25 25
 	public function upgrade() {
26 26
 		Database::exec(
27
-		    'CREATE TABLE IF NOT EXISTS `##maj_admintasks` ('.
28
-		    ' majat_name 		    VARCHAR(32)                      NOT NULL,'.
29
-		    ' majat_status          ENUM(\'enabled\',\'disabled\') 	 NOT NULL DEFAULT \'disabled\','.
30
-		    ' majat_last_run 		DATETIME 					     NOT NULL DEFAULT \'2000-01-01 00:00:00\','.
31
-		    ' majat_last_result 	TINYINT(1)					     NOT NULL DEFAULT 1,'.		// 0 means error, 1 is success
32
-		    ' majat_frequency		INTEGER						     NOT NULL DEFAULT 10080,'.	// In min, Default every week
33
-		    ' majat_nb_occur	 	SMALLINT					     NOT NULL DEFAULT 0,'.
34
-		    ' majat_running 		TINYINT(1)					     NOT NULL DEFAULT 0,'.
35
-		    ' PRIMARY KEY (majat_name)'.
36
-		    ') COLLATE utf8_unicode_ci ENGINE=InnoDB'
27
+			'CREATE TABLE IF NOT EXISTS `##maj_admintasks` ('.
28
+			' majat_name 		    VARCHAR(32)                      NOT NULL,'.
29
+			' majat_status          ENUM(\'enabled\',\'disabled\') 	 NOT NULL DEFAULT \'disabled\','.
30
+			' majat_last_run 		DATETIME 					     NOT NULL DEFAULT \'2000-01-01 00:00:00\','.
31
+			' majat_last_result 	TINYINT(1)					     NOT NULL DEFAULT 1,'.		// 0 means error, 1 is success
32
+			' majat_frequency		INTEGER						     NOT NULL DEFAULT 10080,'.	// In min, Default every week
33
+			' majat_nb_occur	 	SMALLINT					     NOT NULL DEFAULT 0,'.
34
+			' majat_running 		TINYINT(1)					     NOT NULL DEFAULT 0,'.
35
+			' PRIMARY KEY (majat_name)'.
36
+			') COLLATE utf8_unicode_ci ENGINE=InnoDB'
37 37
 		);
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
 		    ' majat_name 		    VARCHAR(32)                      NOT NULL,'.
29 29
 		    ' majat_status          ENUM(\'enabled\',\'disabled\') 	 NOT NULL DEFAULT \'disabled\','.
30 30
 		    ' majat_last_run 		DATETIME 					     NOT NULL DEFAULT \'2000-01-01 00:00:00\','.
31
-		    ' majat_last_result 	TINYINT(1)					     NOT NULL DEFAULT 1,'.		// 0 means error, 1 is success
32
-		    ' majat_frequency		INTEGER						     NOT NULL DEFAULT 10080,'.	// In min, Default every week
31
+		    ' majat_last_result 	TINYINT(1)					     NOT NULL DEFAULT 1,'.// 0 means error, 1 is success
32
+		    ' majat_frequency		INTEGER						     NOT NULL DEFAULT 10080,'.// In min, Default every week
33 33
 		    ' majat_nb_occur	 	SMALLINT					     NOT NULL DEFAULT 0,'.
34 34
 		    ' majat_running 		TINYINT(1)					     NOT NULL DEFAULT 0,'.
35 35
 		    ' PRIMARY KEY (majat_name)'.
Please login to merge, or discard this patch.