Skip to content

Commit ca37150

Browse files
author
Harrison Ifeanyichukwu
committed
feat: Add ability to set and update feed default language
1 parent 41d4b71 commit ca37150

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/Parser.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,29 @@
2020
*/
2121
class Parser
2222
{
23+
private $_default_lang = '';
24+
25+
public function __construct(string $default_lang = 'en')
26+
{
27+
$this->setDefaultLanguage($default_lang);
28+
}
29+
30+
/**
31+
* set default language
32+
*/
33+
public function setDefaultLanguage(string $default_lang)
34+
{
35+
$this->_default_lang = $default_lang;
36+
}
37+
38+
/**
39+
* return default language
40+
*/
41+
public function getDefaultLanguage()
42+
{
43+
return $this->_default_lang;
44+
}
45+
2346
/**
2447
* creates a feed parser, and xml document, feeds the document to the parser, and returns
2548
* the result from the parser
@@ -72,7 +95,7 @@ public function parseFromFile(string $filename)
7295
* Parses feed from the given xml string
7396
*
7497
*@param string $xml - the xml string
75-
*/
98+
*/
7699
public function parseFromString(string $xml)
77100
{
78101
return $this->parse($xml);

0 commit comments

Comments
 (0)