Passed
Branch feature/2.1-geodispersion-dev (38d49e)
by Jonathan
04:17
created
src/Webtrees/Mvc/View/ViewFactory.php 3 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -17,87 +17,87 @@
 block discarded – undo
17 17
  */
18 18
 class ViewFactory {
19 19
     
20
-    /**
21
-     * @var ViewFactory $instance Singleton pattern instance
22
-     */
23
-    private static $instance = null;
20
+	/**
21
+	 * @var ViewFactory $instance Singleton pattern instance
22
+	 */
23
+	private static $instance = null;
24 24
     
25
-    /**
26
-     * Returns the *ViewFactory* instance of this class.
27
-     *
28
-     * @return ViewFactory The *Singleton* instance.
29
-     */
30
-    public static function getInstance()
31
-    {
32
-        if (null === static::$instance) {
33
-            static::$instance = new static();
34
-        }
25
+	/**
26
+	 * Returns the *ViewFactory* instance of this class.
27
+	 *
28
+	 * @return ViewFactory The *Singleton* instance.
29
+	 */
30
+	public static function getInstance()
31
+	{
32
+		if (null === static::$instance) {
33
+			static::$instance = new static();
34
+		}
35 35
     
36
-        return static::$instance;
37
-    }
36
+		return static::$instance;
37
+	}
38 38
     
39
-    /**
40
-     * Protected constructor
41
-     */
42
-    protected function __construct() {}
39
+	/**
40
+	 * Protected constructor
41
+	 */
42
+	protected function __construct() {}
43 43
               
44
-    /**
45
-     * Return the view specified by the controller and view name, using data from the ViewBag
46
-     * 
47
-     * @param string $view_name
48
-     * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
49
-     * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl
50
-     * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
51
-     * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View
52
-     * @throws \Exception
53
-     */
54
-    public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) 
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');
44
+	/**
45
+	 * Return the view specified by the controller and view name, using data from the ViewBag
46
+	 * 
47
+	 * @param string $view_name
48
+	 * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
49
+	 * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl
50
+	 * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
51
+	 * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View
52
+	 * @throws \Exception
53
+	 */
54
+	public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) 
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');
59 59
         
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');
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');
63 63
         
64
-        return new $view_class($ctrl, $data);
65
-    }
64
+		return new $view_class($ctrl, $data);
65
+	}
66 66
     
67
-    /**
68
-     * Static invocation of the makeView method
69
-     * 
70
-     * @param string $view_name
71
-     * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
72
-     * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl
73
-     * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
74
-     * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View
75
-     * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle()
76
-     */
77
-    public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) 
78
-    {
79
-        return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data);
80
-    }
67
+	/**
68
+	 * Static invocation of the makeView method
69
+	 * 
70
+	 * @param string $view_name
71
+	 * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl
72
+	 * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl
73
+	 * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data
74
+	 * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View
75
+	 * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle()
76
+	 */
77
+	public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) 
78
+	{
79
+		return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data);
80
+	}
81 81
     
82
-    /**
83
-     * Private clone method to prevent cloning of the instance of the
84
-     * *Dispatcher* instance.
85
-     *
86
-     * @return void
87
-     */
88
-    private function __clone()
89
-    {
90
-    }
82
+	/**
83
+	 * Private clone method to prevent cloning of the instance of the
84
+	 * *Dispatcher* instance.
85
+	 *
86
+	 * @return void
87
+	 */
88
+	private function __clone()
89
+	{
90
+	}
91 91
     
92
-    /**
93
-     * Private unserialize method to prevent unserializing of the *Dispatcher*
94
-     * instance.
95
-     *
96
-     * @return void
97
-     */
98
-    private function __wakeup()
99
-    {
100
-    }
92
+	/**
93
+	 * Private unserialize method to prevent unserializing of the *Dispatcher*
94
+	 * instance.
95
+	 *
96
+	 * @return void
97
+	 */
98
+	private function __wakeup()
99
+	{
100
+	}
101 101
     
102 102
 }
103 103
  
