Example #1
0
File: Api.php Project: jberkel/tool
 /**
  * @param string $lang the language code of the Wikisource like 'en' or 'fr'
  * @param string $domainName
  * @param ClientInterface $client
  */
 public function __construct($lang = '', $domainName = '', ClientInterface $client = null)
 {
     if ($lang == '') {
         $lang = Api::getHttpLang();
     }
     $this->lang = $lang;
     if ($domainName != '') {
         $this->domainName = $domainName;
     } elseif ($this->lang == 'www' || $this->lang == '') {
         $this->domainName = 'wikisource.org';
         $this->lang = '';
     } elseif ($this->lang == 'wl' || $this->lang == 'wikilivres') {
         $this->domainName = 'wikilivres.ca';
         $this->lang = '';
     } else {
         $this->domainName = $this->lang . '.wikisource.org';
     }
     if ($client === null) {
         $client = static::createClient(ToolLogger::get(__CLASS__));
     }
     $this->client = $client;
 }
Example #2
0
 public function testLoggerHasCorrectName()
 {
     $this->enableDebug();
     $logger = ToolLogger::get('test');
     $this->assertEquals('test', $logger->getName());
 }