Skip to content

Instantly share code, notes, and snippets.

@Ulv
Created June 27, 2013 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ulv/5878207 to your computer and use it in GitHub Desktop.
Save Ulv/5878207 to your computer and use it in GitHub Desktop.
объект form. Содержит спарсенные данные html формы
/**
* Class form
* just a container
*/
class form implements IteratorAggregate
{
private $_formAction;
private $_formMethod;
private $_inputs;
function __construct($_formAction, $_formMethod)
{
$this->_formAction = $_formAction;
$this->_formMethod = strtoupper($_formMethod);
$this->_inputs = array();
}
/**
* @param $field
*/
public function addField($field)
{
if (! empty($field)) {
$this->_inputs[] = $field;
}
}
/**
* @return mixed
*/
public function getFormAction()
{
return $this->_formAction;
}
/**
* @return mixed
*/
public function getFormMethod()
{
return $this->_formMethod;
}
public function getIterator()
{
return new ArrayIterator($this->_inputs);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment