public function resolve($key)
{
// this shouldn't happen
if (is_array($key)) {
throw new LiquidException("Cannot resolve arrays as key");
}
if (is_null($key) || $key == 'null') {
return null;
}
if ($key == 'true') {
return true;
}
if ($key == 'false') {
return false;
}
if (preg_match('/^\'(.*)\'$/', $key, $matches)) {
return $matches[1];
}
if (preg_match('/^"(.*)"$/', $key, $matches)) {
return $matches[1];
}
if (preg_match('/^(\\d+)$/', $key, $matches)) {
return $matches[1];
}
if (preg_match('/^(\\d[\\d\\.]+)$/', $key, $matches)) {
return $matches[1];
}
return $this->variable($key);
}