104 104
\ No newline at end of file
Please login to merge, or discard this 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.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,13 +53,21 @@
 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) {
57
+        	throw new \Exception('Mvc Controller not defined');
58
+        }
59
+        if(!$ctrl) {
60
+        	throw new \Exception('Base Controller not defined');
61
+        }
62
+        if(!$view_name) {
63
+        	throw new \Exception('View not defined');
64
+        }
59 65
         
60 66
         $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl);
61 67
         $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View';       
62
-        if(!class_exists($view_class)) throw new \Exception('View does not exist');
68
+        if(!class_exists($view_class)) {
69
+        	throw new \Exception('View does not exist');
70
+        }
63 71
         
64 72
         return new $view_class($ctrl, $data);
65 73
     }
Please login to merge, or discard this patch.
src/Webtrees/Mvc/View/ViewBag.php 3 patches
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.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,8 +73,12 @@
 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)) {
77
+        	return;
78
+        }
79
+        if(!$override && array_key_exists($key, $this->data)) {
80
+        	return;
81
+        }
78 82
         $this->data[$key] = $value;        
79 83
     }
80 84
     
Please login to merge, or discard this patch.
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -18,97 +18,97 @@
 block discarded – undo
18 18
 	/**
19 19
 	 * @var array $data Container for data
20 20
 	 */
21
-    protected $data = array();
21
+	protected $data = array();
22 22
     
23
-    /**
24
-     * Constructor for ViewBag
25
-     * @param array $data_in
26
-     */
27
-    public function __construct(array $data_in = array()) {
28
-        $this->data = $data_in;
29
-    }
23
+	/**
24
+	 * Constructor for ViewBag
25
+	 * @param array $data_in
26
+	 */
27
+	public function __construct(array $data_in = array()) {
28
+		$this->data = $data_in;
29
+	}
30 30
     
31
-    /**
32
-     * Get the keys present in the view bag.
33
-     *
34
-     * @return array
35
-     */
36
-    public function keys()
37
-    {
38
-        return array_keys($this->data);
39
-    }
31
+	/**
32
+	 * Get the keys present in the view bag.
33
+	 *
34
+	 * @return array
35
+	 */
36
+	public function keys()
37
+	{
38
+		return array_keys($this->data);
39
+	}
40 40
     
41
-    /**
42
-     * Get all the data from the bag for a given key.
43
-     *
44
-     * @param  string  $key
45
-     * @param  string  $format
46
-     * @return unknown
47
-     */
48
-    public function get($key, $default = null)
49
-    {
50
-        if (array_key_exists($key, $this->data)) {
51
-            return $this->data[$key];
52
-        }
53
-        return $default;
54
-    }
41
+	/**
42
+	 * Get all the data from the bag for a given key.
43
+	 *
44
+	 * @param  string  $key
45
+	 * @param  string  $format
46
+	 * @return unknown
47
+	 */
48
+	public function get($key, $default = null)
49
+	{
50
+		if (array_key_exists($key, $this->data)) {
51
+			return $this->data[$key];
52
+		}
53
+		return $default;
54
+	}
55 55
     
56
-    /**
57
-     * Magic getter.
58
-     * Returns the value associated with the key.
59
-     * 
60
-     * @param string $key
61
-     * @return unknown
62
-     */
63
-    public function __get($key) {
64
-        return $this->get($key, null);
65
-    }
56
+	/**
57
+	 * Magic getter.
58
+	 * Returns the value associated with the key.
59
+	 * 
60
+	 * @param string $key
61
+	 * @return unknown
62
+	 */
63
+	public function __get($key) {
64
+		return $this->get($key, null);
65
+	}
66 66
     
67
-    /**
68
-     * Set the value for the specified key.
69
-     * Can define whether to override an existing value;
70
-     * 
71
-     * @param string $key
72
-     * @param mixed $value
73
-     * @param bool $override
74
-     */
75
-    public function set($key, $value, $override = true) {
76
-        if(is_null($key)) return;
77
-        if(!$override && array_key_exists($key, $this->data)) return;
78
-        $this->data[$key] = $value;        
79
-    }
67
+	/**
68
+	 * Set the value for the specified key.
69
+	 * Can define whether to override an existing value;
70
+	 * 
71
+	 * @param string $key
72
+	 * @param mixed $value
73
+	 * @param bool $override
74
+	 */
75
+	public function set($key, $value, $override = true) {
76
+		if(is_null($key)) return;
77
+		if(!$override && array_key_exists($key, $this->data)) return;
78
+		$this->data[$key] = $value;        
79
+	}
80 80
     
