Browse Source

PHPDoc, some trailing PHP tags removed

master
Anton Terekhov 12 years ago
parent
commit
1354f3d001
  1. 1
      app/router/Route.php
  2. 1
      classes/Format.class.php
  3. 1
      classes/User.class.php
  4. 1
      exception/ErrorHandler.php
  5. 36
      form/Form.php
  6. 51
      form/FormField.php
  7. 3
      i18n/I18N.php
  8. 1
      model/MongoStatement.php

1
app/router/Route.php

@ -27,6 +27,7 @@ class Route
/** /**
* @param array $request * @param array $request
* @return bool
*/ */
public function match($request) public function match($request)
{ {

1
classes/Format.class.php

@ -229,4 +229,3 @@ class Format
* Оффсет с учетом летнего/зимнего времени * Оффсет с учетом летнего/зимнего времени
*/ */
Format::setTimezoneOffset(date('Z') - ((date('I') ? 60*60 : 0 ))); Format::setTimezoneOffset(date('Z') - ((date('I') ? 60*60 : 0 )));
?>

1
classes/User.class.php

@ -116,4 +116,3 @@ class User
return $model->getById($id); return $model->getById($id);
} }
} }
?>

1
exception/ErrorHandler.php

@ -73,6 +73,7 @@ class ErrorHandler
/** /**
* @param Exception $exception * @param Exception $exception
* @return string
*/ */
static public function showDebug($exception) static public function showDebug($exception)
{ {

36
form/Form.php

@ -13,11 +13,20 @@ abstract class Form
{ {
const SUCCESS = 'success'; const SUCCESS = 'success';
const ERROR = 'error';
const ERROR = 'error';
/**
* @var FormField[]
*/
protected $fields = array(); protected $fields = array();
protected $messages = array(self::SUCCESS => 'Form data valid',
self::ERROR => 'Form data invalid');
/**
* @var array
*/
protected $messages = array(
self::SUCCESS => 'Form data valid',
self::ERROR => 'Form data invalid');
protected $valid = true; protected $valid = true;
@ -28,6 +37,7 @@ abstract class Form
/** /**
* @param string $name * @param string $name
* @param bool|string $message
* @return FormField * @return FormField
*/ */
protected function addField($name, $message = false) protected function addField($name, $message = false)
@ -74,6 +84,9 @@ abstract class Form
return false; return false;
} }
/**
* @return array
*/
public function getValues() public function getValues()
{ {
$values = array(); $values = array();
@ -85,6 +98,9 @@ abstract class Form
return $values; return $values;
} }
/**
* @return array
*/
public function getSourceValues() public function getSourceValues()
{ {
$values = array(); $values = array();
@ -94,22 +110,36 @@ abstract class Form
return $values; return $values;
} }
/**
* @return string
*/
public function getMessageType() public function getMessageType()
{ {
return ($this->valid) ? self::SUCCESS : self::ERROR; return ($this->valid) ? self::SUCCESS : self::ERROR;
} }
/**
* @return string
*/
public function getMessage() public function getMessage()
{ {
return $this->messages[$this->getMessageType()]; return $this->messages[$this->getMessageType()];
} }
/**
* @param string $message
* @return Form
*/
public function setSuccessMessage($message) public function setSuccessMessage($message)
{ {
$this->messages[self::SUCCESS] = (string) $message; $this->messages[self::SUCCESS] = (string) $message;
return $this; return $this;
} }
/**
* @param string $message
* @return Form
*/
public function setErrorMessage($message) public function setErrorMessage($message)
{ {
$this->messages[self::ERROR] = (string) $message; $this->messages[self::ERROR] = (string) $message;

51
form/FormField.php

@ -11,8 +11,14 @@
class FormField class FormField
{ {
/**
* @var iValidator[]
*/
protected $validators = array(); protected $validators = array();
/**
* @var iFilter[]
*/
protected $filters = array(); protected $filters = array();
/** /**
@ -21,41 +27,77 @@ class FormField
* @var string * @var string
*/ */
protected $default_message = false; protected $default_message = false;
/**
* @var string
*/
protected $message = false; protected $message = false;
/**
* @var mixed
*/
protected $value; protected $value;
/* Flags */ /* Flags */
/**
* @var bool
*/
protected $required = true; protected $required = true;
/**
* @var bool
*/
protected $ignored = false; protected $ignored = false;
/**
* @param bool|string $default_message
*/
public function __construct($default_message = false) public function __construct($default_message = false)
{ {
$this->default_message = $default_message; $this->default_message = $default_message;
} }
/**
* @param bool $flag
* @return FormField
*/
public function setRequired($flag) public function setRequired($flag)
{ {
$this->required = (bool) $flag; $this->required = (bool) $flag;
return $this; return $this;
} }
/**
* @return bool
*/
public function isRequired() public function isRequired()
{ {
return $this->required; return $this->required;
} }
/**
* @param bool $flag
* @return FormField
*/
public function setIgnored($flag) public function setIgnored($flag)
{ {
$this->ignored = (bool) $flag; $this->ignored = (bool) $flag;
return $this; return $this;
} }
/**
* @return bool
*/
public function isIgnored() public function isIgnored()
{ {
return $this->ignored; return $this->ignored;
} }
/**
* @param string[]|iValidator[] $validators
* @return FormField
*/
public function addValidators($validators) public function addValidators($validators)
{ {
foreach ($validators as $validator) { foreach ($validators as $validator) {
@ -64,6 +106,11 @@ class FormField
return $this; return $this;
} }
/**
* @param string|iValidator $validator
* @return FormField
* @throws InitializationException
*/
public function addValidator($validator) public function addValidator($validator)
{ {
if ($validator instanceof iValidator) { if ($validator instanceof iValidator) {
@ -88,7 +135,7 @@ class FormField
public function addFilter($filter) public function addFilter($filter)
{ {
if ($filter instanceof iFilter) {
if ($filter instanceof iFilter) {
$name = get_class($filter); $name = get_class($filter);
} elseif (is_string($filter)) { } elseif (is_string($filter)) {
$name = $filter . 'Filter'; $name = $filter . 'Filter';

3
i18n/I18N.php

@ -23,7 +23,8 @@ class I18N
/** /**
* @param mixed $lang default language set
* @throws InitializationException
* @internal mixed $lang default language set
*/ */
static public function init() static public function init()
{ {

1
model/MongoStatement.php

@ -131,6 +131,7 @@ class MongoStatement extends DbStatement
/** /**
* @param MongoDbCommand $request * @param MongoDbCommand $request
* @throws GeneralException
* @return bool * @return bool
*/ */
protected function driverExecute($request) protected function driverExecute($request)

Loading…
Cancel
Save