Process value array

@param  array $value
@param  array $settings
@return string
@access protected
353116
protected function processArrayValue(
        array $value,
        array $settings,
        /*# bool */ $between = false
    )/*# : string */ {
        if ($between) {
            $v1 = $this->processValue($value[0], $settings);
            $v2 = $this->processValue($value[1], $settings);
            return $v1 . ' AND ' . $v2;
        } else {
            $result = [];
            foreach ($value as $val) {
                $result[] = $this->processValue($val, $settings);
            }
            return '(' . join(', ', $result) . ')';
        }
    }
457275
protected function getArrayFromValue($value, $separator = ',')
    {
        if (!is_array($value)) {
            $value = explode($separator, $value);
        }

        return $value;
    }
1226581
protected function updateSetting($settings, $parts, $value)
    {
        $part = current(array_slice($parts, 0, 1));

        if ((string) intval($part) == $part) {
            $part = intval($part);
        }
        
        if (count($parts) > 0) {
            $parts = array_slice($parts, 1);
            
            if (!isset($settings[$part])) {
                $settings[$part] = array();
            }

            $settings[$part] = $this->updateSetting($settings[$part], $parts, $value);
        } else {
            $settings = $value;
        }
        
        return $settings;
    }
699527
protected function buildValues(
        /*# string */ $prefix,
        array $settings
    )/*# : string */ {
        $rows = [];
        $cols = array_keys($this->set_col);
        foreach ($this->set_data as $row) {
            $values = [];
            foreach ($cols as $col) {
                $values[] = isset($row[$col]) ?
                    $this->processValue($row[$col], $settings) :
                    $this->nullOrDefault($settings);
            }
            $rows[] = '(' . join(', ', $values) . ')';
        }
        return $this->joinClause($prefix, ',', $rows, $settings);
    }
162370
public static function overload(array $settings)
    {
        if (self::mustLoad()) {
            self::load();
        }
        foreach ($settings as $var=>$val) {
            self::set($var, $val);
        }
    }
795218
private function compareValues($value, array $comparisons)
    {
        foreach ($comparisons as $comparison) {
            if (0 === strcasecmp($value, $comparison)) {
                return true;
            }
        }

        return false;
    }
214262
protected function preSerialization(array $value)
    {
        /** @var \NilPortugues\Api\Mapping\Mapping $mapping */
        foreach ($this->mappings as $class => $mapping) {
            RecursiveFilterHelper::deletePropertiesNotInFilter($this->mappings, $value, $class);
            RecursiveDeleteHelper::deleteProperties($this->mappings, $value, $class);
            $this->buildValidPropertyAlias($mapping);
            RecursiveRenamerHelper::renameKeyValue($this->mappings, $value, $class);
        }

        return $value;
    }
395079
protected static function processString(&$value, $options)
    {
        $value = str_replace(chr(0), '', $value);
        if (isset($options['length']) && $options['length']) {
            $value = substr($value, 0, $options['length']);
        }

        if (isset($options['regex']) && $options['regex']) {
            if (!preg_match($options['regex'], $value)) {
                $value = null;
            }
        }
    }
6154
public function setSetting( $name, $value )
    {
        $old = isset( $this->settings[$name] )
            ? $this->settings[$name]
            : null;

        if ( $old instanceof self || $value instanceof self )
        {
            if ( $old instanceof self && $value instanceof self )
            {
                $old->setSettings( $value->settings );
            }
            else if ( $old instanceof self )
            {
                if ( $value instanceof Traversable )
                {
                    $value = ArrayUtils::iteratorToArray( $value );
                }

                $old->setSettings( (array) $value );
            }
            else
            {
                $this->settings[$name] = $value;
            }
        }
        else
        {
            $method = array( $this, 'update' . ucfirst( $name ) );

            if ( is_callable( $method ) &&
                 ( ( isset( $value )    && isset( $this->settings[$name] )
                                        && $value != $this->settings[$name] ) ||
                   ( isset( $value )    && ! isset( $this->settings[$name] ) ) ||
                   ( ! isset( $value )  && isset( $this->settings[$name] ) ) ) )
            {
                $value = $method( $value, $old );
            }

            if ( null === $value )
            {
                unset( $this->settings[$name] );
            }
            else
            {
                $this->settings[$name] = $value;
            }
        }

        return $this;
    }
