Completed
Push — feature/code-analysis ( 110b5c...ddc57d )
by Jonathan
03:27
created
src/Webtrees/Module/WelcomeBlock/Views/WelcomeBlockConfigView.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,42 +28,42 @@
 block discarded – undo
28 28
         return '
29 29
             <tr>
30 30
                 <td class="descriptionbox wrap width33">' .
31
-                I18N::translate('Enable Piwik Statistics') .
31
+                I18N::translate('Enable Piwik Statistics').
32 32
                 // Ideally, would like to add helpLink, but this does not work for modules...
33 33
                 // FunctionsPrint::helpLink('piwik_enabled', $this->getName());
34 34
                 '</td>
35 35
                 <td class="optionbox">' .
36
-                FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')) .
36
+                FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')).
37 37
                 '</td>
38 38
             </tr>' .
39 39
             
40 40
             '<tr>
41 41
                 <td class="descriptionbox wrap width33">' .
42
-                I18N::translate('Piwik URL') .
42
+                I18N::translate('Piwik URL').
43 43
                 '</td>
44 44
                 <td class="optionbox">
45 45
                     <input type="text" name="piwik_url" size="45" value="' . 
46
-                    $this->data->get('piwik_url', '') . '" />
46
+                    $this->data->get('piwik_url', '').'" />
47 47
                 </td>
48 48
             </tr>' .
49 49
             
50 50
             '<tr>
51 51
                 <td class="descriptionbox wrap width33">' .
52
-                    I18N::translate('Piwik Token') .
52
+                    I18N::translate('Piwik Token').
53 53
                 '</td>
54 54
                 <td class="optionbox">
55 55
                     <input type="text" name="piwik_token" size="45" value="' . 
56
-                    $this->data->get('piwik_token', '') . '" />
56
+                    $this->data->get('piwik_token', '').'" />
57 57
                 </td>
58 58
             </tr>' .
59 59
             
60 60
             '<tr>
61 61
                 <td class="descriptionbox wrap width33">' .
62
-                    I18N::translate('Piwik Site ID') .
62
+                    I18N::translate('Piwik Site ID').
63 63
                 '</td>
64 64
                 <td class="optionbox">
65 65
                     <input type="text" name="piwik_siteid" size="4" value="' . 
66
-                    $this->data->get('piwik_siteid', '') . '" />
66
+                    $this->data->get('piwik_siteid', '').'" />
67 67
                 </td>
68 68
             </tr>' ;
69 69
         
