Build CVSS vector for the given inputs

@param array $inputs

@return string
325564
static function buildVector($inputs)
    {
        $inputs = array_merge(array('CVSS' => self::VERSION), $inputs);
        return implode(self::$metricSeparator, array_map(function ($k, $v) {
            return sprintf('%1$s%3$s%2$s', strtoupper($k), strtoupper($v), self::$valueSeparator);
        }, array_keys($inputs), $inputs));
    }
13576
private function array_to_css( array $rules )
    {
        $css = '';
        foreach( $rules as $rule => $value )
        {
            $css .= $rule.':'.$value.';';
        }
        return $css;
    }
1318411
public static function css_files(array $files) {
        if (empty($files)) {
            return '';
        }

        $compressed = array();
        foreach ($files as $file) {
            $content = file_get_contents($file);
            if ($content === false) {
                $compressed[] = "\n\n/* Cannot read CSS file ".basename(dirname(dirname($file))).'/'.basename(dirname($file)).'/'.basename($file)."*/\n\n";
                continue;
            }
            $compressed[] = self::css($content);
        }

        return implode("\n", $compressed);
    }
271046
public function createCvsMapTransaction(array $params)
    {
        $this->sdk->Send = array_merge($this->sdk->Send, [
            'MerchantTradeNo' => '',
            'LogisticsSubType' => LogisticsSubType::UNIMART,
            'IsCollection' => IsCollection::NO,
            'ServerReplyURL' => '',
            'ExtraData' => '',
            'Device' => $this->isMobile() ? Device::MOBILE : Device::PC,
        ]);

        $this->sdk->Send = array_replace(
            $this->sdk->Send,
            array_intersect_key($params, $this->sdk->Send)
        );

        return $this->sdk->formToArray(
            $this->sdk->CvsMap()
        );
    }
450420
private static function getParamValues($params, $inputs) {
        foreach ($params as $key => $param) {
            if (preg_match("#^:([\[\]a-zA-Z0-9_]+)$#", $param, $param_type)) {
                $params[$key] = @$inputs[(string) $param_type[1]];
            }
        }
        return $params;
    }
739888
public function create($inputs)
    {
        $record = $this->model->create($inputs);
        $record->save();
        return $record;
    }
822808
private static function formatVector(array $vector, array $lines)
    {
        $template = [' '];
        foreach ($vector as $type) {
            $max = 0;
            foreach ($lines as $line) {
                $chunk = $line[$type];
                $cur = empty($chunk) ? 0 : \strlen($chunk) + 1;
                if ($cur > $max) {
                    $max = $cur;
                }
            }

            $template[] = self::getVectorParamTemplate($type, $max);
        }
        $template = \implode(' ', $template);

        return \implode("\n", \array_map(function ($line) use ($template) {
            $escaped = \array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $line);

            return \rtrim(\vsprintf($template, $escaped));
        }, $lines));
    }
516708
protected function filterCsvInjection($input)
    {
        // Try to prevent csv injection
        $dangers = ['=', '+', '-', '@'];
        
        // Trim leading spaces for our test
        $trimmed = trim($input);
        
        if (strlen($trimmed)>1 && in_array($trimmed[0], $dangers)) {
            return "'" . $input;
        }  else {
            return $input;
        }
    }
471502
public static function fromArray(array $input) {
        $input = array_map(function($value) {
            return is_array($value) ? ArrayObject::fromArray($value) : $value;
        }, $input);

        return new ArrayObject($input);
    }
722259
public static function fromArray($input = [])
	{
		$fields = ScalarFields::getInstance();

		foreach ($input as $k => $v) {
			if (is_array($v)) {
				$fields = $fields->appendFields($k, self::fromArray($v));
			} elseif (!!$v) {
				$fields = $fields->appendField($k);
			}
		}

		return $fields;
	}
281948
public static function buildAttrs(array $attributes, array $cssClasses = []): string
    {
        $output = '';
        if ($cssClasses) {
            if (array_key_exists('class', $attributes) && $attributes['class']) {
                $attributes['class'] .= ' ' . implode(' ', $cssClasses);
            } else {
                $attributes['class'] = implode(' ', $cssClasses);
            }
        }
        foreach ($attributes as $key => $value) {
            $output .= ' ' . $key . ($value !== null ? '="' . str_replace('"', '\"', $value) . '"' : '');
        }
        return $output;
    }
1331322
private function validateStoreInputs($inputs)
    {
        $rules = array(
            'selected_products' => 'required_without_all:selected_bundles,pricelist_id',
            'selected_bundles'  => 'required_without_all:selected_products,pricelist_id',
            'pricelist_id'      => 'required_without_all:selected_products,selected_bundles',
            'transaction_id'    => 'required',
            'payment_status'    => 'required',
            'paid'              => 'numeric',
            'email'             => 'required|email'
        );
        
        $messages = [
            'selected_products.required_without_all' =>
                trans('redminportal::messages.order_error_selected_products_required_without_all'),
            'selected_bundles.required_without_all' =>
                trans('redminportal::messages.order_error_selected_bundles_required_without_all'),
            'pricelist_id.required_without_all' =>
                trans('redminportal::messages.order_error_pricelist_id_required_without_all')
        ];

        return Validator::make($inputs, $rules, $messages);
    }
1198092
public function create( $inputs = [] )
	{
		$columns = [];
		$placeholders = [];
		$values = [];

		foreach( $inputs as $column => $value )
		{
			$columns []= "`$column`";
			$placeholders []= ":$column";
			$values[":$column"] = $value;
		}

		$keys = implode(',', $columns);
		$placeholders = implode(',', $placeholders);

		$this->_exec_( "INSERT INTO `{$this->table}` ( $keys ) VALUES ( $placeholders )", $values );

		return $this->insert_id();
	}
890022
public function setInputsToFilter($inputs)
    {
        // No need to apply validation groups for empty arrays
        if (!is_array($inputs) || $this->needsFiltering($inputs)) {
            try {
                if ($inputs === null) {
                    // Provide Zend's expected value when intending to filter all inputs...
                    $group = self::VALIDATE_ALL;
                } elseif (is_array($inputs)) {
                    $knownInputs = array_keys($this->getInputs());
                    $group = array_intersect($inputs, $knownInputs);
                } else {
                    $group = $inputs;
                }

                parent::setValidationGroup($group);
            } catch (InputFilterException $e) {
                throw new Exception\InvalidArgumentException(
                    sprintf('Failed to set inputs to filter: %s', $e->getMessage()),
                    0,
                    $e
                );
            }
        }

        // Apply only after we made sure the provided inputs are valid
        $this->inputsToFilter = $inputs;

        return $this;
    }
1284450
protected function cleanInputData(array $input)
    {
        $columns = $this->getColumns();
        foreach ($columns as $column) {
            if (!isset($input[$column])) {
                $input[$column] = '';
            }
        }
        return $input;
    }
502186
protected function buildRequirements(array $matches)
    {
        $result = [];
        foreach ($matches as $match) {
            list($key, $regexp) = $this->splitSegment($match[3]);
            $result[$key] = $regexp . ($match[1] == '(' ? '*' : '+');
        }

        return $result;
    }
1202259
protected function serialize($vars)
    {
        $data = '';
        if (is_array($vars)) {
            foreach ($vars as $var=>$value)
                $data .= $var.'|'.serialize($value);
        }
        else {
            $data = 'b:0;';
        }

        return $data;
    }