supernova-ws /
SuperNova
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Common; |
||
| 4 | |||
| 5 | use Bonus\BonusCatalog; |
||
| 6 | use Bonus\ValueStorage; |
||
| 7 | use Bonus\ValueBonused; |
||
| 8 | use Core\SnPimp; |
||
| 9 | use Modules\ModulesManager; |
||
| 10 | use \SN; |
||
| 11 | use \General; |
||
| 12 | use \Core\Watchdog; |
||
| 13 | use \Core\Repository; |
||
| 14 | use \Event\EventBus; |
||
| 15 | use \Meta\Economic\EconomicHelper; |
||
| 16 | use Player\PlayerLevelHelper; |
||
| 17 | |||
| 18 | |||
| 19 | /** |
||
| 20 | * Class GlobalContainer |
||
| 21 | * |
||
| 22 | * Used to describe internal structures of container |
||
| 23 | * |
||
| 24 | * Variables ------------------------------------------------------------------------------------------------------------ |
||
| 25 | * @property string $cachePrefix |
||
| 26 | * |
||
| 27 | * Services ------------------------------------------------------------------------------------------------------------ |
||
| 28 | * @property \debug $debug |
||
| 29 | * @property \db_mysql $db |
||
| 30 | * @property \classCache $cache |
||
| 31 | * @property \classConfig $config |
||
| 32 | * @property \Core\Repository $repository |
||
| 33 | * @property \Storage $storage |
||
| 34 | * @property \Design $design |
||
| 35 | * @property \BBCodeParser $bbCodeParser |
||
| 36 | * @property \Fleet\FleetDispatcher $fleetDispatcher |
||
| 37 | * @property Watchdog $watchdog |
||
| 38 | * @property EventBus $eventBus |
||
| 39 | * |
||
| 40 | * @property ValueStorage $valueStorage |
||
| 41 | * @property BonusCatalog $bonusCatalog |
||
| 42 | * |
||
| 43 | * @property General $general |
||
| 44 | * @property EconomicHelper $economicHelper |
||
| 45 | * |
||
| 46 | * @property PlayerLevelHelper $playerLevelHelper |
||
| 47 | * @property SnPimp $pimp |
||
| 48 | * |
||
| 49 | * @property ModulesManager $modules |
||
| 50 | * |
||
| 51 | * Dummy objects ------------------------------------------------------------------------------------------------------- |
||
| 52 | * @property \TheUser $theUser |
||
| 53 | * |
||
| 54 | * Models -------------------------------------------------------------------------------------------------------------- |
||
| 55 | * @property \TextModel $textModel |
||
| 56 | * @property string $skinEntityClass |
||
| 57 | * @property \SkinModel $skinModel |
||
| 58 | * |
||
| 59 | * @package Common |
||
| 60 | * |
||
| 61 | */ |
||
| 62 | |||
| 63 | // * Unused -------------------------------------------------------------------------------------------------------------- |
||
| 64 | // * @property \Common\Types $types |
||
| 65 | // * @property \DbQueryConstructor $query |
||
| 66 | // * @property \DbRowDirectOperator $dbGlobalRowOperator |
||
| 67 | // * @property \SnDbCachedOperator $cacheOperator - really DB record operator. But let it be |
||
| 68 | // * @property \classLocale $localePlayer |
||
| 69 | // * |
||
| 70 | // * @property string $snCacheClass |
||
| 71 | // * @property \SnCache $snCache |
||
| 72 | // * |
||
| 73 | // * @property string $buddyClass |
||
| 74 | // * @property \Buddy\BuddyModel $buddyModel |
||
| 75 | // * |
||
| 76 | // * @property \V2Unit\V2UnitModel $unitModel |
||
| 77 | // * @property \V2Unit\V2UnitList $unitList |
||
| 78 | // * |
||
| 79 | // * @property V2FleetModel $fleetModel |
||
| 80 | // * |
||
| 81 | // * @property PlanetRenderer $planetRenderer |
||
| 82 | // * @property \FleetRenderer $fleetRenderer |
||
| 83 | // * @property $dbOperator - makes CRUD to DB: |
||
| 84 | |||
| 85 | class GlobalContainer extends ContainerPlus { |
||
| 86 | |||
| 87 | public function __construct(array $values = array()) { |
||
| 88 | parent::__construct($values); |
||
| 89 | |||
| 90 | $gc = $this; |
||
| 91 | |||
| 92 | // Services -------------------------------------------------------------------------------------------------------- |
||
| 93 | // Default db |
||
| 94 | $gc->db = function (GlobalContainer $c) { |
||
| 95 | SN::$db = new \db_mysql($c); |
||
| 96 | |||
| 97 | return SN::$db; |
||
| 98 | }; |
||
| 99 | |||
| 100 | $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */ |
||
| 101 | GlobalContainer $c) { |
||
| 102 | return new \debug(); |
||
| 103 | }; |
||
| 104 | |||
| 105 | $gc->cache = function (GlobalContainer $gc) { |
||
| 106 | return new \classCache($gc->cachePrefix); |
||
| 107 | }; |
||
| 108 | |||
| 109 | $gc->config = function (GlobalContainer $gc) { |
||
| 110 | return new \classConfig($gc->cachePrefix); |
||
| 111 | }; |
||
| 112 | |||
| 113 | |||
| 114 | $gc->repository = function (GlobalContainer $gc) { |
||
| 115 | return new Repository($gc); |
||
| 116 | }; |
||
| 117 | |||
| 118 | $gc->storage = function (GlobalContainer $gc) { |
||
| 119 | return new \Storage($gc); |
||
| 120 | }; |
||
| 121 | |||
| 122 | $gc->design = function (GlobalContainer $gc) { |
||
| 123 | return new \Design($gc); |
||
| 124 | }; |
||
| 125 | |||
| 126 | $gc->bbCodeParser = function (GlobalContainer $gc) { |
||
| 127 | return new \BBCodeParser($gc); |
||
| 128 | }; |
||
| 129 | |||
| 130 | $gc->fleetDispatcher = function (GlobalContainer $gc) { |
||
|
0 ignored issues
–
show
|
|||
| 131 | return new \Fleet\FleetDispatcher($gc); |
||
| 132 | }; |
||
| 133 | |||
| 134 | $gc->watchdog = function (GlobalContainer $gc) { |
||
| 135 | return new Watchdog($gc); |
||
| 136 | }; |
||
| 137 | |||
| 138 | $gc->eventBus = function (GlobalContainer $gc) { |
||
| 139 | return new EventBus($gc); |
||
| 140 | }; |
||
| 141 | |||
| 142 | $gc->valueStorage = function (GlobalContainer $gc) { |
||
| 143 | return new ValueStorage([]); |
||
| 144 | }; |
||
| 145 | |||
| 146 | $gc->bonusCatalog = function (GlobalContainer $gc) { |
||
| 147 | return new BonusCatalog($gc); |
||
| 148 | }; |
||
| 149 | |||
| 150 | $gc->general = function (GlobalContainer $gc) { |
||
| 151 | return new General($gc); |
||
| 152 | }; |
||
| 153 | |||
| 154 | $gc->economicHelper = function (GlobalContainer $gc) { |
||
| 155 | return new EconomicHelper($gc); |
||
| 156 | }; |
||
| 157 | |||
| 158 | $gc->playerLevelHelper = function (GlobalContainer $gc) { |
||
| 159 | return new PlayerLevelHelper($gc); |
||
| 160 | }; |
||
| 161 | |||
| 162 | $gc->pimp = function (GlobalContainer $gc) { |
||
| 163 | return new SnPimp($gc); |
||
| 164 | }; |
||
| 165 | |||
| 166 | $gc->modules = function (GlobalContainer $gc) { |
||
| 167 | return new ModulesManager($gc); |
||
| 168 | }; |
||
| 169 | |||
| 170 | // Dummy objects --------------------------------------------------------------------------------------------------- |
||
| 171 | $gc->theUser = function (GlobalContainer $gc) { |
||
| 172 | return new \TheUser($gc); |
||
| 173 | }; |
||
| 174 | |||
| 175 | |||
| 176 | // Models ---------------------------------------------------------------------------------------------------------- |
||
| 177 | $gc->skinEntityClass = \SkinV2::class; |
||
| 178 | $gc->skinModel = function (GlobalContainer $gc) { |
||
| 179 | return new \SkinModel($gc); |
||
| 180 | }; |
||
| 181 | |||
| 182 | $gc->textModel = function (GlobalContainer $gc) { |
||
| 183 | return new \TextModel($gc); |
||
| 184 | }; |
||
| 185 | |||
| 186 | |||
| 187 | // $gc->types = function ($c) { |
||
| 188 | // return new \Common\Types(); |
||
| 189 | // }; |
||
| 190 | // |
||
| 191 | // $gc->dbOperator = function (GlobalContainer $c) { |
||
| 192 | // return new \classConfig(SN::$cache_prefix); |
||
| 193 | // }; |
||
| 194 | // |
||
| 195 | // $gc->localePlayer = function (GlobalContainer $c) { |
||
| 196 | // return new \classLocale($c->config->server_locale_log_usage); |
||
| 197 | // }; |
||
| 198 | // |
||
| 199 | // $gc->dbGlobalRowOperator = function (GlobalContainer $c) { |
||
| 200 | // return new \DbRowDirectOperator($c->db); |
||
| 201 | // }; |
||
| 202 | // |
||
| 203 | // $gc->query = $gc->factory(function (GlobalContainer $c) { |
||
| 204 | // return new \DbQueryConstructor($c->db); |
||
| 205 | // }); |
||
| 206 | // |
||
| 207 | // $gc->cacheOperator = function (GlobalContainer $gc) { |
||
| 208 | // return new \SnDbCachedOperator($gc); |
||
| 209 | // }; |
||
| 210 | // |
||
| 211 | // $gc->snCacheClass = 'SnCache'; |
||
| 212 | // $gc->snCache = function (GlobalContainer $gc) { |
||
| 213 | // return $gc->db->snCache; |
||
| 214 | // }; |
||
| 215 | // |
||
| 216 | // $gc->buddyClass = 'Buddy\BuddyModel'; |
||
| 217 | // $gc->buddyModel = function (GlobalContainer $c) { |
||
| 218 | // return new $c->buddyClass($c); |
||
| 219 | // }; |
||
| 220 | // |
||
| 221 | // $gc->unitModel = function (GlobalContainer $c) { |
||
| 222 | // return new \V2Unit\V2UnitModel($c); |
||
| 223 | // }; |
||
| 224 | // $gc->unitList = $this->factory(function (GlobalContainer $c) { |
||
| 225 | // return new \V2Unit\V2UnitList($c); |
||
| 226 | // }); |
||
| 227 | // |
||
| 228 | // $gc->fleetModel = function (GlobalContainer $c) { |
||
| 229 | // return new V2FleetModel($c); |
||
| 230 | // }; |
||
| 231 | // |
||
| 232 | // $gc->planetRenderer = function (GlobalContainer $c) { |
||
| 233 | // return new PlanetRenderer($c); |
||
| 234 | // }; |
||
| 235 | // |
||
| 236 | // $gc->fleetRenderer = function (GlobalContainer $c) { |
||
| 237 | // return new \FleetRenderer($c); |
||
| 238 | // }; |
||
| 239 | // |
||
| 240 | // $gc->groupFleet = function (GlobalContainer $c) { |
||
| 241 | // return sn_get_groups('fleet'); |
||
| 242 | // }; |
||
| 243 | // |
||
| 244 | // $gc->groupFleetAndMissiles = function (GlobalContainer $c) { |
||
| 245 | // return sn_get_groups(array('fleet', GROUP_STR_MISSILES)); |
||
| 246 | // }; |
||
| 247 | // |
||
| 248 | // $gc->groupRecyclers = function (GlobalContainer $c) { |
||
| 249 | // return sn_get_groups('flt_recyclers'); |
||
| 250 | // }; |
||
| 251 | |||
| 252 | } |
||
| 253 | |||
| 254 | } |
||
| 255 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..