Please login to merge, or discard this patch.
src/Webtrees/Module/WelcomeBlock/WelcomeBlockController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     public function index(PageController $parent_controller, Tree $tree, $block_id, $template) {        
45 45
         $view_bag = new ViewBag();
46 46
         
47
-        if($parent_controller && $tree) {
47
+        if ($parent_controller && $tree) {
48 48
         
49 49
             $view_bag->set('tree', $tree);
50 50
             $view_bag->set('indi', $parent_controller->getSignificantIndividual());
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
63 63
     			');
64 64
     
65 65
             if (Auth::isAdmin()) {
66
-                $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&amp;ged=' . $tree->getNameHtml() . '&amp;ctype=gedcom"></a>';
66
+                $title = '<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&amp;ged='.$tree->getNameHtml().'&amp;ctype=gedcom"></a>';
67 67
             } else {
68
-                $title='';
68
+                $title = '';
69 69
             }
70
-            $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>';
70
+            $title .= '<span dir="auto">'.$tree->getTitleHtml().'</span>';
71 71
     
72 72
             $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false);
73 73
             $view_bag->set('piwik_enabled', $piwik_enabled);
74
-            if($piwik_enabled) {
74
+            if ($piwik_enabled) {
75 75
                 $parent_controller->addInlineJavascript(
76 76
                     '$("#piwik_stats")
77 77
                         .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");'
78 78
                 );
79 79
             }
80 80
     
81
-            $content = ViewFactory::make('WelcomeBlock', $this,  new BaseController(), $view_bag)->getHtmlPartial();   
81
+            $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial();   
82 82
             
83 83
             if ($template) {
84 84
                 return Theme::theme()->formatBlock($id, $title, $class, $content);
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersionModule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     public function getConfigLink() {
65 65
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
66 66
         
67
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
67
+        return 'module.php?mod='.$this->getName().'&amp;mod_action=AdminConfig';
68 68
     }
69 69
     
70 70
     /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function getProvider() {
84 84
         global $WT_TREE;
85 85
         
86
-        if(!$this->provider) {
86
+        if (!$this->provider) {
87 87
             $this->provider = new GeoAnalysisProvider($WT_TREE);
88 88
         }
89 89
         return $this->provider;
Please login to merge, or discard this patch.
src/Webtrees/Fact.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	*
39 39
 	* @param \Fisharebest\Webtrees\Fact $fact_in The Fact to extend
40 40
 	*/
41
-	public function __construct(\Fisharebest\Webtrees\Fact $fact_in){
41
+	public function __construct(\Fisharebest\Webtrees\Fact $fact_in) {
42 42
 		$this->fact = $fact_in;
43 43
 	}
44 44
 	
@@ -54,22 +54,22 @@  discard block
 block discarded – undo
54 54
 	*
55 55
 	* @return int Level of sources
56 56
 	*/
57
-	public function isSourced(){
58
-		$isSourced=0;
57
+	public function isSourced() {
58
+		$isSourced = 0;
59 59
 		$date = $this->fact->getDate(false);
60
-		if($date->isOK()) {
61
-			$isSourced=-1;
62
-			if($date->qual1=='' && $date->minimumJulianDay() == $date->maximumJulianDay()){
63
-				$isSourced=-2;
60
+		if ($date->isOK()) {
61
+			$isSourced = -1;
62
+			if ($date->qual1 == '' && $date->minimumJulianDay() == $date->maximumJulianDay()) {
63
+				$isSourced = -2;
64 64
 				$citations = $this->fact->getCitations();
65
-				foreach($citations as $citation){
66
-					$isSourced=max($isSourced, 1);
67
-					if(preg_match('/3 _ACT (.*)/', $citation) ){
68
- 						$isSourced=max($isSourced, 2);
65
+				foreach ($citations as $citation) {
66
+					$isSourced = max($isSourced, 1);
67
+					if (preg_match('/3 _ACT (.*)/', $citation)) {
68
+ 						$isSourced = max($isSourced, 2);
69 69
  						preg_match_all("/4 DATE (.*)/", $citation, $datessource, PREG_SET_ORDER);
70
- 						foreach($datessource as $daterec){
70
+ 						foreach ($datessource as $daterec) {
71 71
  							$datesource = new Date($daterec[1]);
72
- 							if(abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN){
72
+ 							if (abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN) {
73 73
  								$isSourced = max($isSourced, 3); //If this level increases, do not forget to change the constant MAX_IS_SOURCED_LEVEL
74 74
  							}
75 75
  						}
Please login to merge, or discard this patch.
src/Webtrees/Mvc/Dispatcher.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
     public function handle(fw\Module\AbstractModule $module, $request) {
51 51
 		
52 52
 		$fq_modclass_name = get_class($module);
53
-		$ctrl_namespace = substr($fq_modclass_name, 0, - strlen('Module')) . '\\';
53
+		$ctrl_namespace = substr($fq_modclass_name, 0, - strlen('Module')).'\\';
54 54
 		
55
-		$args = explode( '@', $request, 2);
56
-		switch(count($args)) {
55
+		$args = explode('@', $request, 2);
56
+		switch (count($args)) {
57 57
 			case 1:
58 58
 				$ctrl_name = $args[0];
59 59
 				$method = 'index';
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 				break;
66 66
 		}
67 67
 		
68
-		$ctrl_class = $ctrl_namespace . $ctrl_name . 'Controller';
69
-		if(class_exists($ctrl_class) 
68
+		$ctrl_class = $ctrl_namespace.$ctrl_name.'Controller';
69
+		if (class_exists($ctrl_class) 
70 70
 		    && is_subclass_of($ctrl_class, '\\MyArtJaub\\Webtrees\\Mvc\\Controller\\MvcController')
71
-			&& $ctrl = new $ctrl_class($module) ) {
72
-			if(method_exists($ctrl, $method)) {
71
+			&& $ctrl = new $ctrl_class($module)) {
72
+			if (method_exists($ctrl, $method)) {
73 73
 				call_user_func_array(array($ctrl, $method), array());
74 74
 			}
75 75
 			 else {
Please login to merge, or discard this patch.
src/Webtrees/Mvc/View/ViewFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,13 +53,13 @@
 block discarded – undo
53 53
      */
54 54
     public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) 
55 55
     {
56
-        if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined');
57
-        if(!$ctrl) throw new \Exception('Base Controller not defined');
58
-        if(!$view_name) throw new \Exception('View not defined');
56
+        if (!$mvc_ctrl) throw new \Exception('Mvc Controller not defined');
57
+        if (!$ctrl) throw new \Exception('Base Controller not defined');
58
+        if (!$view_name) throw new \Exception('View not defined');
59 59
         
60 60
         $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl);
61
-        $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View';       
62
-        if(!class_exists($view_class)) throw new \Exception('View does not exist');
61
+        $view_class = $mvc_ctrl_refl->getNamespaceName().'\\Views\\'.$view_name.'View';       
62
+        if (!class_exists($view_class)) throw new \Exception('View does not exist');
63 63
         
64 64
         return new $view_class($ctrl, $data);
65 65
     }
Please login to merge, or discard this patch.
src/Webtrees/Mvc/View/AbstractView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
     public function render() {
46 46
 		global $controller;
47 47
 		
48
-        if(!$this->ctrl) throw new \Exception('Controller not initialised');
48
+        if (!$this->ctrl) throw new \Exception('Controller not initialised');
49 49
         
50 50
 		$controller = $this->ctrl;
51 51
         $this->ctrl->pageHeader();
Please login to merge, or discard this patch.
src/Webtrees/Mvc/View/ViewBag.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
      * @param bool $override
74 74
      */
75 75
     public function set($key, $value, $override = true) {
76
-        if(is_null($key)) return;
77
-        if(!$override && array_key_exists($key, $this->data)) return;
76
+        if (is_null($key)) return;
77
+        if (!$override && array_key_exists($key, $this->data)) return;
78 78
         $this->data[$key] = $value;        
79 79
     }
80 80
     
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      * @param string $key
108 108
      */
109 109
     public function __unset($key) {
110
-        unset($this->data[$key]);;
110
+        unset($this->data[$key]); ;
111 111
     }
112 112
     
113 113
 }
Please login to merge, or discard this patch.
src/Webtrees/ImageBuilder.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	*
63 63
 	* @param Media|null $media Reference media object
64 64
 	*/
65
-	public function __construct(Media $media = null){
65
+	public function __construct(Media $media = null) {
66 66
 	    $this->media = $media;
67 67
 	    $this->use_ttf = function_exists('imagettftext');
68 68
 	    $this->expire_offset = 3600 * 24;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @return ImageBuilder
88 88
 	 */
89 89
 	public function setExpireOffset($expireOffset) {
90
-	    if($expireOffset) $this->expire_offset = $expireOffset;
90
+	    if ($expireOffset) $this->expire_offset = $expireOffset;
91 91
 	    return $this;
92 92
 	}
93 93
 	
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @return ImageBuilder
108 108
 	 */
109 109
 	public function setShowWatermark($show_watermark) {
110
-	    if(!is_null($show_watermark)) $this->show_watermark = $show_watermark;
110
+	    if (!is_null($show_watermark)) $this->show_watermark = $show_watermark;
111 111
 	    return $this;
112 112
 	}
113 113
 	
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @return ImageBuilder
119 119
 	 */
120 120
 	public function setFontMaxSize($font_max_size) {
121
-	    if($font_max_size) $this->font_max_size = $font_max_size;
121
+	    if ($font_max_size) $this->font_max_size = $font_max_size;
122 122
 	    return $this;
123 123
 	}
124 124
 	
@@ -129,32 +129,32 @@  discard block
 block discarded – undo
129 129
 	 * @return ImageBuilder
130 130
 	 */
131 131
 	public function setFontColor($font_color) {
132
-	    if($font_color) $this->font_color = $font_color;
132
+	    if ($font_color) $this->font_color = $font_color;
133 133
 	    return $this;
134 134
 	}
135 135
 	
136 136
 	/**
137 137
 	 * Render the image to the output.
138 138
 	 */
139
-	public function render(){
139
+	public function render() {
140 140
 	    
141 141
 	    if (!$this->media || !$this->media->canShow()) {
142
-	        Log::addMediaLog('Image Builder error: >' . I18N::translate('Missing or private media object.'));
142
+	        Log::addMediaLog('Image Builder error: >'.I18N::translate('Missing or private media object.'));
143 143
 	        $this->renderError();
144 144
 	    }
145 145
 	    
146 146
 	    $serverFilename = $this->media->getServerFilename();
147 147
 	    
148 148
 	    if (!file_exists($serverFilename)) {
149
-	        Log::addMediaLog('Image Builder error: >'. I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<');
149
+	        Log::addMediaLog('Image Builder error: >'.I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<');
150 150
 	        $this->renderError();
151 151
 	    }
152 152
 	    
153 153
 	    $mimetype = $this->media->mimeType();
154 154
 	    $imgsize = $this->media->getImageAttributes();
155 155
 	    $filetime = $this->media->getFiletime();
156
-	    $filetimeHeader = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';	    
157
-	    $expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()) . ' GMT';
156
+	    $filetimeHeader = gmdate('D, d M Y H:i:s', $filetime).' GMT';	    
157
+	    $expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()).' GMT';
158 158
 	    
159 159
 	    $type = Functions::isImageTypeSupported($imgsize['ext']);
160 160
 	    $usewatermark = false;
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 	    }
187 187
 	    
188 188
 	    // add caching headers.  allow browser to cache file, but not proxy
189
-	    header('Last-Modified: ' . $filetimeHeader);
190
-	    header('ETag: "' . $etag . '"');
191
-	    header('Expires: ' . $expireHeader);
192
-	    header('Cache-Control: max-age=' . $this->getExpireOffset() . ', s-maxage=0, proxy-revalidate');
189
+	    header('Last-Modified: '.$filetimeHeader);
190
+	    header('ETag: "'.$etag.'"');
191
+	    header('Expires: '.$expireHeader);
192
+	    header('Cache-Control: max-age='.$this->getExpireOffset().', s-maxage=0, proxy-revalidate');
193 193
 	    
194 194
 	    // if this file is already in the user’s cache, don’t resend it
195 195
 	    // first check if the if_modified_since param matches
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 	    }	    
204 204
 
205 205
 	    // send headers for the image
206
-	    header('Content-Type: ' . $mimetype);
207
-	    header('Content-Disposition: filename="' . addslashes(basename($this->media->getFilename())) . '"');
206
+	    header('Content-Type: '.$mimetype);
207
+	    header('Content-Disposition: filename="'.addslashes(basename($this->media->getFilename())).'"');
208 208
 	     
209 209
 	    if ($usewatermark) {
210 210
 	        // generate the watermarked image
211
-	        $imCreateFunc = 'imagecreatefrom' . $type;
212
-	        $imSendFunc   = 'image' . $type;
211
+	        $imCreateFunc = 'imagecreatefrom'.$type;
212
+	        $imSendFunc   = 'image'.$type;
213 213
 	    
214 214
 	        if (function_exists($imCreateFunc) && function_exists($imSendFunc)) {
215 215
 	            $im = $imCreateFunc($serverFilename);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	            return;
223 223
 	        } else {
224 224
 	            // this image is defective.  log it
225
-	            Log::addMediaLog('Image Builder error: >' . I18N::translate('This media file is broken and cannot be watermarked.') . '< in file >' . $serverFilename . '< memory used: ' . memory_get_usage());
225
+	            Log::addMediaLog('Image Builder error: >'.I18N::translate('This media file is broken and cannot be watermarked.').'< in file >'.$serverFilename.'< memory used: '.memory_get_usage());
226 226
 	        }
227 227
 	    }
228 228
 	    
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	    $filesize = filesize($serverFilename);
231 231
 	    
232 232
 	    // set content-length header, send file
233
-	    header('Content-Length: ' . $filesize);
233
+	    header('Content-Length: '.$filesize);
234 234
 	    
235 235
 	    // Some servers disable fpassthru() and readfile()
236 236
 	    if (function_exists('readfile')) {
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     	$bgc    = imagecolorallocate($im, 255, 255, 255); /* set background color */
261 261
     	imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */
262 262
     
263
-    	$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
263
+    	$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT.Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
264 264
     
265 265
     	http_response_code(404);
266 266
     	header('Content-Type: image/png');
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	protected function applyWatermark($im) {
279 279
 	    
280 280
 	    // text to watermark with	    
281
-	    if(method_exists($this->media, 'getWatermarkText')) {
281
+	    if (method_exists($this->media, 'getWatermarkText')) {
282 282
 	       $word1_text = $this->media->getWatermarkText();
283 283
 	    }
284 284
 	    else {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	        $word1_text, 
291 291
 	        $this->font_max_size,
292 292
 	        $this->font_color,
293
-	        WT_ROOT . Config::FONT_DEJAVU_SANS_TTF,
293
+	        WT_ROOT.Config::FONT_DEJAVU_SANS_TTF,
294 294
 	        'top', 
295 295
 	        'left'
296 296
 	     );
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 * @param string $hexstr
410 410
 	 * @return int[]
411 411
 	 */
412
-	protected function hexrgb ($hexstr)
412
+	protected function hexrgb($hexstr)
413 413
 	{
414 414
 	    $int = hexdec($hexstr);
415 415
 	
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
      */
452 452
     function imageTtfTextErrorHandler($errno, $errstr) {
453 453
         // log the error
454
-        Log::addErrorLog('Image Builder error: >' . $errno . '/' . $errstr . '< while processing file >' . $this->media->getServerFilename() . '<');
454
+        Log::addErrorLog('Image Builder error: >'.$errno.'/'.$errstr.'< while processing file >'.$this->media->getServerFilename().'<');
455 455
     
456 456
         // change value of useTTF to false so the fallback watermarking can be used.
457 457
         $this->use_ttf = false;
Please login to merge, or discard this patch.