Skip to content

Commit

Permalink
Harmonized method names. Corrected punctuation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmaron committed Jun 8, 2010
1 parent 62bae48 commit 131fc79
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
30 changes: 15 additions & 15 deletions library/Zend/Service/LiveDocx/AbstractLiveDocx.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,8 @@ public function __destruct()
*/
protected function _initSoapClient($endpoint)
{
try {
$this->_soapClient = new Client();
$this->_soapClient->setWsdl($endpoint);
} catch (\SoapFault $e) { // @todo -- which exception to catch here?
throw new Exception('Cannot connect to LiveDocx service at ' . $endpoint, 0, $e);
}
$this->_soapClient = new Client();
$this->_soapClient->setWSDL($endpoint);
}

/**
Expand Down Expand Up @@ -184,18 +180,18 @@ public function logIn()

if (null === $this->getUsername()) {
throw new Exception(
'Username has not been set. To set username specify the options array in the constructor or call setUsername($username) after instantiation'
'Username has not been set. To set username specify the options array in the constructor or call setUsername($username) after instantiation.'
);
}

if (null === $this->getPassword()) {
throw new Exception(
'Password has not been set. To set password specify the options array in the constructor or call setPassword($password) after instantiation'
'Password has not been set. To set password specify the options array in the constructor or call setPassword($password) after instantiation.'
);
}

if (null === $this->getSoapClient()) {
$this->_initSoapClient($this->_wsdl);
$this->_initSoapClient($this->getWSDL());
}

try {
Expand All @@ -204,9 +200,9 @@ public function logIn()
'password' => $this->getPassword(),
));
$this->_loggedIn = true;
} catch (Exception $e) {
} catch (\SoapFault $e) {
throw new Exception(
'Cannot login into LiveDocx service - username and/or password are invalid', 0, $e
'Cannot login into LiveDocx service. Please check that your server can download the WSDL (' . $this->getWSDL() . ') and that your username and password are valid.', 0, $e
);
}
}
Expand All @@ -229,7 +225,7 @@ public function logOut()
$this->_loggedIn = false;
} catch (Exception $e) {
throw new Exception(
'Cannot log out of LiveDocx service', 0, $e
'Cannot log out of LiveDocx service.', 0, $e
);
}
}
Expand Down Expand Up @@ -278,7 +274,7 @@ public function setPassword($password)
* @return Zend\Service\AbstractLiveDocx
* @since LiveDocx 1.0
*/
public function setWsdl($wsdl)
public function setWSDL($wsdl)
{
$this->_wsdl = $wsdl;
return $this;
Expand Down Expand Up @@ -320,9 +316,13 @@ public function getPassword()
* @return Zend\Service\AbstractLiveDocx
* @since LiveDocx 1.0
*/
public function getWsdl()
public function getWSDL()
{
return $this->_wsdl;
if (null !== $this->getSoapClient()) {
return $this->getSoapClient()->getWSDL();
} else {
return $this->_wsdl;
}
}

/**
Expand Down
27 changes: 14 additions & 13 deletions library/Zend/Service/LiveDocx/MailMerge.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ class MailMerge extends AbstractLiveDocx
*/
public function __construct($options = null)
{
$this->_wsdl = self::WSDL;
$this->_fieldValues = array();
$this->_blockFieldValues = array();

$this->setWSDL(self::WSDL);

parent::__construct($options);
}

Expand All @@ -149,7 +150,7 @@ public function setLocalTemplate($filename)
{
if (!is_readable($filename)) {
throw new Exception(
'Cannot read local template from disk'
'Cannot read local template from disk.'
);
}

Expand All @@ -162,7 +163,7 @@ public function setLocalTemplate($filename)
));
} catch (Exception $e) {
throw new Exception(
'Cannot set local template', 0, $e
'Cannot set local template.', 0, $e
);
}

Expand All @@ -188,7 +189,7 @@ public function setRemoteTemplate($filename)
));
} catch (Exception $e) {
throw new Exception(
'Cannot set remote template', 0, $e
'Cannot set remote template.', 0, $e
);
}

Expand Down Expand Up @@ -222,7 +223,7 @@ public function setFieldValues($values)
));
} catch (Exception $e) {
throw new Exception(
'Cannot set field values', 0, $e
'Cannot set field values.', 0, $e
);
}

Expand Down Expand Up @@ -267,7 +268,7 @@ public function setBlockFieldValues($blockName, $blockFieldValues)
));
} catch (Exception $e) {
throw new Exception(
'Cannot set block field values', 0, $e
'Cannot set block field values.', 0, $e
);
}

Expand Down Expand Up @@ -297,7 +298,7 @@ public function assign($field, $value = null)
}
} catch (Exception $e) {
throw new Exception(
'Cannot assign data to template', 0, $e
'Cannot assign data to template.', 0, $e
);
}

Expand Down Expand Up @@ -354,7 +355,7 @@ public function setDocumentAccessPermissions($permissions, $password)
));
} catch (Exception $e) {
throw new Exception(
'Cannot set document access permissions', 0, $e
'Cannot set document access permissions.', 0, $e
);
}

Expand Down Expand Up @@ -383,7 +384,7 @@ public function createDocument()
$this->getSoapClient()->CreateDocument();
} catch (Exception $e) {
throw new Exception(
'Cannot create document', 0, $e
'Cannot create document.', 0, $e
);
}
}
Expand All @@ -409,7 +410,7 @@ public function retrieveDocument($format)
));
} catch (Exception $e) {
throw new Exception(
'Cannot retrieve document - call setLocalTemplate() or setRemoteTemplate() first', 0, $e
'Cannot retrieve document - call setLocalTemplate() or setRemoteTemplate() first.', 0, $e
);
}

Expand Down Expand Up @@ -639,7 +640,7 @@ public function uploadTemplate($filename)
{
if (!is_readable($filename)) {
throw new Exception(
'Cannot read local template from disk'
'Cannot read local template from disk.'
);
}

Expand All @@ -652,7 +653,7 @@ public function uploadTemplate($filename)
));
} catch (Exception $e) {
throw new Exception(
'Cannot upload template', 0, $e
'Cannot upload template.', 0, $e
);
}
}
Expand Down Expand Up @@ -813,7 +814,7 @@ public function downloadSharedDocument($filename)
));
} catch (Exception $e) {
throw new Exception(
'Cannot download shared document', 0, $e
'Cannot download shared document.', 0, $e
);
}

Expand Down

0 comments on commit 131fc79

Please sign in to comment.