/** * Constructor * * @param string $message * @param Profile $profile */ public function __construct($message, Profile $profile = null) { if ($profile instanceof Profile) { $message = '[' . $profile->getLogin() . '@' . $profile->getAddress() . ':' . $profile->getPort() . '] ' . $message; } else { $message = '[No profile specified] ' . $message; } parent::__construct($message); }
/** * Return new connection * * @param string $address * @param string $login * @param string $password * @param int $port * @param boolean $autoConnect * @return EntityConnection */ public function connect($address, $login, $password, $port = 22, $autoConnect = true) { $profile = new Profile(); $profile->setAddress($address); $profile->setLogin($login); $profile->setPassword($password); $profile->setPort($port); return new EntityConnection($profile, $autoConnect); }