Format code using php-cs-fixer
This commit is contained in:
parent
43d7dc92cd
commit
d52c6184b9
352 changed files with 17473 additions and 17041 deletions
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* Check if a field is empty but only when specific fields have specific values
|
||||
* Check if a field is empty but only when specific fields have specific values.
|
||||
*
|
||||
* WARNING: you need to include this file directly when using it, it clashes with the
|
||||
* WARNING: you need to include this file directly when using it, it clashes with the
|
||||
* way zf1 Zend_Loader_PluginLoader expects it to be found. Another way around this
|
||||
* might be to rename the class and have the new name get loaded proper.
|
||||
*
|
||||
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
class ConditionalNotEmpty extends Zend_Validate_Abstract
|
||||
{
|
||||
const KEY_IS_EMPTY = 'keyIsEmpty';
|
||||
public const KEY_IS_EMPTY = 'keyIsEmpty';
|
||||
|
||||
protected $_messageTemplates;
|
||||
|
||||
|
@ -21,16 +21,16 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract
|
|||
* Constructs a new ConditionalNotEmpty validator.
|
||||
*
|
||||
* @param array $fieldValues - the names and expected values of the fields we're depending on;
|
||||
* E.g., if we have a field that should only be validated when two other
|
||||
* fields PARENT_1 and PARENT_2 have values of '1' and '0' respectively, then
|
||||
* $fieldValues should contain ('PARENT_1'=>'1', 'PARENT_2'=>'0')
|
||||
* E.g., if we have a field that should only be validated when two other
|
||||
* fields PARENT_1 and PARENT_2 have values of '1' and '0' respectively, then
|
||||
* $fieldValues should contain ('PARENT_1'=>'1', 'PARENT_2'=>'0')
|
||||
*/
|
||||
public function __construct($fieldValues)
|
||||
{
|
||||
$this->_fieldValues = $fieldValues;
|
||||
$this->_messageTemplates = array(
|
||||
self::KEY_IS_EMPTY => _("Value is required and can't be empty")
|
||||
);
|
||||
$this->_messageTemplates = [
|
||||
self::KEY_IS_EMPTY => _("Value is required and can't be empty"),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,18 +39,19 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract
|
|||
* this function returns true if the expected values doesn't match the actual user input,
|
||||
* or if $value is not empty. Returns false otherwise.
|
||||
*
|
||||
* @param String $value - this field's value
|
||||
* @param array $context - names and values of the rest of the fields in this form
|
||||
* @return boolean - true if valid; false otherwise
|
||||
* @param string $value - this field's value
|
||||
* @param array $context - names and values of the rest of the fields in this form
|
||||
*
|
||||
* @return bool - true if valid; false otherwise
|
||||
*/
|
||||
public function isValid($value, $context = null)
|
||||
{
|
||||
if ($value != "") {
|
||||
if ($value != '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_array($context)) {
|
||||
foreach ($this->_fieldValues as $fieldName=>$fieldValue) {
|
||||
foreach ($this->_fieldValues as $fieldName => $fieldValue) {
|
||||
if (!isset($context[$fieldName]) || $context[$fieldName] != $fieldValue) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue