BookStack\User::getShortName PHP Method

getShortName() public method

Get a shortened version of the user's name.
public getShortName ( integer $chars = 8 ) : string
$chars integer
return string
    public function getShortName($chars = 8)
    {
        if (strlen($this->name) <= $chars) {
            return $this->name;
        }
        $splitName = explode(' ', $this->name);
        if (strlen($splitName[0]) <= $chars) {
            return $splitName[0];
        }
        return '';
    }