@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if(count($this->row) > 0){ |
| 152 | 152 | if(isset($this->row[self::ID])){ |
| 153 | 153 | $result = $this->executeUpdateQuery(); |
| 154 | - }else{ |
|
| 154 | + } else{ |
|
| 155 | 155 | $result = $this->executeInsertQuery(); |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -170,8 +170,12 @@ discard block |
||
| 170 | 170 | $types = ''; |
| 171 | 171 | $arguments = array(); |
| 172 | 172 | foreach ($this->row as $key => $attribute) { |
| 173 | - if($keyString != "(") $keyString .= " ,"; |
|
| 174 | - if($valueString != "(") $valueString .= " ,"; |
|
| 173 | + if($keyString != "(") { |
|
| 174 | + $keyString .= " ,"; |
|
| 175 | + } |
|
| 176 | + if($valueString != "(") { |
|
| 177 | + $valueString .= " ,"; |
|
| 178 | + } |
|
| 175 | 179 | $keyString .= "`" . $key . "`"; |
| 176 | 180 | $valueString .= "?"; |
| 177 | 181 | $types .= $attribute->getType(); |
@@ -200,8 +204,11 @@ discard block |
||
| 200 | 204 | $types = ''; |
| 201 | 205 | $arguments = array(); |
| 202 | 206 | foreach ($this->row as $key => $attribute) { |
| 203 | - if(!empty($updateString)) $updateString .= " ,"; |
|
| 204 | - else $updateString .=" SET "; |
|
| 207 | + if(!empty($updateString)) { |
|
| 208 | + $updateString .= " ,"; |
|
| 209 | + } else { |
|
| 210 | + $updateString .=" SET "; |
|
| 211 | + } |
|
| 205 | 212 | $updateString .= "`" . $key . "`=?"; |
| 206 | 213 | $types .= $attribute->getType(); |
| 207 | 214 | $arguments [] = $attribute->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(); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | * |
| 64 | 64 | * @return string |
| 65 | 65 | */ |
| 66 | - public function getType(){ |
|
| 66 | + public function getType() { |
|
| 67 | 67 | return $this->type; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function __construct($fileData, $rowDelimiter, $tokenDelimiter) { |
| 55 | 55 | $this->rowDelimiter = $rowDelimiter; |
| 56 | 56 | $this->tokenDelimiter = $tokenDelimiter; |
| 57 | - if($this->validate($fileData)){ |
|
| 57 | + if ($this->validate($fileData)) { |
|
| 58 | 58 | $handle = fopen($fileData['tmp_name'], "r"); |
| 59 | 59 | $contents = fread($handle, filesize($fileData['tmp_name'])); |
| 60 | 60 | fclose($handle); |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param array $fileData Data array from $_FILES['yourfile'] |
| 69 | 69 | * @return boolean Is file data valid |
| 70 | 70 | */ |
| 71 | - protected function validate($fileData){ |
|
| 72 | - if(empty($fileData) || empty($fileData['name']) || empty($fileData['tmp_name']) || $fileData['error']>0){ |
|
| 71 | + protected function validate($fileData) { |
|
| 72 | + if (empty($fileData) || empty($fileData['name']) || empty($fileData['tmp_name']) || $fileData['error'] > 0) { |
|
| 73 | 73 | $this->state = false; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $extension = pathinfo($fileData['name'], PATHINFO_EXTENSION); |
| 77 | - if($extension!='csv' && $extension!='CSV'){ |
|
| 77 | + if ($extension != 'csv' && $extension != 'CSV') { |
|
| 78 | 78 | $this->state = false; |
| 79 | 79 | } |
| 80 | 80 | return $this->state; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @return boolean |
| 96 | 96 | */ |
| 97 | - public function hasMoreRows(){ |
|
| 97 | + public function hasMoreRows() { |
|
| 98 | 98 | return $this->state && isset($this->rows[$this->index]); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @return array |
| 105 | 105 | */ |
| 106 | - public function nextRow(){ |
|
| 107 | - if($this->state && $this->hasMoreRows()){ |
|
| 106 | + public function nextRow() { |
|
| 107 | + if ($this->state && $this->hasMoreRows()) { |
|
| 108 | 108 | $row = str_getcsv($this->rows[$this->index], $this->tokenDelimiter); |
| 109 | 109 | $this->index++; |
| 110 | 110 | return $row; |
| 111 | - }else{ |
|
| 111 | + } else { |
|
| 112 | 112 | return array(); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | $row = str_getcsv($this->rows[$this->index], $this->tokenDelimiter); |
| 109 | 109 | $this->index++; |
| 110 | 110 | return $row; |
| 111 | - }else{ |
|
| 111 | + } else{ |
|
| 112 | 112 | return array(); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class SessionStorage implements StorageInterface{ |
|
| 9 | +class SessionStorage implements StorageInterface { |
|
| 10 | 10 | |
| 11 | 11 | const INDEX = 'silverbullet-storage'; |
| 12 | 12 | const WIDE = 'wide'; |
@@ -41,21 +41,21 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @param string $package |
| 43 | 43 | */ |
| 44 | - private function __construct($package = ""){ |
|
| 45 | - if(!isset($_SESSION)){ |
|
| 44 | + private function __construct($package = "") { |
|
| 45 | + if (!isset($_SESSION)) { |
|
| 46 | 46 | session_start(); |
| 47 | 47 | } |
| 48 | - if(!isset($_SESSION['silverbullet-storage'])){ |
|
| 48 | + if (!isset($_SESSION['silverbullet-storage'])) { |
|
| 49 | 49 | $_SESSION[self::INDEX] = array(); |
| 50 | 50 | $_SESSION[self::INDEX][self::WIDE] = array(); |
| 51 | 51 | $_SESSION[self::INDEX][self::SCOPED] = array(); |
| 52 | 52 | } |
| 53 | - if (!empty($package)){ |
|
| 54 | - if(!isset($_SESSION[self::INDEX][self::SCOPED][$package])){ |
|
| 53 | + if (!empty($package)) { |
|
| 54 | + if (!isset($_SESSION[self::INDEX][self::SCOPED][$package])) { |
|
| 55 | 55 | $_SESSION[self::INDEX][self::SCOPED][$package] = array(); |
| 56 | 56 | } |
| 57 | 57 | $this->session = &$_SESSION[self::INDEX][self::SCOPED][$package]; |
| 58 | - }else{ |
|
| 58 | + } else { |
|
| 59 | 59 | $this->session = &$_SESSION[self::INDEX][self::WIDE]; |
| 60 | 60 | } |
| 61 | 61 | $this->package = $package; |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @param string $package |
| 67 | 67 | * @return SessionStorage |
| 68 | 68 | */ |
| 69 | - public static function getInstance($package = ""){ |
|
| 69 | + public static function getInstance($package = "") { |
|
| 70 | 70 | |
| 71 | - if(empty($package)){ |
|
| 72 | - if(empty(self::$instance)){ |
|
| 71 | + if (empty($package)) { |
|
| 72 | + if (empty(self::$instance)) { |
|
| 73 | 73 | self::$instance = new self($package); |
| 74 | 74 | } |
| 75 | 75 | return self::$instance; |
| 76 | - }else{ |
|
| 77 | - if(!isset(self::$pool[$package])){ |
|
| 76 | + } else { |
|
| 77 | + if (!isset(self::$pool[$package])) { |
|
| 78 | 78 | self::$pool[$package] = new self($package); |
| 79 | 79 | } |
| 80 | 80 | return self::$pool[$package]; |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public static function close(){ |
|
| 84 | + public static function close() { |
|
| 85 | 85 | session_unset(); |
| 86 | 86 | session_destroy(); |
| 87 | 87 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * {@inheritDoc} |
| 92 | 92 | * @see \web\lib\admin\domain\storage\StorageInterface::put() |
| 93 | 93 | */ |
| 94 | - public function put($identifier, $object){ |
|
| 94 | + public function put($identifier, $object) { |
|
| 95 | 95 | $this->session[$identifier] = $object; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * {@inheritDoc} |
| 101 | 101 | * @see \web\lib\admin\domain\storage\StorageInterface::add() |
| 102 | 102 | */ |
| 103 | - public function add($identifier, $object){ |
|
| 103 | + public function add($identifier, $object) { |
|
| 104 | 104 | $this->session[$identifier][] = $object; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | * {@inheritDoc} |
| 110 | 110 | * @see \web\lib\admin\domain\storage\StorageInterface::get() |
| 111 | 111 | */ |
| 112 | - public function get($identifier){ |
|
| 113 | - if(isset($this->session[$identifier])){ |
|
| 112 | + public function get($identifier) { |
|
| 113 | + if (isset($this->session[$identifier])) { |
|
| 114 | 114 | return $this->session[$identifier]; |
| 115 | - }else{ |
|
| 115 | + } else { |
|
| 116 | 116 | return array(); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * |
| 122 | 122 | */ |
| 123 | - public function getAll(){ |
|
| 123 | + public function getAll() { |
|
| 124 | 124 | return $this->session; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * {@inheritDoc} |
| 130 | 130 | * @see \web\lib\admin\domain\storage\StorageInterface::delete() |
| 131 | 131 | */ |
| 132 | - public function delete($identifier){ |
|
| 132 | + public function delete($identifier) { |
|
| 133 | 133 | unset($this->session[$identifier]); |
| 134 | 134 | } |
| 135 | 135 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $_SESSION[self::INDEX][self::SCOPED][$package] = array(); |
| 56 | 56 | } |
| 57 | 57 | $this->session = &$_SESSION[self::INDEX][self::SCOPED][$package]; |
| 58 | - }else{ |
|
| 58 | + } else{ |
|
| 59 | 59 | $this->session = &$_SESSION[self::INDEX][self::WIDE]; |
| 60 | 60 | } |
| 61 | 61 | $this->package = $package; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | self::$instance = new self($package); |
| 74 | 74 | } |
| 75 | 75 | return self::$instance; |
| 76 | - }else{ |
|
| 76 | + } else{ |
|
| 77 | 77 | if(!isset(self::$pool[$package])){ |
| 78 | 78 | self::$pool[$package] = new self($package); |
| 79 | 79 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | public function get($identifier){ |
| 113 | 113 | if(isset($this->session[$identifier])){ |
| 114 | 114 | return $this->session[$identifier]; |
| 115 | - }else{ |
|
| 115 | + } else{ |
|
| 116 | 116 | return array(); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | private $box; |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * |
|
| 21 | - * @param string $class |
|
| 22 | - */ |
|
| 19 | + /** |
|
| 20 | + * |
|
| 21 | + * @param string $class |
|
| 22 | + */ |
|
| 23 | 23 | public function __construct($class) { |
| 24 | 24 | $this->box = new CompositeTag('div'); |
| 25 | 25 | $this->class = $class; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * {@inheritDoc} |
| 32 | 32 | * @see \web\lib\admin\view\MessageReceiverInterface::hasMessages() |
| 33 | 33 | */ |
| 34 | - public function hasMessages(){ |
|
| 34 | + public function hasMessages() { |
|
| 35 | 35 | return $this->box->size() > 0; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * {@inheritDoc} |
| 42 | 42 | * @see MessageReceiverInterface::receiveMessage() |
| 43 | 43 | */ |
| 44 | - public function receiveMessage($message){ |
|
| 44 | + public function receiveMessage($message) { |
|
| 45 | 45 | $p = new Tag('p'); |
| 46 | 46 | $p->addAttribute('class', $message->getClass($this->class)); |
| 47 | 47 | $p->addText($message->getText()); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * |
| 53 | 53 | */ |
| 54 | - public function render(){ |
|
| 54 | + public function render() { |
|
| 55 | 55 | echo $this->__toString(); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | * {@inheritDoc} |
| 61 | 61 | * @see HtmlElementInterface::__toString() |
| 62 | 62 | */ |
| 63 | - public function __toString(){ |
|
| 64 | - if($this->hasMessages()){ |
|
| 63 | + public function __toString() { |
|
| 64 | + if ($this->hasMessages()) { |
|
| 65 | 65 | return $this->box->__toString(); |
| 66 | - }else{ |
|
| 66 | + } else { |
|
| 67 | 67 | return ''; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | public function __toString(){ |
| 64 | 64 | if($this->hasMessages()){ |
| 65 | 65 | return $this->box->__toString(); |
| 66 | - }else{ |
|
| 66 | + } else{ |
|
| 67 | 67 | return ''; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class JSButton extends Button{ |
|
| 9 | +class JSButton extends Button { |
|
| 10 | 10 | |
| 11 | 11 | const REVOKE_CREDENTIAL_ACTION = 'revokeCredential'; |
| 12 | 12 | const DELETE_USER_ACTION = 'deleteUser'; |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | private $action = ""; |
| 18 | 18 | |
| 19 | - public function __construct($title, $action, $name = '', $value = '', $type = 'button', $class = ''){ |
|
| 19 | + public function __construct($title, $action, $name = '', $value = '', $type = 'button', $class = '') { |
|
| 20 | 20 | parent::__construct($title, $type, $name, $value, $class); |
| 21 | 21 | $this->action = $action; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | protected function composeNameValueString() { |
| 25 | - return ' onclick="'.$this->action.'(\''.$this->name.'\',\''.$this->value.'\')"'; |
|
| 25 | + return ' onclick="' . $this->action . '(\'' . $this->name . '\',\'' . $this->value . '\')"'; |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | |
| 107 | 107 | } |
| 108 | 108 | return $innerString; |
| 109 | - }else{ |
|
| 109 | + } else{ |
|
| 110 | 110 | return parent::composeInnerString(); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class Row extends Tag{ |
|
| 9 | +class Row extends Tag { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @param array $cells |
| 43 | 43 | */ |
| 44 | - public function setCells($cells){ |
|
| 44 | + public function setCells($cells) { |
|
| 45 | 45 | foreach ($cells as $key => $cell) { |
| 46 | 46 | $td = new CompositeTag('td'); |
| 47 | 47 | $td->addText($cell); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return number |
| 55 | 55 | */ |
| 56 | - public function size(){ |
|
| 56 | + public function size() { |
|
| 57 | 57 | return count($this->cells); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @return \web\lib\admin\view\html\CompositeTag[] |
| 63 | 63 | */ |
| 64 | - public function getCells(){ |
|
| 64 | + public function getCells() { |
|
| 65 | 65 | return $this->cells; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | * @param string $name |
| 72 | 72 | * @param string $value |
| 73 | 73 | */ |
| 74 | - public function addCellAttribute($column, $name, $value){ |
|
| 75 | - if(isset($this->cells[$column])){ |
|
| 74 | + public function addCellAttribute($column, $name, $value) { |
|
| 75 | + if (isset($this->cells[$column])) { |
|
| 76 | 76 | $this->cells[$column]->addAttribute($name, $value); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @param array $columns |
| 83 | 83 | */ |
| 84 | - public function setColumns($columns){ |
|
| 84 | + public function setColumns($columns) { |
|
| 85 | 85 | $this->columns = $columns; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | * @param string $column |
| 91 | 91 | * @param UnaryTag $element |
| 92 | 92 | */ |
| 93 | - public function addToCell($column, $element){ |
|
| 94 | - if(!isset($this->cells[$column])){ |
|
| 93 | + public function addToCell($column, $element) { |
|
| 94 | + if (!isset($this->cells[$column])) { |
|
| 95 | 95 | $this->cells[$column] = new CompositeTag('td'); |
| 96 | 96 | } |
| 97 | 97 | $this->cells[$column]->addTag($element); |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | * @param string $column |
| 103 | 103 | * @return \web\lib\admin\view\html\CompositeTag |
| 104 | 104 | */ |
| 105 | - public function getCell($column){ |
|
| 106 | - if(!isset($this->cells[$column])){ |
|
| 105 | + public function getCell($column) { |
|
| 106 | + if (!isset($this->cells[$column])) { |
|
| 107 | 107 | $this->cells[$column] = new CompositeTag('td'); |
| 108 | 108 | } |
| 109 | 109 | return $this->cells[$column]; |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | * {@inheritDoc} |
| 115 | 115 | * @see \web\lib\admin\view\html\Tag::composeInnerString() |
| 116 | 116 | */ |
| 117 | - public function composeInnerString(){ |
|
| 118 | - if(count($this->columns)>0){ |
|
| 117 | + public function composeInnerString() { |
|
| 118 | + if (count($this->columns) > 0) { |
|
| 119 | 119 | $innerString = ""; |
| 120 | 120 | foreach ($this->columns as $column) { |
| 121 | - if(!isset($this->cells[$column])){ |
|
| 121 | + if (!isset($this->cells[$column])) { |
|
| 122 | 122 | $this->cells[$column] = new CompositeTag('td'); |
| 123 | 123 | } |
| 124 | - $this->cells[$column]->setTab("\t".$this->tab); |
|
| 124 | + $this->cells[$column]->setTab("\t" . $this->tab); |
|
| 125 | 125 | $innerString .= $this->cells[$column]; |
| 126 | 126 | |
| 127 | 127 | } |
| 128 | 128 | return $innerString; |
| 129 | - }else{ |
|
| 129 | + } else { |
|
| 130 | 130 | return parent::composeInnerString(); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -6,13 +6,13 @@ |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class Button extends Tag{ |
|
| 9 | +class Button extends Tag { |
|
| 10 | 10 | |
| 11 | 11 | const SUBMIT_TYPE = 'submit'; |
| 12 | 12 | const RESET_TYPE = 'reset'; |
| 13 | 13 | const BUTTON_TYPE = 'button'; |
| 14 | 14 | |
| 15 | - public function __construct($title, $type = self::SUBMIT_TYPE, $name = '', $value = '', $class = '', $id = ''){ |
|
| 15 | + public function __construct($title, $type = self::SUBMIT_TYPE, $name = '', $value = '', $class = '', $id = '') { |
|
| 16 | 16 | parent::__construct('button'); |
| 17 | 17 | $this->addAttribute('type', $type); |
| 18 | 18 | $this->addAttribute('name', $name); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @return UnaryTag[] |
| 23 | 23 | */ |
| 24 | - public function getTags(){ |
|
| 24 | + public function getTags() { |
|
| 25 | 25 | return $this->tags; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return number |
| 31 | 31 | */ |
| 32 | - public function size(){ |
|
| 32 | + public function size() { |
|
| 33 | 33 | return count($this->tags); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | * {@inheritDoc} |
| 39 | 39 | * @see \lib\html\Tag::composeInnerString() |
| 40 | 40 | */ |
| 41 | - protected function composeInnerString(){ |
|
| 41 | + protected function composeInnerString() { |
|
| 42 | 42 | $innerString = "\n\t" . $this->tab . $this->text; |
| 43 | 43 | foreach ($this->tags as $tag) { |
| 44 | - $tag->setTab("\t".$this->tab); |
|
| 44 | + $tag->setTab("\t" . $this->tab); |
|
| 45 | 45 | $innerString .= $tag; |
| 46 | 46 | } |
| 47 | 47 | return $innerString; |