public function setWhitelist($whitelist)
    {
        if (is_array($whitelist)) {
            $this->whitelist = array_map('strval', $whitelist);
        } elseif ($whitelist instanceof \ArrayObject && true) {
            $this->whitelist = array_map('strval', $whitelist->getArrayCopy());
        } elseif (is_string($whitelist)) {
            $this->whitelist = [];
            for ($i = 0; $i < strlen($whitelist); $i++) {
                $this->whitelist[] = $whitelist[$i];
            }
        } else {
            throw new \Exception('Incorrect whitelist given. Allowed whitelist are: string, array or ArrayObject.');
        }
    }