Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,32 +12,42 @@
|
||||
namespace IPS\nexus\Customer;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\DateTime;
|
||||
use IPS\GeoLocation;
|
||||
use IPS\Member;
|
||||
use IPS\nexus\Customer;
|
||||
use IPS\Patterns\ActiveRecord;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customer Address Model
|
||||
*/
|
||||
class _Address extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
/* @property Customer $member */
|
||||
class Address extends ActiveRecord
|
||||
{
|
||||
/**
|
||||
* @brief Multiton Store
|
||||
*/
|
||||
protected static $multitons;
|
||||
protected static array $multitons;
|
||||
|
||||
/**
|
||||
* @brief Database Table
|
||||
*/
|
||||
public static $databaseTable = 'nexus_customer_addresses';
|
||||
public static ?string $databaseTable = 'nexus_customer_addresses';
|
||||
|
||||
/**
|
||||
* @brief State Codes
|
||||
* @see https://developer.paypal.com/docs/classic/api/state_codes/
|
||||
*/
|
||||
public static $stateCodes = array(
|
||||
public static array $stateCodes = array(
|
||||
'CA' => array(
|
||||
'AB' => "Alberta",
|
||||
'BC' => "British Columbia",
|
||||
@@ -121,28 +131,28 @@ class _Address extends \IPS\Patterns\ActiveRecord
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultValues()
|
||||
public function setDefaultValues() : void
|
||||
{
|
||||
$this->added = new \IPS\DateTime;
|
||||
$this->added = new DateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get member
|
||||
*
|
||||
* @return \IPS\nexus\Customer
|
||||
* @return Customer
|
||||
*/
|
||||
public function get_member()
|
||||
public function get_member(): Customer
|
||||
{
|
||||
return \IPS\nexus\Customer::load( $this->_data['member'] );
|
||||
return Customer::load( $this->_data['member'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set member
|
||||
*
|
||||
* @param \IPS\Member $member Member
|
||||
* @param Member $member Member
|
||||
* @return void
|
||||
*/
|
||||
public function set_member( \IPS\Member $member )
|
||||
public function set_member( Member $member ) : void
|
||||
{
|
||||
$this->_data['member'] = $member->member_id;
|
||||
}
|
||||
@@ -150,20 +160,20 @@ class _Address extends \IPS\Patterns\ActiveRecord
|
||||
/**
|
||||
* Get address
|
||||
*
|
||||
* @return \IPS\GeoLocation
|
||||
* @return GeoLocation
|
||||
*/
|
||||
public function get_address()
|
||||
public function get_address(): GeoLocation
|
||||
{
|
||||
return isset( $this->_data['address'] ) ? \IPS\GeoLocation::buildFromJson( $this->_data['address'] ) : new \IPS\GeoLocation;
|
||||
return isset( $this->_data['address'] ) ? GeoLocation::buildFromJson( $this->_data['address'] ) : new GeoLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set member
|
||||
*
|
||||
* @param \IPS\GeoLocation $address Address
|
||||
* @param GeoLocation $address Address
|
||||
* @return void
|
||||
*/
|
||||
public function set_address( \IPS\GeoLocation $address )
|
||||
public function set_address( GeoLocation $address ) : void
|
||||
{
|
||||
$this->_data['address'] = json_encode( $address );
|
||||
}
|
||||
@@ -171,20 +181,20 @@ class _Address extends \IPS\Patterns\ActiveRecord
|
||||
/**
|
||||
* Get added date
|
||||
*
|
||||
* @return \IPS\DateTime
|
||||
* @return DateTime
|
||||
*/
|
||||
public function get_added()
|
||||
public function get_added(): DateTime
|
||||
{
|
||||
return \IPS\DateTime::ts( $this->_data['added'] );
|
||||
return DateTime::ts( $this->_data['added'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set added date
|
||||
*
|
||||
* @param \IPS\DateTime $date The invoice date
|
||||
* @param DateTime $date The invoice date
|
||||
* @return void
|
||||
*/
|
||||
public function set_added( \IPS\DateTime $date )
|
||||
public function set_added( DateTime $date ) : void
|
||||
{
|
||||
$this->_data['added'] = $date->getTimestamp();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user