for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Flipbox\Relay\HubSpot\Segment\ContactLists;
use Flipbox\Relay\HubSpot\Middleware\Client;
use Flipbox\Relay\HubSpot\Middleware\ContactLists\Add as ContactListAddMiddleware;
use Flipbox\Relay\Middleware\Stash as CacheMiddleware;
use Flipbox\Relay\Segments\AbstractSegment;
use Psr\Cache\CacheItemPoolInterface;
use Flipbox\Relay\HubSpot\Middleware\JsonRequest as JsonRequestMiddleware;
class Add extends AbstractSegment
{
/**
* @var int
*/
public $id;
* @var array
public $contactIds = [];
public $emails = [];
* @return array
protected function defaultSegments(): array
return [
'body' => [
'class' => JsonRequestMiddleware::class,
'payload' => $this->assemblePayload(),
'logger' => $this->getLogger()
],
'uri' => [
'class' => ContactListAddMiddleware::class,
'id' => $this->id,
'client' => [
'class' => Client::class,
]
];
}
protected function assemblePayload(): array
'vids' => array_filter($this->contactIds),
'emails' => array_filter($this->emails)