Skip to content

Commit

Permalink
Workaround for PHP 5.x and 7.x (class properties of the same name in …
Browse files Browse the repository at this point in the history
…base classes)
  • Loading branch information
aimeos committed May 3, 2017
1 parent e68f6c6 commit 462038e
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 63 deletions.
118 changes: 59 additions & 59 deletions lib/mshoplib/src/MShop/Common/Item/Address/Base.php
Expand Up @@ -49,7 +49,7 @@ abstract class Base
const SALUTATION_MR = 'mr';

private $prefix;
private $values;
private $data;


/**
Expand All @@ -62,7 +62,7 @@ public function __construct( $prefix, array $values )
{
parent::__construct( $prefix, $values );

$this->values = $values;
$this->data = $values;
$this->prefix = $prefix;
}

Expand All @@ -76,8 +76,8 @@ public function __construct( $prefix, array $values )
*/
public function getCompany()
{
if( isset( $this->values[$this->prefix . 'company'] ) ) {
return (string) $this->values[$this->prefix . 'company'];
if( isset( $this->data[$this->prefix . 'company'] ) ) {
return (string) $this->data[$this->prefix . 'company'];
}

return '';
Expand All @@ -94,7 +94,7 @@ public function setCompany( $company )
{
if( $company == $this->getCompany() ) { return $this; }

$this->values[$this->prefix . 'company'] = (string) $company;
$this->data[$this->prefix . 'company'] = (string) $company;
$this->setModified();

return $this;
Expand All @@ -107,8 +107,8 @@ public function setCompany( $company )
*/
public function getVatID()
{
if( isset( $this->values[$this->prefix . 'vatid'] ) ) {
return (string) $this->values[$this->prefix . 'vatid'];
if( isset( $this->data[$this->prefix . 'vatid'] ) ) {
return (string) $this->data[$this->prefix . 'vatid'];
}

return '';
Expand All @@ -125,7 +125,7 @@ public function setVatID( $vatid )
{
if( $vatid == $this->getVatID() ) { return $this; }

$this->values[$this->prefix . 'vatid'] = (string) $vatid;
$this->data[$this->prefix . 'vatid'] = (string) $vatid;
$this->setModified();

return $this;
Expand All @@ -139,8 +139,8 @@ public function setVatID( $vatid )
*/
public function getSalutation()
{
if( isset( $this->values[$this->prefix . 'salutation'] ) ) {
return (string) $this->values[$this->prefix . 'salutation'];
if( isset( $this->data[$this->prefix . 'salutation'] ) ) {
return (string) $this->data[$this->prefix . 'salutation'];
}

return \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN;
Expand All @@ -159,7 +159,7 @@ public function setSalutation( $salutation )

$this->checkSalutation( $salutation );

$this->values[$this->prefix . 'salutation'] = (string) $salutation;
$this->data[$this->prefix . 'salutation'] = (string) $salutation;
$this->setModified();

return $this;
Expand All @@ -173,8 +173,8 @@ public function setSalutation( $salutation )
*/
public function getTitle()
{
if( isset( $this->values[$this->prefix . 'title'] ) ) {
return (string) $this->values[$this->prefix . 'title'];
if( isset( $this->data[$this->prefix . 'title'] ) ) {
return (string) $this->data[$this->prefix . 'title'];
}

return '';
Expand All @@ -191,7 +191,7 @@ public function setTitle( $title )
{
if( $title == $this->getTitle() ) { return $this; }

$this->values[$this->prefix . 'title'] = (string) $title;
$this->data[$this->prefix . 'title'] = (string) $title;
$this->setModified();

return $this;
Expand All @@ -205,8 +205,8 @@ public function setTitle( $title )
*/
public function getFirstname()
{
if( isset( $this->values[$this->prefix . 'firstname'] ) ) {
return (string) $this->values[$this->prefix . 'firstname'];
if( isset( $this->data[$this->prefix . 'firstname'] ) ) {
return (string) $this->data[$this->prefix . 'firstname'];
}

return '';
Expand All @@ -223,7 +223,7 @@ public function setFirstname( $firstname )
{
if( $firstname == $this->getFirstname() ) { return $this; }

$this->values[$this->prefix . 'firstname'] = (string) $firstname;
$this->data[$this->prefix . 'firstname'] = (string) $firstname;
$this->setModified();

return $this;
Expand All @@ -237,8 +237,8 @@ public function setFirstname( $firstname )
*/
public function getLastname()
{
if( isset( $this->values[$this->prefix . 'lastname'] ) ) {
return (string) $this->values[$this->prefix . 'lastname'];
if( isset( $this->data[$this->prefix . 'lastname'] ) ) {
return (string) $this->data[$this->prefix . 'lastname'];
}

return '';
Expand All @@ -255,7 +255,7 @@ public function setLastname( $lastname )
{
if( $lastname == $this->getLastname() ) { return $this; }

$this->values[$this->prefix . 'lastname'] = (string) $lastname;
$this->data[$this->prefix . 'lastname'] = (string) $lastname;
$this->setModified();

return $this;
Expand All @@ -269,8 +269,8 @@ public function setLastname( $lastname )
*/
public function getAddress1()
{
if( isset( $this->values[$this->prefix . 'address1'] ) ) {
return (string) $this->values[$this->prefix . 'address1'];
if( isset( $this->data[$this->prefix . 'address1'] ) ) {
return (string) $this->data[$this->prefix . 'address1'];
}

return '';
Expand All @@ -287,7 +287,7 @@ public function setAddress1( $address1 )
{
if( $address1 == $this->getAddress1() ) { return $this; }

$this->values[$this->prefix . 'address1'] = (string) $address1;
$this->data[$this->prefix . 'address1'] = (string) $address1;
$this->setModified();

return $this;
Expand All @@ -301,8 +301,8 @@ public function setAddress1( $address1 )
*/
public function getAddress2()
{
if( isset( $this->values[$this->prefix . 'address2'] ) ) {
return (string) $this->values[$this->prefix . 'address2'];
if( isset( $this->data[$this->prefix . 'address2'] ) ) {
return (string) $this->data[$this->prefix . 'address2'];
}

return '';
Expand All @@ -319,7 +319,7 @@ public function setAddress2( $address2 )
{
if( $address2 == $this->getAddress2() ) { return $this; }

$this->values[$this->prefix . 'address2'] = (string) $address2;
$this->data[$this->prefix . 'address2'] = (string) $address2;
$this->setModified();

return $this;
Expand All @@ -333,8 +333,8 @@ public function setAddress2( $address2 )
*/
public function getAddress3()
{
if( isset( $this->values[$this->prefix . 'address3'] ) ) {
return (string) $this->values[$this->prefix . 'address3'];
if( isset( $this->data[$this->prefix . 'address3'] ) ) {
return (string) $this->data[$this->prefix . 'address3'];
}

return '';
Expand All @@ -351,7 +351,7 @@ public function setAddress3( $address3 )
{
if( $address3 == $this->getAddress3() ) { return $this; }

$this->values[$this->prefix . 'address3'] = (string) $address3;
$this->data[$this->prefix . 'address3'] = (string) $address3;
$this->setModified();

return $this;
Expand All @@ -365,8 +365,8 @@ public function setAddress3( $address3 )
*/
public function getPostal()
{
if( isset( $this->values[$this->prefix . 'postal'] ) ) {
return (string) $this->values[$this->prefix . 'postal'];
if( isset( $this->data[$this->prefix . 'postal'] ) ) {
return (string) $this->data[$this->prefix . 'postal'];
}

return '';
Expand All @@ -383,7 +383,7 @@ public function setPostal( $postal )
{
if( $postal == $this->getPostal() ) { return $this; }

$this->values[$this->prefix . 'postal'] = (string) $postal;
$this->data[$this->prefix . 'postal'] = (string) $postal;
$this->setModified();

return $this;
Expand All @@ -397,8 +397,8 @@ public function setPostal( $postal )
*/
public function getCity()
{
if( isset( $this->values[$this->prefix . 'city'] ) ) {
return (string) $this->values[$this->prefix . 'city'];
if( isset( $this->data[$this->prefix . 'city'] ) ) {
return (string) $this->data[$this->prefix . 'city'];
}

return '';
Expand All @@ -415,7 +415,7 @@ public function setCity( $city )
{
if( $city == $this->getCity() ) { return $this; }

$this->values[$this->prefix . 'city'] = (string) $city;
$this->data[$this->prefix . 'city'] = (string) $city;
$this->setModified();

return $this;
Expand All @@ -429,8 +429,8 @@ public function setCity( $city )
*/
public function getState()
{
if( isset( $this->values[$this->prefix . 'state'] ) ) {
return (string) $this->values[$this->prefix . 'state'];
if( isset( $this->data[$this->prefix . 'state'] ) ) {
return (string) $this->data[$this->prefix . 'state'];
}

return '';
Expand All @@ -447,7 +447,7 @@ public function setState( $state )
{
if( $state == $this->getState() ) { return $this; }

$this->values[$this->prefix . 'state'] = (string) $state;
$this->data[$this->prefix . 'state'] = (string) $state;
$this->setModified();

return $this;
Expand All @@ -461,8 +461,8 @@ public function setState( $state )
*/
public function getCountryId()
{
if( isset( $this->values[$this->prefix . 'countryid'] ) ) {
return (string) $this->values[$this->prefix . 'countryid'];
if( isset( $this->data[$this->prefix . 'countryid'] ) ) {
return (string) $this->data[$this->prefix . 'countryid'];
}

return null;
Expand All @@ -479,7 +479,7 @@ public function setCountryId( $countryid )
{
if( $countryid === $this->getCountryId() ) { return $this; }

$this->values[$this->prefix . 'countryid'] = strtoupper( (string) $countryid );
$this->data[$this->prefix . 'countryid'] = strtoupper( (string) $countryid );
$this->setModified();

return $this;
Expand All @@ -493,8 +493,8 @@ public function setCountryId( $countryid )
*/
public function getLanguageId()
{
if( isset( $this->values[$this->prefix . 'languageid'] ) ) {
return (string) $this->values[$this->prefix . 'languageid'];
if( isset( $this->data[$this->prefix . 'languageid'] ) ) {
return (string) $this->data[$this->prefix . 'languageid'];
}

return null;
Expand All @@ -511,7 +511,7 @@ public function setLanguageId( $langid )
{
if( $langid === $this->getLanguageId() ) { return $this; }

$this->values[$this->prefix . 'languageid'] = strtolower( (string) $langid );
$this->data[$this->prefix . 'languageid'] = strtolower( (string) $langid );
$this->setModified();

return $this;
Expand All @@ -525,8 +525,8 @@ public function setLanguageId( $langid )
*/
public function getTelephone()
{
if( isset( $this->values[$this->prefix . 'telephone'] ) ) {
return (string) $this->values[$this->prefix . 'telephone'];
if( isset( $this->data[$this->prefix . 'telephone'] ) ) {
return (string) $this->data[$this->prefix . 'telephone'];
}

return '';
Expand All @@ -543,7 +543,7 @@ public function setTelephone( $telephone )
{
if( $telephone == $this->getTelephone() ) { return $this; }

$this->values[$this->prefix . 'telephone'] = (string) $telephone;
$this->data[$this->prefix . 'telephone'] = (string) $telephone;
$this->setModified();

return $this;
Expand All @@ -557,8 +557,8 @@ public function setTelephone( $telephone )
*/
public function getEmail()
{
if( isset( $this->values[$this->prefix . 'email'] ) ) {
return (string) $this->values[$this->prefix . 'email'];
if( isset( $this->data[$this->prefix . 'email'] ) ) {
return (string) $this->data[$this->prefix . 'email'];
}

return '';
Expand All @@ -579,7 +579,7 @@ public function setEmail( $email )
throw new \Aimeos\MShop\Exception( sprintf( 'Invalid characters in email address: "%1$s"', $email ) );
}

$this->values[$this->prefix . 'email'] = (string) $email;
$this->data[$this->prefix . 'email'] = (string) $email;
$this->setModified();

return $this;
Expand All @@ -593,8 +593,8 @@ public function setEmail( $email )
*/
public function getTelefax()
{
if( isset( $this->values[$this->prefix . 'telefax'] ) ) {
return (string) $this->values[$this->prefix . 'telefax'];
if( isset( $this->data[$this->prefix . 'telefax'] ) ) {
return (string) $this->data[$this->prefix . 'telefax'];
}

return '';
Expand All @@ -611,7 +611,7 @@ public function setTelefax( $telefax )
{
if( $telefax == $this->getTelefax() ) { return $this; }

$this->values[$this->prefix . 'telefax'] = (string) $telefax;
$this->data[$this->prefix . 'telefax'] = (string) $telefax;
$this->setModified();

return $this;
Expand All @@ -625,8 +625,8 @@ public function setTelefax( $telefax )
*/
public function getWebsite()
{
if( isset( $this->values[$this->prefix . 'website'] ) ) {
return (string) $this->values[$this->prefix . 'website'];
if( isset( $this->data[$this->prefix . 'website'] ) ) {
return (string) $this->data[$this->prefix . 'website'];
}

return '';
Expand All @@ -649,7 +649,7 @@ public function setWebsite( $website )
throw new \Aimeos\MShop\Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) );
}

$this->values[$this->prefix . 'website'] = (string) $website;
$this->data[$this->prefix . 'website'] = (string) $website;
$this->setModified();

return $this;
Expand All @@ -663,8 +663,8 @@ public function setWebsite( $website )
*/
public function getFlag()
{
if( isset( $this->values[$this->prefix . 'flag'] ) ) {
return (int) $this->values[$this->prefix . 'flag'];
if( isset( $this->data[$this->prefix . 'flag'] ) ) {
return (int) $this->data[$this->prefix . 'flag'];
}

return 0;
Expand All @@ -681,7 +681,7 @@ public function setFlag( $flag )
{
if( $flag == $this->getFlag() ) { return $this; }

$this->values[$this->prefix . 'flag'] = (int) $flag;
$this->data[$this->prefix . 'flag'] = (int) $flag;
$this->setModified();

return $this;
Expand Down

0 comments on commit 462038e

Please sign in to comment.