Formats some values as an 'onclick' attribute for Google Analytics

@param null $values
@return string
968623
public function gaTrackEvent($values = null)
    {
        $values = func_get_args();
        array_unshift($values, '_trackEvent');

        return sprintf(
            ' onclick="_gaq.push(%s);"',
            htmlspecialchars(json_encode(array_values($values)))
        );
    }
648490
public static function create($values = null) {
        if ($values === null) {
            $values = array_values(static::constants());
        }

        return EnumHelper::create(static::typeName(), $values);
    }
915171
public function values($values)
    {
        if(!$values instanceof KDatabaseQuerySelect)
        {
            if (!$this->columns && !is_numeric(key($values))) {
                $this->columns(array_keys($values));
            }

            $this->values[] = array_values($values);
        }
        else $this->values = $values;

        return $this;
    }
754816
private function doInsert(array $values) {
        $db       = $this->db();
        $mapping  = $this->dao()->getMapping();
        $table    = $mapping['table'];
        $idColumn = $mapping['identity']['column'];
        $id       = null;
        if  (isset($values[$idColumn])) $id = $values[$idColumn];
        else unset($values[$idColumn]);

        // translate column values
        foreach ($values as &$value) {
            $value = $db->escapeLiteral($value);
        }; unset($value);

        // create SQL statement
        $sql = 'insert into '.$table.' ('.join(', ', \array_keys($values)).')
                   values ('.join(', ', $values).')';

        // execute SQL statement
        if ($id) {
            $db->execute($sql);
        }
        else if ($db->supportsInsertReturn()) {
            $id = $db->query($sql.' returning '.$idColumn)->fetchInt();
        }
        else {
            $id = $db->execute($sql)->lastInsertId();
        }
        return $id;
    }
240392
public function format($value, $property = null)
    {
        switch ($property) {
            case 'http_access':
                return $this->formatHttpAccess($value);

            case 'token':
                return '******';

            case 'addon_credentials':
                if (is_array($value) && isset($value['shared_secret'])) {
                    $value['shared_secret'] = '******';
                }
                break;

            case 'app_credentials':
                if (is_array($value) && isset($value['secret'])) {
                    $value['secret'] = '******';
                }
                break;

            case 'author.date':
            case 'committer.date':
            case 'created_at':
            case 'updated_at':
            case 'expires_at':
            case 'started_at':
            case 'completed_at':
            case 'ssl.expires_on':
                $value = $this->formatDate($value);
                break;

            case 'ssl':
                if ($property === 'ssl' && is_array($value) && isset($value['expires_on'])) {
                    $value['expires_on'] = $this->formatDate($value['expires_on']);
                }
        }

        if (!is_string($value)) {
            $value = rtrim(Yaml::dump($value, 2));
        }

        return $value;
    }
316810
protected function getPreferredValue(array $values)
    {
        foreach ($values as $v) {
            if (!is_null($v) && !empty($v)) {
                return $v;
            }
        }

        return '';
    }
47463
protected static function escapeSet(array $values)
    {
        $escaped_values = [];

        foreach ($values as $value) {
            if (is_array($value)) {
                $escaped_values[] =
                    sprintf("(%s)", join(', ', static::escapeSet($value)));
            } else {
                $escaped_values[] = '$*';
            }
        }

        return $escaped_values;
    }
181861
protected function setOffersAttribute($values)
    {
        if (is_array($values)) {
            foreach($values as $key => $value) {
                $values[$key] = $this->mapProperty([
                    'name' => '',
                    'price' => '',
                    'url' => '',
                ], $value);
            }
        }

        return $values;
    }
