Commit with composer.json

This commit is contained in:
2014-05-27 17:56:46 +04:00
parent c62620593f
commit aec1a60985
20 changed files with 70 additions and 46 deletions

View File

@ -7,6 +7,8 @@
* @since 2010-04-24
*/
namespace Majestic;
abstract class Form
{
@ -15,7 +17,7 @@ abstract class Form
const ERROR = 'error';
/**
* @var FormField[]
* @var \FormField[]
*/
protected $fields = array();
@ -36,18 +38,18 @@ abstract class Form
/**
* @param string $name
* @param bool|string $message
* @return FormField
* @return \FormField
*/
protected function addField($name, $message = false)
{
$this->fields[$name] = new FormField($message);
$this->fields[$name] = new \FormField($message);
return $this->fields[$name];
}
public function isValid($data)
{
if (!is_array($data)) {
throw new InitializationException(__CLASS__ . '::' . __METHOD__ . ' expects an array');
throw new \InitializationException(__CLASS__ . '::' . __METHOD__ . ' expects an array');
}
foreach ($this->fields as $field_name => $field) {
@ -148,7 +150,7 @@ abstract class Form
{
$data['messages'] = $this->getMessages();
$data['values'] = $this->getSourceValues();
Session::set(get_class($this), $data);
\Majestic\Session::set(get_class($this), $data);
}
abstract protected function init();