Stringify the codes

@param  mixed  $codes

@return string
11243
protected function codeStr($codes)
    {
        // If we get something that is already a code string, just pass it back
        if (!is_array($codes) && strpos($codes, ';')) {
            return $codes;
        }

        $codes = Helper::toArray($codes);

        // Sort for the sake of consistency and testability
        sort($codes);

        return implode(';', $codes);
    }
756660
public function serializeStrings(array $strings)
	{
		$info         = $this->analyzeStrings($strings);
		$alternations = array_map([$this, 'serializeString'], $info['strings']);
		if (!empty($info['chars']))
		{
			// Prepend the character class to the list of alternations
			array_unshift($alternations, $this->serializeCharacterClass($info['chars']));
		}

		$expr = implode('|', $alternations);
		if ($this->needsParentheses($info))
		{
			$expr = '(?:' . $expr . ')';
		}

		return $expr . $info['quantifier'];
	}
773885
public static function getDescription($code)
    {
        if (isset(self::$codes[$code])) {
            return sprintf('%d (%s)', $code, self::$codes[$code]);
        }
        return $code;
    }
976296
public function _prepend($code)
    {
        if (is_array($code)) {
            $code = implode(';', $code);
        }
        $this->prepend = $code.';'.$this->prepend;

        return $this;
    }
361803
public function encode(...$numbers): string
    {
        $ret = '';

        if (1 === \count($numbers) && \is_array($numbers[0])) {
            $numbers = $numbers[0];
        }

        if (!$numbers) {
            return $ret;
        }

        foreach ($numbers as $number) {
            $isNumber = \ctype_digit((string) $number);

            if (!$isNumber) {
                return $ret;
            }
        }

        $alphabet = $this->alphabet;
        $numbersSize = \count($numbers);
        $numbersHashInt = 0;

        foreach ($numbers as $i => $number) {
            $numbersHashInt += $this->math->intval($this->math->mod($number, $i + 100));
        }

        $lottery = $ret = \mb_substr($alphabet, $numbersHashInt % \mb_strlen($alphabet), 1);
        foreach ($numbers as $i => $number) {
            $alphabet = $this->shuffle($alphabet, \mb_substr($lottery.$this->salt.$alphabet, 0, \mb_strlen($alphabet)));
            $ret .= $last = $this->hash($number, $alphabet);

            if ($i + 1 < $numbersSize) {
                $number %= (\mb_ord($last, 'UTF-8') + $i);
                $sepsIndex = $this->math->intval($this->math->mod($number, \mb_strlen($this->seps)));
                $ret .= \mb_substr($this->seps, $sepsIndex, 1);
            }
        }

        if (\mb_strlen($ret) < $this->minHashLength) {
            $guardIndex = ($numbersHashInt + \mb_ord(\mb_substr($ret, 0, 1), 'UTF-8')) % \mb_strlen($this->guards);

            $guard = \mb_substr($this->guards, $guardIndex, 1);
            $ret = $guard.$ret;

            if (\mb_strlen($ret) < $this->minHashLength) {
                $guardIndex = ($numbersHashInt + \mb_ord(\mb_substr($ret, 2, 1), 'UTF-8')) % \mb_strlen($this->guards);
                $guard = \mb_substr($this->guards, $guardIndex, 1);

                $ret .= $guard;
            }
        }

        $halfLength = (int) (\mb_strlen($alphabet) / 2);
        while (\mb_strlen($ret) < $this->minHashLength) {
            $alphabet = $this->shuffle($alphabet, $alphabet);
            $ret = \mb_substr($alphabet, $halfLength).$ret.\mb_substr($alphabet, 0, $halfLength);

            $excess = \mb_strlen($ret) - $this->minHashLength;
            if ($excess > 0) {
                $ret = \mb_substr($ret, (int) ($excess / 2), $this->minHashLength);
            }
        }

        return $ret;
    }
