setConfig() public method

Sets the configuration to use.
public setConfig ( Phergie_Config $config ) : Phergie_Runner_Abstract
$config Phergie_Config Configuration instance
return Phergie_Runner_Abstract Provides a fluent interface
Beispiel #1
0
 /**
  * Injects all dependencies into the bot instance being tested.
  *
  * @return void
  */
 private function injectDependencies()
 {
     $this->bot->setConfig($this->getMockConfig());
     $this->bot->setDriver($this->getMockDriver());
     $this->bot->setConnectionHandler($this->getMockConnectionHandler());
     $this->bot->setUi($this->getMockUi());
     $this->bot->setPluginHandler($this->getMockPluginHandler());
     $this->bot->setProcessor($this->getMockProcessor($this->bot));
     $this->bot->setEventHandler($this->getMockEventHandler());
 }
Beispiel #2
0
 * @author    Phergie Development Team <*****@*****.**>
 * @copyright 2008-2010 Phergie Development Team (http://phergie.org)
 * @license   http://phergie.org/license New BSD License
 * @link      http://pear.phergie.org/package/Phergie
 */
/**
 * @see Phergie_Autoload
 */
require 'Phergie/Autoload.php';
Phergie_Autoload::registerAutoloader();
$bot = new Phergie_Bot();
if (!isset($argc)) {
    echo 'The PHP setting register_argc_argv must be enabled for Phergie ', 'configuration files to be specified using command line arguments; ', 'defaulting to Settings.php in the current working directory', PHP_EOL;
} else {
    if ($argc > 0) {
        // Skip the current file for manual installations
        // ex: php phergie.php Settings.php
        if (realpath($argv[0]) == __FILE__) {
            array_shift($argv);
        }
        // If configuration files were specified, override default behavior
        if (count($argv) > 0) {
            $config = new Phergie_Config();
            foreach ($argv as $file) {
                $config->read($file);
            }
            $bot->setConfig($config);
        }
    }
}
$bot->run();