81
-    /**
82
-     * Magic setter.
83
-     * Set the value for the specified key.
84
-     * 
85
-     * @param string $key
86
-     * @param mixed $value
87
-     */
88
-    public function __set($key, $value) {
89
-        $this->set($key, $value);
90
-    }
81
+	/**
82
+	 * Magic setter.
83
+	 * Set the value for the specified key.
84
+	 * 
85
+	 * @param string $key
86
+	 * @param mixed $value
87
+	 */
88
+	public function __set($key, $value) {
89
+		$this->set($key, $value);
90
+	}
91 91
     
92
-    /**
93
-     * Magic isset
94
-     * Checks whether the ViewBag contains the specified key
95
-     * 
96
-     * @param string $key
97
-     * @return bool
98
-     */
99
-    public function __isset($key) {
100
-        return isset($this->data[$key]);
101
-    }
92
+	/**
93
+	 * Magic isset
94
+	 * Checks whether the ViewBag contains the specified key
95
+	 * 
96
+	 * @param string $key
97
+	 * @return bool
98
+	 */
99
+	public function __isset($key) {
100
+		return isset($this->data[$key]);
101
+	}
102 102
     
103
-    /**
104
-     * Magic unset
105
-     * Unset the specified key from the ViewBag
106
-     * 
107
-     * @param string $key
108
-     */
109
-    public function __unset($key) {
110
-        unset($this->data[$key]);;
111
-    }
103
+	/**
104
+	 * Magic unset
105
+	 * Unset the specified key from the ViewBag
106
+	 * 
107
+	 * @param string $key
108
+	 */
109
+	public function __unset($key) {
110
+		unset($this->data[$key]);;
111
+	}
112 112
     
113 113
 }
114 114
  
115 115
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Functions/Functions.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public static function encodeFileSystemToUtf8($string){
186 186
 		if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
187
-		    return iconv('cp1252', 'utf-8//IGNORE',$string);
187
+			return iconv('cp1252', 'utf-8//IGNORE',$string);
188 188
 		}
189 189
 		return $string;
190 190
 	}
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
 	 * @return boolean|string Is supported?
250 250
 	 */
251 251
 	public static function isImageTypeSupported($reqtype) {
252
-	    $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
253
-	    $reqtype = strtolower($reqtype);
252
+		$supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
253
+		$reqtype = strtolower($reqtype);
254 254
 	
255
-	    if (empty($supportByGD[$reqtype])) {
256
-	        return false;
257
-	    }
255
+		if (empty($supportByGD[$reqtype])) {
256
+			return false;
257
+		}
258 258
 	
259
-	    $type = $supportByGD[$reqtype];
259
+		$type = $supportByGD[$reqtype];
260 260
 	
261
-	    if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
262
-	        return $type;
263
-	    }
261
+		if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
262
+			return $type;
263
+		}
264 264
 	
265
-	    return false;
265
+		return false;
266 266
 	}
267 267
 		
268 268
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string $text Text to display
34 34
 	 */
