This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/lib/PayPal/Api/ItemList.php
japatel b011d17cde Removed Deprecated Getter and Setters
- Removed Deprecated Getter Setters from all Model Classes
- All Camelcase getters and setters are removed. Please use first letter uppercase syntax
- E.g. instead of using get_notify_url(), use getNotifyUrl() instead
2015-01-08 22:23:58 -06:00

104 lines
1.9 KiB
PHP

<?php
namespace PayPal\Api;
use PayPal\Common\PayPalModel;
use PayPal\Rest\ApiContext;
/**
* Class ItemList
*
* List of items being paid for.
*
* @package PayPal\Api
*
* @property \PayPal\Api\Item[] items
* @property \PayPal\Api\ShippingAddress shipping_address
*/
class ItemList extends PayPalModel
{
/**
* Is this list empty?
*/
public function isEmpty()
{
return empty($this->items);
}
/**
* List of items.
*
*
* @param \PayPal\Api\Item[] $items
*
* @return $this
*/
public function setItems($items)
{
$this->items = $items;
return $this;
}
/**
* List of items.
*
* @return \PayPal\Api\Item[]
*/
public function getItems()
{
return $this->items;
}
/**
* Shipping address.
*
*
* @param \PayPal\Api\ShippingAddress $shipping_address
*
* @return $this
*/
public function setShippingAddress($shipping_address)
{
$this->shipping_address = $shipping_address;
return $this;
}
/**
* Append an item to the list.
*
* @return \PayPal\Api\Item
*/
public function addItem($item)
{
if (!$this->items) {
return $this->setItems(array($item));
} else {
return $this->setItems(
array_merge($this->items, array($item))
);
}
}
/**
* Remove an item from the list.
* Items are compared using === comparision (PHP.net)
*
* @return \PayPal\Api\Item
*/
public function removeItem($item)
{
return $this->setItems(array_diff($this->getItems(), array($item)));
}
/**
* Get Shipping Address
*
* @return \PayPal\Api\ShippingAddress
*/
public function getShippingAddress()
{
return $this->shipping_address;
}
}