Overview

Namespaces

  • pgn
    • exceptions
    • tags
  • utils

Classes

  • Game
  • PGN
  • Overview
  • Namespace
  • Class

Class PGN

Description of PGN

Namespace: pgn
Author: Geraldo B. Landre geraldo.landre@gmail.com
Located at pgn/PGN.php
Methods summary
public
# __construct( )

Creates a PGN object with no games

Creates a PGN object with no games

public string
# __toString( )

Returns a string representation of the PGN object

Returns a string representation of the PGN object

Returns

string
a string representation of the PGN object
public string
# toString( string $endl = "\n" )

Returns a string representation of the PGN object

Returns a string representation of the PGN object

Parameters

$endl

The end-line character (default: "\n"). Example:

<code>
<?php
$object = new PGN;
$object->toString("<br />");
</code>

Returns

string
a string representation of the PGN object
public
# load( string $str )

Loads games from a PGN string

Loads games from a PGN string

Parameters

$str
PGN string

Throws

InvalidGameFormatException

throws an exception if the parameter is not a string or if it doesn't have the correct fields, i.e. the move text and the seven roster tags

public
# loadFromFile( string $path )

Parameters

$path

Throws

pgn\exceptions\InvalidGamePathException

throws an exception if the file doesn't exist or if was not possible to read it


InvalidGameFormatException

throws an exception if the parameter is not a string or if it doesn't have the correct fields, i.e. the move text and the seven roster tags

public integer
# countGames( )

Returns

integer
the number of games contained in the PGN object
public static
# getSTR( )

Seven Tag Roster Gets the mandatory tags in a PGN game:

Seven Tag Roster Gets the mandatory tags in a PGN game:

1) Event (the name of the tournament or match event)

2) Site (the location of the event)

3) Date (the starting date of the game)

4) Round (the playing round ordinal of the game)

5) White (the player of the white pieces)

6) Black (the player of the black pieces)

7) Result (the result of the game)

API documentation generated by ApiGen