Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like GameController often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use GameController, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 17 | class GameController extends AbstractActionController |
||
| 18 | { |
||
| 19 | protected $options; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var \PlaygroundGame\Service\Game |
||
| 23 | */ |
||
| 24 | protected $adminGameService; |
||
| 25 | |||
| 26 | protected $game; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * |
||
| 30 | * @var ServiceManager |
||
| 31 | */ |
||
| 32 | protected $serviceLocator; |
||
| 33 | |||
| 34 | public function __construct(ServiceLocatorInterface $locator) |
||
| 38 | |||
| 39 | public function getServiceLocator() |
||
| 43 | |||
| 44 | public function checkGame() |
||
| 57 | |||
| 58 | public function createForm($form) |
||
| 88 | |||
| 89 | /** |
||
| 90 | * @param string $templatePath |
||
| 91 | * @param string $formId |
||
| 92 | */ |
||
| 93 | public function editGame($templatePath, $formId) |
||
| 94 | { |
||
| 95 | // We try to get FB pages from the logged in user |
||
| 96 | $session = new Container('facebook'); |
||
| 97 | $config = $this->getServiceLocator()->get('config'); |
||
| 98 | $appsArray = []; |
||
| 99 | $platformFbAppId = ''; |
||
| 100 | |||
| 101 | if (isset($config['facebook'])) { |
||
| 102 | $platformFbAppId = $config['facebook']['fb_appid']; |
||
| 103 | $platformFbAppSecret = $config['facebook']['fb_secret']; |
||
| 104 | } |
||
| 105 | $fb = new \Facebook\Facebook([ |
||
| 106 | 'app_id' => $platformFbAppId, |
||
| 107 | 'app_secret' => $platformFbAppSecret, |
||
| 108 | 'default_graph_version' => 'v3.1', |
||
| 109 | ]); |
||
| 110 | |||
| 111 | $helper = $fb->getRedirectLoginHelper(); |
||
| 112 | $fb_args_param = array('req_perms' => 'manage_pages,publish_pages'); |
||
| 113 | $fb_login_url = $helper->getLoginUrl($this->adminUrl()->fromRoute( |
||
| 114 | 'playgroundgame/list', |
||
| 115 | array(), |
||
| 116 | array('force_canonical' => true) |
||
| 117 | ), $fb_args_param); |
||
| 118 | $accessToken = $helper->getAccessToken(); |
||
| 119 | |||
| 120 | if (isset($accessToken) || $session->offsetExists('fb_token')) { |
||
| 121 | if (isset($accessToken)) { |
||
| 122 | $session->offsetSet('fb_token', $accessToken); |
||
| 123 | } |
||
| 124 | |||
| 125 | // checking if user access token is not valid then ask user to login again |
||
| 126 | $debugToken = $fb->get('/debug_token?input_token='. $session->offsetGet('fb_token'), $platformFbAppId . '|' . $platformFbAppSecret) |
||
| 127 | ->getGraphNode() |
||
| 128 | ->asArray(); |
||
| 129 | if (isset($debugToken['error']['code'])) { |
||
| 130 | $session->offsetUnset('fb_token'); |
||
| 131 | } else { |
||
| 132 | // setting default user access token for future requests |
||
| 133 | $fb->setDefaultAccessToken($session->offsetGet('fb_token')); |
||
| 134 | $pages = $fb->get('/me/accounts') |
||
| 135 | ->getGraphEdge() |
||
| 136 | ->asArray(); |
||
| 137 | |||
| 138 | foreach ($pages as $key) { |
||
| 139 | $app_label = ''; |
||
| 140 | if (isset($key['name'])) { |
||
| 141 | $app_label .= $key['name']; |
||
| 142 | } |
||
| 143 | if (isset($key['id'])) { |
||
| 144 | $app_label .= ' ('.$key['id'].')'; |
||
| 145 | } |
||
| 146 | $appsArray[$key['id']] = $app_label; |
||
| 147 | } |
||
| 148 | $fb_login_url = ''; |
||
| 149 | |||
| 150 | if ($this->getRequest()->isPost()) { |
||
| 151 | $data = array_replace_recursive( |
||
| 152 | $this->getRequest()->getPost()->toArray(), |
||
| 153 | $this->getRequest()->getFiles()->toArray() |
||
| 154 | ); |
||
| 155 | // Removing a previously page tab set on this game |
||
| 156 | if ($this->game && |
||
| 157 | !empty($this->game->getFbPageId()) && |
||
| 158 | !empty($this->game->getFbAppId()) && |
||
| 159 | ( |
||
| 160 | ( |
||
| 161 | $this->game->getFbPageId() !== $data['fbPageId'] || |
||
| 162 | $this->game->getFbAppId() !== $data['fbAppId'] |
||
| 163 | ) || |
||
| 164 | $data['broadcastFacebook'] == 0 |
||
| 165 | ) |
||
| 166 | ) { |
||
| 167 | $oldPage = $fb->get('/' . $this->game->getFbPageId() . '?fields=access_token,name,id') |
||
| 168 | ->getGraphNode() |
||
| 169 | ->asArray(); |
||
| 170 | $removeTab = $fb->delete( |
||
| 171 | '/' . $this->game->getFbPageId() . '/tabs', |
||
| 172 | [ |
||
| 173 | 'tab' => 'app_'.$this->game->getFbAppId(), |
||
| 174 | ], |
||
| 175 | $oldPage['access_token'] |
||
| 176 | ) |
||
| 177 | ->getGraphNode() |
||
| 178 | ->asArray(); |
||
| 179 | } |
||
| 180 | |||
| 181 | // Removing a previously post set on this game |
||
| 182 | if ($this->game && |
||
| 183 | !empty($this->game->getFbPostId()) && |
||
| 184 | $data['broadcastPostFacebook'] == 0 |
||
| 185 | ) { |
||
| 186 | $oldPage = $fb->get('/' . $this->game->getFbPageId() . '?fields=access_token,name,id') |
||
| 187 | ->getGraphNode() |
||
| 188 | ->asArray(); |
||
| 189 | $removePost = $fb->delete( |
||
| 190 | '/' . $this->game->getFbPostId(), |
||
| 191 | [], |
||
| 192 | $oldPage['access_token'] |
||
| 193 | ) |
||
| 194 | ->getGraphNode() |
||
| 195 | ->asArray(); |
||
| 196 | } |
||
| 197 | } |
||
| 198 | } |
||
| 199 | } |
||
| 200 | |||
| 201 | $viewModel = new ViewModel(); |
||
| 202 | $viewModel->setTemplate($templatePath); |
||
| 203 | |||
| 204 | $gameForm = new ViewModel(); |
||
| 205 | $gameForm->setTemplate('playground-game/game/game-form'); |
||
| 206 | |||
| 207 | $form = $this->getServiceLocator()->get($formId); |
||
| 208 | $form->setAttribute( |
||
| 209 | 'action', |
||
| 210 | $this->adminUrl()->fromRoute( |
||
| 211 | 'playgroundgame/edit-' . $this->game->getClassType(), |
||
| 212 | array('gameId' => $this->game->getId()) |
||
| 213 | ) |
||
| 214 | ); |
||
| 215 | $form->setAttribute('method', 'post'); |
||
| 216 | |||
| 217 | $pageIds = $form->get('fbPageId')->getOption('value_options'); |
||
| 218 | foreach ($appsArray as $k => $v) { |
||
| 219 | $pageIds[$k] = $v; |
||
| 220 | } |
||
| 221 | $form->get('fbPageId')->setAttribute('options', $pageIds); |
||
| 222 | |||
| 223 | //if($form->get('fbAppId')->getValue() == '') { |
||
| 224 | $form->get('fbAppId')->setValue($platformFbAppId); |
||
| 225 | //} |
||
| 226 | |||
| 227 | // if ($this->game->getFbAppId()) { |
||
| 228 | // $data['fbAppId'] = $form->get('fbAppId')->getOption('value_options'); |
||
| 229 | // $appIds[$this->game->getFbAppId()] = $this->game->getFbAppId(); |
||
| 230 | // $form->get('fbAppId')->setAttribute('options', $appIds); |
||
| 231 | // } |
||
| 232 | |||
| 233 | $gameOptions = $this->getAdminGameService()->getOptions(); |
||
| 234 | $gameStylesheet = $gameOptions->getMediaPath() . '/' . 'stylesheet_'. $this->game->getId(). '.css'; |
||
| 235 | View Code Duplication | if (is_file($gameStylesheet)) { |
|
| 236 | $values = $form->get('stylesheet')->getValueOptions(); |
||
| 237 | $values[$gameStylesheet] = 'Style personnalisé de ce jeu'; |
||
| 238 | |||
| 239 | $form->get('stylesheet')->setAttribute('options', $values); |
||
| 240 | } |
||
| 241 | |||
| 242 | $form->bind($this->game); |
||
| 243 | |||
| 244 | if ($this->getRequest()->isPost()) { |
||
| 245 | $data = array_replace_recursive( |
||
| 246 | $this->getRequest()->getPost()->toArray(), |
||
| 247 | $this->getRequest()->getFiles()->toArray() |
||
| 248 | ); |
||
| 249 | if (empty($data['prizes'])) { |
||
| 250 | $data['prizes'] = array(); |
||
| 251 | } |
||
| 252 | if (isset($data['drawDate']) && $data['drawDate']) { |
||
| 253 | $data['drawDate'] = \DateTime::createFromFormat('d/m/Y', $data['drawDate']); |
||
| 254 | } |
||
| 255 | |||
| 256 | $game = $this->getAdminGameService()->createOrUpdate($data, $this->game, $formId); |
||
| 257 | |||
| 258 | if ($game) { |
||
| 259 | if ($session->offsetExists('fb_token')) { |
||
| 260 | if (!empty($data['fbPageId']) && !empty($data['fbAppId'])) { |
||
| 261 | $page = $fb->get('/' . $data['fbPageId'] . '?fields=access_token,name,id') |
||
| 262 | ->getGraphNode() |
||
| 263 | ->asArray(); |
||
| 264 | |||
| 265 | // let's create a post on FB |
||
| 266 | if ($data['broadcastPostFacebook'] && $game->getWelcomeBlock() != '' && $game->getMainImage() != '') { |
||
| 267 | $imgPath = $this->url()->fromRoute('frontend', [], ['force_canonical' => true], false).$game->getMainImage(); |
||
| 268 | // emoticons : $emoji = html_entity_decode('😈'); |
||
| 269 | |||
| 270 | $message = str_replace('<p>', "", $game->getWelcomeBlock()); |
||
| 271 | $message = str_replace('</p>', "\n", $message); |
||
| 272 | $message = strip_tags($message); |
||
| 273 | |||
| 274 | // Create the post |
||
| 275 | try { |
||
| 276 | // Associate the fbAppId to the page so that we can receive the webhooks |
||
| 277 | $linkAppToPage = $fb->post( |
||
| 278 | '/' . $page['id'] . '/subscribed_apps', |
||
| 279 | array(), |
||
| 280 | $page['access_token'] |
||
| 281 | ); |
||
| 282 | |||
| 283 | /** |
||
| 284 | * post text and save the post_id to be able to get the likes and comments on the post |
||
| 285 | */ |
||
| 286 | // $post = $fb->post( |
||
| 287 | // '/' . $page['id'] . '/feed', |
||
| 288 | // array( |
||
| 289 | // 'message' => 'message', |
||
| 290 | // ), |
||
| 291 | // $page['access_token'] |
||
| 292 | // ); |
||
| 293 | |||
| 294 | /** |
||
| 295 | * Post a photo |
||
| 296 | */ |
||
| 297 | // $post = $fb->post( |
||
| 298 | // '/' . $page['id'] . '/photos', |
||
| 299 | // array( |
||
| 300 | // 'url' => 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
||
| 301 | // 'published' => true, |
||
| 302 | // ), |
||
| 303 | // $page['access_token'] |
||
| 304 | // ); |
||
| 305 | |||
| 306 | /** |
||
| 307 | * Upload an unpublished photo and include it in a post |
||
| 308 | */ |
||
| 309 | $img = $fb->post( |
||
| 310 | '/' . $page['id'] . '/photos', |
||
| 311 | array( |
||
| 312 | 'url' => $imgPath, |
||
| 313 | 'published' => false, |
||
| 314 | ), |
||
| 315 | $page['access_token'] |
||
| 316 | ); |
||
| 317 | $img = $img->getGraphNode()->asArray(); |
||
| 318 | |||
| 319 | if ($game->getFbPostId() != '') { |
||
| 320 | $post = $fb->post( |
||
| 321 | '/' . $game->getFbPostId(), |
||
| 322 | array( |
||
| 323 | 'message' => $message, |
||
| 324 | 'attached_media[0]' => '{"media_fbid":"'.$img['id'].'"}', |
||
| 325 | ), |
||
| 326 | $page['access_token'] |
||
| 327 | ); |
||
| 328 | } else { |
||
| 329 | $post = $fb->post( |
||
| 330 | '/' . $page['id'] . '/feed', |
||
| 331 | array( |
||
| 332 | 'message' => $message, |
||
| 333 | 'attached_media[0]' => '{"media_fbid":"'.$img['id'].'"}', |
||
| 334 | ), |
||
| 335 | $page['access_token'] |
||
| 336 | ); |
||
| 337 | } |
||
| 338 | |||
| 339 | /** |
||
| 340 | * Upload an unpublished photo and include it in a scheduled post |
||
| 341 | */ |
||
| 342 | // $img = $fb->post( |
||
| 343 | // '/' . $page['id'] . '/photos', |
||
| 344 | // array( |
||
| 345 | // 'url' => 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
||
| 346 | // 'published' => false, |
||
| 347 | // 'temporary' => true |
||
| 348 | // ), |
||
| 349 | // $page['access_token'] |
||
| 350 | // ); |
||
| 351 | // $img = $img->getGraphNode()->asArray(); |
||
| 352 | // |
||
| 353 | // $post = $fb->post( |
||
| 354 | // '/' . $page['id'] . '/feed', |
||
| 355 | // array( |
||
| 356 | // 'message' => 'message avec image', |
||
| 357 | // 'attached_media[0]' => '{"media_fbid":"'.$img['id'].'"}', |
||
| 358 | // 'published' => false, |
||
| 359 | // 'scheduled_publish_time' => '1512068400', |
||
| 360 | // 'unpublished_content_type' => 'SCHEDULED', |
||
| 361 | // ), |
||
| 362 | // $page['access_token'] |
||
| 363 | // ); |
||
| 364 | |||
| 365 | /** |
||
| 366 | * publish multiple photos then associate these photos to a post |
||
| 367 | */ |
||
| 368 | // $endpoint = "/".$page['id']."/photos"; |
||
| 369 | // $multiple_photos = [ |
||
| 370 | // 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
||
| 371 | // 'https://images.unsplash.com/photo-1538218952949-2f5dda4a9156?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=b79a9c7314dd5ca8eac2f187902ceca2&auto=format&fit=crop&w=2704&q=80', |
||
| 372 | // 'https://images.unsplash.com/photo-1538157245064-badfdabb7142?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=dfa50d5dd51b85f25ca03f2b2667752a&auto=format&fit=crop&w=2700&q=80', |
||
| 373 | // ]; |
||
| 374 | // $photos = []; |
||
| 375 | // $data_post = ['attached_media' => [], 'message' => 'message', 'published' => true]; |
||
| 376 | // foreach ($multiple_photos as $file_url): |
||
| 377 | // array_push($photos, $fb->request('POST',$endpoint,['url' =>$file_url,'published' => false,'temporary' => true], $page['access_token'])); |
||
| 378 | // endforeach; |
||
| 379 | // $uploaded_photos = $fb->sendBatchRequest($photos, $page['access_token']); |
||
| 380 | // $uploaded_photos = $uploaded_photos->getGraphNode()->asArray(); |
||
| 381 | |||
| 382 | // foreach ($uploaded_photos as $photo): |
||
| 383 | // $photo = json_decode($photo['body']); |
||
| 384 | // array_push($data_post['attached_media'], '{"media_fbid":"'.$photo->id.'"}'); |
||
| 385 | // endforeach; |
||
| 386 | // $post = $fb->sendRequest('POST', "/".$page['id']."/feed", $data_post, $page['access_token']); |
||
| 387 | |||
| 388 | /** |
||
| 389 | * publish a carrousel to a post |
||
| 390 | */ |
||
| 391 | // $data_post = [ |
||
| 392 | // 'child_attachments' => [], |
||
| 393 | // 'message' => 'message', |
||
| 394 | // 'link' => 'https://www.playground.gg', |
||
| 395 | // 'multi_share_end_card' => false, |
||
| 396 | // 'published' => true, |
||
| 397 | // ]; |
||
| 398 | |||
| 399 | // $multiple_photos = [ |
||
| 400 | // 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
||
| 401 | // 'https://images.unsplash.com/photo-1538218952949-2f5dda4a9156?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=b79a9c7314dd5ca8eac2f187902ceca2&auto=format&fit=crop&w=2704&q=80', |
||
| 402 | // 'https://images.unsplash.com/photo-1538157245064-badfdabb7142?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=dfa50d5dd51b85f25ca03f2b2667752a&auto=format&fit=crop&w=2700&q=80', |
||
| 403 | // ]; |
||
| 404 | // foreach ($multiple_photos as $k => $photo): |
||
| 405 | // array_push($data_post['child_attachments'], '{"link":"'.$photo.'", "name": "message_'.$k.'"}'); |
||
| 406 | // endforeach; |
||
| 407 | // $post = $fb->sendRequest('POST', "/".$page['id']."/feed", $data_post, $page['access_token']); |
||
| 408 | |||
| 409 | /** Texte avec lien vers une page |
||
| 410 | * |
||
| 411 | */ |
||
| 412 | // $post = $fb->post( |
||
| 413 | // '/' . $page['id'] . '/feed', |
||
| 414 | // array( |
||
| 415 | // 'message' => 'message', |
||
| 416 | // 'link' => 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
||
| 417 | // //'picture' => 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
||
| 418 | // 'call_to_action' => '{"type":"BOOK_TRAVEL","value":{"link":"https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80"}}', |
||
| 419 | // ), |
||
| 420 | // $page['access_token'] |
||
| 421 | // ); |
||
| 422 | } catch (\Exception $e) { |
||
| 423 | if ($e->getMessage() == 'Missing or invalid image file') { |
||
| 424 | if ($game->getFbPostId() != '') { |
||
| 425 | $post = $fb->post( |
||
| 426 | '/' . $game->getFbPostId(), |
||
| 427 | array( |
||
| 428 | 'message' => $message, |
||
| 429 | ), |
||
| 430 | $page['access_token'] |
||
| 431 | ); |
||
| 432 | } else { |
||
| 433 | $post = $fb->post( |
||
| 434 | '/' . $page['id'] . '/feed', |
||
| 435 | array( |
||
| 436 | 'message' => $message, |
||
| 437 | ), |
||
| 438 | $page['access_token'] |
||
| 439 | ); |
||
| 440 | } |
||
| 441 | } else { |
||
| 442 | throw $e; |
||
| 443 | } |
||
| 444 | } |
||
| 445 | $post = $post->getGraphNode()->asArray(); |
||
| 446 | if (isset($post['id'])) { |
||
| 447 | $game->setFbPostId($post['id']); |
||
| 448 | $game = $this->getAdminGameService()->getGameMapper()->update($game); |
||
| 449 | } |
||
| 450 | } |
||
| 451 | |||
| 452 | // Let's record the FB page tab if it is configured |
||
| 453 | // adding page tab to selected page using page access token |
||
| 454 | if ($data['broadcastFacebook']) { |
||
| 455 | try { |
||
| 456 | $addTab = $fb->post( |
||
| 457 | '/' . $page['id'] . '/tabs', |
||
| 458 | [ |
||
| 459 | 'app_id' => $data['fbAppId'], |
||
| 460 | 'custom_name' => (!empty($data['fbPageTabTitle'])) ? $data['fbPageTabTitle'] : $data['title'], |
||
| 461 | 'custom_image_url' => ($game->getFbPageTabImage() !== '') ? |
||
| 462 | $this->getAdminGameService()->getServiceManager()->get('ViewRenderer')->url( |
||
| 463 | 'frontend', |
||
| 464 | array(), |
||
| 465 | array('force_canonical' => true) |
||
| 466 | ).$game->getFbPageTabImage() : |
||
| 467 | null, |
||
| 468 | 'position' => (!empty($data['fbPageTabPosition'])) ? $data['fbPageTabPosition'] : 99 |
||
| 469 | ], |
||
| 470 | $page['access_token'] |
||
| 471 | ) |
||
| 472 | ->getGraphNode() |
||
| 473 | ->asArray(); |
||
| 474 | } catch (\Exception $e) { |
||
| 475 | // (#324) Missing or invalid image file |
||
| 476 | if ($e->getCode() == '324') { |
||
| 477 | try { |
||
| 478 | $addTab = $fb->post( |
||
| 479 | '/' . $page['id'] . '/tabs', |
||
| 480 | [ |
||
| 481 | 'app_id' => $data['fbAppId'], |
||
| 482 | 'custom_name' => (!empty($data['fbPageTabTitle'])) ? $data['fbPageTabTitle'] : $data['title'], |
||
| 483 | 'position' => (!empty($data['fbPageTabPosition'])) ? $data['fbPageTabPosition'] : 99 |
||
| 484 | ], |
||
| 485 | $page['access_token'] |
||
| 486 | ) |
||
| 487 | ->getGraphNode() |
||
| 488 | ->asArray(); |
||
| 489 | } catch (\Exception $e) { |
||
| 490 | throw $e; |
||
| 491 | } |
||
| 492 | } |
||
| 493 | } |
||
| 494 | } |
||
| 495 | } |
||
| 496 | } |
||
| 497 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
||
| 498 | } |
||
| 499 | } |
||
| 500 | |||
| 501 | $gameForm->setVariables( |
||
| 502 | array( |
||
| 503 | 'platform_fb_app_id' => $platformFbAppId, |
||
| 504 | 'fb_login_url' => $fb_login_url, |
||
| 505 | 'form' => $form, |
||
| 506 | 'game' => $this->game |
||
| 507 | ) |
||
| 508 | ); |
||
| 509 | $viewModel->addChild($gameForm, 'game_form'); |
||
| 510 | |||
| 511 | return $viewModel->setVariables( |
||
| 512 | array( |
||
| 513 | 'form' => $form, |
||
| 514 | 'title' => 'Edit this game', |
||
| 515 | ) |
||
| 516 | ); |
||
| 517 | } |
||
| 518 | |||
| 519 | public function listAction() |
||
| 573 | |||
| 574 | public function entryAction() |
||
| 583 | |||
| 584 | View Code Duplication | public function invitationAction() |
|
| 605 | |||
| 606 | public function removeInvitationAction() |
||
| 619 | |||
| 620 | public function downloadAction() |
||
| 648 | |||
| 649 | // Only used for Quiz and Lottery |
||
| 650 | public function drawAction() |
||
| 683 | |||
| 684 | /** |
||
| 685 | * This method serialize a game an export it as a txt file |
||
| 686 | * @return \Zend\Stdlib\ResponseInterface |
||
| 687 | */ |
||
| 688 | public function exportAction() |
||
| 708 | |||
| 709 | /** |
||
| 710 | * This method take an uploaded txt file containing a serialized game |
||
| 711 | * and persist it in the database |
||
| 712 | * @return unknown |
||
| 713 | */ |
||
| 714 | public function importAction() |
||
| 748 | |||
| 749 | public function removeAction() |
||
| 764 | |||
| 765 | public function setActiveAction() |
||
| 774 | |||
| 775 | public function formAction() |
||
| 783 | |||
| 784 | public function setOptions(ModuleOptions $options) |
||
| 790 | |||
| 791 | public function getOptions() |
||
| 799 | |||
| 800 | public function getAdminGameService() |
||
| 808 | |||
| 809 | public function setAdminGameService(AdminGameService $adminGameService) |
||
| 815 | } |
||
| 816 |
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..