@@ -174,11 +174,11 @@ |
||
| 174 | 174 | return empty($this->dbId); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - public function insert(){ |
|
| 177 | + public function insert() { |
|
| 178 | 178 | static::$rowOperator->insert($this); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function delete(){ |
|
| 181 | + public function delete() { |
|
| 182 | 182 | static::$rowOperator->deleteById($this); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -54,13 +54,13 @@ |
||
| 54 | 54 | if (is_callable($callable)) { |
| 55 | 55 | $this->accessors[$type][$varName] = $callable; |
| 56 | 56 | } else { |
| 57 | - throw new Exception('Error assigning callable in ' . get_called_class() . '! Callable typed [' . $type . '] is not a callable or not accessible in the scope'); |
|
| 57 | + throw new Exception('Error assigning callable in '.get_called_class().'! Callable typed ['.$type.'] is not a callable or not accessible in the scope'); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function __set($name, $value) { |
| 62 | 62 | |
| 63 | - if(is_callable($value)) { |
|
| 63 | + if (is_callable($value)) { |
|
| 64 | 64 | $this->accessors[P_CONTAINER_GETTER_PIMPLE][$name] = $value; |
| 65 | 65 | } elseif (is_callable($this->accessors[P_CONTAINER_SETTER][$name])) { |
| 66 | 66 | call_user_func($this->accessors[P_CONTAINER_SETTER][$name], $value); |
@@ -86,14 +86,14 @@ |
||
| 86 | 86 | |
| 87 | 87 | $this->playerArray = $user; |
| 88 | 88 | |
| 89 | - $this->playerId = function (BuddyContainer $cBuddy) { |
|
| 89 | + $this->playerId = function(BuddyContainer $cBuddy) { |
|
| 90 | 90 | return $cBuddy->playerArray['id']; |
| 91 | 91 | }; |
| 92 | - $this->playerName = function (BuddyContainer $cBuddy) { |
|
| 92 | + $this->playerName = function(BuddyContainer $cBuddy) { |
|
| 93 | 93 | return $cBuddy->playerArray['username']; |
| 94 | 94 | }; |
| 95 | - $this->playerNameAndCoordinates = function (BuddyContainer $cBuddy) { |
|
| 96 | - return "{$cBuddy->playerArray['username']} " . uni_render_coordinates($cBuddy->playerArray); |
|
| 95 | + $this->playerNameAndCoordinates = function(BuddyContainer $cBuddy) { |
|
| 96 | + return "{$cBuddy->playerArray['username']} ".uni_render_coordinates($cBuddy->playerArray); |
|
| 97 | 97 | }; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -34,56 +34,56 @@ |
||
| 34 | 34 | $gc = $this; |
| 35 | 35 | |
| 36 | 36 | // Default db |
| 37 | - $gc->db = function ($c) { |
|
| 37 | + $gc->db = function($c) { |
|
| 38 | 38 | classSupernova::$db = $db = new \db_mysql($c); |
| 39 | 39 | $db->sn_db_connect(); |
| 40 | 40 | |
| 41 | 41 | return $db; |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | - $gc->debug = function ($c) { |
|
| 44 | + $gc->debug = function($c) { |
|
| 45 | 45 | return new \debug(); |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | - $gc->cache = function ($c) { |
|
| 48 | + $gc->cache = function($c) { |
|
| 49 | 49 | return new \classCache(classSupernova::$cache_prefix); |
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | - $gc->config = function ($c) { |
|
| 52 | + $gc->config = function($c) { |
|
| 53 | 53 | return new \classConfig(classSupernova::$cache_prefix); |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | - $gc->localePlayer = function (GlobalContainer $c) { |
|
| 56 | + $gc->localePlayer = function(GlobalContainer $c) { |
|
| 57 | 57 | return new \classLocale($c->config->server_locale_log_usage); |
| 58 | 58 | }; |
| 59 | 59 | |
| 60 | - $gc->dbRowOperator = function ($c) { |
|
| 60 | + $gc->dbRowOperator = function($c) { |
|
| 61 | 61 | return new \DbRowDirectOperator($c); |
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | - $gc->query = $gc->factory(function (GlobalContainer $c) { |
|
| 64 | + $gc->query = $gc->factory(function(GlobalContainer $c) { |
|
| 65 | 65 | return new \DbQueryConstructor($c->db); |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | - $gc->cacheOperator = function (GlobalContainer $gc) { |
|
| 68 | + $gc->cacheOperator = function(GlobalContainer $gc) { |
|
| 69 | 69 | return new \SnDbCachedOperator($gc); |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | 72 | $gc->snCacheClass = 'SnCache'; |
| 73 | - $gc->snCache = function (GlobalContainer $gc) { |
|
| 73 | + $gc->snCache = function(GlobalContainer $gc) { |
|
| 74 | 74 | return $gc->db->snCache; |
| 75 | 75 | }; |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | $gc->buddyClass = 'Buddy\BuddyModel'; |
| 79 | - $gc->buddyModel = function (GlobalContainer $c) { |
|
| 79 | + $gc->buddyModel = function(GlobalContainer $c) { |
|
| 80 | 80 | return new $c->buddyClass($c); |
| 81 | 81 | }; |
| 82 | 82 | |
| 83 | - $gc->unitModel = function (GlobalContainer $c) { |
|
| 83 | + $gc->unitModel = function(GlobalContainer $c) { |
|
| 84 | 84 | return new \V2Unit\V2UnitModel($c); |
| 85 | 85 | }; |
| 86 | - $gc->unitContainer = $gc->factory(function (GlobalContainer $c) { |
|
| 86 | + $gc->unitContainer = $gc->factory(function(GlobalContainer $c) { |
|
| 87 | 87 | return new \V2Unit\V2UnitContainer($c); |
| 88 | 88 | }); |
| 89 | 89 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $that = $this; |
| 104 | 104 | |
| 105 | 105 | $this->assignAccessor('type', P_CONTAINER_SETTER, |
| 106 | - function ($value) use ($that) { |
|
| 106 | + function($value) use ($that) { |
|
| 107 | 107 | $that->type = $value; |
| 108 | 108 | $array = get_unit_param($value); |
| 109 | 109 | $that->unitInfo = $array; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | // This crap code is until php 5.4+. There we can use $this binding for lambdas |
| 119 | 119 | $fieldName = $this->properties[$propertyName = 'timeStart'][P_DB_FIELD]; |
| 120 | 120 | $this->assignAccessor($propertyName, P_CONTAINER_IMPORTER, |
| 121 | - function (&$row) use ($that, $fieldName) { |
|
| 121 | + function(&$row) use ($that, $fieldName) { |
|
| 122 | 122 | if (isset($row[$fieldName])) { |
| 123 | 123 | $dateTime = new \DateTime($row[$fieldName]); |
| 124 | 124 | } else { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | ); |
| 130 | 130 | $this->assignAccessor($propertyName, P_CONTAINER_EXPORTER, |
| 131 | - function (&$row) use ($that, $fieldName) { |
|
| 131 | + function(&$row) use ($that, $fieldName) { |
|
| 132 | 132 | $dateTime = $that->timeStart; |
| 133 | 133 | if ($dateTime instanceof \DateTime) { |
| 134 | 134 | $row[$fieldName] = $dateTime->format(FMT_DATE_TIME_SQL); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $fieldName = $this->properties[$propertyName = 'timeFinish'][P_DB_FIELD]; |
| 142 | 142 | $this->assignAccessor($propertyName, P_CONTAINER_IMPORTER, |
| 143 | - function (&$row) use ($that, $fieldName) { |
|
| 143 | + function(&$row) use ($that, $fieldName) { |
|
| 144 | 144 | if (isset($row[$fieldName])) { |
| 145 | 145 | $dateTime = new \DateTime($row[$fieldName]); |
| 146 | 146 | } else { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | ); |
| 152 | 152 | $this->assignAccessor($propertyName, P_CONTAINER_EXPORTER, |
| 153 | - function (&$row) use ($that, $fieldName) { |
|
| 153 | + function(&$row) use ($that, $fieldName) { |
|
| 154 | 154 | $dateTime = $that->timeFinish; |
| 155 | 155 | if ($dateTime instanceof \DateTime) { |
| 156 | 156 | $row[$fieldName] = $dateTime->format(FMT_DATE_TIME_SQL); |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | public static function init_3_load_config_file() { |
| 113 | 113 | $dbsettings = array(); |
| 114 | 114 | |
| 115 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
| 115 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
| 116 | 116 | self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix']; |
| 117 | 117 | self::$db_name = $dbsettings['name']; |
| 118 | 118 | self::$sn_secret_word = $dbsettings['secretword']; |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | ->setIdField($cEntity->getIdFieldName()) |
| 19 | 19 | ->field('*') |
| 20 | 20 | ->from($cEntity->getTableName()) |
| 21 | - ->where($cEntity->getIdFieldName() . ' = "' . $cEntity->dbId . '"'); |
|
| 21 | + ->where($cEntity->getIdFieldName().' = "'.$cEntity->dbId.'"'); |
|
| 22 | 22 | |
| 23 | 23 | return $stmt->selectRow(); |
| 24 | 24 | } |