protected function parseKey($key)
{
if (is_object($key) and $key instanceof AccessKey) {
return $key;
}
// Handle arrays and objects
if (is_object($key) or is_array($key)) {
$key = '';
}
$key_string = strval($key);
$key = new AccessKey();
$key->raw = $key_string;
$keys = explode('.', $key_string);
foreach ($keys as $value) {
$key->push($value);
}
$key->rewind();
return $key;
}