Skip to content

Commit

Permalink
Merge pull request braintree#77 from bryanagee/docblock-updates
Browse files Browse the repository at this point in the history
Docblock updates
  • Loading branch information
atmattpatt committed Jun 26, 2015
2 parents a62a3c6 + 553334b commit 9c30939
Show file tree
Hide file tree
Showing 12 changed files with 372 additions and 17 deletions.
13 changes: 11 additions & 2 deletions lib/Braintree/AddOn.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?php

class Braintree_AddOn extends Braintree_Modification
{
/**
*
* @param array $attributes
* @return Braintree_AddOn
*/
public static function factory($attributes)
{
$instance = new self();
Expand All @@ -9,8 +15,11 @@ public static function factory($attributes)
}


// static methods redirecting to gateway

/**
* static methods redirecting to gateway
*
* @return Braintree_AddOn[]
*/
public static function all()
{
return Braintree_Configuration::gateway()->addOn()->all();
Expand Down
23 changes: 23 additions & 0 deletions lib/Braintree/AddOnGateway.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
<?php

class Braintree_AddOnGateway
{
/**
*
* @var Braintree_Gateway
*/
private $_gateway;

/**
*
* @var Braintree_Configuration
*/
private $_config;

/**
*
* @var Braintree_Http
*/
private $_http;

/**
*
* @param Braintree_Gateway $gateway
*/
public function __construct($gateway)
{
$this->_gateway = $gateway;
Expand All @@ -13,6 +32,10 @@ public function __construct($gateway)
$this->_http = new Braintree_Http($gateway->config);
}

/**
*
* @return Braintree_AddOn[]
*/
public function all()
{
$path = $this->_config->merchantPath() . '/add_ons';
Expand Down
32 changes: 32 additions & 0 deletions lib/Braintree/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,58 @@ public static function factory($attributes)

// static methods redirecting to gateway

/**
*
* @param array $attribs
* @return Braintree_Address
*/
public static function create($attribs)
{
return Braintree_Configuration::gateway()->address()->create($attribs);
}

/**
*
* @param array $attribs
* @return Braintree_Address
*/
public static function createNoValidate($attribs)
{
return Braintree_Configuration::gateway()->address()->createNoValidate($attribs);
}

/**
*
* @param Braintree_Customer|int $customerOrId
* @param int $addressId
* @throws InvalidArgumentException
* @return Braintree_Result_Successful
*/
public static function delete($customerOrId = null, $addressId = null)
{
return Braintree_Configuration::gateway()->address()->delete($customerOrId, $addressId);
}

/**
*
* @param Braintree_Customer|int $customerOrId
* @param int $addressId
* @throws Braintree_Exception_NotFound
* @return Braintree_Address
*/
public static function find($customerOrId, $addressId)
{
return Braintree_Configuration::gateway()->address()->find($customerOrId, $addressId);
}

/**
*
* @param Braintree_Customer|int $customerOrId
* @param int $addressId
* @param array $attributes
* @throws Braintree_Exception_Unexpected
* @return Braintree_Result_Successful|Braintree_Result_Error
*/
public static function update($customerOrId, $addressId, $attributes)
{
return Braintree_Configuration::gateway()->address()->update($customerOrId, $addressId, $attributes);
Expand Down
20 changes: 19 additions & 1 deletion lib/Braintree/AddressGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,28 @@
*/
class Braintree_AddressGateway
{
/**
*
* @var Braintree_Gateway
*/
private $_gateway;

/**
*
* @var Braintree_Configuration
*/
private $_config;

/**
*
* @var Braintree_Http
*/
private $_http;

/**
*
* @param Braintree_Gateway $gateway
*/
public function __construct($gateway)
{
$this->_gateway = $gateway;
Expand Down Expand Up @@ -265,7 +283,7 @@ private function _doCreate($subPath, $params)
*
* @ignore
* @param array $response gateway response values
* @return object Result_Successful or Result_Error
* @return object Result_Successful|Result_Error
* @throws Braintree_Exception_Unexpected
*/
private function _verifyGatewayResponse($response)
Expand Down
18 changes: 18 additions & 0 deletions lib/Braintree/ClientToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,39 @@ class Braintree_ClientToken

// static methods redirecting to gateway

/**
*
* @param array $params
* @return array
*/
public static function generate($params=array())
{
return Braintree_Configuration::gateway()->clientToken()->generate($params);
}

/**
*
* @param type $params
* @throws InvalidArgumentException
*/
public static function conditionallyVerifyKeys($params)
{
return Braintree_Configuration::gateway()->clientToken()->conditionallyVerifyKeys($params);
}

/**
*
* @return string client token retrieved from server
*/
public static function generateWithCustomerIdSignature()
{
return Braintree_Configuration::gateway()->clientToken()->generateWithCustomerIdSignature();
}

/**
*
* @return string client token retrieved from server
*/
public static function generateWithoutCustomerIdSignature()
{
return Braintree_Configuration::gateway()->clientToken()->generateWithoutCustomerIdSignature();
Expand Down
31 changes: 31 additions & 0 deletions lib/Braintree/ClientTokenGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,28 @@

class Braintree_ClientTokenGateway
{
/**
*
* @var Braintree_Gateway
*/
private $_gateway;

/**
*
* @var Braintree_Configuration
*/
private $_config;

/**
*
* @var Braintree_Http
*/
private $_http;

/**
*
* @param Braintree_Gateway $gateway
*/
public function __construct($gateway)
{
$this->_gateway = $gateway;
Expand Down Expand Up @@ -42,6 +60,11 @@ public function _doGenerate($subPath, $params)
return $this->_verifyGatewayResponse($response);
}

/**
*
* @param array $params
* @throws InvalidArgumentException
*/
public function conditionallyVerifyKeys($params)
{
if (array_key_exists("customerId", $params)) {
Expand All @@ -51,11 +74,19 @@ public function conditionallyVerifyKeys($params)
}
}

/**
*
* @return mixed[]
*/
public function generateWithCustomerIdSignature()
{
return array("version", "customerId", "proxyMerchantId", array("options" => array("makeDefault", "verifyCard", "failOnDuplicatePaymentMethod")), "merchantAccountId");
}

/**
*
* @return string[]
*/
public function generateWithoutCustomerIdSignature()
{
return array("version", "proxyMerchantId", "merchantAccountId");
Expand Down
Loading

0 comments on commit 9c30939

Please sign in to comment.