In this case we are attempting to convert camel case formatted
methods into underscore formatted methods.
This allows us to call ORM methods using camel case and remain
backwards compatible.
public function __call($method, array $args) { if ($method != 'loaded' and $this->loaded()) { $exploded = explode('_', strtolower($method)); if (count($exploded) == 3 and $exploded[2] == 'count') { $type = $action = NULL; if (in_array($exploded[0], array('increment', 'decrement'))) { $action = $exploded[0]; } if (in_array($exploded[1], array('views', 'comments'))) { $type = $exploded[1]; } if ($type !== NULL and $action !== NULL) { $key = array('count', $type, $this->id, date('Ymd')); $key = implode('_', $key); $default = parent::__get($type . '_count'); $result = Cache::instance('memcache')->{$action}($key, 1, $default); return $result; } } } return parent::__call($method, $args); }