Gets an identifier from a name.

@param string $name The name
@param string $separator The optional separator, defaults to `_`
@return string The identifier
335994
public static function identifier(string $name, string $separator = '_'): string {
    $slugify    = new Slugify(['separator' => $separator]);
    $identifier = $slugify->slugify($name);

    return $identifier;
  }
1139585
public function htmlId($name = '', $splitor = '-') {
        if (!isset($this->_data['htmlId'])) {
            $this->_data['htmlId'] = empty($name) ? strtolower(preg_replace("/(.)([A-Z])/", "$1{$splitor}$2", $this->shortClassName())) : strtolower(preg_replace("/(.)([A-Z])/", "$1{$splitor}$2", $name));
        }
        return $this->_data['htmlId'];
    }
1200536
protected function getParentName($name)
    {
        return (string) substr($name, 0, (int) strrpos($name, $this->separator));
    }
830082
private function tokenize($string, $separator = '')
    {
        if (!strcmp($separator, '')) {
            $separator = $string;
            $string = $this->headerNextToken;
        }

        for ($character = 0; $character < strlen($separator); $character++) {
            if (gettype($position = strpos($string, $separator[$character])) == 'integer') {
                $found = (isset($found) ? min($found, $position) : $position);
            }
        }

        if (isset($found)) {
            $this->headerNextToken = substr($string, $found + 1);

            return substr($string, 0, $found);
        } else {
            $this->headerNextToken = '';

            return $string;
        }
    }
1134477
public static function getStringWithoutLastElement($string, $separator)
    {
        $elements = self::getStringElements($string, $separator);
        $lastKey = Arrays::getLastKey($elements);

        unset($elements[$lastKey]);

        return implode($separator, $elements);
    }
286296
public static function getSizePattern($separator = ' x ')
    {
        $escapeMe = [
            '/',
            '|',
            '.',
            '(',
            ')',
            '[',
            ']',
        ];

        $cleanSeparator = trim($separator);

        if (in_array($cleanSeparator, $escapeMe, true)) {
            // I have to escape special character of  regular expression that may be used as separator
            $separator = str_replace($cleanSeparator, '\\' . $cleanSeparator, $separator);
        }

        return sprintf(self::$patterns['size'], $separator);
    }
276301
public function splitTagNames($names, $separator=',')
    {
        $tags = explode($separator, $names);
        $tags = array_map('trim', $tags);
        $tags = array_filter($tags, function ($value) { return !empty($value); });

        return array_values($tags);
    }
1145497
public function getUniqFileName($dir, $name, $sep = '-')
    {
        list($name, $ext) = $this->standardizeFileName($name, true);

        $nameF = $name.'.'.$ext;
        $i = 2;
        while (isset($this->uniqFileNames[$dir.'/'.$nameF]) || file_exists($dir.'/'.$nameF)) {
            $nameF = $name.$sep.$i.'.'.$ext;
            ++$i;
        }
        $this->uniqFileNames[$dir.'/'.$nameF] = true;

        return $nameF;
    }
1144073
public static function removeFirst(string $string, string $separator): string
    {
        $string = explode($separator, $string);
        $string = Arr::removeFirst($string);
        return implode($separator, $string);
    }
662419
protected function getValueOfFormatCharacter(string $name, bool &$skip = false): string
    {
        if (($r = $this->shouldWeSkip($name, $skip)) !== false) {
            return ''.$r;
        }

        if ($this->isOverrideFormatCharacter($name)) {
            return ''.$this->{Constants::FORMAT_MAPPER[$name]}();
        }
477627
public function getJoinedMessage($separator = "\n")
    {
        $messages = $this->getDetailMessages();
        $array = array();
        foreach ($messages as $rules) {
            foreach ($rules as $options) {
                foreach ($options as $message) {
                    $array[] = $message;
                }
            }
        }
        return implode($separator, array_unique($array));
    }
884936
public static function getCamelCase($string, $separator = ' ')
    {
        if (empty($string)) {
            return '';
        }

        $effect = '';
        $members = explode($separator, $string);

        foreach ($members as $key => $value) {
            $value = mb_strtolower($value);

            if (0 === $key) {
                $effect .= self::lowercaseFirst($value);
            } else {
                $effect .= self::uppercaseFirst($value);
            }
        }

        return $effect;
    }
55189
public static function removeLast(string $string, string $separator): string
    {
        $string = explode($separator, $string);
        $string = Arr::removeLast($string);
        return implode($separator, $string);
    }
472402
public static function parseConstantName($constName, $separator='_')
    {
        if (!empty($separator)){
            $pos = strpos($constName, $separator);
            if (false !== $pos && $pos != strlen($constName))
                $constName = substr($constName, $pos+1);
        }
        $constName = str_replace($separator, ' ', $constName);
        return ucwords($constName);
    }
795253
public function resolveName(
        PurchasableInterface $purchasable,
        $separator = null
    ) {
        $namespace = $this->getPurchasableNamespace();
        if (!$purchasable instanceof $namespace) {
            return false;
        }

        /**
         * @var $purchasable ProductInterface
         */
        return $purchasable->getName();
    }
732063
public function getGeoLocationAsString(string $separator = ';'): string
    {
        return number_format($this->latitude, 6) . $separator . number_format($this->longitude, 6);
    }
31799
private function pathId($name)
    {
        $parts = $this->splitName($name);
        if ($parts[0] === '') {
            return null;
        }

        return end($parts);
    }