When the field value is an array, its value must be in
@access public
@param $countIn integer[]
@param $error   string
@return \Gcs\Framework\Core\Orm\Validation\Element\Element
@since 3.0
@package Gcs\Framework\Core\Form\Validation\Element
432856
public function countIn($countIn, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::COUNTIN, 'value' => $countIn, 'message' => $error]);
        }

        return $this;
    }
123987
public function addErrors(array $errors)
    {
        foreach ($errors as $error) {
            if (!$error instanceof ValidationError)
                throw new Exception('Error was not instance of ValidationError: '.$error);
            if (!in_array($error, $this->errors))
                $this->errors[] = $error;
        }

        return $this;
    }
242650
public function select(string $pattern = '', int $count = 100): \Iterator
    {
        $iterator = null;
        while (true) {
            $ret = $this->handle->hScan($this->name, $iterator, $pattern, $count);
            if (false === $ret) {
                break;
            }
            foreach ($ret as $k => $v) {
                yield [$k => $v];
            }
        }
    }
634211
public static function preg_replace( $arr, $string, $count = null ) 
	{
		return preg_replace( array_keys( $arr ), array_values( $arr ), $string, $count );
	}
187906
public function setError($error) 
    {
        if (!$this->_isNumericArray($error)) {
            $error =  array ($error);    
        }
        $this->_fields['Error']['FieldValue'] = $error;
        return $this;
    }
404216
protected function validateElement(\marvin255\serviform\interfaces\Field $element)
    {
        $value = $element->getValue();
        if ($this->getArrayValue()) {
            if (!is_array($value)) {
                throw new InvalidArgumentException('Value must ba an array for element: ' . $element->getName());
            }
            $res = true;
            $errors = [];
            foreach ($value as $key => $item) {
                if ($this->vaidateValue($item, $element)) {
                    continue;
                }
                $res = false;
                $errors[$key] = $this->createErrorMessage($element);
            }
            if ($res === false) {
                $element->addError($errors);
            }
        } else {
            $res = $this->vaidateValue($value, $element);
            if ($res === false) {
                $element->addError($this->createErrorMessage($element));
            }
        }

        return $res;
    }
1023358
private function pushValue($value, &$result, $countCol)
    {
        $buildRow = function (&$list, $itemId, $row) use ($countCol) {
            for ($i = count($list); $i < $countCol; $i++) {
                $list[$i] = [
                    'tstamp'  => 0,
                    'value'   => '',
                    'att_id'  => $this->get('id'),
                    'row'     => $row,
                    'col'     => $i,
                    'item_id' => $itemId,
                ];
            }
        };

        $itemId = $value['item_id'];
        if (!isset($result[$itemId])) {
            $result[$itemId] = [];
        }

        // Prepare all rows up until to this item.
        $row = count($result[$itemId]);
        while ($row <= $value['row']) {
            if (!isset($result[$itemId][$row])) {
                $result[$itemId][$row] = [];
            }
            $buildRow($result[$itemId][$row], $itemId, $row);
            $row++;
        }
        $result[$itemId][(int) $value['row']][(int) $value['col']] = $value;
    }