35
-	static public function promptAlert($text){
35
+	static public function promptAlert($text) {
36 36
 		echo '<script>';
37
-		echo 'alert("',fw\Filter::escapeHtml($text),'")';
37
+		echo 'alert("', fw\Filter::escapeHtml($text), '")';
38 38
 		echo '</script>';
39 39
 	}
40 40
 	
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @return float Result of the safe division
48 48
 	 */
49 49
 	public static function safeDivision($num, $denom, $default = 0) {
50
-		if($denom && $denom!=0){
50
+		if ($denom && $denom != 0) {
51 51
 			return $num / $denom;
52 52
 		}
53 53
 		return $default;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @param float $default Default value if denominator null or 0
62 62
 	 * @return float Percentage
63 63
 	 */
64
-	public static function getPercentage($num, $denom, $default = 0){
64
+	public static function getPercentage($num, $denom, $default = 0) {
65 65
 		return 100 * self::safeDivision($num, $denom, $default);
66 66
 	}
67 67
 	
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @param int $target	The final max width/height
73 73
 	 * @return array array of ($width, $height). One of them must be $target
74 74
 	 */
75
-	static public function getResizedImageSize($file, $target=25){
76
-		list($width, $height, , ) = getimagesize($file);
75
+	static public function getResizedImageSize($file, $target = 25) {
76
+		list($width, $height,,) = getimagesize($file);
77 77
 		$max = max($width, $height);
78 78
 		$rapp = $target / $max;
79 79
 		$width = intval($rapp * $width);
@@ -103,21 +103,21 @@  discard block
 block discarded – undo
103 103
 	 * @param int $length Length of the token, default to 32
104 104
 	 * @return string Random token
105 105
 	 */
106
-	public static function generateRandomToken($length=32) {
106
+	public static function generateRandomToken($length = 32) {
107 107
 		$chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
108 108
 		$len_chars = count($chars);
109 109
 		$token = '';
110 110
 		
111 111
 		for ($i = 0; $i < $length; $i++)
112
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
112
+			$token .= $chars[mt_rand(0, $len_chars - 1)];
113 113
 		
114 114
 		# Number of 32 char chunks
115
-		$chunks = ceil( strlen($token) / 32 );
115
+		$chunks = ceil(strlen($token) / 32);
116 116
 		$md5token = '';
117 117
 		
118 118
 		# Run each chunk through md5
119
-		for ( $i=1; $i<=$chunks; $i++ )
120
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
119
+		for ($i = 1; $i <= $chunks; $i++)
120
+			$md5token .= md5(substr($token, $i * 32 - 32, 32));
121 121
 		
122 122
 			# Trim the token
123 123
 		return substr($md5token, 0, $length);		
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	 * @param string $string Filesystem encoded string to encode
130 130
 	 * @return string UTF-8 encoded string
131 131
 	 */
132
-	public static function encodeFileSystemToUtf8($string){
132
+	public static function encodeFileSystemToUtf8($string) {
133 133
 		if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
134
-		    return iconv('cp1252', 'utf-8//IGNORE',$string);
134
+		    return iconv('cp1252', 'utf-8//IGNORE', $string);
135 135
 		}
136 136
 		return $string;
137 137
 	}
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 * @param string $string UTF-8 encoded string to encode
143 143
 	 * @return string Filesystem encoded string
144 144
 	 */
145
-	public static function encodeUtf8ToFileSystem($string){
145
+	public static function encodeUtf8ToFileSystem($string) {
146 146
 		if (preg_match('//u', $string) && strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
147
-			return iconv('utf-8', 'cp1252//IGNORE' ,  $string);
147
+			return iconv('utf-8', 'cp1252//IGNORE', $string);
148 148
 		}
149 149
 		return $string;
150 150
 	}
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return boolean True if path valid
158 158
 	 */
159 159
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
160
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
160
+		if (strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
161 161
 		return false;
162 162
 	}
163 163
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -108,16 +108,18 @@  discard block
 block discarded – undo
108 108
 		$len_chars = count($chars);
109 109
 		$token = '';
110 110
 		
111
-		for ($i = 0; $i < $length; $i++)
112
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
111
+		for ($i = 0; $i < $length; $i++) {
112
+					$token .= $chars[ mt_rand(0, $len_chars - 1) ];
113
+		}
113 114
 		
114 115
 		# Number of 32 char chunks
115 116
 		$chunks = ceil( strlen($token) / 32 );
116 117
 		$md5token = '';
117 118
 		
118 119
 		# Run each chunk through md5
119
-		for ( $i=1; $i<=$chunks; $i++ )
120
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
120
+		for ( $i=1; $i<=$chunks; $i++ ) {
121
+					$md5token .= md5( substr($token, $i * 32 - 32, 32) );
122
+		}
121 123
 		
122 124
 			# Trim the token
123 125
 		return substr($md5token, 0, $length);		
@@ -157,7 +159,9 @@  discard block
 block discarded – undo
157 159
 	 * @return boolean True if path valid
158 160
 	 */
159 161
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
160
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
162
+		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) {
163
+			return true;
164
+		}
161 165
 		return false;
162 166
 	}
163 167
 
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookSubscriberInterface.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@
 block discarded – undo
15 15
  */
16 16
 interface HookSubscriberInterface {
17 17
 	
18
-    /**
18
+	/**
19 19
 	 * Return the list of functions implementented in the class which needs to be registered as hooks.
20 20
 	 * The format is either { function1, function 2,...} in which case the priority is the default one
21 21
 	 * or { function1 => priority1, function2 => priority2, ...}
22 22
 	 * 
23 23
 	 * @return array Array of hooks
24 24
 	 */
25
-    public function getSubscribedHooks();
25
+	public function getSubscribedHooks();
26 26
     
27 27
 }
28 28
\ No newline at end of file
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/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/Mvc/Dispatcher.php 3 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -18,35 +18,35 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Dispatcher implements DispatcherInterface {
20 20
     
21
-    /**
22
-     * @var Dispatcher $instance Singleton pattern instance
23
-     */
24
-    private static $instance = null;
21
+	/**
22
+	 * @var Dispatcher $instance Singleton pattern instance
23
+	 */
24
+	private static $instance = null;
25 25
     
26
-    /**
27
-     * Returns the *Dispatcher* instance of this class.
28
-     *
29
-     * @return Dispatcher The *Singleton* instance.
30
-     */
31
-    public static function getInstance()
32
-    {
33
-        if (null === static::$instance) {
34
-            static::$instance = new static();
35
-        }
26
+	/**
27
+	 * Returns the *Dispatcher* instance of this class.
28
+	 *
29
+	 * @return Dispatcher The *Singleton* instance.
30
+	 */
31
+	public static function getInstance()
32
+	{
33
+		if (null === static::$instance) {
34
+			static::$instance = new static();
35
+		}
36 36
     
37
-        return static::$instance;
38
-    }    
37
+		return static::$instance;
38
+	}    
39 39
     
40 40
 	/**
41
-     * Protected constructor.
42
-     */
43
-    protected function __construct() {}
41
+	 * Protected constructor.
42
+	 */
43
+	protected function __construct() {}
44 44
     
45
-    /**
46
-     * {@inheritdoc }
47
-     * @see \MyArtJaub\Webtrees\Mvc\DispatcherInterface::handle()
48
-     */
49
-    public function handle(fw\Module\AbstractModule $module, $request) {
45
+	/**
46
+	 * {@inheritdoc }
47
+	 * @see \MyArtJaub\Webtrees\Mvc\DispatcherInterface::handle()
48
+	 */
49
+	public function handle(fw\Module\AbstractModule $module, $request) {
50 50
 		
51 51
 		$fq_modclass_name = get_class($module);
52 52
 		$ctrl_namespace = substr($fq_modclass_name, 0, - strlen('Module')) . '\\';
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
 		
67 67
 		$ctrl_class = $ctrl_namespace . $ctrl_name . 'Controller';
68 68
 		if(class_exists($ctrl_class) 
69
-		    && is_subclass_of($ctrl_class, '\\MyArtJaub\\Webtrees\\Mvc\\Controller\\MvcController')
69
+			&& is_subclass_of($ctrl_class, '\\MyArtJaub\\Webtrees\\Mvc\\Controller\\MvcController')
70 70
 			&& $ctrl = new $ctrl_class($module) ) {
71 71
 			if(method_exists($ctrl, $method)) {
72
-			    try {
73
-			        call_user_func_array(array($ctrl, $method), array());
74
-			    }
75
-			    catch (MvcException $ex) {
76
-			        if(!headers_sent()) {
77
-			            http_response_code($ex->getHttpCode());
78
-			        }
79
-			        echo $ex->getMessage();			        
80
-			    }
72
+				try {
73
+					call_user_func_array(array($ctrl, $method), array());
74
+				}
75
+				catch (MvcException $ex) {
76
+					if(!headers_sent()) {
77
+						http_response_code($ex->getHttpCode());
78
+					}
79
+					echo $ex->getMessage();			        
80
+				}
81 81
 			}
82 82
 			 else {
83 83
 				 throw new \Exception('The page requested does not exist');
@@ -86,27 +86,27 @@  discard block
 block discarded – undo
86 86
 		 else {
87 87
 			 throw new \Exception('The page requested does not exist');
88 88
 		 }
89
-    }
89
+	}
90 90
 
91
-    /**
92
-     * Private clone method to prevent cloning of the instance of the
93
-     * *Dispatcher* instance.
94
-     *
95
-     * @return void
96
-     */
97
-    private function __clone()
98
-    {
99
-    }
91
+	/**
92
+	 * Private clone method to prevent cloning of the instance of the
93
+	 * *Dispatcher* instance.
94
+	 *
95
+	 * @return void
96
+	 */
97
+	private function __clone()
98
+	{
99
+	}
100 100
     
101
-    /**
102
-     * Private unserialize method to prevent unserializing of the *Dispatcher*
103
-     * instance.
104
-     *
105
-     * @return void
106
-     */
107
-    private function __wakeup()
108
-    {
109
-    }
101
+	/**
102
+	 * Private unserialize method to prevent unserializing of the *Dispatcher*
103
+	 * instance.
104
+	 *
105
+	 * @return void
106
+	 */
107
+	private function __wakeup()
108
+	{
109
+	}
110 110
     
111 111
 }
112 112
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
     public function handle(fw\Module\AbstractModule $module, $request) {
50 50
 		
51 51
 		$fq_modclass_name = get_class($module);
52
-		$ctrl_namespace = substr($fq_modclass_name, 0, - strlen('Module')) . '\\';
52
+		$ctrl_namespace = substr($fq_modclass_name, 0, - strlen('Module')).'\\';
53 53
 		
54
-		$args = explode( '@', $request, 2);
55
-		switch(count($args)) {
54
+		$args = explode('@', $request, 2);
55
+		switch (count($args)) {
56 56
 			case 1:
57 57
 				$ctrl_name = $args[0];
58 58
 				$method = 'index';
@@ -64,16 +64,16 @@  discard block
 block discarded – undo
64 64
 				break;
65 65
 		}
66 66
 		
67
-		$ctrl_class = $ctrl_namespace . $ctrl_name . 'Controller';
68
-		if(class_exists($ctrl_class) 
67
+		$ctrl_class = $ctrl_namespace.$ctrl_name.'Controller';
68
+		if (class_exists($ctrl_class) 
69 69
 		    && is_subclass_of($ctrl_class, '\\MyArtJaub\\Webtrees\\Mvc\\Controller\\MvcController')
70
-			&& $ctrl = new $ctrl_class($module) ) {
71
-			if(method_exists($ctrl, $method)) {
70
+			&& $ctrl = new $ctrl_class($module)) {
71
+			if (method_exists($ctrl, $method)) {
72 72
 			    try {
73 73
 			        call_user_func_array(array($ctrl, $method), array());
74 74
 			    }
75 75
 			    catch (MvcException $ex) {
76
-			        if(!headers_sent()) {
76
+			        if (!headers_sent()) {
77 77
 			            http_response_code($ex->getHttpCode());
78 78
 			        }
79 79
 			        echo $ex->getMessage();			        
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -71,19 +71,16 @@
 block discarded – undo
71 71
 			if(method_exists($ctrl, $method)) {
72 72
 			    try {
73 73
 			        call_user_func_array(array($ctrl, $method), array());
74
-			    }
75
-			    catch (MvcException $ex) {
74
+			    } catch (MvcException $ex) {
76 75
 			        if(!headers_sent()) {
77 76
 			            http_response_code($ex->getHttpCode());
78 77
 			        }
79 78
 			        echo $ex->getMessage();			        
80 79
 			    }
81
-			}
82
-			 else {
80
+			} else {
83 81
 				 throw new \Exception('The page requested does not exist');
84 82
 			 }
85
-		 }
86
-		 else {
83
+		 } else {
87 84
 			 throw new \Exception('The page requested does not exist');
88 85
 		 }
89 86
     }
Please login to merge, or discard this patch.
src/Webtrees/Mvc/MvcException.php 3 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -16,52 +16,52 @@
 block discarded – undo
16 16
  */
17 17
 class MvcException extends \Exception {
18 18
 
19
-    /** @var int[] $VALID_HTTP List of valid HTTP codes */
20
-    protected static $VALID_HTTP =  array(
21
-        100, 101,
22
-        200, 201, 202, 203, 204, 205, 206,
23
-        300, 301, 302, 303, 304, 305, 306, 307,
24
-        400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,
25
-        500, 501, 502, 503, 504, 505
26
-    );
19
+	/** @var int[] $VALID_HTTP List of valid HTTP codes */
20
+	protected static $VALID_HTTP =  array(
21
+		100, 101,
22
+		200, 201, 202, 203, 204, 205, 206,
23
+		300, 301, 302, 303, 304, 305, 306, 307,
24
+		400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,
25
+		500, 501, 502, 503, 504, 505
26
+	);
27 27
     
28
-    /** @var int $http_code */
29
-    protected $http_code;
28
+	/** @var int $http_code */
29
+	protected $http_code;
30 30
     
31
-    /**
32
-     * Constructor for MvcException
33
-     * 
34
-     * @param int $http_code
35
-     * @param string $message
36
-     * @param int $code
37
-     * @param \Throwable $previous
38
-     */
39
-    public function __construct($http_code = 500, $message = "", $code = 0, \Throwable $previous = null) {
40
-        parent::__construct($message, $code, $previous);   
31
+	/**
32
+	 * Constructor for MvcException
33
+	 * 
34
+	 * @param int $http_code
35
+	 * @param string $message
36
+	 * @param int $code
37
+	 * @param \Throwable $previous
38
+	 */
39
+	public function __construct($http_code = 500, $message = "", $code = 0, \Throwable $previous = null) {
40
+		parent::__construct($message, $code, $previous);   
41 41
                 
42
-        $this->http_code = in_array($http_code, self::$VALID_HTTP) ? $http_code : 500;
43
-    }
42
+		$this->http_code = in_array($http_code, self::$VALID_HTTP) ? $http_code : 500;
43
+	}
44 44
     
45
-    /**
46
-     * Get the HTTP code
47
-     * 
48
-     * @return int
49
-     */
50
-    public function getHttpCode() {
51
-        return $this->http_code;
52
-    }
45
+	/**
46
+	 * Get the HTTP code
47
+	 * 
48
+	 * @return int
49
+	 */
50
+	public function getHttpCode() {
51
+		return $this->http_code;
52
+	}
53 53
     
54
-    /**
55
-     * Set the HTTP code
56
-     * 
57
-     * @param int $http_code
58
-     * @throws InvalidArgumentException Thrown if not valid Http code
59
-     */
60
-    public function setHttpCode($http_code) {
61
-        if(!in_array($http_code, self::$VALID_HTTP))
62
-            throw new \InvalidArgumentException('Invalid HTTP code');
63
-        $this->http_code= $http_code;
64
-    }   
54
+	/**
55
+	 * Set the HTTP code
56
+	 * 
57
+	 * @param int $http_code
58
+	 * @throws InvalidArgumentException Thrown if not valid Http code
59
+	 */
60
+	public function setHttpCode($http_code) {
61
+		if(!in_array($http_code, self::$VALID_HTTP))
62
+			throw new \InvalidArgumentException('Invalid HTTP code');
63
+		$this->http_code= $http_code;
64
+	}   
65 65
 
66 66
 }
67 67
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 class MvcException extends \Exception {
18 18
 
19 19
     /** @var int[] $VALID_HTTP List of valid HTTP codes */
20
-    protected static $VALID_HTTP =  array(
20
+    protected static $VALID_HTTP = array(
21 21
         100, 101,
22 22
         200, 201, 202, 203, 204, 205, 206,
23 23
         300, 301, 302, 303, 304, 305, 306, 307,
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
      * @throws InvalidArgumentException Thrown if not valid Http code
59 59
      */
60 60
     public function setHttpCode($http_code) {
61
-        if(!in_array($http_code, self::$VALID_HTTP))
61
+        if (!in_array($http_code, self::$VALID_HTTP))
62 62
             throw new \InvalidArgumentException('Invalid HTTP code');
63
-        $this->http_code= $http_code;
63
+        $this->http_code = $http_code;
64 64
     }   
65 65
 
66 66
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@
 block discarded – undo
58 58
      * @throws InvalidArgumentException Thrown if not valid Http code
59 59
      */
60 60
     public function setHttpCode($http_code) {
61
-        if(!in_array($http_code, self::$VALID_HTTP))
62
-            throw new \InvalidArgumentException('Invalid HTTP code');
61
+        if(!in_array($http_code, self::$VALID_HTTP)) {
62
+                    throw new \InvalidArgumentException('Invalid HTTP code');
63
+        }
63 64
         $this->http_code= $http_code;
64 65
     }   
65 66
 
Please login to merge, or discard this patch.
src/Webtrees/Module/HooksModule.php 3 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -19,59 +19,59 @@
 block discarded – undo
19 19
  * Hooks Module.
20 20
  */
21 21
 class HooksModule extends AbstractModule implements ModuleConfigInterface, DependentInterface {
22
-    // How to update the database schema for this module
23
-    const SCHEMA_TARGET_VERSION   = 1;
24
-    const SCHEMA_SETTING_NAME     = 'MAJ_HOOKS_SCHEMA_VERSION';
25
-    const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Hooks\Schema';
22
+	// How to update the database schema for this module
23
+	const SCHEMA_TARGET_VERSION   = 1;
24
+	const SCHEMA_SETTING_NAME     = 'MAJ_HOOKS_SCHEMA_VERSION';
25
+	const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Hooks\Schema';
26 26
     
27
-    /** @var string For custom modules - link for support, upgrades, etc. */
28
-    const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
27
+	/** @var string For custom modules - link for support, upgrades, etc. */
28
+	const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
29 29
     
30
-    /**
31
-     * {@inhericDoc}
32
-     */
33
-    public function getTitle() {
34
-        return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks');
35
-    }
30
+	/**
31
+	 * {@inhericDoc}
32
+	 */
33
+	public function getTitle() {
34
+		return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks');
35
+	}
36 36
     
37
-    /**
38
-     * {@inhericDoc}
39
-     */
40
-    public function getDescription() {
41
-        return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.');
42
-    }
37
+	/**
38
+	 * {@inhericDoc}
39
+	 */
40
+	public function getDescription() {
41
+		return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.');
42
+	}
43 43
     
44
-    /**
45
-     * {@inhericDoc}
46
-     */
47
-    public function modAction($mod_action) {
48
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
44
+	/**
45
+	 * {@inhericDoc}
46
+	 */
47
+	public function modAction($mod_action) {
48
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
49 49
         
50
-        \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
51
-    }
50
+		\MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
51
+	}
52 52
     
53
-    /**
54
-     * {@inhericDoc}
55
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
56
-     */
57
-    public function getConfigLink() {
58
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
53
+	/**
54
+	 * {@inhericDoc}
55
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
56
+	 */
57
+	public function getConfigLink() {
58
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
59 59
         
60
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
61
-    }
60
+		return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
61
+	}
62 62
     
63
-    /**
64
-     * {@inheritDoc}
65
-     * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites()
66
-     */
67
-    public function validatePrerequisites() {
68
-        try {
69
-            Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
70
-            return true;
71
-        }
72
-        catch (\Exception $ex) { }
73
-        return false;
74
-    }
63
+	/**
64
+	 * {@inheritDoc}
65
+	 * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites()
66
+	 */
67
+	public function validatePrerequisites() {
68
+		try {
69
+			Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
70
+			return true;
71
+		}
72
+		catch (\Exception $ex) { }
73
+		return false;
74
+	}
75 75
     
76 76
 
77 77
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@
 block discarded – undo
68 68
         try {
69 69
             Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
70 70
             return true;
71
-        }
72
-        catch (\Exception $ex) { }
71
+        } catch (\Exception $ex) { }
73 72
         return false;
74 73
     }
75 74
     
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     public function getConfigLink() {
58 58
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
59 59
         
60
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
60
+        return 'module.php?mod='.$this->getName().'&amp;mod_action=AdminConfig';
61 61
     }
62 62
     
63 63
     /**
Please login to merge, or discard this patch.