@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param string $commandToken |
24 | 24 | * @param SilverbulletContext $context |
25 | 25 | */ |
26 | - public function __construct($commandToken, $context){ |
|
26 | + public function __construct($commandToken, $context) { |
|
27 | 27 | parent::__construct($commandToken, $context); |
28 | 28 | $this->context = $context; |
29 | 29 | } |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | * {@inheritDoc} |
34 | 34 | * @see \web\lib\admin\http\AbstractCommand::execute() |
35 | 35 | */ |
36 | - public function execute(){ |
|
37 | - if(isset($_POST[self::PARAM_NAME]) && isset($_POST[self::PARAM_EXPIRY])){ |
|
36 | + public function execute() { |
|
37 | + if (isset($_POST[self::PARAM_NAME]) && isset($_POST[self::PARAM_EXPIRY])) { |
|
38 | 38 | $name = $this->parseString(filter_input(INPUT_POST, self::PARAM_NAME, FILTER_SANITIZE_STRING)); |
39 | 39 | $expiry = $this->parseString($_POST[self::PARAM_EXPIRY]); |
40 | 40 | $user = $this->context->createUser($name, $expiry, $this); |
41 | - if(!empty($user->getIdentifier())){ |
|
41 | + if (!empty($user->getIdentifier())) { |
|
42 | 42 | $this->storeInfoMessage(_('User was added successfully!')); |
43 | 43 | } |
44 | - }else{ |
|
44 | + } else { |
|
45 | 45 | $this->storeErrorMessage(_('User name or expiry parameters are missing!')); |
46 | 46 | } |
47 | 47 | } |
@@ -84,14 +84,14 @@ |
||
84 | 84 | $langConverted[] = $hardSetLang; |
85 | 85 | } |
86 | 86 | if (!empty($_REQUEST['lang'])) { |
87 | - $recoverLang = filter_input(INPUT_GET,'lang', FILTER_SANITIZE_STRING) ?? filter_input(INPUT_POST, 'lang', FILTER_SANITIZE_STRING); |
|
87 | + $recoverLang = filter_input(INPUT_GET, 'lang', FILTER_SANITIZE_STRING) ?? filter_input(INPUT_POST, 'lang', FILTER_SANITIZE_STRING); |
|
88 | 88 | $langConverted[] = $recoverLang; |
89 | 89 | } |
90 | 90 | if (!empty($_SESSION['language'])) { |
91 | 91 | $langConverted[] = $_SESSION['language']; |
92 | 92 | } |
93 | 93 | if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
94 | - $langs = explode(",", filter_input(INPUT_SERVER,"HTTP_ACCEPT_LANGUAGE", FILTER_SANITIZE_STRING)); |
|
94 | + $langs = explode(",", filter_input(INPUT_SERVER, "HTTP_ACCEPT_LANGUAGE", FILTER_SANITIZE_STRING)); |
|
95 | 95 | foreach ($langs as $lang) { |
96 | 96 | $result = []; |
97 | 97 | preg_match("/(.*);+.*/", $lang, $result); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | $cleanToken = FALSE; |
23 | 23 | $tokenStatus = ["status" => \core\ProfileSilverbullet::SB_TOKENSTATUS_INVALID, |
24 | - "cert_status" => [],]; |
|
24 | + "cert_status" => [], ]; |
|
25 | 25 | $profile = NULL; |
26 | 26 | $idp = NULL; |
27 | 27 | $fed = NULL; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | // it can be VALID (exists and not redeemed, EXPIRED, REDEEMED or INVALID (non existent) |
39 | 39 | $tokenStatus = \core\ProfileSilverbullet::tokenStatus($cleanToken); |
40 | 40 | } |
41 | -} elseif (isset($_SERVER['SSL_CLIENT_SAN_Email']) || isset($_SERVER['SSL_CLIENT_SAN_Email_0']) ) { |
|
41 | +} elseif (isset($_SERVER['SSL_CLIENT_SAN_Email']) || isset($_SERVER['SSL_CLIENT_SAN_Email_0'])) { |
|
42 | 42 | // maybe the user authenticated with his client cert? Then pick any of his |
43 | 43 | // tokens to go on |
44 | 44 | $certname = $_SERVER['SSL_CLIENT_SAN_Email'] ?? $_SERVER['SSL_CLIENT_SAN_Email_0']; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $this->entityOptionTable = "institution_option"; |
64 | 64 | $this->entityIdColumn = "institution_id"; |
65 | 65 | if (!is_numeric($instId)) { |
66 | - throw new Exception("An ".CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_inst']." is identified by an integer index!"); |
|
66 | + throw new Exception("An " . CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_inst'] . " is identified by an integer index!"); |
|
67 | 67 | } |
68 | 68 | $this->identifier = (int) $instId; |
69 | 69 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $alreadyUsed = $this->databaseHandle->exec("SELECT DISTINCT external_db_id FROM institution WHERE external_db_id = ? AND external_db_syncstate = ?", "si", $identifier, $syncState); |
318 | 318 | |
319 | 319 | if (mysqli_num_rows($alreadyUsed) == 0) { |
320 | - $this->databaseHandle->exec("UPDATE institution SET external_db_id = ?, external_db_syncstate = ? WHERE inst_id = ?", "sii", $identifier, $syncState, $this->identifier ); |
|
320 | + $this->databaseHandle->exec("UPDATE institution SET external_db_id = ?, external_db_syncstate = ? WHERE inst_id = ?", "sii", $identifier, $syncState, $this->identifier); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | $prepResult = $statementObject->prepare($querystring); |
96 | 96 | if ($prepResult === FALSE) { |
97 | - throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> ". $statementObject->error ." <--."); |
|
97 | + throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> " . $statementObject->error . " <--."); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // we have a variable number of arguments packed into the ... array |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | array_unshift($localArray, $types); |
107 | 107 | $retval = call_user_func_array([$statementObject, "bind_param"], $localArray); |
108 | 108 | if ($retval === FALSE) { |
109 | - throw new Exception("DB: Unuable to bind parameters to prepared statement! Argument array was --> ". var_export($localArray, TRUE) ." <--. Error was --> ". $statementObject->error ." <--"); |
|
109 | + throw new Exception("DB: Unuable to bind parameters to prepared statement! Argument array was --> " . var_export($localArray, TRUE) . " <--. Error was --> " . $statementObject->error . " <--"); |
|
110 | 110 | } |
111 | 111 | $result = $statementObject->execute(); |
112 | 112 | if ($result === FALSE) { |
113 | - throw new Exception("DB: Unuable to execute prepared statement! Error was --> ". $statementObject->error ." <--"); |
|
113 | + throw new Exception("DB: Unuable to execute prepared statement! Error was --> " . $statementObject->error . " <--"); |
|
114 | 114 | } |
115 | 115 | $selectResult = $statementObject->get_result(); |
116 | 116 | if ($selectResult !== FALSE) { |
@@ -15,24 +15,24 @@ discard block |
||
15 | 15 | use web\lib\admin\http\SilverbulletContext; |
16 | 16 | use web\lib\admin\domain\SilverbulletInvitation; |
17 | 17 | |
18 | -if ( !isset( $_SESSION ) ) $_SESSION = array(); |
|
18 | +if (!isset($_SESSION)) $_SESSION = array(); |
|
19 | 19 | |
20 | -class MockInstitutionPageBuilder extends InstitutionPageBuilder{ |
|
20 | +class MockInstitutionPageBuilder extends InstitutionPageBuilder { |
|
21 | 21 | |
22 | 22 | private $profile; |
23 | 23 | |
24 | - public function __construct($profile){ |
|
24 | + public function __construct($profile) { |
|
25 | 25 | parent::__construct(new DefaultHtmlPage("Test Page")); |
26 | 26 | $this->profile = $profile; |
27 | 27 | } |
28 | 28 | |
29 | - public function getProfile(){ |
|
29 | + public function getProfile() { |
|
30 | 30 | return $this->profile; |
31 | 31 | } |
32 | 32 | |
33 | 33 | } |
34 | 34 | |
35 | -class SilverbulletControllerTest extends PHPUnit_Framework_TestCase{ |
|
35 | +class SilverbulletControllerTest extends PHPUnit_Framework_TestCase { |
|
36 | 36 | |
37 | 37 | private $username = 'testusername'; |
38 | 38 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | private $factory; |
46 | 46 | |
47 | - protected function setUp(){ |
|
47 | + protected function setUp() { |
|
48 | 48 | $this->databaseHandle = \core\DBConnection::handle('INST'); |
49 | 49 | |
50 | 50 | $this->profile = new MockProfileSilverbullet($this->databaseHandle); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $usersAfter = count(SilverbulletUser::getList($this->profile->identifier)); |
65 | 65 | $this->assertFalse($usersAfter > $usersBefore); |
66 | 66 | |
67 | - $_POST[AddUserCommand::PARAM_EXPIRY] = date('Y-m-d',strtotime("tomorrow")); |
|
67 | + $_POST[AddUserCommand::PARAM_EXPIRY] = date('Y-m-d', strtotime("tomorrow")); |
|
68 | 68 | $this->factory->parseRequest(); |
69 | 69 | |
70 | 70 | // Is not going to work since the $_POST variables can't be modified at runtime for filter_input function |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | |
74 | 74 | } |
75 | 75 | |
76 | - private function countActiveUsers($users){ |
|
76 | + private function countActiveUsers($users) { |
|
77 | 77 | $count = 0; |
78 | 78 | foreach ($users as $user) { |
79 | - if(!$user->isDeactivated()){ |
|
79 | + if (!$user->isDeactivated()) { |
|
80 | 80 | $count++; |
81 | 81 | } |
82 | 82 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | public function testRevokeGeneratedCertificate() { |
155 | 155 | $serial = '29837498273948'; |
156 | 156 | $cn = 'testCommonName'; |
157 | - $expiry = date('Y-m-d',strtotime("tomorrow")); |
|
157 | + $expiry = date('Y-m-d', strtotime("tomorrow")); |
|
158 | 158 | |
159 | 159 | $this->user->save(); |
160 | 160 | |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | |
182 | 182 | } |
183 | 183 | |
184 | - protected function tearDown(){ |
|
184 | + protected function tearDown() { |
|
185 | 185 | $this->user->delete(); |
186 | - $this->databaseHandle->exec("DELETE FROM `".SilverbulletUser::TABLE."` WHERE `".SilverbulletUser::USERNAME."`='".$this->username."'"); |
|
186 | + $this->databaseHandle->exec("DELETE FROM `" . SilverbulletUser::TABLE . "` WHERE `" . SilverbulletUser::USERNAME . "`='" . $this->username . "'"); |
|
187 | 187 | $this->profile->delete(); |
188 | 188 | } |
189 | 189 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use web\lib\admin\http\DefaultContext; |
6 | 6 | use web\lib\admin\http\ValidateEmailAddress; |
7 | 7 | |
8 | -class ValidateEmailAddressTest extends PHPUnit_Framework_TestCase{ |
|
8 | +class ValidateEmailAddressTest extends PHPUnit_Framework_TestCase { |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $this->command = new ValidateEmailAddress(ValidateEmailAddress::COMMAND, new DefaultContext($this->page)); |
25 | 25 | } |
26 | 26 | |
27 | - public function testExecute(){ |
|
27 | + public function testExecute() { |
|
28 | 28 | |
29 | 29 | $this->command->execute(); |
30 | 30 | $response = $this->page->getResponse(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $this->command->execute(); |
38 | 38 | $renderedResponse = $response->__toString(); |
39 | - $this->assertTrue(strpos($renderedResponse, '<email')!==false); |
|
39 | + $this->assertTrue(strpos($renderedResponse, '<email') !== false); |
|
40 | 40 | // Is not going to work since the $_POST variables can't be modified at runtime for filter_input function |
41 | 41 | //$this->assertTrue(strpos($renderedResponse, 'address="'.$_POST[ValidateEmailAddress::PARAM_ADDRESS].'"')!==false); |
42 | 42 | $this->assertFalse(strpos($renderedResponse, 'isValid="true"')); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * {@inheritDoc} |
83 | 83 | * @see \web\lib\admin\domain\PersistentInterface::validate() |
84 | 84 | */ |
85 | - public function validate(){ |
|
85 | + public function validate() { |
|
86 | 86 | return ( |
87 | 87 | !empty($this->get(self::PROFILEID)) && |
88 | 88 | !empty($this->get(self::SILVERBULLETUSERID)) |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param int $quantity |
111 | 111 | */ |
112 | - public function setQuantity($quantity){ |
|
112 | + public function setQuantity($quantity) { |
|
113 | 113 | $this->set(self::QUANTITY, $quantity); |
114 | 114 | } |
115 | 115 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return string |
119 | 119 | */ |
120 | - public function getRemainingActivations(){ |
|
120 | + public function getRemainingActivations() { |
|
121 | 121 | return sprintf(_("%s of %s"), count($this->certificates), $this->get(self::QUANTITY)); |
122 | 122 | } |
123 | 123 | |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return boolean |
127 | 127 | */ |
128 | - public function isRevoked(){ |
|
128 | + public function isRevoked() { |
|
129 | 129 | $quantity = $this->get(self::QUANTITY); |
130 | 130 | return $quantity <= 0; |
131 | 131 | } |
132 | 132 | |
133 | - public function isAbsent(){ |
|
133 | + public function isAbsent() { |
|
134 | 134 | $quantity = $this->get(self::QUANTITY); |
135 | 135 | return count($this->certificates) >= $quantity; |
136 | 136 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | $link .= $_SERVER['SERVER_NAME']; |
164 | 164 | $relPath = dirname(dirname($_SERVER['SCRIPT_NAME'])); |
165 | - if ($relPath[strlen($relPath) -1] == '/') { |
|
165 | + if ($relPath[strlen($relPath) - 1] == '/') { |
|
166 | 166 | $relPath = substr($relPath, 0, strlen($relPath) - 1); |
167 | 167 | } |
168 | 168 | $link = $link . $relPath; |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | $link = $host; |
171 | 171 | } |
172 | 172 | |
173 | - if ($this->isRevoked()){ |
|
173 | + if ($this->isRevoked()) { |
|
174 | 174 | $link = _('This token has been revoked!'); |
175 | - }else if($this->isAbsent()){ |
|
175 | + } else if ($this->isAbsent()) { |
|
176 | 176 | $link = _('All available activations were used!'); |
177 | - }else if ($this->isExpired()) { |
|
177 | + } else if ($this->isExpired()) { |
|
178 | 178 | $link = _('User did not consume the token and it expired!'); |
179 | 179 | } else { |
180 | 180 | $link .= '/accountstatus/accountstatus.php?token=' . $this->get(self::TOKEN); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @return \web\lib\admin\domain\SilverbulletCertificate[] |
236 | 236 | */ |
237 | - public function getCertificates(){ |
|
237 | + public function getCertificates() { |
|
238 | 238 | return $this->certificates; |
239 | 239 | } |
240 | 240 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * {@inheritDoc} |
244 | 244 | * @see \web\lib\admin\domain\PersistentEntity::load() |
245 | 245 | */ |
246 | - public function load($searchAttribute = null){ |
|
246 | + public function load($searchAttribute = null) { |
|
247 | 247 | $state = parent::load($searchAttribute); |
248 | 248 | $this->certificates = SilverbulletCertificate::getList(null, new Attribute(SilverbulletCertificate::SILVERBULLETINVITATIONID, $this->getIdentifier(), Attribute::TYPE_INTEGER)); |
249 | 249 | return $state; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $attrValue = $searchAttribute->value; |
277 | 277 | $query = sprintf("SELECT * FROM `%s` WHERE `%s`=? AND `%s`=? ORDER BY `%s` DESC", self::TABLE, self::SILVERBULLETUSERID, $searchAttribute->key, self::EXPIRY); |
278 | 278 | $result = $databaseHandle->exec($query, $userType . $attrType, $userValue, $attrValue); |
279 | - } else if($silverbulletUser != null) { |
|
279 | + } else if ($silverbulletUser != null) { |
|
280 | 280 | $userId = $silverbulletUser->getAttribute(self::ID); |
281 | 281 | $userType = $userId->getType(); |
282 | 282 | $userValue = $userId->value; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param string $table |
57 | 57 | * @param string $databaseType |
58 | 58 | */ |
59 | - public function __construct($table, $databaseType = 'INST'){ |
|
59 | + public function __construct($table, $databaseType = 'INST') { |
|
60 | 60 | $this->table = $table; |
61 | 61 | $this->setAttributeType(self::ID, Attribute::TYPE_INTEGER); |
62 | 62 | $this->databaseHandle = \core\DBConnection::handle($databaseType); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param string $key |
68 | 68 | * @param string $type |
69 | 69 | */ |
70 | - protected function setAttributeType($key, $type){ |
|
70 | + protected function setAttributeType($key, $type) { |
|
71 | 71 | $this->types[$key] = $type; |
72 | 72 | } |
73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string $key |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - protected function getAttributeType($key){ |
|
79 | + protected function getAttributeType($key) { |
|
80 | 80 | return isset($this->types[$key]) ? $this->types[$key] : Attribute::TYPE_STRING; |
81 | 81 | } |
82 | 82 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param string $key |
87 | 87 | * @return string |
88 | 88 | */ |
89 | - public function get($key){ |
|
89 | + public function get($key) { |
|
90 | 90 | return isset($this->row[$key]) ? $this->row[$key]->value : ""; |
91 | 91 | } |
92 | 92 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $key |
96 | 96 | * @return NULL|\web\lib\admin\domain\Attribute |
97 | 97 | */ |
98 | - public function getAttribute($key){ |
|
98 | + public function getAttribute($key) { |
|
99 | 99 | return isset($this->row[$key]) ? $this->row[$key] : new Attribute('', ''); |
100 | 100 | } |
101 | 101 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param string $key |
106 | 106 | * @param mixed $value |
107 | 107 | */ |
108 | - protected function set($key, $value){ |
|
108 | + protected function set($key, $value) { |
|
109 | 109 | $attribute = new Attribute($key, $value, $this->getAttributeType($key)); |
110 | 110 | $this->row[$key] = $attribute; |
111 | 111 | } |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param array $row |
116 | 116 | */ |
117 | - public function setRow($row){ |
|
117 | + public function setRow($row) { |
|
118 | 118 | $this->clear(); |
119 | - foreach ($row as $key => $value){ |
|
119 | + foreach ($row as $key => $value) { |
|
120 | 120 | $this->set($key, $value); |
121 | 121 | } |
122 | 122 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * |
126 | 126 | */ |
127 | - public function clear(){ |
|
127 | + public function clear() { |
|
128 | 128 | $this->row = array(); |
129 | 129 | } |
130 | 130 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public function getIdentifier(){ |
|
135 | + public function getIdentifier() { |
|
136 | 136 | return $this->get(self::ID); |
137 | 137 | } |
138 | 138 | |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | * {@inheritDoc} |
142 | 142 | * @see \web\lib\admin\domain\PersistentInterface::save() |
143 | 143 | */ |
144 | - public function save(){ |
|
144 | + public function save() { |
|
145 | 145 | $result = false; |
146 | - if(count($this->row) > 0){ |
|
147 | - if(isset($this->row[self::ID])){ |
|
146 | + if (count($this->row) > 0) { |
|
147 | + if (isset($this->row[self::ID])) { |
|
148 | 148 | $result = $this->executeUpdateQuery(); |
149 | - }else{ |
|
149 | + } else { |
|
150 | 150 | $result = $this->executeInsertQuery(); |
151 | 151 | } |
152 | 152 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return boolean|mixed |
159 | 159 | */ |
160 | - private function executeInsertQuery(){ |
|
160 | + private function executeInsertQuery() { |
|
161 | 161 | $result = false; |
162 | 162 | $query = sprintf("INSERT INTO `%s`", $this->table); |
163 | 163 | $keyString = "("; |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | $types = ''; |
166 | 166 | $arguments = array(); |
167 | 167 | foreach ($this->row as $key => $attribute) { |
168 | - if($keyString != "(") $keyString .= " ,"; |
|
169 | - if($valueString != "(") $valueString .= " ,"; |
|
168 | + if ($keyString != "(") $keyString .= " ,"; |
|
169 | + if ($valueString != "(") $valueString .= " ,"; |
|
170 | 170 | $keyString .= "`" . $key . "`"; |
171 | 171 | $valueString .= "?"; |
172 | 172 | $types .= $attribute->getType(); |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | $keyString .= ")"; |
176 | 176 | $valueString .= ")"; |
177 | 177 | $isValid = $this->validate(); |
178 | - if($isValid && $keyString != "()"){ |
|
179 | - $query .= " " .$keyString . " VALUES " . $valueString; |
|
178 | + if ($isValid && $keyString != "()") { |
|
179 | + $query .= " " . $keyString . " VALUES " . $valueString; |
|
180 | 180 | $result = $this->databaseHandle->exec($query, $types, ...$arguments); |
181 | - if($result){ |
|
181 | + if ($result) { |
|
182 | 182 | $this->set(self::ID, $this->databaseHandle->lastID()); |
183 | 183 | } |
184 | 184 | } |
@@ -189,21 +189,21 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return boolean|mixed |
191 | 191 | */ |
192 | - private function executeUpdateQuery(){ |
|
192 | + private function executeUpdateQuery() { |
|
193 | 193 | $result = false; |
194 | 194 | $query = sprintf("UPDATE `%s`", $this->table); |
195 | 195 | $updateString = ""; |
196 | 196 | $types = ''; |
197 | 197 | $arguments = array(); |
198 | 198 | foreach ($this->row as $key => $attribute) { |
199 | - if(!empty($updateString)) $updateString .= " ,"; |
|
200 | - else $updateString .=" SET "; |
|
199 | + if (!empty($updateString)) $updateString .= " ,"; |
|
200 | + else $updateString .= " SET "; |
|
201 | 201 | $updateString .= "`" . $key . "`=?"; |
202 | 202 | $types .= $attribute->getType(); |
203 | 203 | $arguments [] = $attribute->value; |
204 | 204 | } |
205 | - if(!empty($updateString)){ |
|
206 | - $query .= " " .$updateString . " WHERE `" .self::ID. "`=?"; |
|
205 | + if (!empty($updateString)) { |
|
206 | + $query .= " " . $updateString . " WHERE `" . self::ID . "`=?"; |
|
207 | 207 | $id = $this->getAttribute(self::ID); |
208 | 208 | $types .= $id->getType(); |
209 | 209 | $arguments [] = $id->value; |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * {@inheritDoc} |
217 | 217 | * @see \web\lib\admin\domain\PersistentInterface::load() |
218 | 218 | */ |
219 | - public function load($searchAttribute = null){ |
|
219 | + public function load($searchAttribute = null) { |
|
220 | 220 | $state = false; |
221 | 221 | $id = $this->getAttribute(self::ID); |
222 | 222 | $query = sprintf("SELECT * FROM `%s` WHERE `%s` =?", $this->table, self::ID); |
223 | 223 | $value = $id->value; |
224 | 224 | $result = $this->databaseHandle->exec($query, $id->getType(), $value); |
225 | - if(mysqli_num_rows($result)>0){ |
|
225 | + if (mysqli_num_rows($result) > 0) { |
|
226 | 226 | $this->setRow(mysqli_fetch_assoc($result)); |
227 | 227 | $state = true; |
228 | 228 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * {@inheritDoc} |
235 | 235 | * @see \web\lib\admin\domain\PersistentInterface::delete() |
236 | 236 | */ |
237 | - public function delete(){ |
|
237 | + public function delete() { |
|
238 | 238 | $id = $this->getAttribute(self::ID); |
239 | 239 | $query = sprintf("DELETE FROM `%s` WHERE `%s`=?", $this->table, self::ID); |
240 | 240 | $type = $id->getType(); |