39566
public final function translate($message, $count = NULL)
    {
        // load if is first usage
        if ($this->locale->isReady() && !$this->dictionary) {
            // set plurals from locales to translate always current language
            $this->plural = $this->locale->getPlural();
//            \Tracy\Debugger::fireLog('Translator::translate, loadTranslate');
            $this->loadTranslate();  // load data
        }

        $indexDictionary = $message; // message is index (identification) for translation

        if ($message) {
            if (isset($count)) {
                if (isset($this->plural)) {
                    if (!is_array($count)) {
                        $plural = null; // input variable plural for eval
                        $n = $count;    // input variable count for eval
                        eval($this->plural);    // evaluate plural
                        $pluralFormat = '%s:plural:%d'; // create format plural
                        $pluralIndex = sprintf($pluralFormat, $indexDictionary, $plural);   // main substitute plural form
                        $this->addUsedIndex($pluralIndex);
                        if (!isset($this->dictionary[$pluralIndex])) {
                            // make other plural form by $nplurals
                            if (isset($nplurals)) {
                                // iterate over $nplurals
                                for ($i = 0; $i < $nplurals; $i++) {
                                    $this->saveTranslate(sprintf($pluralFormat, $indexDictionary, $i), $message);   // create plural index
                                }
                                return $message;    // return message
                            } else {
                                return $this->saveTranslate($pluralIndex, $message);    // create plural without $nplurals
                            }
                        }
                        return sprintf($this->dictionary[$pluralIndex], $count);    // substitute value
                    } else {
                        $this->addUsedIndex($indexDictionary);
                        if (!isset($this->dictionary[$indexDictionary])) {
                            return $this->saveTranslate($indexDictionary, $message);    // create & return
                        }
                        // if plural enable but $count is array
                        return vsprintf($this->dictionary[$indexDictionary], $count);   // array
                    }
                } else {
                    $this->addUsedIndex($indexDictionary);
                    if (!isset($this->dictionary[$indexDictionary])) {
                        return $this->saveTranslate($indexDictionary, $message);    // create & return
                    }

                    if (!is_array($count)) {
                        // count is value
                        return sprintf($this->dictionary[$indexDictionary], $count);    // value
                    } else {
                        // count is array
                        return vsprintf($this->dictionary[$indexDictionary], $count);   // array
                    }
                }
            } else {
                $this->addUsedIndex($indexDictionary);
                if (!isset($this->dictionary[$indexDictionary])) {
                    return $this->saveTranslate($indexDictionary, $message);    // create & return
                }
                return $this->dictionary[$indexDictionary];
            }
        }
        return '';
    }
1344556
public function size($size = 1048576, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::SIZE, 'value' => $size, 'message' => $error]);
        }

        return $this;
    }
430192
public function fromArray(array $error)
    {

        // extract the array with the error information
        list ($type, $message, $file, $line) = array_values($error);

        // initialize and return the error instance
        return new Error($type, $message, $file, $line);
    }
500365
public function in($in, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::IN, 'value' => $in, 'message' => $error]);
        }

        return $this;
    }
723946
public function lremove($key, $count, $value)
    {
        try {
            return $this->redis->lremove($key, $count, $value);
        } catch (\RedisException $e) {
            die("Error!: " . $e->getMessage() . "<br/>");
        }
    }
1322798
public function accept($accept, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::ACCEPT, 'value' => $accept, 'message' => $error]);
        }

        return $this;
    }
1091360
protected function modelValidationError(array $error)
    {
        $code = ('no_permission' == $error['error']) ? 403 : 400;
        $param = array_value($error, 'params.field');

        return new InvalidRequest($error['message'], $code, $param);
    }
11696
public function lengthOf($countable, $length, $message = '')
    {
        $this->assertion->setActual($countable);

        return $this->assertion->to->have->length($length, $message);
    }
199961
public static function plural($value, $count = 2)
    {
        if (($count === 1) || static::uncountable($value)) {
            return $value;
        }

        $plural = Inflector::pluralize($value);

        return static::matchCase($plural, $value);
    }
297332
public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = [])
    {
        $builder = $this->select($collection);
        $builder->where("e.{$column} = :" . $this->prepareParam($column));

        if (!is_null($excludeId) && $excludeId != 'NULL') {
            $idColumn = $idColumn ?: 'id';
            $builder->andWhere("e.{$idColumn} <> :" . $this->prepareParam($idColumn));
        }

        $this->queryExtraConditions($extra, $builder);

        $query = $builder->getQuery();
        $query->setParameter($this->prepareParam($column), $value);

        if (!is_null($excludeId) && $excludeId != 'NULL') {
            $query->setParameter($this->prepareParam($idColumn), $excludeId);
        }

        return $query->getSingleScalarResult();
    }