1: <?php
2: /*
3: * Copyright (c) 2016 Geraldo B. Landre
4: *
5: * See the file LICENSE for copying permission.
6: */
7: namespace pgn\tags;
8:
9: use utils\Parser;
10:
11: /**
12: * @see pgn_standard.txt
13: * @author Geraldo
14: */
15: class WhiteTitle extends Tag {
16:
17: /**
18: * @assert() === 'WhiteTitle'
19: * @return string
20: */
21: public function getName() {
22: $parsed = Parser::parseClassName(get_class());
23: return $parsed['className'];
24: }
25:
26: /**
27: * @param string $data
28: * @return boolean
29: */
30: public function validate($data) {
31:
32: if(!parent::validate($data)) {
33: return false;
34: }
35:
36: if($data === '-') {
37: return true;
38: }
39:
40: return preg_match_all("/^" . self::validPattern() . "$/", $data) === 1;
41: }
42:
43: /**
44: *
45: * @return string Valid Regular Expression
46: */
47: static public function validPattern() {
48: return "GM|IM|FM";
49: }
50:
51: }
52: