public function getCardinality()
    {
        if (null !== $this->cardinality) {
            return $this->cardinality;
        }
        $lower = $upper = $digits = $symbols = $unicode = 0;

        // Use token instead of password to support bruteforce matches on sub-string
        // of password.
        $chars = str_split($this->token);
        foreach ($chars as $char) {
            $ord = ord($char);

            if ($this->isDigit($ord)) {
                $digits = 10;
            } elseif ($this->isUpper($ord)) {
                $upper = 26;
            } elseif ($this->isLower($ord)) {
                $lower = 26;
            } elseif ($this->isSymbol($ord)) {
                $symbols = 33;
            } else {
                $unicode = 100;
            }
        }
        $this->cardinality = $lower + $digits + $upper + $symbols + $unicode;

        return $this->cardinality;
    }