Overview

Namespaces

  • pgn
    • exceptions
    • tags
  • utils

Classes

  • pgn\Game
  • pgn\PGN
  • pgn\tags\Annotator
  • pgn\tags\Black
  • pgn\tags\BlackElo
  • pgn\tags\BlackNA
  • pgn\tags\BlackTitle
  • pgn\tags\BlackType
  • pgn\tags\BlackUSCF
  • pgn\tags\Board
  • pgn\tags\Date
  • pgn\tags\ECO
  • pgn\tags\Event
  • pgn\tags\EventCountry
  • pgn\tags\EventDate
  • pgn\tags\EventRounds
  • pgn\tags\EventSponsor
  • pgn\tags\EventType
  • pgn\tags\FEN
  • pgn\tags\Mode
  • pgn\tags\NIC
  • pgn\tags\Opening
  • pgn\tags\PlyCount
  • pgn\tags\Result
  • pgn\tags\Round
  • pgn\tags\Section
  • pgn\tags\SetUp
  • pgn\tags\Site
  • pgn\tags\Source
  • pgn\tags\SourceDate
  • pgn\tags\Stage
  • pgn\tags\SubVariation
  • pgn\tags\Tag
  • pgn\tags\Termination
  • pgn\tags\Time
  • pgn\tags\TimeControl
  • pgn\tags\UknownTag
  • pgn\tags\UTCDate
  • pgn\tags\UTCTime
  • pgn\tags\Variation
  • pgn\tags\White
  • pgn\tags\WhiteElo
  • pgn\tags\WhiteNA
  • pgn\tags\WhiteTitle
  • pgn\tags\WhiteType
  • pgn\tags\WhiteUSCF
  • utils\Parser
  • utils\String

Exceptions

  • pgn\exceptions\InvalidClassNameException
  • pgn\exceptions\InvalidDataException
  • pgn\exceptions\InvalidGameFormatException
  • pgn\exceptions\InvalidGamePathException
  • pgn\exceptions\PGNException
  • utils\ParserException
  • Overview
  • Namespace
  • Class
 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:  * Description of White:
13:  * The White tag value is the name of the player or players of the white pieces.
14:  * The names are given as they would appear in a telephone directory.  The family
15:  * or last name appears first.  If a first name or first initial is available, it
16:  * is separated from the family name by a comma and a space.  Finally, one or more
17:  * middle initials may appear.  (Wherever a comma appears, the very next character
18:  * should be a space.  Wherever an initial appears, the very next character should
19:  * be a period.)  If the name is unknown, a single question mark should appear as
20:  * the tag value.
21:  *
22:  * The intent is to allow meaningful ASCII sorting of the tag value that is
23:  * independent of regional name formation customs.  If more than one person is
24:  * playing the white pieces, the names are listed in alphabetical order and are
25:  * separated by the colon character between adjacent entries.  A player who is
26:  * also a computer program should have appropriate version information listed
27:  * after the name of the program.
28:  *
29:  * The format used in the FIDE Rating Lists is appropriate for use for player name
30:  * tags.
31:  *
32:  * Examples:
33:  *
34:  * [White "Tal, Mikhail N."]
35:  *
36:  * [White "van der Wiel, Johan"]
37:  *
38:  * [White "Acme Pawngrabber v.3.2"]
39:  *
40:  * @see pgn_standard.txt
41:  * @author Geraldo
42:  */
43: class WhiteNA extends Tag {
44: 
45:     /**
46:      * @assert () === 'WhiteNA'
47:      * @return string WhiteNA
48:      */
49:     public function getName() {
50:         $parsed = Parser::parseClassName(get_class());
51:         return $parsed['className'];
52:     }
53: 
54:     /**
55:      * @assert("-") === true
56:      * @assert("email@domain.com") === true
57:      * @assert("http://www.meusite.com") === true
58:      * @assert("http://www.meusite.com/diretorio") === true
59:      * @assert("http://www.meusite.com/diretorio/pagina.html") === true
60:      * @assert("https://meusite.com/diretorio/pagina.html") === true
61:      * Tests based on description:
62:      * @assert("Tal, Mikhail N.") === false
63:      * @assert("van der Wiel, Johan") === false
64:      * @assert("Acme Pawngrabber v.3.2") === false
65:      * @assert("?") === false
66:      * Basic path tests:
67:      * @assert (NULL) === false
68:      * @assert ("ab") === false
69:      * @assert (", ") === false
70:      * @assert (",a") === false
71:      * @assert ("a") === false
72:      * @param string $data
73:      * @return bool true if data is valid and false if not.
74:      */
75:     public function validate($data) {
76:         if (!parent::validate($data)) {
77:             return false;
78:         }
79:         
80:         return preg_match_all("/^" . self::validPattern() . "$/", $data) === 1;
81:     }
82:     
83:     /**
84:      * 
85:      * @return string Valid Regular Expression Pattern for Network Address
86:      */
87:     static public function validPattern() {
88:         return "-|\w+@\w+\.\w+|http(s)?\:\/\/.+";
89:     }
90: 
91: }
92: 
API documentation generated by ApiGen