1: <?php
2: class Horde_Date_Parser_Locale_Base_Grabber
3: {
4: /**
5: * Regex tokens
6: */
7: public $scanner = array(
8: '/last/' => 'last',
9: '/this/' => 'this',
10: '/next/' => 'next',
11: );
12:
13: public function scan($tokens)
14: {
15: foreach ($tokens as &$token) {
16: if ($t = $this->scanForAll($token)) {
17: $token->tag('grabber', $t);
18: }
19: }
20: return $tokens;
21: }
22:
23: public function scanForAll($token)
24: {
25: foreach ($this->scanner as $scannerItem => $scannerTag) {
26: if (preg_match($scannerItem, $token->word)) {
27: return $scannerTag;
28: }
29: }
30: }
31:
32: }
33: