HumanNameParser_Parser::getArray PHP Method

getArray() public method

returns all the parts of the name as an array
public getArray ( String $arrType = 'assoc' ) : array
$arrType String pass 'int' to get an integer-indexed array (default is associative)
return array An array of the name-parts
    public function getArray($arrType = 'assoc')
    {
        $arr = array();
        $arr['leadingInit'] = $this->leadingInit;
        $arr['first'] = $this->first;
        $arr['nicknames'] = $this->nicknames;
        $arr['middle'] = $this->middle;
        $arr['last'] = $this->last;
        $arr['suffix'] = $this->suffix;
        if ($arrType == 'assoc') {
            return $arr;
        } else {
            if ($arrType == 'int') {
                return array_values($arr);
            } else {
                throw new Exception("Array must be associative ('assoc') or numeric ('num').");
            }
        }
    }