882344
protected function formatValue($value)
    {
        $formatted_value = '<unknown parameter type>';

        if (is_object($value)) {
            $formatted_value = '<' . get_class($value) . ' object>';
        } elseif ($value === null) {
            $formatted_value = '<null>';
        } elseif (is_string($value)) {
            if (SwatString::validateUtf8($value)) {
                $formatted_value = "'" . $value . "'";
            } else {
                $formatted_value = '"' . SwatString::escapeBinary($value) . '"';
            }
        } elseif (is_int($value) || is_float($value)) {
            $formatted_value = strval($value);
        } elseif (is_bool($value)) {
            $formatted_value = $value ? 'true' : 'false';
        } elseif (is_resource($value)) {
            $formatted_value = '<resource>';
        } elseif (is_array($value)) {
            // check whether or not array is associative
            $keys = array_keys($value);
            $associative = false;
            $count = 0;
            foreach ($keys as $key) {
                if ($key !== $count) {
                    $associative = true;
                    break;
                }
                $count++;
            }

            $formatted_value = 'array(';

            $count = 0;
            foreach ($value as $key => $the_value) {
                if ($count > 0) {
                    $formatted_value .= ', ';
                }

                if ($associative) {
                    $formatted_value .= $this->formatValue($key);
                    $formatted_value .= ' => ';
                }
                $formatted_value .= $this->formatValue($the_value);
                $count++;
            }
            $formatted_value .= ')';
        }

        return $formatted_value;
    }
920932
public function transformValues( array $values )
    {
        if ( ! empty( $values['gridguyz-multisite']['defaultDomain'] ) )
        {
            $values['gridguyz-multisite']['defaultDomain'] = trim(
                $values['gridguyz-multisite']['defaultDomain'],
                '.'
            );
        }

        if ( ! empty( $values['gridguyz-multisite']['domainPostfix'] ) )
        {
            $values['gridguyz-multisite']['domainPostfix'] = '.' . trim(
                $values['gridguyz-multisite']['domainPostfix'],
                '.'
            );
        }

        return $values;
    }
1029385
function InListFromValues(array $values)
    {
        if (count($values) == 0)
        {
            return null;
        }
        $list = $this->InList($this->Value($values[0]));
        foreach ($values as $value)
        {
            $list->Add($this->Value($value));
        }
        return $list;
    }
480250
public function displayValue($value): string
    {
        if ($value === null) {
            return 'NULL';
        }

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

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

        if (is_array($value)) {
            return Json::encode($value);
        }

        return '"' . str_replace('"', '\"', $value) . '"';
    }
403233
protected function formatParameter($value)
    {
        if (\is_bool($value) || \is_array($value) || (null === $value)) {
            $jsonString = json_encode($value);

            if (preg_match('/^(.{60})./us', $jsonString, $matches)) {
                return $matches[1].'...';
            }

            return $jsonString;
        }

        return (string) $value;
    }
497011
protected static function tagLanguage(array $values)
    {
        $lang   = null;
        $values = self::createLanguage($values, $lang);

        return $lang ? array_map(function($value) use ($lang) {
            return (object)['value' => $value, 'lang' => $lang];
        }, $values) : $values;
    }
301644
protected static function getBigger(array $values)
    {
        $bigger = null;

        foreach ($values as $value => $repeat) {
            if ($bigger === null || $repeat > $values[$bigger]) {
                $bigger = $value;
            }
        }

        return $bigger;
    }
156188
public static function generate(array $values) : string
    {
        $namespace = '__CustomDoctrineEnums';
        $className = 'CustomEnum__' . preg_replace('/[^a-zA-Z0-9_]/', '_', implode('__', $values));

        /** @var string|BaseEnumType $fullClassName */
        $fullClassName = $namespace . '\\' . $className;

        if (!class_exists($fullClassName, false)) {
            $class = strtr(self::$template, [
                    '{namespace}'  => $namespace,
                    '{class}'      => $className,
                    '{base_class}' => '\\' . BaseEnumType::class,
                    '{values}'     => var_export($values, true)
            ]);

            eval($class);
            Type::addType($fullClassName::getTypeName(), $fullClassName);
        }


        return $fullClassName::getTypeName();
    }
333617
public function decimal($values)
    {
        // Avoid empty strings being put in the db
        if ($values['precision'] == '') {
            $precision = 1;
        } else {
            $precision = $values['precision'];
        }

        $defaultValue = '0';
        if (isset($values['default']) && is_numeric($values['default'])) {
            $defaultValue = $values['default'];
        }

        return "decimal($precision) not null default $defaultValue";
    }