protected function getMatchingKeys($key, $content): array
    {
        // return if is not regex.
        if (!is_string($key) || !self::isStringRegex($key)) {
            return [$key];
        }

        if ($content instanceof Treadable) {
            $allKeys = $content->getChildKeys();
        }

        if (is_object($content) && !($content instanceof Treadable)) {
            $content = get_object_vars($content);
        }

        if (is_array($content)) {
            $allKeys = array_keys($content);
        }

        if (!isset($allKeys)) {
            return [];
        }

        return preg_grep($key, $allKeys);
    }