535088
private function _loadSettingsFromArray($settings)
    {
        if (isset($settings['sp'])) {
            $this->_sp = $settings['sp'];
        }
        if (isset($settings['idp'])) {
            $this->_idp = $settings['idp'];
        }

        $errors = $this->checkSettings($settings);
        if (empty($errors)) {
            $this->_errors = array();

            if (isset($settings['strict'])) {
                $this->_strict = $settings['strict'];
            }
            if (isset($settings['debug'])) {
                $this->_debug = $settings['debug'];
            }

            if (isset($settings['baseurl'])) {
                $this->_baseurl = $settings['baseurl'];
            }

            if (isset($settings['compress'])) {
                $this->_compress = $settings['compress'];
            }

            if (isset($settings['security'])) {
                $this->_security = $settings['security'];
            }

            if (isset($settings['contactPerson'])) {
                $this->_contacts = $settings['contactPerson'];
            }

            if (isset($settings['organization'])) {
                $this->_organization = $settings['organization'];
            }

            $this->_addDefaultValues();
            return true;
        } else {
            $this->_errors = $errors;
            return false;
        }
    }
332849
static public function attachment($name, $value=null, $settings=[])
    {
        $settings['media_type'] = 'attachment';
        if (!isset($settings['preview_url'])) $settings['preview_url'] = Ioc::url('preview?metia_type=attachment');
        return static::image($name, $value, $settings);
    }
538224
static public function url($name, $value=null, $settings=[])
    {
        $settings['media_type'] = 'url';
        $settings['with_input'] = isset($settings['with_input']) ? $settings['with_input'] : 'text';
        return static::select($name, $value, $settings);
    }
439620
static public function kind($name, $value=null, $settings=[])
    {
        if (strpos($name, '[') === false) {
            $kind_type = $name;
            $name = '_kinds[' . $name . '][]';
        } else {
            $kind_type = preg_replace('/_(kinds\[)?(\w+)\]?\[\]/', '${2}', $name);
        }
        $settings = static::formatSettings($settings);
        $form_type = isset($settings['form_type']) ? trim($settings['form_type']) : 'checkbox_group';
        
        if ($form_type === 'modal') {
            $modal_url = isset($setting['modal_url']) ? $setting['modal_url'] : 'common/data/select/kind?kind_type=' . $kind_type;
            $settings['modal_url'] = Ioc::url($modal_url);
            $str = static::select($name, $value, $settings);
        } elseif ($form_type === 'select') {
            $str = static::select($name, $value, $settings);
        } else {
            $str = static::checkbox_group($name, $value, $settings);
        }
        
        return $str;
    }
1075679
public function getUserValue($value)
    {
        if (! is_array($value)) {
            if ('' == $value) {
                $value = [];
            } else {
                $value = explode($this->getSeparator(), $value);
            }
        }

        return $value;
    }
367422
public static function parse(string $value, array $references = [])
    {
        $value = \trim($value);

        if ('' === $value) {
            return '';
        }

        $i = 0;
        switch ($value[$i]) {
            case '[':
                $result = self::parseSequence($value, $i, $references);
                ++$i;
                break;
            case '{':
                $result = self::parseMapping($value, $i, $references);
                ++$i;
                break;
            default:
                $result = self::parseScalar($value, null, $i, true, $references);
        }

        // some comments are allowed at the end
        if (\preg_replace('/\s+#.*$/A', '', \substr($value, $i))) {
            throw new ParseException(\sprintf('Unexpected characters near "%s".', \substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
        }

        return $result;
    }
789743
protected function prepareArrayValue(array $value)
    {
        $rii = new \RecursiveIteratorIterator(
            new \RecursiveArrayIterator($value),
            \RecursiveIteratorIterator::SELF_FIRST
        );
        foreach ($rii as $key => $value) {
            if (($value instanceof ValueGenerator) === false) {
                $value = new self($value);
                $rii->getSubIterator()->offsetSet($key, $value);
            }

            $value->setIndentationLevel($value->getIndentationLevel() + $rii->getDepth());
        }

        return $rii->getSubIterator()->getArrayCopy();
    }
449981
public static function string(&$value='', bool $flatten=false) {
		if (! $flatten && \is_array($value)) {
			foreach ($value as $k=>$v) {
				static::string($value[$k]);
			}
		}
		else {
			// Flatten single-entry arrays.
			if (\is_array($value) && (1 === \count($value))) {
				$value = data::array_pop_top($value);
			}

			if (\is_array($value)) {
				$value = '';
				return;
			}

			try {
				$value = (string) $value;
				if (
					$value &&
					(
						! \function_exists('mb_check_encoding') ||
						! \mb_check_encoding($value, 'ASCII')
					)
				) {
					sanitize::utf8($value);
				}
			} catch (\Throwable $e) {
				$value = '';
			}
		}
	}