Convert an array into an OpenID colon/newline separated string

@static
@access private
@param null|array $values
@return null|string
559729
static function fromArray($values)
    {
        if ($values === null) {
            return null;
        }

        ksort($values);

        $serialized = '';
        foreach ($values as $key => $value) {
            if (is_array($value)) {
                list($key, $value) = array($value[0], $value[1]);
            }

            if (strpos($key, ':') !== false) {
                return null;
            }

            if (strpos($key, "\n") !== false) {
                return null;
            }

            if (strpos($value, "\n") !== false) {
                return null;
            }
            $serialized .= "$key:$value\n";
        }
        return $serialized;
    }
112708
public static function createFromArray(array $values)
    {
        $category = new self($values['title'], isset($values['domain']) ? $values['domain'] : null);

        return $category;
    }
139176
public function insertGetId(array $values, $sequence = null)
    {
        $result = $this->collection->insertOne($values);

        if (1 == (int) $result->isAcknowledged()) {
            if (is_null($sequence)) {
                $sequence = '_id';
            }

            // Return id
            return $sequence == '_id' ? trim($result->getInsertedId()) : $values[$sequence];
        }

        return null;
    }
353664
public function insert(array $values)
    {
        $result = parent::insert($values);

        $this->handler->setBuilder($this)
            ->invalidateQuery(Reflector::QUERY_TYPE_INSERT, $values);

        return $result;
    }
1277717
protected function _createValueList( $type, array $values )
	{
		if( ( $val = reset( $values ) ) === false ) {
			return '';
		}

		$string = $this->_escape( $this->getOperator(), $type, $val );

		while( ( $val = next( $values ) ) !== false ) {
			$string .= ',' . $this->_escape( $this->getOperator(), $type, $val );
		}

		return 'array(' . $string . ')';
	}
114990
public function appendValues(array $values)
    {
        $appendValues = [];

        foreach ($values as $value) {
            $appendValues[] = $this->formatValue($value);
        }

        $this->message = $this->message . implode(', ', $appendValues);

        return $this;
    }
1097465
protected function forceStringValues(array $values)
    {
        foreach ($values as $key => $value) {
            $values[$key] = (string) $value;
        }

        return $values;
    }
1102962
public function concatenate($values, $separator = null)
  {
    if ( $separator ){
      return 'CONCATENATE(' . implode(' || ' . $this->q($separator) . ' || ', $values) . ')';
    }
    else {
      return 'CONCATENATE(' . implode(' || ', $values) . ')';
    }
  }
730748
private function buildSetPart($values)
    {
        $result = [];
        foreach ($values as $columnName => $placeholder) {
            $result[] = $this->quoteIdentifier($columnName) . ' = ' . $placeholder;
        }

        return "\nSET " . implode(', ', $result);
    }
169753
public function multiselectToArray($values)
    {
        // Unencode
        $values = unencodeMultienum($values);

        // First clean the array
        foreach ($values as $k => $v) {
            if (empty($v)) {
                unset($values[$k]);
            }
        }

        // Then return the array
        return $values;
    }
793797
public static function convert(array $values, $windows = false) {
        if (true === $windows) {
            for ($i = count($values) - 1; 0 <= $i; --$i) {
                $values[$i] = utf8_decode($values[$i]);
            }
        }
        return $values;
    }
476995
public function getUrlFromPathWithValues(array $values = []){

        $url    = $this->path;
        //$url  = preg_replace($this->regex, $values, $this->path);

        //straightforward match and replace
        preg_match_all('@{([a-zA-Z0-9_]*)}@', $url, $matches);

        if($matches) {
            foreach ($matches[1] as $k=>$optional){
                $url = str_ireplace($matches[0][$k], isset($values[$optional])? $values[$optional] : null , $url );
            }
        }

        //the more complicated stuff;
        preg_match('@{/([a-zA-Z0-9_]*)}@', $url, $expandables);

        if ($expandables) {
            //expand /{foo,bar} type patterns
            $list = explode(',', $expandables[1]);
            $head = '';

            if (substr($url, 0, 2) == '{/') {
                $name = array_shift($list);
                if(isset($values[$name])) {
                    $head = "/{$values[$name]}";
                }
            }

            $tail = '';

            foreach ($list as $name) {
                if(isset($values[$name])) {
                    $head = "/{$values[$name]}";
                }
            }
            $url = str_replace($expandables[0], $head . $tail, $url);
        }

        return $url;
    }
780797
public function markValueArray(array $values): array
    {
        // 对数组中的每一项,逐个加定界符
        foreach ($values as $k => $v) {
            $values[$k] = self::markValue($v);
        }
        return $values;
    }
371445
public static function getNonEmptyValuesAsString(array $values, $separator = ', ')
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($values)) {
            return null;
        }

        $nonEmpty = self::getNonEmptyValues($values);

        /*
         * No values?
         * Nothing to do
         */
        if (empty($nonEmpty)) {
            return '';
        }

        return implode($separator, $nonEmpty);
    }
832359
public function createOutput($values) {
		$output = '';
		foreach ($values as $key => $value) {
			$output .= $this->createLine($key, $value) . PHP_EOL;
		}

		return $output;
	}
1310957
public function transform($value): ?string
    {
        /** TODO add sanity check is array of Location object? */
        if (!is_array($value) || empty($value)) {
            return null;
        }

        return implode(',', array_column($value, 'id'));
    }
1324632
public function insertGetId(array $values, $sequence = null)
    {
        // create a neo4j Node
        $node = $this->client->makeNode();

        // set its properties
        foreach ($values as $key => $value)
        {
            $value = $this->formatValue($value);

            $node->setProperty($key, $value);
        }

        // save the node
        $node->save();

        // get the saved node id
        $id = $node->getId();

        // set the labels
        $node->addLabels(array_map(array($this, 'makeLabel'), $this->from));

        return $id;
    }