repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
TheDMSGroup/mautic-contact-client | Helper/TokenHelper.php | TokenHelper.handleMustacheErrors | private function handleMustacheErrors($errno, $errstr, $errfile, $errline)
{
if (!empty($this->lastTemplate)) {
if (function_exists('newrelic_add_custom_parameter')) {
call_user_func(
'newrelic_add_custom_parameter',
'contactclientToken',
... | php | private function handleMustacheErrors($errno, $errstr, $errfile, $errline)
{
if (!empty($this->lastTemplate)) {
if (function_exists('newrelic_add_custom_parameter')) {
call_user_func(
'newrelic_add_custom_parameter',
'contactclientToken',
... | [
"private",
"function",
"handleMustacheErrors",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"lastTemplate",
")",
")",
"{",
"if",
"(",
"function_exists",
"(",... | Capture Mustache warnings to be logged for debugging.
@param $errno
@param $errstr
@param $errfile
@param $errline
@return bool | [
"Capture",
"Mustache",
"warnings",
"to",
"be",
"logged",
"for",
"debugging",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/TokenHelper.php#L1480-L1506 |
TheDMSGroup/mautic-contact-client | Helper/TokenHelper.php | TokenHelper.eventTokenDecode | private function eventTokenDecode($string)
{
list($campaignIdString, $eventIdString, $contactIdString) = explode('0', $string);
return [
$this->baseDecode($campaignIdString),
$this->baseDecode($eventIdString),
$this->baseDecode($contactIdString),
];
} | php | private function eventTokenDecode($string)
{
list($campaignIdString, $eventIdString, $contactIdString) = explode('0', $string);
return [
$this->baseDecode($campaignIdString),
$this->baseDecode($eventIdString),
$this->baseDecode($contactIdString),
];
} | [
"private",
"function",
"eventTokenDecode",
"(",
"$",
"string",
")",
"{",
"list",
"(",
"$",
"campaignIdString",
",",
"$",
"eventIdString",
",",
"$",
"contactIdString",
")",
"=",
"explode",
"(",
"'0'",
",",
"$",
"string",
")",
";",
"return",
"[",
"$",
"thi... | Take a string from eventTokenEncode and reverse it to an array.
NOTE: Not currently in use, but likely to be used in the future.
@param $string
@return array | [
"Take",
"a",
"string",
"from",
"eventTokenEncode",
"and",
"reverse",
"it",
"to",
"an",
"array",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/TokenHelper.php#L1517-L1526 |
TheDMSGroup/mautic-contact-client | Helper/TokenHelper.php | TokenHelper.baseDecode | private function baseDecode($string)
{
$b = 61;
$base = '123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$limit = strlen($string);
$result = strpos($base, $string[0]);
for ($i = 1; $i < $limit; ++$i) {
$result = $b * $result + strpos($base,... | php | private function baseDecode($string)
{
$b = 61;
$base = '123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$limit = strlen($string);
$result = strpos($base, $string[0]);
for ($i = 1; $i < $limit; ++$i) {
$result = $b * $result + strpos($base,... | [
"private",
"function",
"baseDecode",
"(",
"$",
"string",
")",
"{",
"$",
"b",
"=",
"61",
";",
"$",
"base",
"=",
"'123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'",
";",
"$",
"limit",
"=",
"strlen",
"(",
"$",
"string",
")",
";",
"$",
"result",
"... | @param $string
@return bool|float|int | [
"@param",
"$string"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/TokenHelper.php#L1533-L1544 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.__isset | public function __isset($key)
{
$format = $this->validateFormat($key);
if (!$format) {
list($op, $format) = $this->validateDiff($key);
}
return (bool) $format;
} | php | public function __isset($key)
{
$format = $this->validateFormat($key);
if (!$format) {
list($op, $format) = $this->validateDiff($key);
}
return (bool) $format;
} | [
"public",
"function",
"__isset",
"(",
"$",
"key",
")",
"{",
"$",
"format",
"=",
"$",
"this",
"->",
"validateFormat",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"$",
"format",
")",
"{",
"list",
"(",
"$",
"op",
",",
"$",
"format",
")",
"=",
"$",
... | @param $key
@return bool | [
"@param",
"$key"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L145-L154 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.validateFormat | private function validateFormat($format)
{
if (isset($this->formatsDate[$format])) {
return $this->formatsDate[$format];
}
if (isset($this->formatsTime[$format])) {
return $this->formatsTime[$format];
}
$format = strtolower($format);
if (isset(... | php | private function validateFormat($format)
{
if (isset($this->formatsDate[$format])) {
return $this->formatsDate[$format];
}
if (isset($this->formatsTime[$format])) {
return $this->formatsTime[$format];
}
$format = strtolower($format);
if (isset(... | [
"private",
"function",
"validateFormat",
"(",
"$",
"format",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"formatsDate",
"[",
"$",
"format",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"formatsDate",
"[",
"$",
"format",
"]",
";",
"}",
... | @param $format
@return mixed|string | [
"@param",
"$format"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L161-L176 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.validateDiff | private function validateDiff($format)
{
$keywords = [
'from',
'since',
'age',
'till',
'until',
];
$op = null;
foreach ($keywords as $keyword) {
$len = strlen($keyword);
if (substr($format, -$le... | php | private function validateDiff($format)
{
$keywords = [
'from',
'since',
'age',
'till',
'until',
];
$op = null;
foreach ($keywords as $keyword) {
$len = strlen($keyword);
if (substr($format, -$le... | [
"private",
"function",
"validateDiff",
"(",
"$",
"format",
")",
"{",
"$",
"keywords",
"=",
"[",
"'from'",
",",
"'since'",
",",
"'age'",
",",
"'till'",
",",
"'until'",
",",
"]",
";",
"$",
"op",
"=",
"null",
";",
"foreach",
"(",
"$",
"keywords",
"as",
... | @param $format
@return array | [
"@param",
"$format"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L183-L206 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.parse | private function parse($date, $timezone = null)
{
if (!($date instanceof \DateTime)) {
if (false === strtotime($date)) {
throw new \Exception('Invalid date not parsed.');
}
if (!$timezone) {
$timezone = $this->timezoneSource;
}... | php | private function parse($date, $timezone = null)
{
if (!($date instanceof \DateTime)) {
if (false === strtotime($date)) {
throw new \Exception('Invalid date not parsed.');
}
if (!$timezone) {
$timezone = $this->timezoneSource;
}... | [
"private",
"function",
"parse",
"(",
"$",
"date",
",",
"$",
"timezone",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"date",
"instanceof",
"\\",
"DateTime",
")",
")",
"{",
"if",
"(",
"false",
"===",
"strtotime",
"(",
"$",
"date",
")",
")",
"{... | Parse a string into a DateTime.
@param string $date
@param string $timezone
@return \DateTime
@throws \Exception | [
"Parse",
"a",
"string",
"into",
"a",
"DateTime",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L316-L331 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.getIntervalUnits | private function getIntervalUnits(\DateTime $date1, \DateTime $date2, string $intervalFormat)
{
$result = 0;
try {
$interval = new \DateInterval($intervalFormat);
$periods = new \DatePeriod($date1, $interval, $date2);
$result = max(0, iterator_count($periods) - ... | php | private function getIntervalUnits(\DateTime $date1, \DateTime $date2, string $intervalFormat)
{
$result = 0;
try {
$interval = new \DateInterval($intervalFormat);
$periods = new \DatePeriod($date1, $interval, $date2);
$result = max(0, iterator_count($periods) - ... | [
"private",
"function",
"getIntervalUnits",
"(",
"\\",
"DateTime",
"$",
"date1",
",",
"\\",
"DateTime",
"$",
"date2",
",",
"string",
"$",
"intervalFormat",
")",
"{",
"$",
"result",
"=",
"0",
";",
"try",
"{",
"$",
"interval",
"=",
"new",
"\\",
"DateInterva... | @param \DateTime $date1
@param \DateTime $date2
@param string $intervalFormat
@return int | [
"@param",
"\\",
"DateTime",
"$date1",
"@param",
"\\",
"DateTime",
"$date2",
"@param",
"string",
"$intervalFormat"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L340-L352 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.format | public function format($date, $format = 'iso8601', $validate = true)
{
$result = null;
try {
if ($validate) {
$format = $this->validateFormat($format);
}
$result = $this->parse($date)->format($format);
} catch (\Exception $e) {
}
... | php | public function format($date, $format = 'iso8601', $validate = true)
{
$result = null;
try {
if ($validate) {
$format = $this->validateFormat($format);
}
$result = $this->parse($date)->format($format);
} catch (\Exception $e) {
}
... | [
"public",
"function",
"format",
"(",
"$",
"date",
",",
"$",
"format",
"=",
"'iso8601'",
",",
"$",
"validate",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"$",
"validate",
")",
"{",
"$",
"format",
"=",
"$",
"this... | @param $date
@param string $format
@param bool $validate
@return null|string | [
"@param",
"$date",
"@param",
"string",
"$format",
"@param",
"bool",
"$validate"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L361-L373 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.getFormatsDateTime | public function getFormatsDateTime($prefix = true)
{
$formats = $this->formatsDate;
// Add other common suggestions
foreach ($this->formatInterval as $key => $value) {
foreach (['till', 'since'] as $op) {
if ('age' == $key) {
$op = '';
... | php | public function getFormatsDateTime($prefix = true)
{
$formats = $this->formatsDate;
// Add other common suggestions
foreach ($this->formatInterval as $key => $value) {
foreach (['till', 'since'] as $op) {
if ('age' == $key) {
$op = '';
... | [
"public",
"function",
"getFormatsDateTime",
"(",
"$",
"prefix",
"=",
"true",
")",
"{",
"$",
"formats",
"=",
"$",
"this",
"->",
"formatsDate",
";",
"// Add other common suggestions",
"foreach",
"(",
"$",
"this",
"->",
"formatInterval",
"as",
"$",
"key",
"=>",
... | @param bool $prefix
@return array | [
"@param",
"bool",
"$prefix"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L380-L397 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.prefixWithHelperName | private function prefixWithHelperName($array, $prefix = true)
{
if ($prefix) {
$newArray = [];
foreach ($array as $key => $value) {
$newArray['date.'.$key] = $value;
}
$array = $newArray;
}
return $array;
} | php | private function prefixWithHelperName($array, $prefix = true)
{
if ($prefix) {
$newArray = [];
foreach ($array as $key => $value) {
$newArray['date.'.$key] = $value;
}
$array = $newArray;
}
return $array;
} | [
"private",
"function",
"prefixWithHelperName",
"(",
"$",
"array",
",",
"$",
"prefix",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"prefix",
")",
"{",
"$",
"newArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value"... | @param $array
@param bool $prefix
@return array | [
"@param",
"$array",
"@param",
"bool",
"$prefix"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L405-L416 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.getFormatsDate | public function getFormatsDate($prefix = true)
{
$formats = $this->formatsDate;
// Add other common suggestions
foreach ($this->formatInterval as $key => $value) {
foreach (['hours', 'minutes', 'seconds'] as $exclusion) {
if ($key == $exclusion) {
... | php | public function getFormatsDate($prefix = true)
{
$formats = $this->formatsDate;
// Add other common suggestions
foreach ($this->formatInterval as $key => $value) {
foreach (['hours', 'minutes', 'seconds'] as $exclusion) {
if ($key == $exclusion) {
... | [
"public",
"function",
"getFormatsDate",
"(",
"$",
"prefix",
"=",
"true",
")",
"{",
"$",
"formats",
"=",
"$",
"this",
"->",
"formatsDate",
";",
"// Add other common suggestions",
"foreach",
"(",
"$",
"this",
"->",
"formatInterval",
"as",
"$",
"key",
"=>",
"$"... | @param bool $prefix
@return array | [
"@param",
"bool",
"$prefix"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L423-L442 |
TheDMSGroup/mautic-contact-client | Helper/DateFormatHelper.php | DateFormatHelper.getFormatsTime | public function getFormatsTime($prefix = true)
{
$formats = $this->formatsTime;
// Add other common suggestions
foreach ($this->formatInterval as $key => $value) {
foreach (['months', 'years', 'days', 'age'] as $exclusion) {
if ($key == $exclusion) {
... | php | public function getFormatsTime($prefix = true)
{
$formats = $this->formatsTime;
// Add other common suggestions
foreach ($this->formatInterval as $key => $value) {
foreach (['months', 'years', 'days', 'age'] as $exclusion) {
if ($key == $exclusion) {
... | [
"public",
"function",
"getFormatsTime",
"(",
"$",
"prefix",
"=",
"true",
")",
"{",
"$",
"formats",
"=",
"$",
"this",
"->",
"formatsTime",
";",
"// Add other common suggestions",
"foreach",
"(",
"$",
"this",
"->",
"formatInterval",
"as",
"$",
"key",
"=>",
"$"... | @param bool $prefix
@return array | [
"@param",
"bool",
"$prefix"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/DateFormatHelper.php#L449-L465 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.setContactClient | public function setContactClient(ContactClient $contactClient)
{
$this->contactClient = $contactClient;
$this->setPayload($this->contactClient->getApiPayload());
return $this;
} | php | public function setContactClient(ContactClient $contactClient)
{
$this->contactClient = $contactClient;
$this->setPayload($this->contactClient->getApiPayload());
return $this;
} | [
"public",
"function",
"setContactClient",
"(",
"ContactClient",
"$",
"contactClient",
")",
"{",
"$",
"this",
"->",
"contactClient",
"=",
"$",
"contactClient",
";",
"$",
"this",
"->",
"setPayload",
"(",
"$",
"this",
"->",
"contactClient",
"->",
"getApiPayload",
... | @param ContactClient $contactClient
@return $this
@throws ContactClientException | [
"@param",
"ContactClient",
"$contactClient"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L213-L219 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.setPayload | private function setPayload($payload = null)
{
if (!$payload && $this->contactClient) {
$payload = $this->contactClient->getApiPayload();
}
if (!$payload) {
throw new ContactClientException(
'API instructions not set.',
0,
... | php | private function setPayload($payload = null)
{
if (!$payload && $this->contactClient) {
$payload = $this->contactClient->getApiPayload();
}
if (!$payload) {
throw new ContactClientException(
'API instructions not set.',
0,
... | [
"private",
"function",
"setPayload",
"(",
"$",
"payload",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"payload",
"&&",
"$",
"this",
"->",
"contactClient",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"contactClient",
"->",
"getApiPayload",
"(",
")... | Take the stored JSON string and parse for use.
@param string|null $payload
@return $this
@throws ContactClientException | [
"Take",
"the",
"stored",
"JSON",
"string",
"and",
"parse",
"for",
"use",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L230-L264 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.setSettings | private function setSettings($settings)
{
if ($settings) {
foreach ($this->settings as $key => &$value) {
if (!empty($settings->{$key}) && $settings->{$key}) {
$value = $settings->{$key};
}
}
}
} | php | private function setSettings($settings)
{
if ($settings) {
foreach ($this->settings as $key => &$value) {
if (!empty($settings->{$key}) && $settings->{$key}) {
$value = $settings->{$key};
}
}
}
} | [
"private",
"function",
"setSettings",
"(",
"$",
"settings",
")",
"{",
"if",
"(",
"$",
"settings",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"settings",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"se... | Retrieve API settings from the payload to override our defaults.
@param object $settings | [
"Retrieve",
"API",
"settings",
"from",
"the",
"payload",
"to",
"override",
"our",
"defaults",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L271-L280 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.evaluateSchedule | public function evaluateSchedule()
{
$this->scheduleModel->reset()
->setContactClient($this->contactClient)
->setTimezone()
->evaluateDay()
->evaluateTime()
->evaluateExclusions();
return new \DateTime();
} | php | public function evaluateSchedule()
{
$this->scheduleModel->reset()
->setContactClient($this->contactClient)
->setTimezone()
->evaluateDay()
->evaluateTime()
->evaluateExclusions();
return new \DateTime();
} | [
"public",
"function",
"evaluateSchedule",
"(",
")",
"{",
"$",
"this",
"->",
"scheduleModel",
"->",
"reset",
"(",
")",
"->",
"setContactClient",
"(",
"$",
"this",
"->",
"contactClient",
")",
"->",
"setTimezone",
"(",
")",
"->",
"evaluateDay",
"(",
")",
"->"... | Returns the expected send time for limit evaluation.
Throws an exception if an open slot is not available.
@return \DateTime
@throws ContactClientException | [
"Returns",
"the",
"expected",
"send",
"time",
"for",
"limit",
"evaluation",
".",
"Throws",
"an",
"exception",
"if",
"an",
"open",
"slot",
"is",
"not",
"available",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L310-L320 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.run | public function run()
{
$this->validateOperations();
$this->prepareTransport();
$this->prepareTokenHelper();
$this->preparePayloadAuth();
try {
$this->runApiOperations();
} catch (\Exception $e) {
if (
$this->start
... | php | public function run()
{
$this->validateOperations();
$this->prepareTransport();
$this->prepareTokenHelper();
$this->preparePayloadAuth();
try {
$this->runApiOperations();
} catch (\Exception $e) {
if (
$this->start
... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"validateOperations",
"(",
")",
";",
"$",
"this",
"->",
"prepareTransport",
"(",
")",
";",
"$",
"this",
"->",
"prepareTokenHelper",
"(",
")",
";",
"$",
"this",
"->",
"preparePayloadAuth",
"("... | Step through all operations defined.
@return $this
@throws ContactClientException | [
"Step",
"through",
"all",
"operations",
"defined",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L329-L355 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.prepareTokenHelper | private function prepareTokenHelper()
{
$this->tokenHelper->newSession(
$this->contactClient,
$this->contact,
$this->payload,
$this->campaign,
$this->event
);
// Add any additional tokens here that are only needed for API payloads.
... | php | private function prepareTokenHelper()
{
$this->tokenHelper->newSession(
$this->contactClient,
$this->contact,
$this->payload,
$this->campaign,
$this->event
);
// Add any additional tokens here that are only needed for API payloads.
... | [
"private",
"function",
"prepareTokenHelper",
"(",
")",
"{",
"$",
"this",
"->",
"tokenHelper",
"->",
"newSession",
"(",
"$",
"this",
"->",
"contactClient",
",",
"$",
"this",
"->",
"contact",
",",
"$",
"this",
"->",
"payload",
",",
"$",
"this",
"->",
"camp... | Apply our context to create a new tokenhelper session. | [
"Apply",
"our",
"context",
"to",
"create",
"a",
"new",
"tokenhelper",
"session",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L389-L404 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.preparePayloadAuth | private function preparePayloadAuth()
{
$this->apiPayloadAuth->reset()
->setTest($this->test)
->setContactClient($this->contactClient)
->setOperations($this->payload->operations);
$this->start = $this->apiPayloadAuth->getStartOperation();
if ($this->start... | php | private function preparePayloadAuth()
{
$this->apiPayloadAuth->reset()
->setTest($this->test)
->setContactClient($this->contactClient)
->setOperations($this->payload->operations);
$this->start = $this->apiPayloadAuth->getStartOperation();
if ($this->start... | [
"private",
"function",
"preparePayloadAuth",
"(",
")",
"{",
"$",
"this",
"->",
"apiPayloadAuth",
"->",
"reset",
"(",
")",
"->",
"setTest",
"(",
"$",
"this",
"->",
"test",
")",
"->",
"setContactClient",
"(",
"$",
"this",
"->",
"contactClient",
")",
"->",
... | Prepare the APIPayloadAuth model and get the starting operation ID it reccomends. | [
"Prepare",
"the",
"APIPayloadAuth",
"model",
"and",
"get",
"the",
"starting",
"operation",
"ID",
"it",
"reccomends",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L409-L421 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.savePayloadAuthTokens | private function savePayloadAuthTokens($operationId)
{
if (
$this->valid
&& $this->apiPayloadAuth->hasAuthRequest($operationId)
) {
$fieldSets = $this->getAggregateActualResponses(null, $operationId);
$this->apiPayloadAuth->savePayloadAuthTokens($opera... | php | private function savePayloadAuthTokens($operationId)
{
if (
$this->valid
&& $this->apiPayloadAuth->hasAuthRequest($operationId)
) {
$fieldSets = $this->getAggregateActualResponses(null, $operationId);
$this->apiPayloadAuth->savePayloadAuthTokens($opera... | [
"private",
"function",
"savePayloadAuthTokens",
"(",
"$",
"operationId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"valid",
"&&",
"$",
"this",
"->",
"apiPayloadAuth",
"->",
"hasAuthRequest",
"(",
"$",
"operationId",
")",
")",
"{",
"$",
"fieldSets",
"=",
"$",... | If we just made a successful run with an auth operation, without skipping said operation,
preserve the applicable auth tokens for future use.
@param $operationId | [
"If",
"we",
"just",
"made",
"a",
"successful",
"run",
"with",
"an",
"auth",
"operation",
"without",
"skipping",
"said",
"operation",
"preserve",
"the",
"applicable",
"auth",
"tokens",
"for",
"future",
"use",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L507-L516 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.getAggregateActualResponses | public function getAggregateActualResponses($key = null, $operationId = null, $types = ['headers', 'body'])
{
if ($this->valid && isset($this->aggregateActualResponses)) {
if (null !== $key) {
foreach ($types as $type) {
if (null !== $operationId) {
... | php | public function getAggregateActualResponses($key = null, $operationId = null, $types = ['headers', 'body'])
{
if ($this->valid && isset($this->aggregateActualResponses)) {
if (null !== $key) {
foreach ($types as $type) {
if (null !== $operationId) {
... | [
"public",
"function",
"getAggregateActualResponses",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"operationId",
"=",
"null",
",",
"$",
"types",
"=",
"[",
"'headers'",
",",
"'body'",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"valid",
"&&",
"isset",
"(",
... | Get the most recent non-empty response value by field name, ignoring validity.
Provide key, or operationId or both.
@param string $key
@param int $operationId
@param array $types Types to check for (header/body/etc) | [
"Get",
"the",
"most",
"recent",
"non",
"-",
"empty",
"response",
"value",
"by",
"field",
"name",
"ignoring",
"validity",
".",
"Provide",
"key",
"or",
"operationId",
"or",
"both",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L526-L557 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.setAggregateActualResponses | public function setAggregateActualResponses($responseActual, $operationId, $types = ['headers', 'body'])
{
if (!isset($this->aggregateActualResponses[$operationId])) {
$this->aggregateActualResponses[$operationId] = [];
}
foreach ($types as $type) {
if (!isset($this->... | php | public function setAggregateActualResponses($responseActual, $operationId, $types = ['headers', 'body'])
{
if (!isset($this->aggregateActualResponses[$operationId])) {
$this->aggregateActualResponses[$operationId] = [];
}
foreach ($types as $type) {
if (!isset($this->... | [
"public",
"function",
"setAggregateActualResponses",
"(",
"$",
"responseActual",
",",
"$",
"operationId",
",",
"$",
"types",
"=",
"[",
"'headers'",
",",
"'body'",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"aggregateActualResponses",
"["... | @param array $responseActual Actual response array, including headers and body
@param null $operationId
@param array $types types of data we wish to aggregate
@return $this | [
"@param",
"array",
"$responseActual",
"Actual",
"response",
"array",
"including",
"headers",
"and",
"body",
"@param",
"null",
"$operationId",
"@param",
"array",
"$types",
"types",
"of",
"data",
"we",
"wish",
"to",
"aggregate"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L566-L584 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.applyResponseMap | public function applyResponseMap($updateTokens = false)
{
$responseMap = $this->getResponseMap();
// Check the responseMap to discern where field values should go.
if (count($responseMap)) {
foreach ($responseMap as $alias => $value) {
$oldValue = $this->contact->... | php | public function applyResponseMap($updateTokens = false)
{
$responseMap = $this->getResponseMap();
// Check the responseMap to discern where field values should go.
if (count($responseMap)) {
foreach ($responseMap as $alias => $value) {
$oldValue = $this->contact->... | [
"public",
"function",
"applyResponseMap",
"(",
"$",
"updateTokens",
"=",
"false",
")",
"{",
"$",
"responseMap",
"=",
"$",
"this",
"->",
"getResponseMap",
"(",
")",
";",
"// Check the responseMap to discern where field values should go.",
"if",
"(",
"count",
"(",
"$"... | Apply the responsemap to update a contact entity.
@param bool $updateTokens
@return bool | [
"Apply",
"the",
"responsemap",
"to",
"update",
"a",
"contact",
"entity",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L593-L612 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.updatePayload | private function updatePayload()
{
if ($this->contactClient) {
$this->sortPayloadFields();
$jsonHelper = new JSONHelper();
$payloadJSON = $jsonHelper->encode($this->payload, 'Payload');
$this->contactClient->setAPIPayload($payloadJSON);
}
} | php | private function updatePayload()
{
if ($this->contactClient) {
$this->sortPayloadFields();
$jsonHelper = new JSONHelper();
$payloadJSON = $jsonHelper->encode($this->payload, 'Payload');
$this->contactClient->setAPIPayload($payloadJSON);
}
} | [
"private",
"function",
"updatePayload",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"contactClient",
")",
"{",
"$",
"this",
"->",
"sortPayloadFields",
"(",
")",
";",
"$",
"jsonHelper",
"=",
"new",
"JSONHelper",
"(",
")",
";",
"$",
"payloadJSON",
"=",
... | Update the payload with the parent ContactClient because we've updated the response expectation. | [
"Update",
"the",
"payload",
"with",
"the",
"parent",
"ContactClient",
"because",
"we",
"ve",
"updated",
"the",
"response",
"expectation",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L627-L635 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.sortPayloadFields | private function sortPayloadFields()
{
if (isset($this->payload->operations)) {
foreach ($this->payload->operations as $id => $operation) {
foreach (['request', 'response'] as $opType) {
if (isset($operation->{$opType})) {
foreach (['he... | php | private function sortPayloadFields()
{
if (isset($this->payload->operations)) {
foreach ($this->payload->operations as $id => $operation) {
foreach (['request', 'response'] as $opType) {
if (isset($operation->{$opType})) {
foreach (['he... | [
"private",
"function",
"sortPayloadFields",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"payload",
"->",
"operations",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"payload",
"->",
"operations",
"as",
"$",
"id",
"=>",
"$",
"operatio... | Sort the fields by keys, so that the user doesn't have to.
Only applies when AutoUpdate is enabled. | [
"Sort",
"the",
"fields",
"by",
"keys",
"so",
"that",
"the",
"user",
"doesn",
"t",
"have",
"to",
".",
"Only",
"applies",
"when",
"AutoUpdate",
"is",
"enabled",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L641-L664 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.getOverrides | public function getOverrides()
{
$result = [];
if (isset($this->payload->operations)) {
foreach ($this->payload->operations as $id => $operation) {
if (isset($operation->request)) {
// API Payloads can optionally have their URLs overriden per request.
... | php | public function getOverrides()
{
$result = [];
if (isset($this->payload->operations)) {
foreach ($this->payload->operations as $id => $operation) {
if (isset($operation->request)) {
// API Payloads can optionally have their URLs overriden per request.
... | [
"public",
"function",
"getOverrides",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"payload",
"->",
"operations",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"payload",
"->",
"operations",
"as",
... | Retrieve from the payload all outgoing fields that are set to overridable.
@return array | [
"Retrieve",
"from",
"the",
"payload",
"all",
"outgoing",
"fields",
"that",
"are",
"set",
"to",
"overridable",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L703-L737 |
TheDMSGroup/mautic-contact-client | Model/ApiPayload.php | ApiPayload.setOverrides | public function setOverrides($overrides)
{
$fieldsOverridden = [];
if (isset($this->payload->operations)) {
foreach ($this->payload->operations as $id => &$operation) {
// API Payloads can optionally have their URLs overriden per request.
$key = 'payload.o... | php | public function setOverrides($overrides)
{
$fieldsOverridden = [];
if (isset($this->payload->operations)) {
foreach ($this->payload->operations as $id => &$operation) {
// API Payloads can optionally have their URLs overriden per request.
$key = 'payload.o... | [
"public",
"function",
"setOverrides",
"(",
"$",
"overrides",
")",
"{",
"$",
"fieldsOverridden",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"payload",
"->",
"operations",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"payload",
... | Override the default field values, if allowed.
@param array $overrides
@return $this | [
"Override",
"the",
"default",
"field",
"values",
"if",
"allowed",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayload.php#L779-L822 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.getErrors | public function getErrors($clean = true)
{
$errors = $this->errors;
if ($clean) {
foreach ($errors as $key => $error) {
$errors[$key] = trim(strip_tags($error));
if (empty($errors[$key])) {
unset($errors[$key]);
}
... | php | public function getErrors($clean = true)
{
$errors = $this->errors;
if ($clean) {
foreach ($errors as $key => $error) {
$errors[$key] = trim(strip_tags($error));
if (empty($errors[$key])) {
unset($errors[$key]);
}
... | [
"public",
"function",
"getErrors",
"(",
"$",
"clean",
"=",
"true",
")",
"{",
"$",
"errors",
"=",
"$",
"this",
"->",
"errors",
";",
"if",
"(",
"$",
"clean",
")",
"{",
"foreach",
"(",
"$",
"errors",
"as",
"$",
"key",
"=>",
"$",
"error",
")",
"{",
... | @param bool $clean
@return array | [
"@param",
"bool",
"$clean"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L53-L66 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.filter | public function filter($json, array $context = [], $noRulesResult = true)
{
// Pre-validate the string.
if (!strlen($json)) {
if (!$noRulesResult) {
$this->setError('No rules to evaluate.');
}
return $noRulesResult;
}
$query = $th... | php | public function filter($json, array $context = [], $noRulesResult = true)
{
// Pre-validate the string.
if (!strlen($json)) {
if (!$noRulesResult) {
$this->setError('No rules to evaluate.');
}
return $noRulesResult;
}
$query = $th... | [
"public",
"function",
"filter",
"(",
"$",
"json",
",",
"array",
"$",
"context",
"=",
"[",
"]",
",",
"$",
"noRulesResult",
"=",
"true",
")",
"{",
"// Pre-validate the string.",
"if",
"(",
"!",
"strlen",
"(",
"$",
"json",
")",
")",
"{",
"if",
"(",
"!",... | Use a jQuery Query Builder JSON to evaluate the context.
@param string $json
@param array $context An array of data to be evaluated
@param bool|string $noRulesResult the result should the rules be missing/invalid,
leave as true to succeed by default
@return bool return true if the context passes the ... | [
"Use",
"a",
"jQuery",
"Query",
"Builder",
"JSON",
"to",
"evaluate",
"the",
"context",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L80-L103 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.decodeJSON | private function decodeJSON($json)
{
$query = json_decode($json);
if (json_last_error()) {
throw new \Exception('JSON parsing threw an error: '.json_last_error_msg());
}
if (!is_object($query)) {
throw new \Exception('The query is not valid JSON');
}
... | php | private function decodeJSON($json)
{
$query = json_decode($json);
if (json_last_error()) {
throw new \Exception('JSON parsing threw an error: '.json_last_error_msg());
}
if (!is_object($query)) {
throw new \Exception('The query is not valid JSON');
}
... | [
"private",
"function",
"decodeJSON",
"(",
"$",
"json",
")",
"{",
"$",
"query",
"=",
"json_decode",
"(",
"$",
"json",
")",
";",
"if",
"(",
"json_last_error",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'JSON parsing threw an error: '",
".",... | Decode the given JSON.
@param $json
@return mixed
@throws Exception | [
"Decode",
"the",
"given",
"JSON",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L119-L130 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.loopThroughRules | protected function loopThroughRules(array $rules, array $context = [], $condition = 'AND')
{
$result = true;
$condition = strtolower($condition);
$this->validateCondition($condition);
foreach ($rules as $rule) {
$result = $this->evaluate($rule, $context);
i... | php | protected function loopThroughRules(array $rules, array $context = [], $condition = 'AND')
{
$result = true;
$condition = strtolower($condition);
$this->validateCondition($condition);
foreach ($rules as $rule) {
$result = $this->evaluate($rule, $context);
i... | [
"protected",
"function",
"loopThroughRules",
"(",
"array",
"$",
"rules",
",",
"array",
"$",
"context",
"=",
"[",
"]",
",",
"$",
"condition",
"=",
"'AND'",
")",
"{",
"$",
"result",
"=",
"true",
";",
"$",
"condition",
"=",
"strtolower",
"(",
"$",
"condit... | Called by parse, loops through all the rules to find out if nested or not.
@param array $rules
@param array $context
@param string $condition
@return bool
@throws Exception
@throws \Exception | [
"Called",
"by",
"parse",
"loops",
"through",
"all",
"the",
"rules",
"to",
"find",
"out",
"if",
"nested",
"or",
"not",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L144-L165 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.validateCondition | protected function validateCondition($condition)
{
$condition = trim(strtolower($condition));
if ('and' !== $condition && 'or' !== $condition) {
throw new \Exception("Condition can only be one of: 'and', 'or'.");
}
return $condition;
} | php | protected function validateCondition($condition)
{
$condition = trim(strtolower($condition));
if ('and' !== $condition && 'or' !== $condition) {
throw new \Exception("Condition can only be one of: 'and', 'or'.");
}
return $condition;
} | [
"protected",
"function",
"validateCondition",
"(",
"$",
"condition",
")",
"{",
"$",
"condition",
"=",
"trim",
"(",
"strtolower",
"(",
"$",
"condition",
")",
")",
";",
"if",
"(",
"'and'",
"!==",
"$",
"condition",
"&&",
"'or'",
"!==",
"$",
"condition",
")"... | Make sure that a condition is either 'or' or 'and'.
@param $condition
@return string
@throws \Exception | [
"Make",
"sure",
"that",
"a",
"condition",
"is",
"either",
"or",
"or",
"and",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L176-L185 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.getValueFromRule | protected function getValueFromRule($rule)
{
$value = $this->getRuleValue($rule);
if (isset($this->operators[$rule->operator]['accept_values'])
&& $this->operators[$rule->operator]['accept_values'] === false) {
return $this->operatorValueWhenNotAcceptingOne($rule);
}... | php | protected function getValueFromRule($rule)
{
$value = $this->getRuleValue($rule);
if (isset($this->operators[$rule->operator]['accept_values'])
&& $this->operators[$rule->operator]['accept_values'] === false) {
return $this->operatorValueWhenNotAcceptingOne($rule);
}... | [
"protected",
"function",
"getValueFromRule",
"(",
"$",
"rule",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getRuleValue",
"(",
"$",
"rule",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"operators",
"[",
"$",
"rule",
"->",
"operator",
"]... | Ensure that the value is correct for the rule, try and set it if it's not.
@param $rule
@return mixed|null|string
@throws Exception | [
"Ensure",
"that",
"the",
"value",
"is",
"correct",
"for",
"the",
"rule",
"try",
"and",
"set",
"it",
"if",
"it",
"s",
"not",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L236-L246 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.checkRuleCorrect | protected function checkRuleCorrect($rule)
{
if (!isset($rule->value)) {
// We will assume a missing value for the rule is to be interpreted as empty.
$rule->value = null;
}
if (!isset($rule->id, $rule->field, $rule->type, $rule->input, $rule->operator)) {
... | php | protected function checkRuleCorrect($rule)
{
if (!isset($rule->value)) {
// We will assume a missing value for the rule is to be interpreted as empty.
$rule->value = null;
}
if (!isset($rule->id, $rule->field, $rule->type, $rule->input, $rule->operator)) {
... | [
"protected",
"function",
"checkRuleCorrect",
"(",
"$",
"rule",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"rule",
"->",
"value",
")",
")",
"{",
"// We will assume a missing value for the rule is to be interpreted as empty.",
"$",
"rule",
"->",
"value",
"=",
"nul... | Check if a given rule is correct.
Just before making a query for a rule, we want to make sure that the field, operator and value are set.
@param $rule
@return bool true if values are correct | [
"Check",
"if",
"a",
"given",
"rule",
"is",
"correct",
".",
"Just",
"before",
"making",
"a",
"query",
"for",
"a",
"rule",
"we",
"want",
"to",
"make",
"sure",
"that",
"the",
"field",
"operator",
"and",
"value",
"are",
"set",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L275-L289 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.getCorrectValue | protected function getCorrectValue($operator, $rule, $value)
{
$requireArray = $this->operatorRequiresArray($operator);
return $this->enforceArrayOrString($requireArray, $value, $rule->field);
} | php | protected function getCorrectValue($operator, $rule, $value)
{
$requireArray = $this->operatorRequiresArray($operator);
return $this->enforceArrayOrString($requireArray, $value, $rule->field);
} | [
"protected",
"function",
"getCorrectValue",
"(",
"$",
"operator",
",",
"$",
"rule",
",",
"$",
"value",
")",
"{",
"$",
"requireArray",
"=",
"$",
"this",
"->",
"operatorRequiresArray",
"(",
"$",
"operator",
")",
";",
"return",
"$",
"this",
"->",
"enforceArra... | Ensure that the value for a field is correct.
@param string $operator
@param $rule
@param $value
@return mixed
@throws \Exception | [
"Ensure",
"that",
"the",
"value",
"for",
"a",
"field",
"is",
"correct",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L318-L323 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.enforceArrayOrString | protected function enforceArrayOrString($requireArray, $value, $field)
{
$this->checkFieldIsAnArray($requireArray, $value, $field);
if (!$requireArray && is_array($value)) {
return $this->convertArrayToFlatValue($field, $value);
}
return $value;
} | php | protected function enforceArrayOrString($requireArray, $value, $field)
{
$this->checkFieldIsAnArray($requireArray, $value, $field);
if (!$requireArray && is_array($value)) {
return $this->convertArrayToFlatValue($field, $value);
}
return $value;
} | [
"protected",
"function",
"enforceArrayOrString",
"(",
"$",
"requireArray",
",",
"$",
"value",
",",
"$",
"field",
")",
"{",
"$",
"this",
"->",
"checkFieldIsAnArray",
"(",
"$",
"requireArray",
",",
"$",
"value",
",",
"$",
"field",
")",
";",
"if",
"(",
"!",... | Enforce whether the value for a given field is the correct type.
@param bool $requireArray value must be an array
@param mixed $value the value we are checking against
@param string $field the field that we are enforcing
@return mixed value after enforcement
@throws \Exception if value is not a corr... | [
"Enforce",
"whether",
"the",
"value",
"for",
"a",
"given",
"field",
"is",
"the",
"correct",
"type",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L348-L357 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.getValueFromContext | protected function getValueFromContext($rule, $context)
{
// Fields are only nested one level deep and flattened thereafter.
$parts = explode('.', $rule->field);
$key = array_shift($parts);
if (isset($context[$key]) && count($parts)) {
$context = $context[$key];
... | php | protected function getValueFromContext($rule, $context)
{
// Fields are only nested one level deep and flattened thereafter.
$parts = explode('.', $rule->field);
$key = array_shift($parts);
if (isset($context[$key]) && count($parts)) {
$context = $context[$key];
... | [
"protected",
"function",
"getValueFromContext",
"(",
"$",
"rule",
",",
"$",
"context",
")",
"{",
"// Fields are only nested one level deep and flattened thereafter.",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"rule",
"->",
"field",
")",
";",
"$",
"key",
... | Take a (potentially nested) field name and get the literal value from the contextual array.
@param $rule
@param $context
@return bool | [
"Take",
"a",
"(",
"potentially",
"nested",
")",
"field",
"name",
"and",
"get",
"the",
"literal",
"value",
"from",
"the",
"contextual",
"array",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L407-L420 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.evaluateRuleAgainstContext | protected function evaluateRuleAgainstContext($rule, $contextValue, $ruleValue)
{
$operator = strtolower($rule->operator);
switch ($operator) {
case 'in':
return in_array($contextValue, $ruleValue);
break;
case 'not_in':
return ... | php | protected function evaluateRuleAgainstContext($rule, $contextValue, $ruleValue)
{
$operator = strtolower($rule->operator);
switch ($operator) {
case 'in':
return in_array($contextValue, $ruleValue);
break;
case 'not_in':
return ... | [
"protected",
"function",
"evaluateRuleAgainstContext",
"(",
"$",
"rule",
",",
"$",
"contextValue",
",",
"$",
"ruleValue",
")",
"{",
"$",
"operator",
"=",
"strtolower",
"(",
"$",
"rule",
"->",
"operator",
")",
";",
"switch",
"(",
"$",
"operator",
")",
"{",
... | Convert an incomming rule from jQuery QueryBuilder to the Doctrine Querybuilder.
(This used to be part of evaluate, where the name made sense, but I pulled it
out to reduce some duplicated code inside JoinSupportingQueryBuilder)
@param $rule
@param $contextValue
@param $ruleValue
@return bool
@throws \Excepti... | [
"Convert",
"an",
"incomming",
"rule",
"from",
"jQuery",
"QueryBuilder",
"to",
"the",
"Doctrine",
"Querybuilder",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L436-L516 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.isNested | protected function isNested($rule)
{
if (isset($rule->rules) && is_array($rule->rules) && count($rule->rules) > 0) {
return true;
}
return false;
} | php | protected function isNested($rule)
{
if (isset($rule->rules) && is_array($rule->rules) && count($rule->rules) > 0) {
return true;
}
return false;
} | [
"protected",
"function",
"isNested",
"(",
"$",
"rule",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"rule",
"->",
"rules",
")",
"&&",
"is_array",
"(",
"$",
"rule",
"->",
"rules",
")",
"&&",
"count",
"(",
"$",
"rule",
"->",
"rules",
")",
">",
"0",
")",... | Determine if we have nested rules to evaluate.
@param $rule
@return bool | [
"Determine",
"if",
"we",
"have",
"nested",
"rules",
"to",
"evaluate",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L525-L532 |
TheDMSGroup/mautic-contact-client | Helper/FilterHelper.php | FilterHelper.expoundContext | private function expoundContext(&$context)
{
foreach ($context as $key => &$value) {
if (is_array($value) || is_object($value)) {
$this->expoundContext($value);
}
$t = &$context;
$keys = explode('.', $key);
if (count($keys) > 1) ... | php | private function expoundContext(&$context)
{
foreach ($context as $key => &$value) {
if (is_array($value) || is_object($value)) {
$this->expoundContext($value);
}
$t = &$context;
$keys = explode('.', $key);
if (count($keys) > 1) ... | [
"private",
"function",
"expoundContext",
"(",
"&",
"$",
"context",
")",
"{",
"foreach",
"(",
"$",
"context",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"||",
"is_object",
"(",
"$",
"value",
"... | /*
Kept for posterity. A mechanism to expound the dot-notated fields to a nested array recursively.
Not currently used because our contextual arrays are flattened externally after the first level.
@param $context | [
"/",
"*",
"Kept",
"for",
"posterity",
".",
"A",
"mechanism",
"to",
"expound",
"the",
"dot",
"-",
"notated",
"fields",
"to",
"a",
"nested",
"array",
"recursively",
".",
"Not",
"currently",
"used",
"because",
"our",
"contextual",
"arrays",
"are",
"flattened",
... | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Helper/FilterHelper.php#L540-L559 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadRequest.php | ApiPayloadRequest.send | public function send()
{
// The URI has already been overriden (if applicable) by this point.
$uri = isset($this->request->url) ? $this->request->url : null;
if ($this->test && !empty($this->request->testUrl)) {
$uri = $this->request->testUrl;
}
$uri = trim($this-... | php | public function send()
{
// The URI has already been overriden (if applicable) by this point.
$uri = isset($this->request->url) ? $this->request->url : null;
if ($this->test && !empty($this->request->testUrl)) {
$uri = $this->request->testUrl;
}
$uri = trim($this-... | [
"public",
"function",
"send",
"(",
")",
"{",
"// The URI has already been overriden (if applicable) by this point.",
"$",
"uri",
"=",
"isset",
"(",
"$",
"this",
"->",
"request",
"->",
"url",
")",
"?",
"$",
"this",
"->",
"request",
"->",
"url",
":",
"null",
";"... | Given a uri and request object, formulate options and make the request.
@throws ContactClientException | [
"Given",
"a",
"uri",
"and",
"request",
"object",
"formulate",
"options",
"and",
"make",
"the",
"request",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadRequest.php#L64-L251 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadRequest.php | ApiPayloadRequest.renderTokens | private function renderTokens($template = '', $context = [])
{
if ($context) {
$this->tokenHelper->addContext($context);
}
return $this->tokenHelper->render($template);
} | php | private function renderTokens($template = '', $context = [])
{
if ($context) {
$this->tokenHelper->addContext($context);
}
return $this->tokenHelper->render($template);
} | [
"private",
"function",
"renderTokens",
"(",
"$",
"template",
"=",
"''",
",",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"tokenHelper",
"->",
"addContext",
"(",
"$",
"context",
")",
";",
"}",
"re... | @param string|array|object $template
@param array $context
@return string | [
"@param",
"string|array|object",
"$template",
"@param",
"array",
"$context"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadRequest.php#L259-L266 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadRequest.php | ApiPayloadRequest.templateFieldValues | private function templateFieldValues($fields)
{
$result = [];
foreach ($fields as $field) {
if (!$this->test && (isset($field->test_only) ? $field->test_only : false)) {
// Skip this field as it is for test mode only.
continue;
}
$k... | php | private function templateFieldValues($fields)
{
$result = [];
foreach ($fields as $field) {
if (!$this->test && (isset($field->test_only) ? $field->test_only : false)) {
// Skip this field as it is for test mode only.
continue;
}
$k... | [
"private",
"function",
"templateFieldValues",
"(",
"$",
"fields",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"test",
"&&",
"(",
"isset",
"(",
"$",
"... | Tokenize/parse fields from the API Payload for template context.
@param $fields
@return array
@throws ContactClientException | [
"Tokenize",
"/",
"parse",
"fields",
"from",
"the",
"API",
"Payload",
"for",
"template",
"context",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadRequest.php#L334-L387 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.findLimit | public function findLimit(
ContactClient $contactClient,
$rules = [],
$timezone = null,
\DateTime $dateSend = null
) {
$filters = [];
$result = null;
foreach ($rules as $rule) {
$orx = [];
$value = $rule['value'];
$... | php | public function findLimit(
ContactClient $contactClient,
$rules = [],
$timezone = null,
\DateTime $dateSend = null
) {
$filters = [];
$result = null;
foreach ($rules as $rule) {
$orx = [];
$value = $rule['value'];
$... | [
"public",
"function",
"findLimit",
"(",
"ContactClient",
"$",
"contactClient",
",",
"$",
"rules",
"=",
"[",
"]",
",",
"$",
"timezone",
"=",
"null",
",",
"\\",
"DateTime",
"$",
"dateSend",
"=",
"null",
")",
"{",
"$",
"filters",
"=",
"[",
"]",
";",
"$"... | Given a matching pattern and a contact, find any exceeded limits (aka caps/budgets).
@param ContactClient $contactClient
@param array $rules
@param null $timezone
@param \DateTime|null $dateSend
@return array|null
@throws \Exception | [
"Given",
"a",
"matching",
"pattern",
"and",
"a",
"contact",
"find",
"any",
"exceeded",
"limits",
"(",
"aka",
"caps",
"/",
"budgets",
")",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L57-L108 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.oldestDateAdded | public function oldestDateAdded($duration, string $timezone = null, \DateTime $dateSend = null)
{
if (!$timezone) {
$timezone = date_default_timezone_get();
}
if (is_string($timezone)) {
$timezone = new \DateTimeZone($timezone);
}
if ($dateSend) {
... | php | public function oldestDateAdded($duration, string $timezone = null, \DateTime $dateSend = null)
{
if (!$timezone) {
$timezone = date_default_timezone_get();
}
if (is_string($timezone)) {
$timezone = new \DateTimeZone($timezone);
}
if ($dateSend) {
... | [
"public",
"function",
"oldestDateAdded",
"(",
"$",
"duration",
",",
"string",
"$",
"timezone",
"=",
"null",
",",
"\\",
"DateTime",
"$",
"dateSend",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"timezone",
")",
"{",
"$",
"timezone",
"=",
"date_default_time... | Support non-rolling durations when P is not prefixing.
@param $duration
@param string|null $timezone
@param \DateTime|null $dateSend
@return \DateTime
@throws \Exception | [
"Support",
"non",
"-",
"rolling",
"durations",
"when",
"P",
"is",
"not",
"prefixing",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L121-L164 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.applyFilters | private function applyFilters($filters = [], $returnCount = false)
{
$result = null;
// Convert our filters into a query.
if ($filters) {
$alias = $this->getTableAlias();
$query = $this->slaveQueryBuilder();
if ($returnCount) {
$query->sele... | php | private function applyFilters($filters = [], $returnCount = false)
{
$result = null;
// Convert our filters into a query.
if ($filters) {
$alias = $this->getTableAlias();
$query = $this->slaveQueryBuilder();
if ($returnCount) {
$query->sele... | [
"private",
"function",
"applyFilters",
"(",
"$",
"filters",
"=",
"[",
"]",
",",
"$",
"returnCount",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"null",
";",
"// Convert our filters into a query.",
"if",
"(",
"$",
"filters",
")",
"{",
"$",
"alias",
"=",
"... | @param array $filters
@param bool $returnCount
@return mixed|null | [
"@param",
"array",
"$filters",
"@param",
"bool",
"$returnCount"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L172-L281 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.slaveQueryBuilder | private function slaveQueryBuilder()
{
/** @var Connection $connection */
$connection = $this->getEntityManager()->getConnection();
if ($connection instanceof MasterSlaveConnection) {
// Prefer a slave connection if available.
$connection->connect('slave');
}
... | php | private function slaveQueryBuilder()
{
/** @var Connection $connection */
$connection = $this->getEntityManager()->getConnection();
if ($connection instanceof MasterSlaveConnection) {
// Prefer a slave connection if available.
$connection->connect('slave');
}
... | [
"private",
"function",
"slaveQueryBuilder",
"(",
")",
"{",
"/** @var Connection $connection */",
"$",
"connection",
"=",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"getConnection",
"(",
")",
";",
"if",
"(",
"$",
"connection",
"instanceof",
"MasterSlave... | Create a DBAL QueryBuilder preferring a slave connection if available.
@return QueryBuilder | [
"Create",
"a",
"DBAL",
"QueryBuilder",
"preferring",
"a",
"slave",
"connection",
"if",
"available",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L288-L298 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.findDuplicate | public function findDuplicate(
Contact $contact,
ContactClient $contactClient,
$rules = [],
string $utmSource = null,
string $timezone = null,
\DateTime $dateSend = null
) {
// Generate our filters based on the rules provided.
$filters = [];
fo... | php | public function findDuplicate(
Contact $contact,
ContactClient $contactClient,
$rules = [],
string $utmSource = null,
string $timezone = null,
\DateTime $dateSend = null
) {
// Generate our filters based on the rules provided.
$filters = [];
fo... | [
"public",
"function",
"findDuplicate",
"(",
"Contact",
"$",
"contact",
",",
"ContactClient",
"$",
"contactClient",
",",
"$",
"rules",
"=",
"[",
"]",
",",
"string",
"$",
"utmSource",
"=",
"null",
",",
"string",
"$",
"timezone",
"=",
"null",
",",
"\\",
"Da... | Given a matching pattern and a contact, discern if there is a match in the cache.
Used for exclusivity and duplicate checking.
@param Contact $contact
@param ContactClient $contactClient
@param array $rules
@param string $utmSource
@param string|null $timezone
@param \DateTime|null $dateSen... | [
"Given",
"a",
"matching",
"pattern",
"and",
"a",
"contact",
"discern",
"if",
"there",
"is",
"a",
"match",
"in",
"the",
"cache",
".",
"Used",
"for",
"exclusivity",
"and",
"duplicate",
"checking",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L315-L426 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.phoneValidate | private function phoneValidate($phone)
{
$result = null;
$phone = trim($phone);
if (!empty($phone)) {
if (!$this->phoneHelper) {
$this->phoneHelper = new PhoneNumberHelper();
}
try {
$phone = $this->phoneHelper->format($pho... | php | private function phoneValidate($phone)
{
$result = null;
$phone = trim($phone);
if (!empty($phone)) {
if (!$this->phoneHelper) {
$this->phoneHelper = new PhoneNumberHelper();
}
try {
$phone = $this->phoneHelper->format($pho... | [
"private",
"function",
"phoneValidate",
"(",
"$",
"phone",
")",
"{",
"$",
"result",
"=",
"null",
";",
"$",
"phone",
"=",
"trim",
"(",
"$",
"phone",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"phone",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this"... | @param $phone
@return string | [
"@param",
"$phone"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L433-L451 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.findExclusive | public function findExclusive(
Contact $contact,
ContactClient $contactClient,
\DateTime $dateSend = null,
$matching = self::MATCHING_EXPLICIT | self::MATCHING_EMAIL | self::MATCHING_PHONE | self::MATCHING_MOBILE,
$scope = self::SCOPE_GLOBAL | self::SCOPE_CATEGORY
) {
... | php | public function findExclusive(
Contact $contact,
ContactClient $contactClient,
\DateTime $dateSend = null,
$matching = self::MATCHING_EXPLICIT | self::MATCHING_EMAIL | self::MATCHING_PHONE | self::MATCHING_MOBILE,
$scope = self::SCOPE_GLOBAL | self::SCOPE_CATEGORY
) {
... | [
"public",
"function",
"findExclusive",
"(",
"Contact",
"$",
"contact",
",",
"ContactClient",
"$",
"contactClient",
",",
"\\",
"DateTime",
"$",
"dateSend",
"=",
"null",
",",
"$",
"matching",
"=",
"self",
"::",
"MATCHING_EXPLICIT",
"|",
"self",
"::",
"MATCHING_E... | Check the entire cache for matching contacts given all possible Exclusivity rules.
Only the first 4 matching rules are allowed for exclusivity (by default).
Only the first two scopes are allowed for exclusivity.
@param Contact $contact
@param ContactClient $contactClient
@param \DateTime|null $dateSend
@param... | [
"Check",
"the",
"entire",
"cache",
"for",
"matching",
"contacts",
"given",
"all",
"possible",
"Exclusivity",
"rules",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L469-L606 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.bitwiseIn | private function bitwiseIn(
$max,
$matching
) {
$result = [];
for ($i = 1; $i <= $max; ++$i) {
if ($i & $matching) {
$result[] = $i;
}
}
return $result;
} | php | private function bitwiseIn(
$max,
$matching
) {
$result = [];
for ($i = 1; $i <= $max; ++$i) {
if ($i & $matching) {
$result[] = $i;
}
}
return $result;
} | [
"private",
"function",
"bitwiseIn",
"(",
"$",
"max",
",",
"$",
"matching",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"$",
"max",
";",
"++",
"$",
"i",
")",
"{",
"if",
"(",
"$",
"i",
"... | Given bitwise operators, and the value we want to match against,
generate a minimal array for an IN query.
@param int $max
@param $matching
@return array | [
"Given",
"bitwise",
"operators",
"and",
"the",
"value",
"we",
"want",
"to",
"match",
"against",
"generate",
"a",
"minimal",
"array",
"for",
"an",
"IN",
"query",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L617-L629 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.addExpiration | private function addExpiration(
&$filters = [],
\DateTime $dateSend = null
) {
if ($filters) {
$expiration = $dateSend ? $dateSend : new \DateTime();
$expiration = $expiration->getTimestamp();
foreach ($filters as &$filter) {
$filter['exclu... | php | private function addExpiration(
&$filters = [],
\DateTime $dateSend = null
) {
if ($filters) {
$expiration = $dateSend ? $dateSend : new \DateTime();
$expiration = $expiration->getTimestamp();
foreach ($filters as &$filter) {
$filter['exclu... | [
"private",
"function",
"addExpiration",
"(",
"&",
"$",
"filters",
"=",
"[",
"]",
",",
"\\",
"DateTime",
"$",
"dateSend",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"filters",
")",
"{",
"$",
"expiration",
"=",
"$",
"dateSend",
"?",
"$",
"dateSend",
":",
... | Add Exclusion Expiration date.
@param array $filters
@param \DateTime|null $dateSend
@throws \Exception | [
"Add",
"Exclusion",
"Expiration",
"date",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L639-L650 |
TheDMSGroup/mautic-contact-client | Entity/CacheRepository.php | CacheRepository.reduceExclusivityIndex | public function reduceExclusivityIndex()
{
$q = $this->getEntityManager()->getConnection()->createQueryBuilder();
$q->update(MAUTIC_TABLE_PREFIX.$this->getTableName());
$q->where(
$q->expr()->isNotNull('exclusive_expire_date'),
$q->expr()->lte('exclusive_expire_date',... | php | public function reduceExclusivityIndex()
{
$q = $this->getEntityManager()->getConnection()->createQueryBuilder();
$q->update(MAUTIC_TABLE_PREFIX.$this->getTableName());
$q->where(
$q->expr()->isNotNull('exclusive_expire_date'),
$q->expr()->lte('exclusive_expire_date',... | [
"public",
"function",
"reduceExclusivityIndex",
"(",
")",
"{",
"$",
"q",
"=",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"getConnection",
"(",
")",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"q",
"->",
"update",
"(",
"MAUTIC_TABLE_PREFIX",
... | Update exclusivity rows to reduce the index size and thus reduce processing required to check exclusivity. | [
"Update",
"exclusivity",
"rows",
"to",
"reduce",
"the",
"index",
"size",
"and",
"thus",
"reduce",
"processing",
"required",
"to",
"check",
"exclusivity",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/CacheRepository.php#L673-L685 |
TheDMSGroup/mautic-contact-client | Entity/FileRepository.php | FileRepository.getCountByDate | public function getCountByDate(
\DateTime $date = null,
$contactClientId,
$statuses = [File::STATUS_READY, File::STATUS_SENT, File::STATUS_ERROR],
$test = false
) {
$start = clone $date;
$end = clone $date;
$q = $this->getEntityManager()->getConnection()... | php | public function getCountByDate(
\DateTime $date = null,
$contactClientId,
$statuses = [File::STATUS_READY, File::STATUS_SENT, File::STATUS_ERROR],
$test = false
) {
$start = clone $date;
$end = clone $date;
$q = $this->getEntityManager()->getConnection()... | [
"public",
"function",
"getCountByDate",
"(",
"\\",
"DateTime",
"$",
"date",
"=",
"null",
",",
"$",
"contactClientId",
",",
"$",
"statuses",
"=",
"[",
"File",
"::",
"STATUS_READY",
",",
"File",
"::",
"STATUS_SENT",
",",
"File",
"::",
"STATUS_ERROR",
"]",
",... | Gets the number of files (ready/sent by default) on a given date.
@param \DateTime|null $date
@param $contactClientId
@param array $statuses
@param bool $test
@return int | [
"Gets",
"the",
"number",
"of",
"files",
"(",
"ready",
"/",
"sent",
"by",
"default",
")",
"on",
"a",
"given",
"date",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/FileRepository.php#L31-L60 |
TheDMSGroup/mautic-contact-client | Entity/ContactClientRepository.php | ContactClientRepository.getEntities | public function getEntities(array $args = [])
{
$alias = $this->getTableAlias();
$q = $this->_em
->createQueryBuilder()
->select($alias)
->from('MauticContactClientBundle:ContactClient', $alias, $alias.'.id');
if (empty($args['iterator_mode'])) {
... | php | public function getEntities(array $args = [])
{
$alias = $this->getTableAlias();
$q = $this->_em
->createQueryBuilder()
->select($alias)
->from('MauticContactClientBundle:ContactClient', $alias, $alias.'.id');
if (empty($args['iterator_mode'])) {
... | [
"public",
"function",
"getEntities",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"alias",
"=",
"$",
"this",
"->",
"getTableAlias",
"(",
")",
";",
"$",
"q",
"=",
"$",
"this",
"->",
"_em",
"->",
"createQueryBuilder",
"(",
")",
"->",
"sel... | Get a list of entities.
@param array $args
@return \Doctrine\ORM\Tools\Pagination\Paginator | [
"Get",
"a",
"list",
"of",
"entities",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/ContactClientRepository.php#L28-L44 |
TheDMSGroup/mautic-contact-client | Entity/ContactClientRepository.php | ContactClientRepository.addCatchAllWhereClause | protected function addCatchAllWhereClause($q, $filter)
{
$alias = $this->getTableAlias();
return $this->addStandardCatchAllWhereClause(
$q,
$filter,
[$alias.'.name', $alias.'.website', $alias.'.description']
);
} | php | protected function addCatchAllWhereClause($q, $filter)
{
$alias = $this->getTableAlias();
return $this->addStandardCatchAllWhereClause(
$q,
$filter,
[$alias.'.name', $alias.'.website', $alias.'.description']
);
} | [
"protected",
"function",
"addCatchAllWhereClause",
"(",
"$",
"q",
",",
"$",
"filter",
")",
"{",
"$",
"alias",
"=",
"$",
"this",
"->",
"getTableAlias",
"(",
")",
";",
"return",
"$",
"this",
"->",
"addStandardCatchAllWhereClause",
"(",
"$",
"q",
",",
"$",
... | @param \Doctrine\ORM\QueryBuilder|\Doctrine\DBAL\Query\QueryBuilder $q
@param $filter
@return array | [
"@param",
"\\",
"Doctrine",
"\\",
"ORM",
"\\",
"QueryBuilder|",
"\\",
"Doctrine",
"\\",
"DBAL",
"\\",
"Query",
"\\",
"QueryBuilder",
"$q",
"@param",
"$filter"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/ContactClientRepository.php#L82-L91 |
TheDMSGroup/mautic-contact-client | Entity/StatRepository.php | StatRepository.getStats | public function getStats($contactClientId, $type, $fromDate = null, $toDate = null)
{
$q = $this->createQueryBuilder('s');
$expr = $q->expr()->andX(
$q->expr()->eq('IDENTITY(s.contactclient)', (int) $contactClientId),
$q->expr()->eq('s.type', ':type')
);
if ... | php | public function getStats($contactClientId, $type, $fromDate = null, $toDate = null)
{
$q = $this->createQueryBuilder('s');
$expr = $q->expr()->andX(
$q->expr()->eq('IDENTITY(s.contactclient)', (int) $contactClientId),
$q->expr()->eq('s.type', ':type')
);
if ... | [
"public",
"function",
"getStats",
"(",
"$",
"contactClientId",
",",
"$",
"type",
",",
"$",
"fromDate",
"=",
"null",
",",
"$",
"toDate",
"=",
"null",
")",
"{",
"$",
"q",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'s'",
")",
";",
"$",
"expr",
... | Fetch the base stat data from the database.
@param $contactClientId
@param $type
@param null $fromDate
@param null $toDate
@return array | [
"Fetch",
"the",
"base",
"stat",
"data",
"from",
"the",
"database",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/StatRepository.php#L31-L57 |
TheDMSGroup/mautic-contact-client | Entity/StatRepository.php | StatRepository.getSourcesByClient | public function getSourcesByClient(
$contactClientId,
\DateTime $dateFrom = null,
\DateTime $dateTo = null,
$type = null
) {
$q = $this->getEntityManager()->getConnection()->createQueryBuilder();
$q->select('distinct(s.utm_source)')
->from(MAUTIC_TABLE_PR... | php | public function getSourcesByClient(
$contactClientId,
\DateTime $dateFrom = null,
\DateTime $dateTo = null,
$type = null
) {
$q = $this->getEntityManager()->getConnection()->createQueryBuilder();
$q->select('distinct(s.utm_source)')
->from(MAUTIC_TABLE_PR... | [
"public",
"function",
"getSourcesByClient",
"(",
"$",
"contactClientId",
",",
"\\",
"DateTime",
"$",
"dateFrom",
"=",
"null",
",",
"\\",
"DateTime",
"$",
"dateTo",
"=",
"null",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"q",
"=",
"$",
"this",
"->",
... | @param $contactClientId
@param \DateTime|null $dateFrom
@param \DateTime|null $dateTo
@param string|null $type
@return array | [
"@param",
"$contactClientId",
"@param",
"\\",
"DateTime|null",
"$dateFrom",
"@param",
"\\",
"DateTime|null",
"$dateTo",
"@param",
"string|null",
"$type"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/StatRepository.php#L67-L100 |
TheDMSGroup/mautic-contact-client | Command/FilesCommand.php | FilesCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$container = $this->getContainer();
$options = $input->getOptions();
/** @var ContactClientModel $clientModel */
$clientModel = $container->get('mautic.contactclient.model.contactclient');
/** @var... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$container = $this->getContainer();
$options = $input->getOptions();
/** @var ContactClientModel $clientModel */
$clientModel = $container->get('mautic.contactclient.model.contactclient');
/** @var... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"options",
"=",
"$",
"input",
"->",
"getOptions",
"(",
... | Send appropriate client files. | [
"Send",
"appropriate",
"client",
"files",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Command/FilesCommand.php#L63-L171 |
TheDMSGroup/mautic-contact-client | Controller/ContactClientAccessTrait.php | ContactClientAccessTrait.checkContactClientAccess | protected function checkContactClientAccess($contactClientId, $action, $isPlugin = false, $integration = '')
{
if (!$contactClientId instanceof ContactClient) {
//make sure the user has view access to this contactClient
$contactClientModel = $this->getModel('contactClient');
... | php | protected function checkContactClientAccess($contactClientId, $action, $isPlugin = false, $integration = '')
{
if (!$contactClientId instanceof ContactClient) {
//make sure the user has view access to this contactClient
$contactClientModel = $this->getModel('contactClient');
... | [
"protected",
"function",
"checkContactClientAccess",
"(",
"$",
"contactClientId",
",",
"$",
"action",
",",
"$",
"isPlugin",
"=",
"false",
",",
"$",
"integration",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"contactClientId",
"instanceof",
"ContactClient",
")",
... | Determines if the user has access to the contactClient.
@param $contactClientId
@param $action
@param bool $isPlugin
@param string $integration
@return ContactClient | [
"Determines",
"if",
"the",
"user",
"has",
"access",
"to",
"the",
"contactClient",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Controller/ContactClientAccessTrait.php#L33-L87 |
TheDMSGroup/mautic-contact-client | Controller/ContactClientAccessTrait.php | ContactClientAccessTrait.checkContactClientFileAccess | protected function checkContactClientFileAccess($fileId, $action, $isPlugin = false, $integration = '')
{
if (!$fileId instanceof File) {
/** @var FileRepository $fileRepository */
$fileRepository = $this->getDoctrine()->getEntityManager()->getRepository(
'MauticConta... | php | protected function checkContactClientFileAccess($fileId, $action, $isPlugin = false, $integration = '')
{
if (!$fileId instanceof File) {
/** @var FileRepository $fileRepository */
$fileRepository = $this->getDoctrine()->getEntityManager()->getRepository(
'MauticConta... | [
"protected",
"function",
"checkContactClientFileAccess",
"(",
"$",
"fileId",
",",
"$",
"action",
",",
"$",
"isPlugin",
"=",
"false",
",",
"$",
"integration",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"fileId",
"instanceof",
"File",
")",
"{",
"/** @var File... | Determines if the user has access to a File.
@param $fileId
@param $action
@param bool $isPlugin
@param string $integration
@return File | [
"Determines",
"if",
"the",
"user",
"has",
"access",
"to",
"a",
"File",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Controller/ContactClientAccessTrait.php#L99-L156 |
TheDMSGroup/mautic-contact-client | Controller/ContactClientAccessTrait.php | ContactClientAccessTrait.checkAllAccess | protected function checkAllAccess($action, $limit)
{
/** @var ContactClientModel $model */
$model = $this->getModel('contactClient');
//make sure the user has view access to contactClients
$repo = $model->getRepository();
// order by lastactive, filter
$contactClien... | php | protected function checkAllAccess($action, $limit)
{
/** @var ContactClientModel $model */
$model = $this->getModel('contactClient');
//make sure the user has view access to contactClients
$repo = $model->getRepository();
// order by lastactive, filter
$contactClien... | [
"protected",
"function",
"checkAllAccess",
"(",
"$",
"action",
",",
"$",
"limit",
")",
"{",
"/** @var ContactClientModel $model */",
"$",
"model",
"=",
"$",
"this",
"->",
"getModel",
"(",
"'contactClient'",
")",
";",
"//make sure the user has view access to contactClien... | Returns contactClients the user has access to.
@param $action
@return array|\Symfony\Component\HttpFoundation\RedirectResponse | [
"Returns",
"contactClients",
"the",
"user",
"has",
"access",
"to",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Controller/ContactClientAccessTrait.php#L165-L200 |
TheDMSGroup/mautic-contact-client | Controller/ContactClientController.php | ContactClientController.indexAction | public function indexAction($page = 1)
{
// When the user inserts a numeric value, assume they want to find the entity by ID.
$session = $this->get('session');
$search = $this->request->get('search', $session->get('mautic.'.$this->getSessionBase().'.filter', ''));
if (isset($search)... | php | public function indexAction($page = 1)
{
// When the user inserts a numeric value, assume they want to find the entity by ID.
$session = $this->get('session');
$search = $this->request->get('search', $session->get('mautic.'.$this->getSessionBase().'.filter', ''));
if (isset($search)... | [
"public",
"function",
"indexAction",
"(",
"$",
"page",
"=",
"1",
")",
"{",
"// When the user inserts a numeric value, assume they want to find the entity by ID.",
"$",
"session",
"=",
"$",
"this",
"->",
"get",
"(",
"'session'",
")",
";",
"$",
"search",
"=",
"$",
"... | @param int $page
@return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse|Response | [
"@param",
"int",
"$page"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Controller/ContactClientController.php#L43-L64 |
TheDMSGroup/mautic-contact-client | Controller/ContactClientController.php | ContactClientController.customizeViewArguments | public function customizeViewArguments($args, $view)
{
if ('view' == $view) {
$session = $this->get('session');
/** @var \MauticPlugin\MauticContactClientBundle\Entity\ContactClient $item */
$item = $args['viewParameters']['item'];
// Setup page forms in ses... | php | public function customizeViewArguments($args, $view)
{
if ('view' == $view) {
$session = $this->get('session');
/** @var \MauticPlugin\MauticContactClientBundle\Entity\ContactClient $item */
$item = $args['viewParameters']['item'];
// Setup page forms in ses... | [
"public",
"function",
"customizeViewArguments",
"(",
"$",
"args",
",",
"$",
"view",
")",
"{",
"if",
"(",
"'view'",
"==",
"$",
"view",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"get",
"(",
"'session'",
")",
";",
"/** @var \\MauticPlugin\\MauticConta... | @param $args
@param $view
@return array | [
"@param",
"$args",
"@param",
"$view"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Controller/ContactClientController.php#L145-L233 |
TheDMSGroup/mautic-contact-client | Controller/ContactClientController.php | ContactClientController.getUpdateSelectParams | protected function getUpdateSelectParams(
$updateSelect,
$entity,
$nameMethod = 'getName',
$groupMethod = 'getLanguage'
) {
$options = [
'updateSelect' => $updateSelect,
'id' => $entity->getId(),
'name' => $entity->$nameMe... | php | protected function getUpdateSelectParams(
$updateSelect,
$entity,
$nameMethod = 'getName',
$groupMethod = 'getLanguage'
) {
$options = [
'updateSelect' => $updateSelect,
'id' => $entity->getId(),
'name' => $entity->$nameMe... | [
"protected",
"function",
"getUpdateSelectParams",
"(",
"$",
"updateSelect",
",",
"$",
"entity",
",",
"$",
"nameMethod",
"=",
"'getName'",
",",
"$",
"groupMethod",
"=",
"'getLanguage'",
")",
"{",
"$",
"options",
"=",
"[",
"'updateSelect'",
"=>",
"$",
"updateSel... | Return array of options update select response.
@param string $updateSelect HTML id of the select
@param object $entity
@param string $nameMethod name of the entity method holding the name
@param string $groupMethod name of the entity method holding the select group
@return array | [
"Return",
"array",
"of",
"options",
"update",
"select",
"response",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Controller/ContactClientController.php#L296-L309 |
TheDMSGroup/mautic-contact-client | Controller/TransactionsController.php | TransactionsController.exportAction | public function exportAction(Request $request, $objectId)
{
$entityManager = $this->getDoctrine()->getManager();
if (empty($objectId)) {
return $this->accessDenied();
}
// If contactclient:export:disable is true, deny access
// since Admin permissions are always... | php | public function exportAction(Request $request, $objectId)
{
$entityManager = $this->getDoctrine()->getManager();
if (empty($objectId)) {
return $this->accessDenied();
}
// If contactclient:export:disable is true, deny access
// since Admin permissions are always... | [
"public",
"function",
"exportAction",
"(",
"Request",
"$",
"request",
",",
"$",
"objectId",
")",
"{",
"$",
"entityManager",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"objectId",
")... | @param Request $request
@param $objectId
@return array|\MauticPlugin\MauticContactClientBundle\Entity\ContactClient|\Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse|StreamedResponse | [
"@param",
"Request",
"$request",
"@param",
"$objectId"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Controller/TransactionsController.php#L34-L139 |
TheDMSGroup/mautic-contact-client | Controller/TransactionsController.php | TransactionsController.parseLogJSONBlob | private function parseLogJSONBlob($data)
{
$json = json_decode($data['logs'], true);
unset($data['logs']);
$rows = [];
$data['request_format'] = '';
$data['request_method'] = '';
$data['request_headers'] = '';
$data['request_body']... | php | private function parseLogJSONBlob($data)
{
$json = json_decode($data['logs'], true);
unset($data['logs']);
$rows = [];
$data['request_format'] = '';
$data['request_method'] = '';
$data['request_headers'] = '';
$data['request_body']... | [
"private",
"function",
"parseLogJSONBlob",
"(",
"$",
"data",
")",
"{",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"data",
"[",
"'logs'",
"]",
",",
"true",
")",
";",
"unset",
"(",
"$",
"data",
"[",
"'logs'",
"]",
")",
";",
"$",
"rows",
"=",
"[",
"... | @param $data
@return array | [
"@param",
"$data"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Controller/TransactionsController.php#L146-L199 |
TheDMSGroup/mautic-contact-client | Controller/TransactionsController.php | TransactionsController.parseLogYAMLBlob | private function parseLogYAMLBlob($data)
{
$yaml = Yaml::parse($data['logs']);
unset($data['logs']);
$rows = [];
$data['request_format'] = '';
$data['request_method'] = '';
$data['request_headers'] = '';
$data['request_body'] ... | php | private function parseLogYAMLBlob($data)
{
$yaml = Yaml::parse($data['logs']);
unset($data['logs']);
$rows = [];
$data['request_format'] = '';
$data['request_method'] = '';
$data['request_headers'] = '';
$data['request_body'] ... | [
"private",
"function",
"parseLogYAMLBlob",
"(",
"$",
"data",
")",
"{",
"$",
"yaml",
"=",
"Yaml",
"::",
"parse",
"(",
"$",
"data",
"[",
"'logs'",
"]",
")",
";",
"unset",
"(",
"$",
"data",
"[",
"'logs'",
"]",
")",
";",
"$",
"rows",
"=",
"[",
"]",
... | @param $data
@return array | [
"@param",
"$data"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Controller/TransactionsController.php#L206-L259 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadAuth.php | ApiPayloadAuth.getStartOperation | public function getStartOperation()
{
$id = 0;
if ($this->hasAuthRequest()) {
// Step through operations, skipping any at the beginning that can be skipped.
foreach ($this->operations as $id => $operation) {
if ($id == count($this->operations) - 1) {
... | php | public function getStartOperation()
{
$id = 0;
if ($this->hasAuthRequest()) {
// Step through operations, skipping any at the beginning that can be skipped.
foreach ($this->operations as $id => $operation) {
if ($id == count($this->operations) - 1) {
... | [
"public",
"function",
"getStartOperation",
"(",
")",
"{",
"$",
"id",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"hasAuthRequest",
"(",
")",
")",
"{",
"// Step through operations, skipping any at the beginning that can be skipped.",
"foreach",
"(",
"$",
"this",
"... | Step forward through operations to find the one we MUST start with.
@return array | [
"Step",
"forward",
"through",
"operations",
"to",
"find",
"the",
"one",
"we",
"MUST",
"start",
"with",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadAuth.php#L130-L170 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadAuth.php | ApiPayloadAuth.hasAuthRequest | public function hasAuthRequest($operationId = null)
{
if (null === $this->authRequestOperations) {
$this->authRequestOperations = [];
if (count($this->operations) > 1) {
foreach ($this->operations as $id => $operation) {
if (
... | php | public function hasAuthRequest($operationId = null)
{
if (null === $this->authRequestOperations) {
$this->authRequestOperations = [];
if (count($this->operations) > 1) {
foreach ($this->operations as $id => $operation) {
if (
... | [
"public",
"function",
"hasAuthRequest",
"(",
"$",
"operationId",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"authRequestOperations",
")",
"{",
"$",
"this",
"->",
"authRequestOperations",
"=",
"[",
"]",
";",
"if",
"(",
"count",
"(... | @param null $operationId
@return bool | [
"@param",
"null",
"$operationId"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadAuth.php#L177-L195 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadAuth.php | ApiPayloadAuth.operationUpdatesContact | private function operationUpdatesContact($operation)
{
if (isset($operation->response)) {
foreach (['headers', 'body'] as $fieldType) {
if (is_array($operation->response->{$fieldType})) {
foreach ($operation->response->{$fieldType} as $field) {
... | php | private function operationUpdatesContact($operation)
{
if (isset($operation->response)) {
foreach (['headers', 'body'] as $fieldType) {
if (is_array($operation->response->{$fieldType})) {
foreach ($operation->response->{$fieldType} as $field) {
... | [
"private",
"function",
"operationUpdatesContact",
"(",
"$",
"operation",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"operation",
"->",
"response",
")",
")",
"{",
"foreach",
"(",
"[",
"'headers'",
",",
"'body'",
"]",
"as",
"$",
"fieldType",
")",
"{",
"if",
... | @param $operation
@return bool | [
"@param",
"$operation"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadAuth.php#L202-L220 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadAuth.php | ApiPayloadAuth.determineOperationRequirements | private function determineOperationRequirements()
{
if (null === $this->requiredPayloadTokens) {
$this->requiredPayloadTokens = [];
$valueSources = ['value', 'default_value'];
if ($this->test) {
$valueSources = ['test_value', 'value', 'default_value'];
... | php | private function determineOperationRequirements()
{
if (null === $this->requiredPayloadTokens) {
$this->requiredPayloadTokens = [];
$valueSources = ['value', 'default_value'];
if ($this->test) {
$valueSources = ['test_value', 'value', 'default_value'];
... | [
"private",
"function",
"determineOperationRequirements",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"requiredPayloadTokens",
")",
"{",
"$",
"this",
"->",
"requiredPayloadTokens",
"=",
"[",
"]",
";",
"$",
"valueSources",
"=",
"[",
"'value'",
... | Discern the tokens that are required by operation ID. | [
"Discern",
"the",
"tokens",
"that",
"are",
"required",
"by",
"operation",
"ID",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadAuth.php#L225-L275 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadAuth.php | ApiPayloadAuth.loadPreviousPayloadAuthTokens | private function loadPreviousPayloadAuthTokens()
{
if (!$this->previousPayloadAuthTokens) {
$this->previousPayloadAuthTokens = $this->getAuthRepository()->getPreviousPayloadAuthTokensByContactClient(
$this->contactClient->getId(),
null,
$this->test... | php | private function loadPreviousPayloadAuthTokens()
{
if (!$this->previousPayloadAuthTokens) {
$this->previousPayloadAuthTokens = $this->getAuthRepository()->getPreviousPayloadAuthTokensByContactClient(
$this->contactClient->getId(),
null,
$this->test... | [
"private",
"function",
"loadPreviousPayloadAuthTokens",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"previousPayloadAuthTokens",
")",
"{",
"$",
"this",
"->",
"previousPayloadAuthTokens",
"=",
"$",
"this",
"->",
"getAuthRepository",
"(",
")",
"->",
"getPrev... | Load up the previously stored payload tokens. | [
"Load",
"up",
"the",
"previously",
"stored",
"payload",
"tokens",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadAuth.php#L280-L289 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadAuth.php | ApiPayloadAuth.savePayloadAuthTokens | public function savePayloadAuthTokens($operationId, $fieldSets)
{
if (!$fieldSets) {
return;
}
$repo = $this->getAuthRepository();
$repo->flushPreviousAuthTokens($this->contactClient->getId(), $operationId, $this->test);
$entities = [];
foreach ($fieldSet... | php | public function savePayloadAuthTokens($operationId, $fieldSets)
{
if (!$fieldSets) {
return;
}
$repo = $this->getAuthRepository();
$repo->flushPreviousAuthTokens($this->contactClient->getId(), $operationId, $this->test);
$entities = [];
foreach ($fieldSet... | [
"public",
"function",
"savePayloadAuthTokens",
"(",
"$",
"operationId",
",",
"$",
"fieldSets",
")",
"{",
"if",
"(",
"!",
"$",
"fieldSets",
")",
"{",
"return",
";",
"}",
"$",
"repo",
"=",
"$",
"this",
"->",
"getAuthRepository",
"(",
")",
";",
"$",
"repo... | Given an array from the response object (headers and body) save as new Auth entities.
Flush previous entries for this operation.
@param $operationId
@param $fieldSets | [
"Given",
"an",
"array",
"from",
"the",
"response",
"object",
"(",
"headers",
"and",
"body",
")",
"save",
"as",
"new",
"Auth",
"entities",
".",
"Flush",
"previous",
"entries",
"for",
"this",
"operation",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadAuth.php#L318-L342 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.createForm | public function createForm($entity, $formFactory, $action = null, $options = [])
{
if (!$entity instanceof ContactClient) {
throw new MethodNotAllowedHttpException(['ContactClient']);
}
if (!empty($action)) {
$options['action'] = $action;
}
// Preven... | php | public function createForm($entity, $formFactory, $action = null, $options = [])
{
if (!$entity instanceof ContactClient) {
throw new MethodNotAllowedHttpException(['ContactClient']);
}
if (!empty($action)) {
$options['action'] = $action;
}
// Preven... | [
"public",
"function",
"createForm",
"(",
"$",
"entity",
",",
"$",
"formFactory",
",",
"$",
"action",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"ContactClient",
")",
"{",
"throw",
"new",
"M... | {@inheritdoc}
@param object $entity
@param \Symfony\Component\Form\FormFactory $formFactory
@param string $action
@param array $options
@throws NotFoundHttpException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L103-L117 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.saveEntity | public function saveEntity($entity, $unlock = true)
{
parent::saveEntity($entity, $unlock);
$this->getRepository()->saveEntity($entity);
} | php | public function saveEntity($entity, $unlock = true)
{
parent::saveEntity($entity, $unlock);
$this->getRepository()->saveEntity($entity);
} | [
"public",
"function",
"saveEntity",
"(",
"$",
"entity",
",",
"$",
"unlock",
"=",
"true",
")",
"{",
"parent",
"::",
"saveEntity",
"(",
"$",
"entity",
",",
"$",
"unlock",
")",
";",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"saveEntity",
"(",
... | {@inheritdoc}
@param ContactClient $entity
@param bool|false $unlock | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L139-L144 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.addStat | public function addStat(
ContactClient $contactClient = null,
$type = null,
Contact $contact = null,
$attribution = 0,
$utmSource = '',
$campaignId = 0,
$eventId = 0
) {
$stat = new Stat();
$stat->setDateAdded(new \DateTime());
if ($typ... | php | public function addStat(
ContactClient $contactClient = null,
$type = null,
Contact $contact = null,
$attribution = 0,
$utmSource = '',
$campaignId = 0,
$eventId = 0
) {
$stat = new Stat();
$stat->setDateAdded(new \DateTime());
if ($typ... | [
"public",
"function",
"addStat",
"(",
"ContactClient",
"$",
"contactClient",
"=",
"null",
",",
"$",
"type",
"=",
"null",
",",
"Contact",
"$",
"contact",
"=",
"null",
",",
"$",
"attribution",
"=",
"0",
",",
"$",
"utmSource",
"=",
"''",
",",
"$",
"campai... | Add a stat entry.
@param ContactClient|null $contactClient
@param null $type
@param Contact|null $contact
@param int $attribution
@param string $utmSource
@param int $campaignId
@param int $eventId | [
"Add",
"a",
"stat",
"entry",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L167-L208 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.getStatRepository | public function getStatRepository()
{
if (!$this->em->isOpen()) {
$this->em = $this->em->create(
$this->em->getConnection(),
$this->em->getConfiguration(),
$this->em->getEventManager()
);
}
return $this->em->getReposito... | php | public function getStatRepository()
{
if (!$this->em->isOpen()) {
$this->em = $this->em->create(
$this->em->getConnection(),
$this->em->getConfiguration(),
$this->em->getEventManager()
);
}
return $this->em->getReposito... | [
"public",
"function",
"getStatRepository",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"em",
"->",
"isOpen",
"(",
")",
")",
"{",
"$",
"this",
"->",
"em",
"=",
"$",
"this",
"->",
"em",
"->",
"create",
"(",
"$",
"this",
"->",
"em",
"->",
"g... | {@inheritdoc}
@return \MauticPlugin\MauticContactClientBundle\Entity\StatRepository | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L215-L226 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.addEvent | public function addEvent(
ContactClient $contactClient = null,
$type = null,
Contact $contact = null,
$logs = null,
$message = null,
$integrationEntityId = null
) {
$event = new EventEntity();
$event->setDateAdded(new \DateTime());
if ($type) {... | php | public function addEvent(
ContactClient $contactClient = null,
$type = null,
Contact $contact = null,
$logs = null,
$message = null,
$integrationEntityId = null
) {
$event = new EventEntity();
$event->setDateAdded(new \DateTime());
if ($type) {... | [
"public",
"function",
"addEvent",
"(",
"ContactClient",
"$",
"contactClient",
"=",
"null",
",",
"$",
"type",
"=",
"null",
",",
"Contact",
"$",
"contact",
"=",
"null",
",",
"$",
"logs",
"=",
"null",
",",
"$",
"message",
"=",
"null",
",",
"$",
"integrati... | Add transactional log in contactclient_events.
@param ContactClient|null $contactClient
@param string $type
@param Contact|null $contact
@param null $logs
@param null $message
@param null $integrationEntityId | [
"Add",
"transactional",
"log",
"in",
"contactclient_events",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L238-L268 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.getStats | public function getStats(
ContactClient $contactClient,
$unit,
\DateTime $dateFrom = null,
\DateTime $dateTo = null,
$campaignId = null,
$dateFormat = null,
$canViewOthers = true
) {
$query = new ChartQuery($this->em->getConnection(), $dateFrom, $dateT... | php | public function getStats(
ContactClient $contactClient,
$unit,
\DateTime $dateFrom = null,
\DateTime $dateTo = null,
$campaignId = null,
$dateFormat = null,
$canViewOthers = true
) {
$query = new ChartQuery($this->em->getConnection(), $dateFrom, $dateT... | [
"public",
"function",
"getStats",
"(",
"ContactClient",
"$",
"contactClient",
",",
"$",
"unit",
",",
"\\",
"DateTime",
"$",
"dateFrom",
"=",
"null",
",",
"\\",
"DateTime",
"$",
"dateTo",
"=",
"null",
",",
"$",
"campaignId",
"=",
"null",
",",
"$",
"dateFo... | @param ContactClient $contactClient
@param $unit
@param \DateTime|null $dateFrom
@param \DateTime|null $dateTo
@param null $campaignId
@param null $dateFormat
@param bool $canViewOthers
@return array | [
"@param",
"ContactClient",
"$contactClient",
"@param",
"$unit",
"@param",
"\\",
"DateTime|null",
"$dateFrom",
"@param",
"\\",
"DateTime|null",
"$dateTo",
"@param",
"null",
"$campaignId",
"@param",
"null",
"$dateFormat",
"@param",
"bool",
"$canViewOthers"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L291-L367 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.getTimeUnitFromDateRange | public function getTimeUnitFromDateRange($dateFrom, $dateTo)
{
$dayDiff = $dateTo->diff($dateFrom)->format('%a');
$unit = 'd';
if ($dayDiff <= 1) {
$unit = 'H';
$sameDay = $dateTo->format('d') == $dateFrom->format('d') ? 1 : 0;
$hourDiff = $dateT... | php | public function getTimeUnitFromDateRange($dateFrom, $dateTo)
{
$dayDiff = $dateTo->diff($dateFrom)->format('%a');
$unit = 'd';
if ($dayDiff <= 1) {
$unit = 'H';
$sameDay = $dateTo->format('d') == $dateFrom->format('d') ? 1 : 0;
$hourDiff = $dateT... | [
"public",
"function",
"getTimeUnitFromDateRange",
"(",
"$",
"dateFrom",
",",
"$",
"dateTo",
")",
"{",
"$",
"dayDiff",
"=",
"$",
"dateTo",
"->",
"diff",
"(",
"$",
"dateFrom",
")",
"->",
"format",
"(",
"'%a'",
")",
";",
"$",
"unit",
"=",
"'d'",
";",
"i... | Returns appropriate time unit from a date range so the line/bar charts won't be too full/empty.
@param $dateFrom
@param $dateTo
@return string | [
"Returns",
"appropriate",
"time",
"unit",
"from",
"a",
"date",
"range",
"so",
"the",
"line",
"/",
"bar",
"charts",
"won",
"t",
"be",
"too",
"full",
"/",
"empty",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L377-L407 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.limitQueryToCreator | public function limitQueryToCreator(QueryBuilder $q)
{
$q->join('t', MAUTIC_TABLE_PREFIX.'contactclient', 'm', 'e.id = t.contactclient_id')
->andWhere('m.created_by = :userId')
->setParameter('userId', $this->userHelper->getUser()->getId());
} | php | public function limitQueryToCreator(QueryBuilder $q)
{
$q->join('t', MAUTIC_TABLE_PREFIX.'contactclient', 'm', 'e.id = t.contactclient_id')
->andWhere('m.created_by = :userId')
->setParameter('userId', $this->userHelper->getUser()->getId());
} | [
"public",
"function",
"limitQueryToCreator",
"(",
"QueryBuilder",
"$",
"q",
")",
"{",
"$",
"q",
"->",
"join",
"(",
"'t'",
",",
"MAUTIC_TABLE_PREFIX",
".",
"'contactclient'",
",",
"'m'",
",",
"'e.id = t.contactclient_id'",
")",
"->",
"andWhere",
"(",
"'m.created_... | Joins the email table and limits created_by to currently logged in user.
@param QueryBuilder $q | [
"Joins",
"the",
"email",
"table",
"and",
"limits",
"created_by",
"to",
"currently",
"logged",
"in",
"user",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L414-L419 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.getStatsBySource | public function getStatsBySource(
ContactClient $contactClient,
$unit,
$type,
\DateTime $dateFrom = null,
\DateTime $dateTo = null,
$campaignId = null,
$dateFormat = null,
$canViewOthers = true
) {
$unit = (null === $unit) ? $this->ge... | php | public function getStatsBySource(
ContactClient $contactClient,
$unit,
$type,
\DateTime $dateFrom = null,
\DateTime $dateTo = null,
$campaignId = null,
$dateFormat = null,
$canViewOthers = true
) {
$unit = (null === $unit) ? $this->ge... | [
"public",
"function",
"getStatsBySource",
"(",
"ContactClient",
"$",
"contactClient",
",",
"$",
"unit",
",",
"$",
"type",
",",
"\\",
"DateTime",
"$",
"dateFrom",
"=",
"null",
",",
"\\",
"DateTime",
"$",
"dateTo",
"=",
"null",
",",
"$",
"campaignId",
"=",
... | @param ContactClient $contactClient
@param $unit
@param $type
@param \DateTime|null $dateFrom
@param \DateTime|null $dateTo
@param null $campaignId
@param null $dateFormat
@param bool $canViewOthers
@return array | [
"@param",
"ContactClient",
"$contactClient",
"@param",
"$unit",
"@param",
"$type",
"@param",
"\\",
"DateTime|null",
"$dateFrom",
"@param",
"\\",
"DateTime|null",
"$dateTo",
"@param",
"null",
"$campaignId",
"@param",
"null",
"$dateFormat",
"@param",
"bool",
"$canViewOthe... | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L433-L558 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.getFiles | public function getFiles(
ContactClient $contactClient,
array $filters = [],
array $orderBy = [],
$page = 1,
$limit = 25
) {
$args = array_merge($filters, $orderBy);
$args['page'] = $page;
$args['limit'] = $limit;
/** @var \MauticPlu... | php | public function getFiles(
ContactClient $contactClient,
array $filters = [],
array $orderBy = [],
$page = 1,
$limit = 25
) {
$args = array_merge($filters, $orderBy);
$args['page'] = $page;
$args['limit'] = $limit;
/** @var \MauticPlu... | [
"public",
"function",
"getFiles",
"(",
"ContactClient",
"$",
"contactClient",
",",
"array",
"$",
"filters",
"=",
"[",
"]",
",",
"array",
"$",
"orderBy",
"=",
"[",
"]",
",",
"$",
"page",
"=",
"1",
",",
"$",
"limit",
"=",
"25",
")",
"{",
"$",
"args",... | @param ContactClient $contactClient
@param array $filters
@param array $orderBy
@param int $page
@param int $limit
@return array|\Doctrine\ORM\Internal\Hydration\IterableResult|\Doctrine\ORM\Tools\Pagination\Paginator | [
"@param",
"ContactClient",
"$contactClient",
"@param",
"array",
"$filters",
"@param",
"array",
"$orderBy",
"@param",
"int",
"$page",
"@param",
"int",
"$limit"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L569-L584 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.getEngagements | public function getEngagements(
ContactClient $contactClient,
$filters = [],
$orderBy = [],
$page = 1,
$limit = 25,
$forTimeline = true
) {
/** @var \MauticPlugin\MauticContactClientBundle\Event\ContactClientTimelineEvent $event */
$event = $this->disp... | php | public function getEngagements(
ContactClient $contactClient,
$filters = [],
$orderBy = [],
$page = 1,
$limit = 25,
$forTimeline = true
) {
/** @var \MauticPlugin\MauticContactClientBundle\Event\ContactClientTimelineEvent $event */
$event = $this->disp... | [
"public",
"function",
"getEngagements",
"(",
"ContactClient",
"$",
"contactClient",
",",
"$",
"filters",
"=",
"[",
"]",
",",
"$",
"orderBy",
"=",
"[",
"]",
",",
"$",
"page",
"=",
"1",
",",
"$",
"limit",
"=",
"25",
",",
"$",
"forTimeline",
"=",
"true"... | Get timeline/engagement data.
@param ContactClient|null $contactClient
@param array $filters
@param array $orderBy
@param int $page
@param int $limit
@param bool $forTimeline
@return array | [
"Get",
"timeline",
"/",
"engagement",
"data",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L598-L621 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.getEngagementCount | public function getEngagementCount(
ContactClient $contactClient,
\DateTime $dateFrom = null,
\DateTime $dateTo = null,
$unit = 'm',
ChartQuery $chartQuery = null
) {
$event = new ContactClientTimelineEvent($contactClient);
$event->setCountOnly($dateFrom, $dat... | php | public function getEngagementCount(
ContactClient $contactClient,
\DateTime $dateFrom = null,
\DateTime $dateTo = null,
$unit = 'm',
ChartQuery $chartQuery = null
) {
$event = new ContactClientTimelineEvent($contactClient);
$event->setCountOnly($dateFrom, $dat... | [
"public",
"function",
"getEngagementCount",
"(",
"ContactClient",
"$",
"contactClient",
",",
"\\",
"DateTime",
"$",
"dateFrom",
"=",
"null",
",",
"\\",
"DateTime",
"$",
"dateTo",
"=",
"null",
",",
"$",
"unit",
"=",
"'m'",
",",
"ChartQuery",
"$",
"chartQuery"... | Get engagement counts by time unit.
@param ContactClient $contactClient
@param \DateTime|null $dateFrom
@param \DateTime|null $dateTo
@param string $unit
@param ChartQuery|null $chartQuery
@return array | [
"Get",
"engagement",
"counts",
"by",
"time",
"unit",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L647-L660 |
TheDMSGroup/mautic-contact-client | Model/ContactClientModel.php | ContactClientModel.dispatchEvent | protected function dispatchEvent($action, &$entity, $isNew = false, Event $event = null)
{
if (!$entity instanceof ContactClient) {
throw new MethodNotAllowedHttpException(['ContactClient']);
}
switch ($action) {
case 'pre_save':
$name = ContactClient... | php | protected function dispatchEvent($action, &$entity, $isNew = false, Event $event = null)
{
if (!$entity instanceof ContactClient) {
throw new MethodNotAllowedHttpException(['ContactClient']);
}
switch ($action) {
case 'pre_save':
$name = ContactClient... | [
"protected",
"function",
"dispatchEvent",
"(",
"$",
"action",
",",
"&",
"$",
"entity",
",",
"$",
"isNew",
"=",
"false",
",",
"Event",
"$",
"event",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"ContactClient",
")",
"{",
"throw",
... | {@inheritdoc}
@return bool|ContactClientEvent
@throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ContactClientModel.php#L692-L727 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadOperation.php | ApiPayloadOperation.run | public function run()
{
if (empty($this->request)) {
$this->setLogs('Skipping empty operation: '.$this->name, 'notice');
return true;
}
$this->setLogs($this->name, 'name');
$this->setLogs(($this->test ? 'TEST' : 'PROD'), 'mode');
// Send the API req... | php | public function run()
{
if (empty($this->request)) {
$this->setLogs('Skipping empty operation: '.$this->name, 'notice');
return true;
}
$this->setLogs($this->name, 'name');
$this->setLogs(($this->test ? 'TEST' : 'PROD'), 'mode');
// Send the API req... | [
"public",
"function",
"run",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"request",
")",
")",
"{",
"$",
"this",
"->",
"setLogs",
"(",
"'Skipping empty operation: '",
".",
"$",
"this",
"->",
"name",
",",
"'notice'",
")",
";",
"return",
... | Run this single API Operation.
@return $this|bool
@throws \Exception | [
"Run",
"this",
"single",
"API",
"Operation",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadOperation.php#L120-L162 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadOperation.php | ApiPayloadOperation.updatePayloadResponse | public function updatePayloadResponse()
{
$result = $this->responseExpected;
$updates = false;
foreach (['headers', 'body'] as $type) {
if (isset($this->responseActual[$type])) {
$fieldKeys = [];
foreach ($result->{$type} as $id => $value) {
... | php | public function updatePayloadResponse()
{
$result = $this->responseExpected;
$updates = false;
foreach (['headers', 'body'] as $type) {
if (isset($this->responseActual[$type])) {
$fieldKeys = [];
foreach ($result->{$type} as $id => $value) {
... | [
"public",
"function",
"updatePayloadResponse",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"responseExpected",
";",
"$",
"updates",
"=",
"false",
";",
"foreach",
"(",
"[",
"'headers'",
",",
"'body'",
"]",
"as",
"$",
"type",
")",
"{",
"if",
"(... | Automatically updates a response with filled in data from the parsed response object from the API. | [
"Automatically",
"updates",
"a",
"response",
"with",
"filled",
"in",
"data",
"from",
"the",
"parsed",
"response",
"object",
"from",
"the",
"API",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadOperation.php#L167-L238 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadOperation.php | ApiPayloadOperation.getResponseMap | public function getResponseMap()
{
$mappedFields = [];
foreach (['headers', 'body'] as $type) {
if (isset($this->responseExpected->{$type}) && isset($this->responseActual[$type])) {
foreach ($this->responseExpected->{$type} as $value) {
if (!empty($val... | php | public function getResponseMap()
{
$mappedFields = [];
foreach (['headers', 'body'] as $type) {
if (isset($this->responseExpected->{$type}) && isset($this->responseActual[$type])) {
foreach ($this->responseExpected->{$type} as $value) {
if (!empty($val... | [
"public",
"function",
"getResponseMap",
"(",
")",
"{",
"$",
"mappedFields",
"=",
"[",
"]",
";",
"foreach",
"(",
"[",
"'headers'",
",",
"'body'",
"]",
"as",
"$",
"type",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"responseExpected",
"->",
"... | Get filled responses that have Contact destinations defined.
@return array | [
"Get",
"filled",
"responses",
"that",
"have",
"Contact",
"destinations",
"defined",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadOperation.php#L314-L329 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadOperation.php | ApiPayloadOperation.getExternalId | public function getExternalId()
{
$externalIds = array_flip($this->externalIds);
$id = null;
$idIndex = null;
foreach (['headers', 'body'] as $type) {
if (isset($this->responseActual[$type]) && isset($this->responseActual[$type])) {
foreach ($... | php | public function getExternalId()
{
$externalIds = array_flip($this->externalIds);
$id = null;
$idIndex = null;
foreach (['headers', 'body'] as $type) {
if (isset($this->responseActual[$type]) && isset($this->responseActual[$type])) {
foreach ($... | [
"public",
"function",
"getExternalId",
"(",
")",
"{",
"$",
"externalIds",
"=",
"array_flip",
"(",
"$",
"this",
"->",
"externalIds",
")",
";",
"$",
"id",
"=",
"null",
";",
"$",
"idIndex",
"=",
"null",
";",
"foreach",
"(",
"[",
"'headers'",
",",
"'body'"... | Given the response fields, attempt to assume an external ID for future correlation.
Find the best possible fit. | [
"Given",
"the",
"response",
"fields",
"attempt",
"to",
"assume",
"an",
"external",
"ID",
"for",
"future",
"correlation",
".",
"Find",
"the",
"best",
"possible",
"fit",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadOperation.php#L335-L356 |
TheDMSGroup/mautic-contact-client | Entity/ContactClient.php | ContactClient.setDncChecks | public function setDncChecks($dnc_checks)
{
if (is_array($dnc_checks)) {
$dnc_checks = implode(',', $dnc_checks);
}
$this->isChanged('dncChecks', $dnc_checks);
$this->dnc_checks = $dnc_checks;
return $this;
} | php | public function setDncChecks($dnc_checks)
{
if (is_array($dnc_checks)) {
$dnc_checks = implode(',', $dnc_checks);
}
$this->isChanged('dncChecks', $dnc_checks);
$this->dnc_checks = $dnc_checks;
return $this;
} | [
"public",
"function",
"setDncChecks",
"(",
"$",
"dnc_checks",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"dnc_checks",
")",
")",
"{",
"$",
"dnc_checks",
"=",
"implode",
"(",
"','",
",",
"$",
"dnc_checks",
")",
";",
"}",
"$",
"this",
"->",
"isChanged",
... | @param $dnc_checks
@return $this | [
"@param",
"$dnc_checks"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Entity/ContactClient.php#L887-L896 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadResponse.php | ApiPayloadResponse.parse | public function parse()
{
$result = [];
$result['status'] = $this->service->getStatusCode();
$this->setLogs($result['status'], 'status');
// Format the head response.
$result['headers'] = $this->service->getHeaders();
if ($result['headers']) {
$result['h... | php | public function parse()
{
$result = [];
$result['status'] = $this->service->getStatusCode();
$this->setLogs($result['status'], 'status');
// Format the head response.
$result['headers'] = $this->service->getHeaders();
if ($result['headers']) {
$result['h... | [
"public",
"function",
"parse",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"result",
"[",
"'status'",
"]",
"=",
"$",
"this",
"->",
"service",
"->",
"getStatusCode",
"(",
")",
";",
"$",
"this",
"->",
"setLogs",
"(",
"$",
"result",
"[",
... | Parse the response and capture key=value pairs.
@return $this
@throws \Exception | [
"Parse",
"the",
"response",
"and",
"capture",
"key",
"=",
"value",
"pairs",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadResponse.php#L81-L160 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadResponse.php | ApiPayloadResponse.getResponseArray | private function getResponseArray($data, $responseExpectedFormat = 'json')
{
$result = $hierarchy = [];
try {
switch ($responseExpectedFormat) {
case 'headers':
foreach ($data as $key => $array) {
$result[$key] = implode('; ', $... | php | private function getResponseArray($data, $responseExpectedFormat = 'json')
{
$result = $hierarchy = [];
try {
switch ($responseExpectedFormat) {
case 'headers':
foreach ($data as $key => $array) {
$result[$key] = implode('; ', $... | [
"private",
"function",
"getResponseArray",
"(",
"$",
"data",
",",
"$",
"responseExpectedFormat",
"=",
"'json'",
")",
"{",
"$",
"result",
"=",
"$",
"hierarchy",
"=",
"[",
"]",
";",
"try",
"{",
"switch",
"(",
"$",
"responseExpectedFormat",
")",
"{",
"case",
... | Given a headers array or body of text and a format, parse to a flat key=value array.
@param mixed $data
@param string $responseExpectedFormat
@return array|bool return false if there is an error or we are unable to parse
@throws \Exception | [
"Given",
"a",
"headers",
"array",
"or",
"body",
"of",
"text",
"and",
"a",
"format",
"parse",
"to",
"a",
"flat",
"key",
"=",
"value",
"array",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadResponse.php#L172-L294 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadResponse.php | ApiPayloadResponse.flattenStructure | private function flattenStructure($subject, &$result = [], $prefix = '', $delimiter = '.')
{
foreach ($subject as $key => $value) {
if (is_array($value) || is_object($value)) {
$this->flattenStructure($value, $result, $prefix ? $prefix.$delimiter.$key : $key);
} else ... | php | private function flattenStructure($subject, &$result = [], $prefix = '', $delimiter = '.')
{
foreach ($subject as $key => $value) {
if (is_array($value) || is_object($value)) {
$this->flattenStructure($value, $result, $prefix ? $prefix.$delimiter.$key : $key);
} else ... | [
"private",
"function",
"flattenStructure",
"(",
"$",
"subject",
",",
"&",
"$",
"result",
"=",
"[",
"]",
",",
"$",
"prefix",
"=",
"''",
",",
"$",
"delimiter",
"=",
"'.'",
")",
"{",
"foreach",
"(",
"$",
"subject",
"as",
"$",
"key",
"=>",
"$",
"value"... | Recursively flatten an structure to an array including only key/value pairs.
@param $subject
@param array $result
@param string $prefix
@param string $delimiter
@return array | [
"Recursively",
"flatten",
"an",
"structure",
"to",
"an",
"array",
"including",
"only",
"key",
"/",
"value",
"pairs",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadResponse.php#L351-L377 |
TheDMSGroup/mautic-contact-client | Model/ApiPayloadResponse.php | ApiPayloadResponse.validate | public function validate()
{
if ($this->valid) {
if (!$this->responseActual) {
throw new ContactClientException(
'There was no response to parse.',
0,
null,
Stat::TYPE_ERROR,
true
... | php | public function validate()
{
if ($this->valid) {
if (!$this->responseActual) {
throw new ContactClientException(
'There was no response to parse.',
0,
null,
Stat::TYPE_ERROR,
true
... | [
"public",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"valid",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"responseActual",
")",
"{",
"throw",
"new",
"ContactClientException",
"(",
"'There was no response to parse.'",
",",
"0",
"... | Given the recent response, evaluate it for success based on the expected success validator.
@return bool
@throws ContactClientException | [
"Given",
"the",
"recent",
"response",
"evaluate",
"it",
"for",
"success",
"based",
"on",
"the",
"expected",
"success",
"validator",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/ApiPayloadResponse.php#L386-L508 |
TheDMSGroup/mautic-contact-client | Command/SendContactCommand.php | SendContactCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$options = $input->getOptions();
$container = $this->getContainer();
$translator = $container->get('translator');
if (!$this->checkRunStatus($input, $output, $options['client'].$options['contact'])) {
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$options = $input->getOptions();
$container = $this->getContainer();
$translator = $container->get('translator');
if (!$this->checkRunStatus($input, $output, $options['client'].$options['contact'])) {
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"options",
"=",
"$",
"input",
"->",
"getOptions",
"(",
")",
";",
"$",
"container",
"=",
"$",
"this",
"->",
"getContainer",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Command/SendContactCommand.php#L66-L161 |
TheDMSGroup/mautic-contact-client | Command/MaintenanceCommand.php | MaintenanceCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$container = $this->getContainer();
$translator = $container->get('translator');
if (!$this->checkRunStatus($input, $output)) {
return 0;
}
/** @var Cache $cacheModel */
$cacheM... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$container = $this->getContainer();
$translator = $container->get('translator');
if (!$this->checkRunStatus($input, $output)) {
return 0;
}
/** @var Cache $cacheModel */
$cacheM... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"translator",
"=",
"$",
"container",
"->",
"get",
"(",
... | @param InputInterface $input
@param OutputInterface $output
@return int|null
@throws \Exception | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Command/MaintenanceCommand.php#L45-L72 |
TheDMSGroup/mautic-contact-client | Model/Schedule.php | Schedule.findOpening | public function findOpening($startDay = 0, $endDay = 7, $fileRate = 1, $all = false, $startTime = null)
{
$openings = [];
for ($day = $startDay; $day <= $endDay; ++$day) {
if (0 === $day) {
// Current day.
if ($startTime && $startTime instanceof \DateTime)... | php | public function findOpening($startDay = 0, $endDay = 7, $fileRate = 1, $all = false, $startTime = null)
{
$openings = [];
for ($day = $startDay; $day <= $endDay; ++$day) {
if (0 === $day) {
// Current day.
if ($startTime && $startTime instanceof \DateTime)... | [
"public",
"function",
"findOpening",
"(",
"$",
"startDay",
"=",
"0",
",",
"$",
"endDay",
"=",
"7",
",",
"$",
"fileRate",
"=",
"1",
",",
"$",
"all",
"=",
"false",
",",
"$",
"startTime",
"=",
"null",
")",
"{",
"$",
"openings",
"=",
"[",
"]",
";",
... | Given the hours of operation, timezone and excluded dates of the client...
Find the next appropriate time to send them contacts.
@param int $startDay Set to 1 to start the seek tomorrow, 0 for today
@param int $endDay Maximum number of days forward to seek for an opening
@param int $fileRate Maximum numb... | [
"Given",
"the",
"hours",
"of",
"operation",
"timezone",
"and",
"excluded",
"dates",
"of",
"the",
"client",
"...",
"Find",
"the",
"next",
"appropriate",
"time",
"to",
"send",
"them",
"contacts",
"."
] | train | https://github.com/TheDMSGroup/mautic-contact-client/blob/5874413494d1c73bc18749c0e75c87e7ccc6d65a/Model/Schedule.php#L110-L193 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.