189632
public function uncolor($codes = array())
    {
        $nums = array();
        $result = array();
        $patts = array('/^' . chr(27) . '\[/', '/m$/');
        foreach ($codes as $code) {
            $esc = preg_replace($patts, '', $code);
            if (preg_match('/^((?:\d+;)*\d*)$/', $esc, $matches)) {
                if ($matches[0] != '') {
                    $nums = array_merge($nums, explode(';', $matches[0]));
                }
            } else {
                throw new InvalidArgumentException("Bad escape sequence $esc");
            }
        }
        foreach ($nums as $num) {
            $num += 0; // Strip leading zeroes
            if (isset($this->ATTRIBUTES_R[$num])) {
                $result[] = $this->ATTRIBUTES_R[$num];
            } else {
                throw new InvalidArgumentException("No name for escape sequence $num");
            }
        }
        return $result;
    }
490068
public static function getName($code)
    {
        if (!isset(self::$codesDescriptions[$code])) {
            throw new InvalidArgumentException("Invalid code $code specified");
        }

        return self::$codesDescriptions[$code];
    }
948807
public static function addNames($codes)
    {
        // Get languages from config
        $languages = config('localizer_languages.languages');

        $array = [];

        // Generate an array with $code as key and $code language as value
        foreach ($codes as $code) {
            $lang_name = 'Unknown';

            foreach ($languages as $language) {
                if ($language['code'] == $code) {
                    $lang_name = $language['name'];
                }
            }

            $array[$code] = $lang_name;
        }

        return $array;
    }
1351575
public function getName(string $code): string
    {
        $result = $code;

        if (empty($code)) {
            throw new InvalidArgumentException("Code must be a non-empty string.");
        }

        $languages = $this->getSupported();
        if (!empty($languages[$code])) {
            $result = $languages[$code];
        }

        return $result;
    }
1145117
public static function getStatusMessage($code) {
		if (!$code) {
			return '';
		}

		return isset(self::$statusMessages[$code]) ? self::$statusMessages[$code] : '';
	}
1328004
public function parseCode($code)
    {
        $segments = (new NamespacedItemResolver)->parseKey($code);

        if (is_null($segments[0])) {
            $segments[0] = '*';
        }

        return $segments;
    }
1320990
public static function get(int $code): string {

        if ( array_key_exists($code, self::ZIP_STATUS_CODES) ) return self::ZIP_STATUS_CODES[$code];

        else return sprintf('Unknown status %s', $code);

    }
495253
protected function getErrorTypeByCode($code) {
		if(!static::$errorsConstantsValues) {
			foreach(static::$errorsConstantsNames as $constantName) {
				if(defined($constantName)) {
					static::$errorsConstantsValues[constant($constantName)] = $constantName;
				}
			}
		}
		if(isset(static::$errorsConstantsValues[$code])) {
			return static::$errorsConstantsValues[$code];
		}
		return (string)$code;
	}
267952
public function codeDesc()
    {
        // Cast code to string from SimpleXMLObject
        $code = (string)$this->code;
        return array_key_exists($code, self::$codes) ? self::$codes[$code] : '';
    }
918912
static function compressCSS($code) {
        $code = self::clearWhitespaces($code);
        $code = preg_replace('/ ?\{ ?/', "{", $code);
        $code = preg_replace('/ ?\} ?/', "}", $code);
        $code = preg_replace('/ ?\; ?/', ";", $code);
        $code = preg_replace('/ ?\> ?/', ">", $code);
        $code = preg_replace('/ ?\, ?/', ",", $code);
        $code = preg_replace('/ ?\: ?/', ":", $code);
        $code = str_replace(";}", "}", $code);
        return $code;
    }
108637
public function filter($code)
    {
        $elements = (array) $this->elements($code);

        foreach ((array) $elements as $element)
        {
            $original = (string) $element->nodeValue;

            $minified = $this->minify($original);

            $minified = preg_replace('/\s+/', ' ', $minified);

            $minified = $this->minify($minified);

            $code = str_replace($original, $minified, $code);
        }

        return $code;
    }
427641
private function prefixWithSpaces($code)
    {
        $lines = explode("\n", $code);

        foreach ($lines as $key => $value) {
            if ($value) {
                $lines[$key] = $this->spaces . $lines[$key];
            }
        }

        return implode("\n", $lines);
    }