public function expand($shortcode) { // remove the 1 we added when we created it $index = ShortUrl::decode($shortcode) - 1; if ($index == -1) { return NULL; } $urls = $this->storage->getYAML('urls'); $url_data =& $urls[$index]; $url_data['clicks']++; $this->storage->putYAML('urls', $urls); return $url_data['url']; }