| Conditions | 7 |
| Paths | 8 |
| Total Lines | 680 |
| Lines | 18 |
| Ratio | 2.65 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 23 | public function __construct($name, ServiceManager $sm, Translator $translator) |
||
| 24 | { |
||
| 25 | parent::__construct($name); |
||
| 26 | |||
| 27 | $this->setServiceManager($sm); |
||
| 28 | |||
| 29 | $this->setAttribute('enctype', 'multipart/form-data'); |
||
| 30 | |||
| 31 | $this->add(array( |
||
| 32 | 'name' => 'id', |
||
| 33 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 34 | 'attributes' => array( |
||
| 35 | 'value' => 0 |
||
| 36 | ) |
||
| 37 | )); |
||
| 38 | |||
| 39 | $this->add(array( |
||
| 40 | 'name' => 'title', |
||
| 41 | 'options' => array( |
||
| 42 | 'label' => $translator->translate('Title', 'playgroundgame') |
||
| 43 | ), |
||
| 44 | 'attributes' => array( |
||
| 45 | 'type' => 'text', |
||
| 46 | 'placeholder' => $translator->translate('Title', 'playgroundgame') |
||
| 47 | ) |
||
| 48 | )); |
||
| 49 | |||
| 50 | $this->add(array( |
||
| 51 | 'name' => 'identifier', |
||
| 52 | 'options' => array( |
||
| 53 | 'label' => $translator->translate('Slug', 'playgroundgame') |
||
| 54 | ), |
||
| 55 | 'attributes' => array( |
||
| 56 | 'type' => 'text' |
||
| 57 | ) |
||
| 58 | )); |
||
| 59 | |||
| 60 | // Adding an empty upload field to be able to correctly handle this on |
||
| 61 | // the service side. |
||
| 62 | $this->add(array( |
||
| 63 | 'name' => 'uploadMainImage', |
||
| 64 | 'attributes' => array( |
||
| 65 | 'type' => 'file' |
||
| 66 | ), |
||
| 67 | 'options' => array( |
||
| 68 | 'label' => $translator->translate('Main image', 'playgroundgame') |
||
| 69 | ) |
||
| 70 | )); |
||
| 71 | $this->add(array( |
||
| 72 | 'name' => 'mainImage', |
||
| 73 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 74 | 'attributes' => array( |
||
| 75 | 'value' => '' |
||
| 76 | ) |
||
| 77 | )); |
||
| 78 | $this->add(array( |
||
| 79 | 'name' => 'deleteMainImage', |
||
| 80 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 81 | 'attributes' => array( |
||
| 82 | 'value' => '', |
||
| 83 | 'class' => 'delete_main_image', |
||
| 84 | ), |
||
| 85 | )); |
||
| 86 | |||
| 87 | // Adding an empty upload field to be able to correctly handle this on |
||
| 88 | // the service side. |
||
| 89 | $this->add(array( |
||
| 90 | 'name' => 'uploadSecondImage', |
||
| 91 | 'attributes' => array( |
||
| 92 | 'type' => 'file' |
||
| 93 | ), |
||
| 94 | 'options' => array( |
||
| 95 | 'label' => $translator->translate('Secondary image', 'playgroundgame') |
||
| 96 | ) |
||
| 97 | )); |
||
| 98 | $this->add(array( |
||
| 99 | 'name' => 'secondImage', |
||
| 100 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 101 | 'attributes' => array( |
||
| 102 | 'value' => '' |
||
| 103 | ) |
||
| 104 | )); |
||
| 105 | $this->add(array( |
||
| 106 | 'name' => 'deleteSecondImage', |
||
| 107 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 108 | 'attributes' => array( |
||
| 109 | 'value' => '', |
||
| 110 | 'class' => 'delete_second_image', |
||
| 111 | ), |
||
| 112 | )); |
||
| 113 | |||
| 114 | $categories = $this->getPrizeCategories(); |
||
| 115 | $this->add(array( |
||
| 116 | 'type' => 'Zend\Form\Element\Select', |
||
| 117 | 'name' => 'prizeCategory', |
||
| 118 | 'options' => array( |
||
| 119 | 'empty_option' => $translator->translate('No category for this game', 'playgroundgame'), |
||
| 120 | 'value_options' => $categories, |
||
| 121 | 'label' => $translator->translate('Category benefit', 'playgroundgame'), |
||
| 122 | 'disable_inarray_validator' => true |
||
| 123 | ), |
||
| 124 | |||
| 125 | )); |
||
| 126 | |||
| 127 | $this->add(array( |
||
| 128 | 'type' => 'Zend\Form\Element\Checkbox', |
||
| 129 | 'name' => 'broadcastPlatform', |
||
| 130 | 'options' => array( |
||
| 131 | 'label' => $translator->translate('Publish game on plateform', 'playgroundgame'), |
||
| 132 | ), |
||
| 133 | )); |
||
| 134 | |||
| 135 | $this->add(array( |
||
| 136 | 'type' => 'Zend\Form\Element\Checkbox', |
||
| 137 | 'name' => 'anonymousAllowed', |
||
| 138 | 'options' => array( |
||
| 139 | 'label' => $translator->translate('Anonymous players allowed', 'playgroundgame'), |
||
| 140 | ), |
||
| 141 | )); |
||
| 142 | |||
| 143 | $this->add(array( |
||
| 144 | 'name' => 'anonymousIdentifier', |
||
| 145 | 'options' => array( |
||
| 146 | 'label' => $translator->translate('Anonymous Identifier', 'playgroundgame') |
||
| 147 | ), |
||
| 148 | 'attributes' => array( |
||
| 149 | 'type' => 'text' |
||
| 150 | ) |
||
| 151 | )); |
||
| 152 | |||
| 153 | $this->add(array( |
||
| 154 | 'type' => 'Zend\Form\Element\Checkbox', |
||
| 155 | 'name' => 'broadcastEmbed', |
||
| 156 | 'options' => array( |
||
| 157 | 'label' => $translator->translate('Publish game on embed mode', 'playgroundgame'), |
||
| 158 | ), |
||
| 159 | )); |
||
| 160 | |||
| 161 | $this->add(array( |
||
| 162 | 'type' => 'Zend\Form\Element\Checkbox', |
||
| 163 | 'name' => 'displayHome', |
||
| 164 | 'options' => array( |
||
| 165 | 'label' => $translator->translate('Publish game on home page', 'playgroundgame'), |
||
| 166 | ), |
||
| 167 | )); |
||
| 168 | |||
| 169 | $this->add(array( |
||
| 170 | 'type' => 'Zend\Form\Element\Checkbox', |
||
| 171 | 'name' => 'pushHome', |
||
| 172 | 'options' => array( |
||
| 173 | 'label' => $translator->translate('Publish game on home page slider', 'playgroundgame'), |
||
| 174 | ), |
||
| 175 | )); |
||
| 176 | |||
| 177 | $this->add(array( |
||
| 178 | 'type' => 'Zend\Form\Element\DateTime', |
||
| 179 | 'name' => 'publicationDate', |
||
| 180 | 'options' => array( |
||
| 181 | 'label' => $translator->translate('Publication date', 'playgroundgame'), |
||
| 182 | 'format' => 'd/m/Y H:i:s' |
||
| 183 | ), |
||
| 184 | 'attributes' => array( |
||
| 185 | 'type' => 'text', |
||
| 186 | 'class'=> 'datepicker' |
||
| 187 | ) |
||
| 188 | )); |
||
| 189 | |||
| 190 | $this->add(array( |
||
| 191 | 'type' => 'Zend\Form\Element\DateTime', |
||
| 192 | 'name' => 'startDate', |
||
| 193 | 'options' => array( |
||
| 194 | 'label' => $translator->translate('Start Date', 'playgroundgame'), |
||
| 195 | 'format' => 'd/m/Y H:i:s' |
||
| 196 | ), |
||
| 197 | 'attributes' => array( |
||
| 198 | 'type' => 'text', |
||
| 199 | 'class'=> 'datepicker' |
||
| 200 | ) |
||
| 201 | )); |
||
| 202 | |||
| 203 | $this->add(array( |
||
| 204 | 'type' => 'Zend\Form\Element\DateTime', |
||
| 205 | 'name' => 'endDate', |
||
| 206 | 'options' => array( |
||
| 207 | 'label' => $translator->translate('End Date', 'playgroundgame'), |
||
| 208 | 'format' => 'd/m/Y H:i:s' |
||
| 209 | ), |
||
| 210 | 'attributes' => array( |
||
| 211 | 'type' => 'text', |
||
| 212 | 'class'=> 'datepicker' |
||
| 213 | ) |
||
| 214 | )); |
||
| 215 | |||
| 216 | $this->add(array( |
||
| 217 | 'type' => 'Zend\Form\Element\DateTime', |
||
| 218 | 'name' => 'closeDate', |
||
| 219 | 'options' => array( |
||
| 220 | 'label' => $translator->translate('Unpublished date', 'playgroundgame'), |
||
| 221 | 'format' => 'd/m/Y H:i:s' |
||
| 222 | ), |
||
| 223 | 'attributes' => array( |
||
| 224 | 'type' => 'text', |
||
| 225 | 'class'=> 'datepicker' |
||
| 226 | ) |
||
| 227 | )); |
||
| 228 | |||
| 229 | $this->add(array( |
||
| 230 | 'name' => 'playLimit', |
||
| 231 | 'type' => 'Zend\Form\Element\Text', |
||
| 232 | 'attributes' => array( |
||
| 233 | 'placeholder' => $translator->translate('Tries limit per player', 'playgroundgame'), |
||
| 234 | ), |
||
| 235 | 'options' => array( |
||
| 236 | 'label' => $translator->translate('What\'s the tries limit per player ?', 'playgroundgame'), |
||
| 237 | ), |
||
| 238 | )); |
||
| 239 | |||
| 240 | $this->add(array( |
||
| 241 | 'type' => 'Zend\Form\Element\Select', |
||
| 242 | 'name' => 'playLimitScale', |
||
| 243 | 'attributes' => array( |
||
| 244 | 'id' => 'playLimitScale', |
||
| 245 | 'options' => array( |
||
| 246 | 'day' => $translator->translate('Day', 'playgroundgame'), |
||
| 247 | 'week' => $translator->translate('Week', 'playgroundgame'), |
||
| 248 | 'month' => $translator->translate('Month', 'playgroundgame'), |
||
| 249 | 'year' => $translator->translate('Year', 'playgroundgame'), |
||
| 250 | 'always' => $translator->translate('Everytime', 'playgroundgame'), |
||
| 251 | ), |
||
| 252 | ), |
||
| 253 | 'options' => array( |
||
| 254 | 'empty_option' => $translator->translate('Limitation time', 'playgroundgame'), |
||
| 255 | 'label' => $translator->translate('Limit time', 'playgroundgame'), |
||
| 256 | ), |
||
| 257 | )); |
||
| 258 | |||
| 259 | $this->add(array( |
||
| 260 | 'type' => 'Zend\Form\Element\Select', |
||
| 261 | 'name' => 'playBonus', |
||
| 262 | 'attributes' => array( |
||
| 263 | 'id' => 'playBonus', |
||
| 264 | 'options' => array( |
||
| 265 | 'none' => $translator->translate('No bonus entry', 'playgroundgame'), |
||
| 266 | 'one' => $translator->translate('One bonus entry per game', 'playgroundgame'), |
||
| 267 | 'per_entry' => $translator->translate('One bonus entry by entry', 'playgroundgame'), |
||
| 268 | ), |
||
| 269 | ), |
||
| 270 | 'options' => array( |
||
| 271 | 'empty_option' => $translator->translate('Bonus entries', 'playgroundgame'), |
||
| 272 | 'label' => $translator->translate('Any bonus entries ?', 'playgroundgame'), |
||
| 273 | |||
| 274 | ), |
||
| 275 | )); |
||
| 276 | |||
| 277 | $this->add(array( |
||
| 278 | 'type' => 'Zend\Form\Element\Select', |
||
| 279 | 'name' => 'active', |
||
| 280 | 'options' => array( |
||
| 281 | 'value_options' => array( |
||
| 282 | '0' => $translator->translate('No', 'playgroundgame'), |
||
| 283 | '1' => $translator->translate('Yes', 'playgroundgame') |
||
| 284 | ), |
||
| 285 | 'label' => $translator->translate('Active', 'playgroundgame') |
||
| 286 | ) |
||
| 287 | )); |
||
| 288 | |||
| 289 | $this->add(array( |
||
| 290 | 'type' => 'Zend\Form\Element\Select', |
||
| 291 | 'name' => 'onInvitation', |
||
| 292 | 'options' => array( |
||
| 293 | 'value_options' => array( |
||
| 294 | '0' => $translator->translate('No', 'playgroundgame'), |
||
| 295 | '1' => $translator->translate('Yes', 'playgroundgame') |
||
| 296 | ), |
||
| 297 | 'label' => $translator->translate('On Invitation', 'playgroundgame') |
||
| 298 | ), |
||
| 299 | 'attributes' => array( |
||
| 300 | 'id' => 'onInvitation' |
||
| 301 | ) |
||
| 302 | )); |
||
| 303 | |||
| 304 | $this->add(array( |
||
| 305 | 'type' => 'Zend\Form\Element\Select', |
||
| 306 | 'name' => 'mailWinner', |
||
| 307 | 'options' => array( |
||
| 308 | 'value_options' => array( |
||
| 309 | '0' => $translator->translate('No', 'playgroundgame'), |
||
| 310 | '1' => $translator->translate('Yes', 'playgroundgame') |
||
| 311 | ), |
||
| 312 | 'label' => $translator->translate('Send a mail to winner', 'playgroundgame') |
||
| 313 | ) |
||
| 314 | )); |
||
| 315 | |||
| 316 | $this->add(array( |
||
| 317 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 318 | 'name' => 'mailWinnerBlock', |
||
| 319 | 'options' => array( |
||
| 320 | 'label' => $translator->translate('Mail winner content', 'playgroundgame') |
||
| 321 | ), |
||
| 322 | 'attributes' => array( |
||
| 323 | 'cols' => '10', |
||
| 324 | 'rows' => '10', |
||
| 325 | 'id' => 'mailWinnerBlock' |
||
| 326 | ) |
||
| 327 | )); |
||
| 328 | |||
| 329 | $this->add(array( |
||
| 330 | 'type' => 'Zend\Form\Element\Select', |
||
| 331 | 'name' => 'mailLooser', |
||
| 332 | 'options' => array( |
||
| 333 | 'value_options' => array( |
||
| 334 | '0' => $translator->translate('No', 'playgroundgame'), |
||
| 335 | '1' => $translator->translate('Yes', 'playgroundgame') |
||
| 336 | ), |
||
| 337 | 'label' => $translator->translate('Send a mail to looser', 'playgroundgame') |
||
| 338 | ) |
||
| 339 | )); |
||
| 340 | |||
| 341 | $this->add(array( |
||
| 342 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 343 | 'name' => 'mailLooserBlock', |
||
| 344 | 'options' => array( |
||
| 345 | 'label' => $translator->translate('Mail looser content', 'playgroundgame') |
||
| 346 | ), |
||
| 347 | 'attributes' => array( |
||
| 348 | 'cols' => '10', |
||
| 349 | 'rows' => '10', |
||
| 350 | 'id' => 'mailLooserBlock' |
||
| 351 | ) |
||
| 352 | )); |
||
| 353 | |||
| 354 | $options = $this->getServiceManager()->get('configuration'); |
||
| 355 | |||
| 356 | $layoutArray = array( |
||
| 357 | '' => $translator->translate('Use layout per default', 'playgroundgame') |
||
| 358 | ); |
||
| 359 | if (isset($options['core_layout']) && |
||
| 360 | isset($options['core_layout']['PlaygroundGame']) && |
||
| 361 | isset($options['core_layout']['PlaygroundGame']['models']) |
||
| 362 | ) { |
||
| 363 | $layoutOptions = array(); |
||
|
|
|||
| 364 | $layoutOptions = $options['core_layout']['PlaygroundGame']['models']; |
||
| 365 | foreach ($layoutOptions as $k => $v) { |
||
| 366 | $layoutArray[$v['layout']] = $v['description']; |
||
| 367 | } |
||
| 368 | } |
||
| 369 | |||
| 370 | $this->add(array( |
||
| 371 | 'type' => 'Zend\Form\Element\Select', |
||
| 372 | 'name' => 'layout', |
||
| 373 | 'options' => array( |
||
| 374 | // 'empty_option' => $translator->translate('Ce jeu n\'a pas de catégorie', 'playgroundgame'), |
||
| 375 | 'value_options' => $layoutArray, |
||
| 376 | 'label' => $translator->translate('Layout', 'playgroundgame') |
||
| 377 | ) |
||
| 378 | )); |
||
| 379 | |||
| 380 | // The additional Stylesheets are populated by the controllers |
||
| 381 | $stylesheetArray = array( |
||
| 382 | '' => $translator->translate('Use default style sheet', 'playgroundgame') |
||
| 383 | ); |
||
| 384 | |||
| 385 | $this->add(array( |
||
| 386 | 'type' => 'Zend\Form\Element\Select', |
||
| 387 | 'name' => 'stylesheet', |
||
| 388 | 'options' => array( |
||
| 389 | 'value_options' => $stylesheetArray, |
||
| 390 | 'label' => $translator->translate('Style sheet', 'playgroundgame') |
||
| 391 | ) |
||
| 392 | )); |
||
| 393 | |||
| 394 | $this->add(array( |
||
| 395 | 'name' => 'uploadStylesheet', |
||
| 396 | 'attributes' => array( |
||
| 397 | 'type' => 'file' |
||
| 398 | ), |
||
| 399 | 'options' => array( |
||
| 400 | 'label' => $translator->translate('Add style sheet', 'playgroundgame') |
||
| 401 | ) |
||
| 402 | )); |
||
| 403 | |||
| 404 | $partners = $this->getPartners(); |
||
| 405 | View Code Duplication | if (count($partners) <= 1) { |
|
| 406 | $this->add(array( |
||
| 407 | 'name' => 'partner', |
||
| 408 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 409 | 'attributes' => array( |
||
| 410 | 'value' => 0 |
||
| 411 | ) |
||
| 412 | )); |
||
| 413 | } else { |
||
| 414 | $this->add(array( |
||
| 415 | 'type' => 'Zend\Form\Element\Select', |
||
| 416 | 'name' => 'partner', |
||
| 417 | 'options' => array( |
||
| 418 | 'value_options' => $partners, |
||
| 419 | 'label' => $translator->translate('Sponsor', 'playgroundgame') |
||
| 420 | ) |
||
| 421 | )); |
||
| 422 | } |
||
| 423 | |||
| 424 | $fbAppIds = $this->getFbAppIds(); |
||
| 425 | $fbAppIds_label = array(); |
||
| 426 | foreach ($fbAppIds as $key => $title) { |
||
| 427 | $fbAppIds_label[$key] = $translator->translate($title, 'playgroundgame'); |
||
| 428 | } |
||
| 429 | $this->add(array( |
||
| 430 | 'type' => 'Zend\Form\Element\Select', |
||
| 431 | 'name' => 'fbAppId', |
||
| 432 | 'options' => array( |
||
| 433 | 'value_options' => $fbAppIds_label, |
||
| 434 | 'label' => $translator->translate('Facebook Apps', 'playgroundgame') |
||
| 435 | ) |
||
| 436 | )); |
||
| 437 | |||
| 438 | $this->add(array( |
||
| 439 | 'name' => 'fbPageTabTitle', |
||
| 440 | 'options' => array( |
||
| 441 | 'label' => $translator->translate('Game tab title', 'playgroundgame') |
||
| 442 | ), |
||
| 443 | 'attributes' => array( |
||
| 444 | 'type' => 'text', |
||
| 445 | 'placeholder' => $translator->translate('Game tab title', 'playgroundgame') |
||
| 446 | ) |
||
| 447 | )); |
||
| 448 | |||
| 449 | $this->add(array( |
||
| 450 | 'name' => 'uploadFbPageTabImage', |
||
| 451 | 'attributes' => array( |
||
| 452 | 'type' => 'file' |
||
| 453 | ), |
||
| 454 | 'options' => array( |
||
| 455 | 'label' => $translator->translate('Game tab icone', 'playgroundgame') |
||
| 456 | ) |
||
| 457 | )); |
||
| 458 | $this->add(array( |
||
| 459 | 'name' => 'fbPageTabImage', |
||
| 460 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 461 | 'attributes' => array( |
||
| 462 | 'value' => '' |
||
| 463 | ) |
||
| 464 | )); |
||
| 465 | $this->add(array( |
||
| 466 | 'name' => 'deleteFbPageTabImage', |
||
| 467 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 468 | 'attributes' => array( |
||
| 469 | 'value' => '', |
||
| 470 | 'class' => 'delete_fb_page_tab_image', |
||
| 471 | ), |
||
| 472 | )); |
||
| 473 | |||
| 474 | $this->add(array( |
||
| 475 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 476 | 'name' => 'welcomeBlock', |
||
| 477 | 'options' => array( |
||
| 478 | 'label' => $translator->translate('Welcome block', 'playgroundgame') |
||
| 479 | ), |
||
| 480 | 'attributes' => array( |
||
| 481 | 'cols' => '10', |
||
| 482 | 'rows' => '10', |
||
| 483 | 'id' => 'welcomeBlock' |
||
| 484 | ) |
||
| 485 | )); |
||
| 486 | |||
| 487 | $this->add(array( |
||
| 488 | 'type' => 'Zend\Form\Element\Select', |
||
| 489 | 'name' => 'termsOptin', |
||
| 490 | 'options' => array( |
||
| 491 | //'empty_option' => $translator->translate('Is the answer correct ?', 'playgroundgame'), |
||
| 492 | 'value_options' => array( |
||
| 493 | '0' => $translator->translate('No', 'playgroundgame'), |
||
| 494 | '1' => $translator->translate('Yes', 'playgroundgame'), |
||
| 495 | ), |
||
| 496 | 'label' => $translator->translate('Player must accept the rules', 'playgroundgame'), |
||
| 497 | ), |
||
| 498 | )); |
||
| 499 | |||
| 500 | $this->add(array( |
||
| 501 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 502 | 'name' => 'conditionsBlock', |
||
| 503 | 'options' => array( |
||
| 504 | 'label' => $translator->translate('Legal status', 'playgroundgame') |
||
| 505 | ), |
||
| 506 | 'attributes' => array( |
||
| 507 | 'cols' => '10', |
||
| 508 | 'rows' => '10', |
||
| 509 | 'id' => 'conditionsBlock' |
||
| 510 | ) |
||
| 511 | )); |
||
| 512 | |||
| 513 | $this->add(array( |
||
| 514 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 515 | 'name' => 'termsBlock', |
||
| 516 | 'options' => array( |
||
| 517 | 'label' => $translator->translate('Payment page', 'playgroundgame') |
||
| 518 | ), |
||
| 519 | 'attributes' => array( |
||
| 520 | 'cols' => '10', |
||
| 521 | 'rows' => '10', |
||
| 522 | 'id' => 'termsBlock' |
||
| 523 | ) |
||
| 524 | )); |
||
| 525 | |||
| 526 | $this->add(array( |
||
| 527 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 528 | 'name' => 'columnBlock1', |
||
| 529 | 'options' => array( |
||
| 530 | 'label' => $translator->translate('Right column', 'playgroundgame').' 1' |
||
| 531 | ), |
||
| 532 | 'attributes' => array( |
||
| 533 | 'cols' => '10', |
||
| 534 | 'rows' => '10', |
||
| 535 | 'id' => 'columnBlock1' |
||
| 536 | ) |
||
| 537 | )); |
||
| 538 | |||
| 539 | $this->add(array( |
||
| 540 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 541 | 'name' => 'columnBlock2', |
||
| 542 | 'options' => array( |
||
| 543 | 'label' => $translator->translate('Right column', 'playgroundgame').' 2' |
||
| 544 | ), |
||
| 545 | 'attributes' => array( |
||
| 546 | 'cols' => '10', |
||
| 547 | 'rows' => '10', |
||
| 548 | 'id' => 'columnBlock2' |
||
| 549 | ) |
||
| 550 | )); |
||
| 551 | |||
| 552 | $this->add(array( |
||
| 553 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 554 | 'name' => 'columnBlock3', |
||
| 555 | 'options' => array( |
||
| 556 | 'label' => $translator->translate('Right column', 'playgroundgame').' 3' |
||
| 557 | ), |
||
| 558 | 'attributes' => array( |
||
| 559 | 'cols' => '10', |
||
| 560 | 'rows' => '10', |
||
| 561 | 'id' => 'columnBlock3' |
||
| 562 | ) |
||
| 563 | )); |
||
| 564 | |||
| 565 | $this->add(array( |
||
| 566 | 'type' => 'Zend\Form\Element\Select', |
||
| 567 | 'name' => 'fbFan', |
||
| 568 | 'options' => array( |
||
| 569 | //'empty_option' => $translator->translate('Is the answer correct ?', 'playgroundgame'), |
||
| 570 | 'value_options' => array( |
||
| 571 | '0' => $translator->translate('No', 'playgroundgame'), |
||
| 572 | '1' => $translator->translate('Yes', 'playgroundgame'), |
||
| 573 | ), |
||
| 574 | 'label' => $translator->translate('You must be fan to participate', 'playgroundgame'), |
||
| 575 | ), |
||
| 576 | )); |
||
| 577 | |||
| 578 | $this->add(array( |
||
| 579 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 580 | 'name' => 'fbFanGate', |
||
| 581 | 'options' => array( |
||
| 582 | 'label' => $translator->translate('Fan gate content', 'playgroundgame') |
||
| 583 | ), |
||
| 584 | 'attributes' => array( |
||
| 585 | 'cols' => '10', |
||
| 586 | 'rows' => '10', |
||
| 587 | 'id' => 'fbFanGate' |
||
| 588 | ) |
||
| 589 | )); |
||
| 590 | |||
| 591 | $this->add(array( |
||
| 592 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 593 | 'name' => 'fbShareMessage', |
||
| 594 | 'options' => array( |
||
| 595 | 'label' => $translator->translate('Facebook share message', 'playgroundgame') |
||
| 596 | ), |
||
| 597 | 'attributes' => array( |
||
| 598 | 'cols' => '10', |
||
| 599 | 'rows' => '4', |
||
| 600 | 'id' => 'fbShareMessage' |
||
| 601 | ) |
||
| 602 | )); |
||
| 603 | |||
| 604 | $this->add(array( |
||
| 605 | 'name' => 'uploadFbShareImage', |
||
| 606 | 'attributes' => array( |
||
| 607 | 'type' => 'file' |
||
| 608 | ), |
||
| 609 | 'options' => array( |
||
| 610 | 'label' => $translator->translate('Facebook share image', 'playgroundgame') |
||
| 611 | ) |
||
| 612 | )); |
||
| 613 | $this->add(array( |
||
| 614 | 'name' => 'fbShareImage', |
||
| 615 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 616 | 'attributes' => array( |
||
| 617 | 'value' => '' |
||
| 618 | ) |
||
| 619 | )); |
||
| 620 | $this->add(array( |
||
| 621 | 'name' => 'deleteFbShareImage', |
||
| 622 | 'type' => 'Zend\Form\Element\Hidden', |
||
| 623 | 'attributes' => array( |
||
| 624 | 'value' => '', |
||
| 625 | 'class' => 'delete_fb_share_image', |
||
| 626 | ), |
||
| 627 | )); |
||
| 628 | |||
| 629 | $this->add(array( |
||
| 630 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 631 | 'name' => 'fbRequestMessage', |
||
| 632 | 'options' => array( |
||
| 633 | 'label' => $translator->translate('Facebook invitation message', 'playgroundgame') |
||
| 634 | ), |
||
| 635 | 'attributes' => array( |
||
| 636 | 'cols' => '10', |
||
| 637 | 'rows' => '4', |
||
| 638 | 'id' => 'fbRequestMessage' |
||
| 639 | ) |
||
| 640 | )); |
||
| 641 | |||
| 642 | $this->add(array( |
||
| 643 | 'type' => 'Zend\Form\Element\Textarea', |
||
| 644 | 'name' => 'twShareMessage', |
||
| 645 | 'options' => array( |
||
| 646 | 'label' => $translator->translate('Twitter share message', 'playgroundgame') |
||
| 647 | ), |
||
| 648 | 'attributes' => array( |
||
| 649 | 'cols' => '10', |
||
| 650 | 'rows' => '4', |
||
| 651 | 'id' => 'twShareMessage' |
||
| 652 | ) |
||
| 653 | )); |
||
| 654 | |||
| 655 | $prizeFieldset = new PrizeFieldset(null, $sm, $translator); |
||
| 656 | $this->add(array( |
||
| 657 | 'type' => 'Zend\Form\Element\Collection', |
||
| 658 | 'name' => 'prizes', |
||
| 659 | 'options' => array( |
||
| 660 | 'id' => 'prizes', |
||
| 661 | 'label' => $translator->translate('List of prizes', 'playgroundgame'), |
||
| 662 | 'count' => 0, |
||
| 663 | 'should_create_template' => true, |
||
| 664 | 'allow_add' => true, |
||
| 665 | 'allow_remove' => true, |
||
| 666 | 'target_element' => $prizeFieldset |
||
| 667 | ) |
||
| 668 | )); |
||
| 669 | |||
| 670 | $this->add(array( |
||
| 671 | 'name' => 'steps', |
||
| 672 | 'type' => 'Zend\Form\Element\Text', |
||
| 673 | 'attributes' => array( |
||
| 674 | 'placeholder' => $translator->translate('Game steps', 'playgroundgame'), |
||
| 675 | 'value' => 'index,play,result,bounce', |
||
| 676 | ), |
||
| 677 | 'options' => array( |
||
| 678 | 'label' => $translator->translate('The steps of the game', 'playgroundgame'), |
||
| 679 | ), |
||
| 680 | )); |
||
| 681 | |||
| 682 | $this->add(array( |
||
| 683 | 'name' => 'stepsViews', |
||
| 684 | 'type' => 'Zend\Form\Element\Text', |
||
| 685 | 'attributes' => array( |
||
| 686 | 'placeholder' => $translator->translate('steps views', 'playgroundgame'), |
||
| 687 | 'value' => '{"index":{},"play":{},"result":{},"bounce":{}}', |
||
| 688 | ), |
||
| 689 | 'options' => array( |
||
| 690 | 'label' => $translator->translate('The steps views', 'playgroundgame'), |
||
| 691 | ), |
||
| 692 | )); |
||
| 693 | |||
| 694 | $submitElement = new Element\Button('submit'); |
||
| 695 | $submitElement->setAttributes(array( |
||
| 696 | 'type' => 'submit' |
||
| 697 | )); |
||
| 698 | |||
| 699 | $this->add($submitElement, array( |
||
| 700 | 'priority' => - 100 |
||
| 701 | )); |
||
| 702 | } |
||
| 703 | |||
| 803 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.