Skip to content
This repository has been archived by the owner on Jan 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #14 from citilinkru/mark_as_deprecated
Browse files Browse the repository at this point in the history
mark as deprecated method SubscriberInfo::addPropertyChunk
  • Loading branch information
liderman committed Aug 14, 2017
2 parents 32b6f6c + 732048b commit 71bfe2b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Deprecated
- Method SubscriberInfo::addPropertyChunk is deprecated, use SubscriberInfo::addProperty instead

## [0.4.0] - 2017-08-09
Fully refactored library, changed everything
### Added
Expand Down
22 changes: 17 additions & 5 deletions src/Model/SubscribersPostRequest/SubscriberInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SubscriberInfo
/**
* @var Property[] Collection of custom subscriber properties
*/
private $propertyChunks = [];
private $properties = [];

/**
* @var bool Allow add subscriber, that was unsubscribed
Expand Down Expand Up @@ -237,11 +237,23 @@ public function setVendor(string $vendor): void
/**
* Add subscriber's property
*
* @param Property $propertyChunk Subscriber's property
* @deprecated Use {@see SubscriberInfo::addProperty} instead
*
* @param Property $property Subscriber's property
*/
public function addPropertyChunk(Property $property): void
{
$this->addProperty($property);
}

/**
* Add subscriber's property
*
* @param Property $property Subscriber's property
*/
public function addPropertyChunk(Property $propertyChunk): void
public function addProperty(Property $property): void
{
$this->propertyChunks[] = $propertyChunk;
$this->properties[] = $property;
}

/**
Expand All @@ -251,7 +263,7 @@ public function addPropertyChunk(Property $propertyChunk): void
*/
public function getProperties(): array
{
return $this->propertyChunks;
return $this->properties;
}

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/Request/SubscribersPostRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public function testAddSubscriberRequestGenerateValidXml()
$subscriberData->setCustomSubscriberId('custom-subscriber-id');
$subscriberData->setAllowAddUserThatWasDeleted(false);
$subscriberData->setAllowAddUserThatWasUnsubscribed(false);
$subscriberData->addPropertyChunk(new Property(1, Value::createInt(24)));
$subscriberData->addPropertyChunk(new Property(2, Value::createString('string')));
$subscriberData->addPropertyChunk(new Property(3, Value::createBoolean(true)));
$subscriberData->addPropertyChunk(new Property(16, Value::createBoolean(false)));
$subscriberData->addPropertyChunk(new Property(15, Value::createDouble(23.4)));
$subscriberData->addPropertyChunk(
$subscriberData->addProperty(new Property(1, Value::createInt(24)));
$subscriberData->addProperty(new Property(2, Value::createString('string')));
$subscriberData->addProperty(new Property(3, Value::createBoolean(true)));
$subscriberData->addProperty(new Property(16, Value::createBoolean(false)));
$subscriberData->addProperty(new Property(15, Value::createDouble(23.4)));
$subscriberData->addProperty(
new Property(4, Value::createDateFromDateTime(new \DateTime('2000-01-01 12:00:00')))
);
$subscriberData->addPropertyChunk(
$subscriberData->addProperty(
new Property(5, Value::createDateTimeFromDateTime(new \DateTime('2000-01-01 12:00:00')))
);

Expand Down

0 comments on commit 71bfe2b

Please sign in to comment.