@@ -77,8 +77,7 @@ |
||
77 | 77 | $index = str_replace('%', '', $match2); |
78 | 78 | if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
79 | 79 | $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
80 | - } |
|
81 | - else{ |
|
80 | + } else{ |
|
82 | 81 | $displayPlace = str_replace($match2, '' , $displayPlace); |
83 | 82 | } |
84 | 83 | } |
@@ -53,13 +53,21 @@ |
||
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 | } |
@@ -73,8 +73,12 @@ |
||
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 |
@@ -45,7 +45,9 @@ |
||
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 | } |
@@ -65,8 +65,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -71,19 +71,16 @@ |
||
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 | } |
@@ -58,8 +58,9 @@ |
||
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 |
@@ -68,8 +68,7 @@ |
||
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 |
@@ -79,8 +79,7 @@ |
||
79 | 79 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
80 | 80 | |
81 | 81 | return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME)); |
82 | - } |
|
83 | - catch (\Exception $ex) { } |
|
82 | + } catch (\Exception $ex) { } |
|
84 | 83 | return false; |
85 | 84 | } |
86 | 85 |