for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SES;
use Title;
/**
* @license GNU GPL v2+
* @since 1.1
*
* @author mwjames
*/
class FormPrinterHandler {
* @var Title|null
private $form;
* @var mixed
private $formPrinter;
* @var string
private $formText = '';
private $dataText = '';
* @var boolean
private $submitState = false;
public function __construct( Title $form = null, $formPrinter = null ) {
$this->form = $form;
$this->formPrinter = $formPrinter;
}
* @return boolean
public function canUseForm() {
return $this->form !== null && $this->form->exists();
* @param boolean $submitState
public function setSubmitState( $submitState ) {
$this->submitState = $submitState;
* @return string
public function getFormText() {
if ( $this->formText === '' ) {
$this->createForm();
return $this->formText;
public function getTemplateText() {
if ( $this->dataText === '' ) {
return $this->dataText;
private function createForm() {
if ( !$this->canUseForm() || !is_object( $this->formPrinter ) ) {
return;
$form = new \Article( $this->form );
$form_definition = $form->getContent();
list ( $form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name ) =
$javascript_text
list($first,,$third)
This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.
list(...)
Consider the following code example.
<?php function returnThreeValues() { return array('a', 'b', 'c'); } list($a, $b, $c) = returnThreeValues(); print $a . " - " . $c;
Only the variables $a and $c are used. There was no need to assign $b.
$a
$c
$b
Instead, the list call could have been.
list($a,, $c) = returnThreeValues();
$form_page_title
$generated_page_name
$this->formPrinter->formHTML( $form_definition, $this->submitState, false );
$this->formText = $form_text;
$this->dataText = $data_text;
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.