This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
forked from Mac2/libiwparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParserMsgI.php
88 lines (79 loc) · 3.14 KB
/
ParserMsgI.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <[email protected]> wrote this file. As long as you retain
* this notice you can do whatever you want with this stuff. If we meet some
* day, and you think this stuff is worth it, you can buy me a beer in return.
* Martin Martimeo
* ----------------------------------------------------------------------------
*/
/**
* @author Martin Martimeo <[email protected]>
* @package libIwParsers
* @subpackage interfaces
*/
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/**
* Interface for msgparsers
*
* Every parser needs to implement this interface in order to register
* with the parser factory.
*/
interface ParserMsgI
{
/////////////////////////////////////////////////////////////////////////////
/**
* Returns the identifier of this parser
*
* The identifier of each parser is defined by the following rules:
* 1. "de_" if the parser recognises a german IceWars page.
* 2. the value of action parameter
* 3. if sub pages exist, "_" + value of the typ parameter
*
* E.g.
* - german server, universe page. ActionId := "de_universum"
* - german server, start page. ActionId := "de_main"
* - german server, economics page. ActionId := "de_wirtschaft"
* - german server, economics page, subpage colony information.
* ActionId := "de_wirtschaft_planiinfo"
* - german server, economics page, subpage resource overview.
* ActionId := "de_wirtschaft_planiress"
*
* @return string identifier of the parser
*/
public function getIdentifier();
/////////////////////////////////////////////////////////////////////////////
/**
* Checks if the parser can handle the text provided
*
* This method is intendet to find the correct parser for a given
* text.
*
* It checks, if this concrete parser can handle the text provided. It
* normally should check this, by searching for simple, small identifiers,
* unique within a page.
*
* If this concrete parser thinks it can handle the text, it should copy the
* text and save it for further operations.
*
* @param string &$msg a reference to the msg to be parsed
*
* @return bool if the parser claims to be the right one for the text provided
*/
public function canParseMsg($msg);
/////////////////////////////////////////////////////////////////////////////
/**
* Parses a text
*
* This method actually parses the text, the concrete parser has saved
* previously, when it was asked if it could do the job.
*
* @param DTOParserResultC $parserResult
*
* @return object DTOParserResult Ergebnisse und Fehler des Parsevorgangs
*/
public function parseMsg(DTOParserResultC $parserResult);
}