src/Parser/MentionParser.php
public function parse($input)
    {
        if (is_null($input) || empty($input)) {
            return $input;
        }
        $character = $this->getOption('character');
        $regex = strtr($this->getOption('regex'), $this->getOption('regex_replacement'));

        preg_match_all($regex, $input, $matches);

        $matches = array_map([$this, 'mapper'], $matches[0]);

        $matches = $this->removeNullKeys($matches);
        $matches = $this->prepareArray($matches);

        $output = preg_replace_callback($matches, [$this, 'replace'], $input);

        return $output;
    }
public function parse($input)
    {
        if (is_null($input) || empty($input)) {
            return $input;
        }
        $character = $this->getOption('character');
        $regex = strtr($this->getOption('regex'), $this->getOption('regex_replacement'));

        preg_match_all($regex, $input, $matches);

        $matches = array_map([$this, 'mapper'], $matches[0]);

        $matches = $this->removeNullKeys($matches);
        $matches = $this->prepareArray($matches);

        $output = preg_replace_callback($matches, [$this, 'replace'], $input);

        return $output;
    }
public function parse ( $ input ) { if ( is_null ( $ input ) || empty ( $ input ) ) { return $ input ; } $ character = $ this -> getOption ( 'character' ) ; $ regex = strtr ( $ this -> getOption ( 'regex' ) , $ this -> getOption ( 'regex_replacement' ) ) ; preg_match_all ( $ regex , $ input , $ matches ) ; $ matches = array_map ( [ $ this , 'mapper' ] , $ matches [ 0 ] ) ; $ matches = $ this -> removeNullKeys ( $ matches ) ; $ matches = $ this -> prepareArray ( $ matches ) ; $ output = preg_replace_callback ( $ matches , [ $ this , 'replace' ] , $ input ) ; return $ output ; }
Parse a text and determine if it contains mentions. If it does,
then we transform the mentions to a markdown link and we notify the user.

@param null|string $input The string to parse.

@return null|string
Parse a text and determine if it contains mentions . If it does then we transform the mentions to a markdown link and we notify the user .