Overview

Namespaces

  • pgn
    • exceptions
    • tags
  • utils

Classes

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

Class Tag

Abstract class representing a Tag in a PGN game

Direct known subclasses

pgn\tags\Board, pgn\tags\Date, pgn\tags\Result, pgn\tags\Round, pgn\tags\Section, pgn\tags\SetUp, pgn\tags\Site, pgn\tags\Source, pgn\tags\Stage, pgn\tags\SubVariation, pgn\tags\Termination, pgn\tags\Time, pgn\tags\ECO, pgn\tags\TimeControl, pgn\tags\UknownTag, pgn\tags\Variation, pgn\tags\White, pgn\tags\WhiteElo, pgn\tags\WhiteNA, pgn\tags\WhiteTitle, pgn\tags\WhiteType, pgn\tags\Event, pgn\tags\EventCountry, pgn\tags\EventType, pgn\tags\FEN, pgn\tags\Mode, pgn\tags\NIC, pgn\tags\Opening

Indirect known subclasses

pgn\tags\Annotator, pgn\tags\Black, pgn\tags\PlyCount, pgn\tags\SourceDate, pgn\tags\UTCDate, pgn\tags\UTCTime, pgn\tags\WhiteUSCF, pgn\tags\BlackElo, pgn\tags\BlackNA, pgn\tags\BlackTitle, pgn\tags\BlackType, pgn\tags\BlackUSCF, pgn\tags\EventDate, pgn\tags\EventRounds, pgn\tags\EventSponsor
Abstract
Namespace: pgn\tags
Author: Geraldo
Located at pgn/tags/Tag.php
Methods summary
abstract public the
# getName( )

Returns

the
name of the tag
public string
# __toString( )

Returns the tag as a string. The default string patter is: [TagName "content"]

Returns the tag as a string. The default string patter is: [TagName "content"]

Returns

string
public
# set( string $data )

Sets the tag with the data if it's a valid data

Sets the tag with the data if it's a valid data

Parameters

$data

Throws

pgn\exceptions\InvalidDataException
throws an exception if the data is not in the correct format

See

pgn\tags\Tag::validate()
public string
# get( )

Returns the data of the tag as a string

Returns the data of the tag as a string

Returns

string
formatted data

See

pgn\tags\Tag::formatted()
public boolean
# validate( mixed $data )

Parameters

$data

Returns

boolean
returns if a data is valid
public string
# getDefaultValue( )

Returns the default value of the Tag

Returns the default value of the Tag

Returns

string
protected string
# formatted( $data )

Returns its data as a formatted string It's recommended to be overwritten

Returns its data as a formatted string It's recommended to be overwritten

Returns

string

See

http://php.net/manual/pt_BR/function.strval.php
public static pgn\tags\Tag
# parse( string $unparsedTag, string & $errors )

Parameters

$unparsedTag
$errors
$errors array of strings

Returns

pgn\tags\Tag
The tag created
public static
# parseTagName( string $unparsedTag )

Parses a string in correct format of a tag and returns the value of the tag

Parses a string in correct format of a tag and returns the value of the tag

Parameters

$unparsedTag

Throws

pgn\exceptions\InvalidGameFormatException
if tag was not on correct format

Assert('[testname

"Test Value"]') === "TestName"
"Test Value"') === "TestName"

Assert('asdf')

throws InvalidGameFormatException
public static
# parseTagValue( string $unparsedTag )

Parses a string in correct format of a tag and returns the value of the tag if the string is not in the correct format throws an exception

Parses a string in correct format of a tag and returns the value of the tag if the string is not in the correct format throws an exception

Parameters

$unparsedTag

Throws

pgn\exceptions\InvalidGameFormatException
if tag was not on correct format

Assert('[testname

"Test Value"]') === "Test Value"
"Test Value"') === "Test Value"

Assert('asdf')

throws InvalidGameFormatException
public static string
# validPattern( )

Get the regex pattern of a valid tag string

Get the regex pattern of a valid tag string

Returns

string
regex pattern of a valid tag string
public static pgn\tags\Tag
# createTag( string $tagName, string $tagValue )

Creates a tag, based on tags classes (@see \pgn\tags)

Creates a tag, based on tags classes (@see \pgn\tags)

Parameters

$tagName
the name of the tag
$tagValue
the value of the tag

Returns

pgn\tags\Tag
Properties summary
protected $data
#
protected $errorMsg
#
API documentation generated by ApiGen