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
sequencelengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
sequencelengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
willhoffmann/domuserp-php
src/Resources/CommercialSector/CommercialSector.php
CommercialSector.customers
public function customers($id) { $customers = $this->execute( self::HTTP_GET, self::DOMUSERP_API_OPERACIONAL . '/setorcomercial/' . $id . '/clientes' ); return $customers; }
php
public function customers($id) { $customers = $this->execute( self::HTTP_GET, self::DOMUSERP_API_OPERACIONAL . '/setorcomercial/' . $id . '/clientes' ); return $customers; }
[ "public", "function", "customers", "(", "$", "id", ")", "{", "$", "customers", "=", "$", "this", "->", "execute", "(", "self", "::", "HTTP_GET", ",", "self", "::", "DOMUSERP_API_OPERACIONAL", ".", "'/setorcomercial/'", ".", "$", "id", ".", "'/clientes'", ")", ";", "return", "$", "customers", ";", "}" ]
Lists all customers linked to the commercial sector @param $id @return string @throws \GuzzleHttp\Exception\GuzzleException
[ "Lists", "all", "customers", "linked", "to", "the", "commercial", "sector" ]
train
https://github.com/willhoffmann/domuserp-php/blob/44e77a4f02b0252bc26cae4c0e6b2b7d578f10a6/src/Resources/CommercialSector/CommercialSector.php#L48-L56
nikolaposa/ZfOpenGraph
src/ZfOpenGraph/View/Helper/OpenGraph.php
OpenGraph.setLocale
public function setLocale($locale, array $alternates = array()) { $this->insertMeta('set', 'locale', $locale); if (!empty($alternates)) { foreach ($alternates as $alternate) { $this->insertStructure('append', 'locale', array( 'alternate' => $alternate )); } } return $this; }
php
public function setLocale($locale, array $alternates = array()) { $this->insertMeta('set', 'locale', $locale); if (!empty($alternates)) { foreach ($alternates as $alternate) { $this->insertStructure('append', 'locale', array( 'alternate' => $alternate )); } } return $this; }
[ "public", "function", "setLocale", "(", "$", "locale", ",", "array", "$", "alternates", "=", "array", "(", ")", ")", "{", "$", "this", "->", "insertMeta", "(", "'set'", ",", "'locale'", ",", "$", "locale", ")", ";", "if", "(", "!", "empty", "(", "$", "alternates", ")", ")", "{", "foreach", "(", "$", "alternates", "as", "$", "alternate", ")", "{", "$", "this", "->", "insertStructure", "(", "'append'", ",", "'locale'", ",", "array", "(", "'alternate'", "=>", "$", "alternate", ")", ")", ";", "}", "}", "return", "$", "this", ";", "}" ]
Set 'locale' property. @param string $locale Default locale @param array $alternates Alternate locales array @return self
[ "Set", "locale", "property", "." ]
train
https://github.com/nikolaposa/ZfOpenGraph/blob/5e1a9b6ff8d2e149dc9d949635f39786f6acc347/src/ZfOpenGraph/View/Helper/OpenGraph.php#L200-L213
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.call
public function call($command, $data = NULL, $format = 'xml') { if ($this->checkStatus()) { $request = array( 'form_params' => [ 'r' => $this->realm, 'p' => $this->password, 'version' => $this->version, 'c' => $command, 'output_format' => $format ] ); if (!empty($data)) { $request = array('form_params' => array_merge($request['form_params'], $data)); } $guzzle = new \GuzzleHttp\Client; $response = $guzzle->request( 'POST', $this->url, $request ); $body = (string)$response->getBody(); if (empty($body)) { throw new Exception("No results"); } if ($body == 'Invalid credentials') { throw new Exception('Invalid Credentials'); } if ((int)substr_compare($body, "FAILURE", 0, 7) == 0) { $result = explode(":", $body); throw new Exception(trim($result[1])); } if ((int)substr_compare($body, "SUCCESS", 0, 7) == 0) { $result = explode(":", $body); return $result; } if ((int)substr_compare($body, "<data>", 0, 6, 1) == 0) return new \SimpleXMLElement($body); if ((int)substr_compare($body, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", 0, 38, 1) == 0) return new \SimpleXMLElement($body); return $body; } return FALSE; }
php
public function call($command, $data = NULL, $format = 'xml') { if ($this->checkStatus()) { $request = array( 'form_params' => [ 'r' => $this->realm, 'p' => $this->password, 'version' => $this->version, 'c' => $command, 'output_format' => $format ] ); if (!empty($data)) { $request = array('form_params' => array_merge($request['form_params'], $data)); } $guzzle = new \GuzzleHttp\Client; $response = $guzzle->request( 'POST', $this->url, $request ); $body = (string)$response->getBody(); if (empty($body)) { throw new Exception("No results"); } if ($body == 'Invalid credentials') { throw new Exception('Invalid Credentials'); } if ((int)substr_compare($body, "FAILURE", 0, 7) == 0) { $result = explode(":", $body); throw new Exception(trim($result[1])); } if ((int)substr_compare($body, "SUCCESS", 0, 7) == 0) { $result = explode(":", $body); return $result; } if ((int)substr_compare($body, "<data>", 0, 6, 1) == 0) return new \SimpleXMLElement($body); if ((int)substr_compare($body, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", 0, 38, 1) == 0) return new \SimpleXMLElement($body); return $body; } return FALSE; }
[ "public", "function", "call", "(", "$", "command", ",", "$", "data", "=", "NULL", ",", "$", "format", "=", "'xml'", ")", "{", "if", "(", "$", "this", "->", "checkStatus", "(", ")", ")", "{", "$", "request", "=", "array", "(", "'form_params'", "=>", "[", "'r'", "=>", "$", "this", "->", "realm", ",", "'p'", "=>", "$", "this", "->", "password", ",", "'version'", "=>", "$", "this", "->", "version", ",", "'c'", "=>", "$", "command", ",", "'output_format'", "=>", "$", "format", "]", ")", ";", "if", "(", "!", "empty", "(", "$", "data", ")", ")", "{", "$", "request", "=", "array", "(", "'form_params'", "=>", "array_merge", "(", "$", "request", "[", "'form_params'", "]", ",", "$", "data", ")", ")", ";", "}", "$", "guzzle", "=", "new", "\\", "GuzzleHttp", "\\", "Client", ";", "$", "response", "=", "$", "guzzle", "->", "request", "(", "'POST'", ",", "$", "this", "->", "url", ",", "$", "request", ")", ";", "$", "body", "=", "(", "string", ")", "$", "response", "->", "getBody", "(", ")", ";", "if", "(", "empty", "(", "$", "body", ")", ")", "{", "throw", "new", "Exception", "(", "\"No results\"", ")", ";", "}", "if", "(", "$", "body", "==", "'Invalid credentials'", ")", "{", "throw", "new", "Exception", "(", "'Invalid Credentials'", ")", ";", "}", "if", "(", "(", "int", ")", "substr_compare", "(", "$", "body", ",", "\"FAILURE\"", ",", "0", ",", "7", ")", "==", "0", ")", "{", "$", "result", "=", "explode", "(", "\":\"", ",", "$", "body", ")", ";", "throw", "new", "Exception", "(", "trim", "(", "$", "result", "[", "1", "]", ")", ")", ";", "}", "if", "(", "(", "int", ")", "substr_compare", "(", "$", "body", ",", "\"SUCCESS\"", ",", "0", ",", "7", ")", "==", "0", ")", "{", "$", "result", "=", "explode", "(", "\":\"", ",", "$", "body", ")", ";", "return", "$", "result", ";", "}", "if", "(", "(", "int", ")", "substr_compare", "(", "$", "body", ",", "\"<data>\"", ",", "0", ",", "6", ",", "1", ")", "==", "0", ")", "return", "new", "\\", "SimpleXMLElement", "(", "$", "body", ")", ";", "if", "(", "(", "int", ")", "substr_compare", "(", "$", "body", ",", "\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"", ",", "0", ",", "38", ",", "1", ")", "==", "0", ")", "return", "new", "\\", "SimpleXMLElement", "(", "$", "body", ")", ";", "return", "$", "body", ";", "}", "return", "FALSE", ";", "}" ]
@param $command @param null $data @param string $format @return array|\SimpleXMLElement|string @throws Exception
[ "@param", "$command", "@param", "null", "$data", "@param", "string", "$format" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L151-L203
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getRealmSettings
public function getRealmSettings() { $xml = $this->call('getrealmsettings'); $realm = new Realm; $realm ->setRealmId((int)$xml->Data->realm_id) ->setUseCustomerKey((string)$xml->Data->use_customer_key) ->setEnableRelationalDatabase((string)$xml->Data->enable_relational_database); return $realm; }
php
public function getRealmSettings() { $xml = $this->call('getrealmsettings'); $realm = new Realm; $realm ->setRealmId((int)$xml->Data->realm_id) ->setUseCustomerKey((string)$xml->Data->use_customer_key) ->setEnableRelationalDatabase((string)$xml->Data->enable_relational_database); return $realm; }
[ "public", "function", "getRealmSettings", "(", ")", "{", "$", "xml", "=", "$", "this", "->", "call", "(", "'getrealmsettings'", ")", ";", "$", "realm", "=", "new", "Realm", ";", "$", "realm", "->", "setRealmId", "(", "(", "int", ")", "$", "xml", "->", "Data", "->", "realm_id", ")", "->", "setUseCustomerKey", "(", "(", "string", ")", "$", "xml", "->", "Data", "->", "use_customer_key", ")", "->", "setEnableRelationalDatabase", "(", "(", "string", ")", "$", "xml", "->", "Data", "->", "enable_relational_database", ")", ";", "return", "$", "realm", ";", "}" ]
@return Realm API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969879
[ "@return", "Realm" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L210-L221
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showLists
public function showLists() { $form_data = array( 'headers' => 1 ); $data = $this->call('show_lists', $form_data, 'csv'); $csv = new \parseCSV($data); $lists = array(); foreach ($csv->data as $listItem) { $list = new MailingList; $list ->setListId((int)$listItem{'List Number'})// Whatcounts' show_lists command uses list_number instead of list_id ->setListName((string)$listItem{'List Name'}) ->setDescription((string)$listItem{'List Description'}) ->setFolderId((int)$listItem{'Folder ID'}); $lists[] = $list; } return $lists; }
php
public function showLists() { $form_data = array( 'headers' => 1 ); $data = $this->call('show_lists', $form_data, 'csv'); $csv = new \parseCSV($data); $lists = array(); foreach ($csv->data as $listItem) { $list = new MailingList; $list ->setListId((int)$listItem{'List Number'})// Whatcounts' show_lists command uses list_number instead of list_id ->setListName((string)$listItem{'List Name'}) ->setDescription((string)$listItem{'List Description'}) ->setFolderId((int)$listItem{'Folder ID'}); $lists[] = $list; } return $lists; }
[ "public", "function", "showLists", "(", ")", "{", "$", "form_data", "=", "array", "(", "'headers'", "=>", "1", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'show_lists'", ",", "$", "form_data", ",", "'csv'", ")", ";", "$", "csv", "=", "new", "\\", "parseCSV", "(", "$", "data", ")", ";", "$", "lists", "=", "array", "(", ")", ";", "foreach", "(", "$", "csv", "->", "data", "as", "$", "listItem", ")", "{", "$", "list", "=", "new", "MailingList", ";", "$", "list", "->", "setListId", "(", "(", "int", ")", "$", "listItem", "{", "'List Number'", "}", ")", "// Whatcounts' show_lists command uses list_number instead of list_id", "->", "setListName", "(", "(", "string", ")", "$", "listItem", "{", "'List Name'", "}", ")", "->", "setDescription", "(", "(", "string", ")", "$", "listItem", "{", "'List Description'", "}", ")", "->", "setFolderId", "(", "(", "int", ")", "$", "listItem", "{", "'Folder ID'", "}", ")", ";", "$", "lists", "[", "]", "=", "$", "list", ";", "}", "return", "$", "lists", ";", "}" ]
@return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669705
[ "@return", "array", "@throws", "Exception" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L229-L250
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getListById
public function getListById($list_id) { $form_data = array( 'list_id' => $list_id ); $xml = $this->call('getlistbyid', $form_data); $list = new MailingList; $list ->setListId((int)$xml->list_id) ->setListName((string)$xml->list_name) ->setDescription((string)$xml->description) ->setTemplate((string)$xml->template) ->setFromAddress((string)$xml->from) ->setReplyToAddress((string)$xml->reply_to) ->setBounceAddress((string)$xml->errors_to) ->setTrackClicks((bool)$xml->track_clicks) ->setTrackOpens((bool)$xml->track_opens) ->setFolderId((int)$xml->folder_Id); return $list; }
php
public function getListById($list_id) { $form_data = array( 'list_id' => $list_id ); $xml = $this->call('getlistbyid', $form_data); $list = new MailingList; $list ->setListId((int)$xml->list_id) ->setListName((string)$xml->list_name) ->setDescription((string)$xml->description) ->setTemplate((string)$xml->template) ->setFromAddress((string)$xml->from) ->setReplyToAddress((string)$xml->reply_to) ->setBounceAddress((string)$xml->errors_to) ->setTrackClicks((bool)$xml->track_clicks) ->setTrackOpens((bool)$xml->track_opens) ->setFolderId((int)$xml->folder_Id); return $list; }
[ "public", "function", "getListById", "(", "$", "list_id", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "list_id", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'getlistbyid'", ",", "$", "form_data", ")", ";", "$", "list", "=", "new", "MailingList", ";", "$", "list", "->", "setListId", "(", "(", "int", ")", "$", "xml", "->", "list_id", ")", "->", "setListName", "(", "(", "string", ")", "$", "xml", "->", "list_name", ")", "->", "setDescription", "(", "(", "string", ")", "$", "xml", "->", "description", ")", "->", "setTemplate", "(", "(", "string", ")", "$", "xml", "->", "template", ")", "->", "setFromAddress", "(", "(", "string", ")", "$", "xml", "->", "from", ")", "->", "setReplyToAddress", "(", "(", "string", ")", "$", "xml", "->", "reply_to", ")", "->", "setBounceAddress", "(", "(", "string", ")", "$", "xml", "->", "errors_to", ")", "->", "setTrackClicks", "(", "(", "bool", ")", "$", "xml", "->", "track_clicks", ")", "->", "setTrackOpens", "(", "(", "bool", ")", "$", "xml", "->", "track_opens", ")", "->", "setFolderId", "(", "(", "int", ")", "$", "xml", "->", "folder_Id", ")", ";", "return", "$", "list", ";", "}" ]
@param $list_id @return MailingList @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669715
[ "@param", "$list_id" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L261-L282
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.exCreateList
public function exCreateList(MailingList &$list) { $form_data = array( 'list_name' => $list->getListName(), 'description' => $list->getDescription(), 'template_id' => $list->getTemplate(), 'from' => $list->getFromAddress(), 'reply_to' => $list->getReplyToAddress(), 'errors_to' => $list->getBounceAddress(), 'track_clicks' => $list->isTrackClicks(), 'track_opens' => $list->isTrackOpens(), 'folder_id' => $list->getFolderId() ); $data = $this->call('excreatelist', $form_data); $list->setListId(trim($data[1])); }
php
public function exCreateList(MailingList &$list) { $form_data = array( 'list_name' => $list->getListName(), 'description' => $list->getDescription(), 'template_id' => $list->getTemplate(), 'from' => $list->getFromAddress(), 'reply_to' => $list->getReplyToAddress(), 'errors_to' => $list->getBounceAddress(), 'track_clicks' => $list->isTrackClicks(), 'track_opens' => $list->isTrackOpens(), 'folder_id' => $list->getFolderId() ); $data = $this->call('excreatelist', $form_data); $list->setListId(trim($data[1])); }
[ "public", "function", "exCreateList", "(", "MailingList", "&", "$", "list", ")", "{", "$", "form_data", "=", "array", "(", "'list_name'", "=>", "$", "list", "->", "getListName", "(", ")", ",", "'description'", "=>", "$", "list", "->", "getDescription", "(", ")", ",", "'template_id'", "=>", "$", "list", "->", "getTemplate", "(", ")", ",", "'from'", "=>", "$", "list", "->", "getFromAddress", "(", ")", ",", "'reply_to'", "=>", "$", "list", "->", "getReplyToAddress", "(", ")", ",", "'errors_to'", "=>", "$", "list", "->", "getBounceAddress", "(", ")", ",", "'track_clicks'", "=>", "$", "list", "->", "isTrackClicks", "(", ")", ",", "'track_opens'", "=>", "$", "list", "->", "isTrackOpens", "(", ")", ",", "'folder_id'", "=>", "$", "list", "->", "getFolderId", "(", ")", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'excreatelist'", ",", "$", "form_data", ")", ";", "$", "list", "->", "setListId", "(", "trim", "(", "$", "data", "[", "1", "]", ")", ")", ";", "}" ]
@param MailingList $list @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969409
[ "@param", "MailingList", "$list" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L323-L339
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.createList
public function createList(MailingList $list) { $form_data = array( 'list_name' => $list->getListName(), 'description' => $list->getDescription(), 'template_id' => $list->getTemplate(), 'from' => $list->getFromAddress(), 'reply_to' => $list->getReplyToAddress(), 'errors_to' => $list->getBounceAddress(), 'track_clicks' => $list->isTrackClicks(), 'track_opens' => $list->isTrackOpens(), 'folder_id' => $list->getFolderId() ); $this->call('createlist', $form_data); return TRUE; }
php
public function createList(MailingList $list) { $form_data = array( 'list_name' => $list->getListName(), 'description' => $list->getDescription(), 'template_id' => $list->getTemplate(), 'from' => $list->getFromAddress(), 'reply_to' => $list->getReplyToAddress(), 'errors_to' => $list->getBounceAddress(), 'track_clicks' => $list->isTrackClicks(), 'track_opens' => $list->isTrackOpens(), 'folder_id' => $list->getFolderId() ); $this->call('createlist', $form_data); return TRUE; }
[ "public", "function", "createList", "(", "MailingList", "$", "list", ")", "{", "$", "form_data", "=", "array", "(", "'list_name'", "=>", "$", "list", "->", "getListName", "(", ")", ",", "'description'", "=>", "$", "list", "->", "getDescription", "(", ")", ",", "'template_id'", "=>", "$", "list", "->", "getTemplate", "(", ")", ",", "'from'", "=>", "$", "list", "->", "getFromAddress", "(", ")", ",", "'reply_to'", "=>", "$", "list", "->", "getReplyToAddress", "(", ")", ",", "'errors_to'", "=>", "$", "list", "->", "getBounceAddress", "(", ")", ",", "'track_clicks'", "=>", "$", "list", "->", "isTrackClicks", "(", ")", ",", "'track_opens'", "=>", "$", "list", "->", "isTrackOpens", "(", ")", ",", "'folder_id'", "=>", "$", "list", "->", "getFolderId", "(", ")", ")", ";", "$", "this", "->", "call", "(", "'createlist'", ",", "$", "form_data", ")", ";", "return", "TRUE", ";", "}" ]
@param MailingList $list @return bool @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969409
[ "@param", "MailingList", "$list" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L350-L366
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.findSubscribers
public function findSubscribers(Subscriber $subscriber, $exact_match = FALSE) { $form_data = array( 'email' => $subscriber->getEmail(), 'first' => $subscriber->getFirstName(), 'last' => $subscriber->getLastName(), 'exact' => (int)$exact_match, ); $xml = $this->call('find', $form_data); $subscribers = array(); foreach ($xml->subscriber as $subscriberItem) { $subscriber = new Subscriber; $subscriber ->setListCount((int)$subscriberItem->lists) ->setEmail((string)$subscriberItem->email) ->setFirstName((string)$subscriberItem->first) ->setLastName((string)$subscriberItem->last) ->setSubscriberId((int)$subscriberItem->subscriber_id); $subscribers[] = $subscriber; } return $subscribers; }
php
public function findSubscribers(Subscriber $subscriber, $exact_match = FALSE) { $form_data = array( 'email' => $subscriber->getEmail(), 'first' => $subscriber->getFirstName(), 'last' => $subscriber->getLastName(), 'exact' => (int)$exact_match, ); $xml = $this->call('find', $form_data); $subscribers = array(); foreach ($xml->subscriber as $subscriberItem) { $subscriber = new Subscriber; $subscriber ->setListCount((int)$subscriberItem->lists) ->setEmail((string)$subscriberItem->email) ->setFirstName((string)$subscriberItem->first) ->setLastName((string)$subscriberItem->last) ->setSubscriberId((int)$subscriberItem->subscriber_id); $subscribers[] = $subscriber; } return $subscribers; }
[ "public", "function", "findSubscribers", "(", "Subscriber", "$", "subscriber", ",", "$", "exact_match", "=", "FALSE", ")", "{", "$", "form_data", "=", "array", "(", "'email'", "=>", "$", "subscriber", "->", "getEmail", "(", ")", ",", "'first'", "=>", "$", "subscriber", "->", "getFirstName", "(", ")", ",", "'last'", "=>", "$", "subscriber", "->", "getLastName", "(", ")", ",", "'exact'", "=>", "(", "int", ")", "$", "exact_match", ",", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'find'", ",", "$", "form_data", ")", ";", "$", "subscribers", "=", "array", "(", ")", ";", "foreach", "(", "$", "xml", "->", "subscriber", "as", "$", "subscriberItem", ")", "{", "$", "subscriber", "=", "new", "Subscriber", ";", "$", "subscriber", "->", "setListCount", "(", "(", "int", ")", "$", "subscriberItem", "->", "lists", ")", "->", "setEmail", "(", "(", "string", ")", "$", "subscriberItem", "->", "email", ")", "->", "setFirstName", "(", "(", "string", ")", "$", "subscriberItem", "->", "first", ")", "->", "setLastName", "(", "(", "string", ")", "$", "subscriberItem", "->", "last", ")", "->", "setSubscriberId", "(", "(", "int", ")", "$", "subscriberItem", "->", "subscriber_id", ")", ";", "$", "subscribers", "[", "]", "=", "$", "subscriber", ";", "}", "return", "$", "subscribers", ";", "}" ]
@param Subscriber $subscriber @param bool $exact_match @return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669925
[ "@param", "Subscriber", "$subscriber", "@param", "bool", "$exact_match" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L405-L429
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.unsubscribe
public function unsubscribe(Subscriber $subscriber, $list_id, $force_optout = FALSE) { $form_data = array( 'list_id' => $list_id, 'force_optout' => $force_optout, 'data' => 'email,first,last^' . $subscriber->getEmail() . ',' . $subscriber->getFirstName() . ',' . $subscriber->getLastName() ); $xml = $this->call('unsub', $form_data); return trim($xml[1]); }
php
public function unsubscribe(Subscriber $subscriber, $list_id, $force_optout = FALSE) { $form_data = array( 'list_id' => $list_id, 'force_optout' => $force_optout, 'data' => 'email,first,last^' . $subscriber->getEmail() . ',' . $subscriber->getFirstName() . ',' . $subscriber->getLastName() ); $xml = $this->call('unsub', $form_data); return trim($xml[1]); }
[ "public", "function", "unsubscribe", "(", "Subscriber", "$", "subscriber", ",", "$", "list_id", ",", "$", "force_optout", "=", "FALSE", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "list_id", ",", "'force_optout'", "=>", "$", "force_optout", ",", "'data'", "=>", "'email,first,last^'", ".", "$", "subscriber", "->", "getEmail", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getFirstName", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getLastName", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'unsub'", ",", "$", "form_data", ")", ";", "return", "trim", "(", "$", "xml", "[", "1", "]", ")", ";", "}" ]
@param Subscriber $subscriber @param $list_id @param bool $force_optout @return string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969639
[ "@param", "Subscriber", "$subscriber", "@param", "$list_id", "@param", "bool", "$force_optout" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L514-L527
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.deleteSubscriber
public function deleteSubscriber(Subscriber $subscriber) { $form_data = array( 'data' => 'email^' . $subscriber->getEmail() ); $xml = $this->call('delete', $form_data); return trim($xml[1]); }
php
public function deleteSubscriber(Subscriber $subscriber) { $form_data = array( 'data' => 'email^' . $subscriber->getEmail() ); $xml = $this->call('delete', $form_data); return trim($xml[1]); }
[ "public", "function", "deleteSubscriber", "(", "Subscriber", "$", "subscriber", ")", "{", "$", "form_data", "=", "array", "(", "'data'", "=>", "'email^'", ".", "$", "subscriber", "->", "getEmail", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'delete'", ",", "$", "form_data", ")", ";", "return", "trim", "(", "$", "xml", "[", "1", "]", ")", ";", "}" ]
@param Subscriber $subscriber @return string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669915
[ "@param", "Subscriber", "$subscriber" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L538-L546
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.deleteSubscribers
public function deleteSubscribers(Array $subscribers) { $form_data = array( 'data' => 'email^' . implode("^", $subscribers) ); $xml = $this->call('delete', $form_data); return trim($xml[1]); }
php
public function deleteSubscribers(Array $subscribers) { $form_data = array( 'data' => 'email^' . implode("^", $subscribers) ); $xml = $this->call('delete', $form_data); return trim($xml[1]); }
[ "public", "function", "deleteSubscribers", "(", "Array", "$", "subscribers", ")", "{", "$", "form_data", "=", "array", "(", "'data'", "=>", "'email^'", ".", "implode", "(", "\"^\"", ",", "$", "subscribers", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'delete'", ",", "$", "form_data", ")", ";", "return", "trim", "(", "$", "xml", "[", "1", "]", ")", ";", "}" ]
@param array $subscribers @return string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669915
[ "@param", "array", "$subscribers" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L556-L565
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showSubscriber
public function showSubscriber($subscriber_id) { $form_data = array( 'subscriber_id' => $subscriber_id ); $xml = $this->call('detail', $form_data); $subscriber_data = $xml->subscriber; $subscriber = new Subscriber; $subscriber ->setSubscriberId((int)$subscriber_data->subscriber_id) ->setEmail((string)$subscriber_data->email) ->setFirstName((string)$subscriber_data->first) ->setLastName((string)$subscriber_data->last) ->setCompany((string)$subscriber_data->company) ->setAddress1((string)$subscriber_data->address_1) ->setAddress2((string)$subscriber_data->address_2) ->setCity((string)$subscriber_data->city) ->setState((string)$subscriber_data->state) ->setZip((string)$subscriber_data->zip) ->setCountry((string)$subscriber_data->country) ->setPhone((string)$subscriber_data->phone) ->setFax((string)$subscriber_data->fax); $list_ids = (array)explode(",", $subscriber_data->lists); $subscriber_lists = array(); $subscription_details = $subscriber_data->subscription_details; foreach ($list_ids as $list_id) { $subscriber_list = New SubscriberList; $subscriber_list ->setListId((int)$list_id) ->setCreatedDate(date_create_from_format('m/d/y h:i A', $subscription_details->{'list_' . $list_id}->created_date)) ->setLastSent(date_create_from_format('m/d/y h:i A', $subscription_details->{'list_' . $list_id}->last_sent)) ->setSentFlag($subscription_details->{'list_' . $list_id}->sent_flag) ->setFormat($subscription_details->{'list_' . $list_id}->format); $subscriber_lists[] = $subscriber_list; } $subscriber->setLists($subscriber_lists); return $subscriber; }
php
public function showSubscriber($subscriber_id) { $form_data = array( 'subscriber_id' => $subscriber_id ); $xml = $this->call('detail', $form_data); $subscriber_data = $xml->subscriber; $subscriber = new Subscriber; $subscriber ->setSubscriberId((int)$subscriber_data->subscriber_id) ->setEmail((string)$subscriber_data->email) ->setFirstName((string)$subscriber_data->first) ->setLastName((string)$subscriber_data->last) ->setCompany((string)$subscriber_data->company) ->setAddress1((string)$subscriber_data->address_1) ->setAddress2((string)$subscriber_data->address_2) ->setCity((string)$subscriber_data->city) ->setState((string)$subscriber_data->state) ->setZip((string)$subscriber_data->zip) ->setCountry((string)$subscriber_data->country) ->setPhone((string)$subscriber_data->phone) ->setFax((string)$subscriber_data->fax); $list_ids = (array)explode(",", $subscriber_data->lists); $subscriber_lists = array(); $subscription_details = $subscriber_data->subscription_details; foreach ($list_ids as $list_id) { $subscriber_list = New SubscriberList; $subscriber_list ->setListId((int)$list_id) ->setCreatedDate(date_create_from_format('m/d/y h:i A', $subscription_details->{'list_' . $list_id}->created_date)) ->setLastSent(date_create_from_format('m/d/y h:i A', $subscription_details->{'list_' . $list_id}->last_sent)) ->setSentFlag($subscription_details->{'list_' . $list_id}->sent_flag) ->setFormat($subscription_details->{'list_' . $list_id}->format); $subscriber_lists[] = $subscriber_list; } $subscriber->setLists($subscriber_lists); return $subscriber; }
[ "public", "function", "showSubscriber", "(", "$", "subscriber_id", ")", "{", "$", "form_data", "=", "array", "(", "'subscriber_id'", "=>", "$", "subscriber_id", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'detail'", ",", "$", "form_data", ")", ";", "$", "subscriber_data", "=", "$", "xml", "->", "subscriber", ";", "$", "subscriber", "=", "new", "Subscriber", ";", "$", "subscriber", "->", "setSubscriberId", "(", "(", "int", ")", "$", "subscriber_data", "->", "subscriber_id", ")", "->", "setEmail", "(", "(", "string", ")", "$", "subscriber_data", "->", "email", ")", "->", "setFirstName", "(", "(", "string", ")", "$", "subscriber_data", "->", "first", ")", "->", "setLastName", "(", "(", "string", ")", "$", "subscriber_data", "->", "last", ")", "->", "setCompany", "(", "(", "string", ")", "$", "subscriber_data", "->", "company", ")", "->", "setAddress1", "(", "(", "string", ")", "$", "subscriber_data", "->", "address_1", ")", "->", "setAddress2", "(", "(", "string", ")", "$", "subscriber_data", "->", "address_2", ")", "->", "setCity", "(", "(", "string", ")", "$", "subscriber_data", "->", "city", ")", "->", "setState", "(", "(", "string", ")", "$", "subscriber_data", "->", "state", ")", "->", "setZip", "(", "(", "string", ")", "$", "subscriber_data", "->", "zip", ")", "->", "setCountry", "(", "(", "string", ")", "$", "subscriber_data", "->", "country", ")", "->", "setPhone", "(", "(", "string", ")", "$", "subscriber_data", "->", "phone", ")", "->", "setFax", "(", "(", "string", ")", "$", "subscriber_data", "->", "fax", ")", ";", "$", "list_ids", "=", "(", "array", ")", "explode", "(", "\",\"", ",", "$", "subscriber_data", "->", "lists", ")", ";", "$", "subscriber_lists", "=", "array", "(", ")", ";", "$", "subscription_details", "=", "$", "subscriber_data", "->", "subscription_details", ";", "foreach", "(", "$", "list_ids", "as", "$", "list_id", ")", "{", "$", "subscriber_list", "=", "New", "SubscriberList", ";", "$", "subscriber_list", "->", "setListId", "(", "(", "int", ")", "$", "list_id", ")", "->", "setCreatedDate", "(", "date_create_from_format", "(", "'m/d/y h:i A'", ",", "$", "subscription_details", "->", "{", "'list_'", ".", "$", "list_id", "}", "->", "created_date", ")", ")", "->", "setLastSent", "(", "date_create_from_format", "(", "'m/d/y h:i A'", ",", "$", "subscription_details", "->", "{", "'list_'", ".", "$", "list_id", "}", "->", "last_sent", ")", ")", "->", "setSentFlag", "(", "$", "subscription_details", "->", "{", "'list_'", ".", "$", "list_id", "}", "->", "sent_flag", ")", "->", "setFormat", "(", "$", "subscription_details", "->", "{", "'list_'", ".", "$", "list_id", "}", "->", "format", ")", ";", "$", "subscriber_lists", "[", "]", "=", "$", "subscriber_list", ";", "}", "$", "subscriber", "->", "setLists", "(", "$", "subscriber_lists", ")", ";", "return", "$", "subscriber", ";", "}" ]
@param $subscriber_id @return Subscriber @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969659
[ "@param", "$subscriber_id" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L575-L616
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.updateSubscriber
public function updateSubscriber(Subscriber $subscriber) { $form_data = array( 'list_id' => $subscriber->getListId(), 'identity_field' => 'email', 'data' => 'email,first,last,address_1,address_2,city,state,zip,country,phone,fax,company^' . $subscriber->getEmail() . ',' . $subscriber->getFirstName() . ',' . $subscriber->getLastName() . ',' . $subscriber->getAddress1() . ',' . $subscriber->getAddress2() . ',' . $subscriber->getCity() . ',' . $subscriber->getState() . ',' . $subscriber->getZip() . ',' . $subscriber->getCountry() . ',' . $subscriber->getPhone() . ',' . $subscriber->getFax() . ',' . $subscriber->getCompany() ); $xml = $this->call('update', $form_data); return trim($xml[1]); }
php
public function updateSubscriber(Subscriber $subscriber) { $form_data = array( 'list_id' => $subscriber->getListId(), 'identity_field' => 'email', 'data' => 'email,first,last,address_1,address_2,city,state,zip,country,phone,fax,company^' . $subscriber->getEmail() . ',' . $subscriber->getFirstName() . ',' . $subscriber->getLastName() . ',' . $subscriber->getAddress1() . ',' . $subscriber->getAddress2() . ',' . $subscriber->getCity() . ',' . $subscriber->getState() . ',' . $subscriber->getZip() . ',' . $subscriber->getCountry() . ',' . $subscriber->getPhone() . ',' . $subscriber->getFax() . ',' . $subscriber->getCompany() ); $xml = $this->call('update', $form_data); return trim($xml[1]); }
[ "public", "function", "updateSubscriber", "(", "Subscriber", "$", "subscriber", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "subscriber", "->", "getListId", "(", ")", ",", "'identity_field'", "=>", "'email'", ",", "'data'", "=>", "'email,first,last,address_1,address_2,city,state,zip,country,phone,fax,company^'", ".", "$", "subscriber", "->", "getEmail", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getFirstName", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getLastName", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getAddress1", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getAddress2", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getCity", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getState", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getZip", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getCountry", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getPhone", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getFax", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getCompany", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'update'", ",", "$", "form_data", ")", ";", "return", "trim", "(", "$", "xml", "[", "1", "]", ")", ";", "}" ]
@param Subscriber $subscriber @return string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969619
[ "@param", "Subscriber", "$subscriber" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L627-L649
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.changeEmailAddress
public function changeEmailAddress(Subscriber &$subscriber, $new_email) { $form_data = array( 'email' => $subscriber->getEmail(), 'email_new' => $new_email ); $this->call('change', $form_data); $subscriber->setEmail($new_email); }
php
public function changeEmailAddress(Subscriber &$subscriber, $new_email) { $form_data = array( 'email' => $subscriber->getEmail(), 'email_new' => $new_email ); $this->call('change', $form_data); $subscriber->setEmail($new_email); }
[ "public", "function", "changeEmailAddress", "(", "Subscriber", "&", "$", "subscriber", ",", "$", "new_email", ")", "{", "$", "form_data", "=", "array", "(", "'email'", "=>", "$", "subscriber", "->", "getEmail", "(", ")", ",", "'email_new'", "=>", "$", "new_email", ")", ";", "$", "this", "->", "call", "(", "'change'", ",", "$", "form_data", ")", ";", "$", "subscriber", "->", "setEmail", "(", "$", "new_email", ")", ";", "}" ]
@param Subscriber $subscriber @param $new_email @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969629
[ "@param", "Subscriber", "$subscriber", "@param", "$new_email" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L659-L668
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.addSubscriberToLifecycleCampaign
public function addSubscriberToLifecycleCampaign(Subscriber $subscriber, $lc_campaign_name) { $form_data = array( 'lc_campaign_name' => $lc_campaign_name, 'data' => 'email,first^' . $subscriber->getEmail() . ',' . $subscriber->getFirstName() . ',' ); $xml = $this->call('addtolifecyclecampaign', $form_data); return trim($xml[1]); }
php
public function addSubscriberToLifecycleCampaign(Subscriber $subscriber, $lc_campaign_name) { $form_data = array( 'lc_campaign_name' => $lc_campaign_name, 'data' => 'email,first^' . $subscriber->getEmail() . ',' . $subscriber->getFirstName() . ',' ); $xml = $this->call('addtolifecyclecampaign', $form_data); return trim($xml[1]); }
[ "public", "function", "addSubscriberToLifecycleCampaign", "(", "Subscriber", "$", "subscriber", ",", "$", "lc_campaign_name", ")", "{", "$", "form_data", "=", "array", "(", "'lc_campaign_name'", "=>", "$", "lc_campaign_name", ",", "'data'", "=>", "'email,first^'", ".", "$", "subscriber", "->", "getEmail", "(", ")", ".", "','", ".", "$", "subscriber", "->", "getFirstName", "(", ")", ".", "','", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'addtolifecyclecampaign'", ",", "$", "form_data", ")", ";", "return", "trim", "(", "$", "xml", "[", "1", "]", ")", ";", "}" ]
@param Subscriber $subscriber @param $lc_campaign_name @return string @throws Exception API documentation: https://support.whatcounts.com/hc/en-us/articles/203969779
[ "@param", "Subscriber", "$subscriber", "@param", "$lc_campaign_name" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L679-L690
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showSegmentationRules
public function showSegmentationRules() { $form_data = array( 'headers' => 1 ); $data = $this->call('show_seg', $form_data, 'csv'); $csv = new \parseCSV($data); $rules = array(); var_dump($csv); foreach ($csv->data as $ruleItem) { $rule = new SegmentationRule; //$rule->setListId($ruleItem['Segmentation ID']); $rule->setName($ruleItem['Segmentation Name']); $rule->setDescription($ruleItem['Description']); $rules[] = $rule; } return $rules; }
php
public function showSegmentationRules() { $form_data = array( 'headers' => 1 ); $data = $this->call('show_seg', $form_data, 'csv'); $csv = new \parseCSV($data); $rules = array(); var_dump($csv); foreach ($csv->data as $ruleItem) { $rule = new SegmentationRule; //$rule->setListId($ruleItem['Segmentation ID']); $rule->setName($ruleItem['Segmentation Name']); $rule->setDescription($ruleItem['Description']); $rules[] = $rule; } return $rules; }
[ "public", "function", "showSegmentationRules", "(", ")", "{", "$", "form_data", "=", "array", "(", "'headers'", "=>", "1", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'show_seg'", ",", "$", "form_data", ",", "'csv'", ")", ";", "$", "csv", "=", "new", "\\", "parseCSV", "(", "$", "data", ")", ";", "$", "rules", "=", "array", "(", ")", ";", "var_dump", "(", "$", "csv", ")", ";", "foreach", "(", "$", "csv", "->", "data", "as", "$", "ruleItem", ")", "{", "$", "rule", "=", "new", "SegmentationRule", ";", "//$rule->setListId($ruleItem['Segmentation ID']);", "$", "rule", "->", "setName", "(", "$", "ruleItem", "[", "'Segmentation Name'", "]", ")", ";", "$", "rule", "->", "setDescription", "(", "$", "ruleItem", "[", "'Description'", "]", ")", ";", "$", "rules", "[", "]", "=", "$", "rule", ";", "}", "return", "$", "rules", ";", "}" ]
@return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969439
[ "@return", "array", "@throws", "Exception" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L698-L719
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.createSegmentationRule
public function createSegmentationRule(SegmentationRule $segmentation_rule) { $form_data = array( 'segmentation_name' => $segmentation_rule->getName(), 'segmentation_type' => $segmentation_rule->getType(), 'list_id' => $segmentation_rule->getListId(), 'rules' => $segmentation_rule->getRules(), 'description' => $segmentation_rule->getDescription() ); $xml = $this->call('createseg', $form_data); $segmentation_rule->setId(trim($xml[1])); return $segmentation_rule; }
php
public function createSegmentationRule(SegmentationRule $segmentation_rule) { $form_data = array( 'segmentation_name' => $segmentation_rule->getName(), 'segmentation_type' => $segmentation_rule->getType(), 'list_id' => $segmentation_rule->getListId(), 'rules' => $segmentation_rule->getRules(), 'description' => $segmentation_rule->getDescription() ); $xml = $this->call('createseg', $form_data); $segmentation_rule->setId(trim($xml[1])); return $segmentation_rule; }
[ "public", "function", "createSegmentationRule", "(", "SegmentationRule", "$", "segmentation_rule", ")", "{", "$", "form_data", "=", "array", "(", "'segmentation_name'", "=>", "$", "segmentation_rule", "->", "getName", "(", ")", ",", "'segmentation_type'", "=>", "$", "segmentation_rule", "->", "getType", "(", ")", ",", "'list_id'", "=>", "$", "segmentation_rule", "->", "getListId", "(", ")", ",", "'rules'", "=>", "$", "segmentation_rule", "->", "getRules", "(", ")", ",", "'description'", "=>", "$", "segmentation_rule", "->", "getDescription", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'createseg'", ",", "$", "form_data", ")", ";", "$", "segmentation_rule", "->", "setId", "(", "trim", "(", "$", "xml", "[", "1", "]", ")", ")", ";", "return", "$", "segmentation_rule", ";", "}" ]
@param SegmentationRule $segmentation_rule @return SegmentationRule @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669735
[ "@param", "SegmentationRule", "$segmentation_rule" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L729-L743
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.updateSegmentationRule
public function updateSegmentationRule(SegmentationRule &$segmentation_rule) { $form_data = array( 'segmentation_id' => $segmentation_rule->getId(), 'segmentation_name' => $segmentation_rule->getName(), 'segmentation_type' => $segmentation_rule->getType(), 'list_id' => $segmentation_rule->getListId(), 'rules' => $segmentation_rule->getRules(), 'description' => $segmentation_rule->getDescription() ); $xml = $this->call('updateseg', $form_data); return trim($xml[1]); }
php
public function updateSegmentationRule(SegmentationRule &$segmentation_rule) { $form_data = array( 'segmentation_id' => $segmentation_rule->getId(), 'segmentation_name' => $segmentation_rule->getName(), 'segmentation_type' => $segmentation_rule->getType(), 'list_id' => $segmentation_rule->getListId(), 'rules' => $segmentation_rule->getRules(), 'description' => $segmentation_rule->getDescription() ); $xml = $this->call('updateseg', $form_data); return trim($xml[1]); }
[ "public", "function", "updateSegmentationRule", "(", "SegmentationRule", "&", "$", "segmentation_rule", ")", "{", "$", "form_data", "=", "array", "(", "'segmentation_id'", "=>", "$", "segmentation_rule", "->", "getId", "(", ")", ",", "'segmentation_name'", "=>", "$", "segmentation_rule", "->", "getName", "(", ")", ",", "'segmentation_type'", "=>", "$", "segmentation_rule", "->", "getType", "(", ")", ",", "'list_id'", "=>", "$", "segmentation_rule", "->", "getListId", "(", ")", ",", "'rules'", "=>", "$", "segmentation_rule", "->", "getRules", "(", ")", ",", "'description'", "=>", "$", "segmentation_rule", "->", "getDescription", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'updateseg'", ",", "$", "form_data", ")", ";", "return", "trim", "(", "$", "xml", "[", "1", "]", ")", ";", "}" ]
@param SegmentationRule $segmentation_rule @return SegmentationRule @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669745
[ "@param", "SegmentationRule", "$segmentation_rule" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L753-L766
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.deleteSegmentationRule
public function deleteSegmentationRule(SegmentationRule $segmentation_rule) { $form_data = array( 'segmentation_id' => $segmentation_rule->getId() ); $xml = $this->call('deleteseg', $form_data); return trim($xml[1]); }
php
public function deleteSegmentationRule(SegmentationRule $segmentation_rule) { $form_data = array( 'segmentation_id' => $segmentation_rule->getId() ); $xml = $this->call('deleteseg', $form_data); return trim($xml[1]); }
[ "public", "function", "deleteSegmentationRule", "(", "SegmentationRule", "$", "segmentation_rule", ")", "{", "$", "form_data", "=", "array", "(", "'segmentation_id'", "=>", "$", "segmentation_rule", "->", "getId", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'deleteseg'", ",", "$", "form_data", ")", ";", "return", "trim", "(", "$", "xml", "[", "1", "]", ")", ";", "}" ]
@param SegmentationRule $segmentation_rule @return SegmentationRule @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969459
[ "@param", "SegmentationRule", "$segmentation_rule" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L776-L784
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showTemplates
public function showTemplates() { $form_data = array( 'headers' => 1 ); $data = $this->call('show_templates', $form_data, 'csv'); $csv = new \parseCSV($data); $templates = array(); foreach ($csv->data as $template_item) { $template = new Template; $template ->setTemplateId((int)$template_item['Template Number']) ->setName((string)$template_item['Template Name']) ->setFolderId((int)$template_item['Folder ID']); $templates[] = $template; } return $templates; }
php
public function showTemplates() { $form_data = array( 'headers' => 1 ); $data = $this->call('show_templates', $form_data, 'csv'); $csv = new \parseCSV($data); $templates = array(); foreach ($csv->data as $template_item) { $template = new Template; $template ->setTemplateId((int)$template_item['Template Number']) ->setName((string)$template_item['Template Name']) ->setFolderId((int)$template_item['Folder ID']); $templates[] = $template; } return $templates; }
[ "public", "function", "showTemplates", "(", ")", "{", "$", "form_data", "=", "array", "(", "'headers'", "=>", "1", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'show_templates'", ",", "$", "form_data", ",", "'csv'", ")", ";", "$", "csv", "=", "new", "\\", "parseCSV", "(", "$", "data", ")", ";", "$", "templates", "=", "array", "(", ")", ";", "foreach", "(", "$", "csv", "->", "data", "as", "$", "template_item", ")", "{", "$", "template", "=", "new", "Template", ";", "$", "template", "->", "setTemplateId", "(", "(", "int", ")", "$", "template_item", "[", "'Template Number'", "]", ")", "->", "setName", "(", "(", "string", ")", "$", "template_item", "[", "'Template Name'", "]", ")", "->", "setFolderId", "(", "(", "int", ")", "$", "template_item", "[", "'Folder ID'", "]", ")", ";", "$", "templates", "[", "]", "=", "$", "template", ";", "}", "return", "$", "templates", ";", "}" ]
@return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969479
[ "@return", "array", "@throws", "Exception" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L811-L831
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getTemplateById
public function getTemplateById($template_id) { $form_data = array( 'template_id' => $template_id ); $xml = $this->call('gettemplatebyid', $form_data); $template = new Template; $template ->setFolderId((int)$xml->folder_id) ->setTemplateId((int)$xml->template_id) ->setName((string)$xml->template_name) ->setSubject((string)$xml->template_subject) ->setBodyPlain((string)$xml->body_plain) ->setBodyHtml((string)$xml->body_html) ->setDescription((string)$xml->template_description); return $template; }
php
public function getTemplateById($template_id) { $form_data = array( 'template_id' => $template_id ); $xml = $this->call('gettemplatebyid', $form_data); $template = new Template; $template ->setFolderId((int)$xml->folder_id) ->setTemplateId((int)$xml->template_id) ->setName((string)$xml->template_name) ->setSubject((string)$xml->template_subject) ->setBodyPlain((string)$xml->body_plain) ->setBodyHtml((string)$xml->body_html) ->setDescription((string)$xml->template_description); return $template; }
[ "public", "function", "getTemplateById", "(", "$", "template_id", ")", "{", "$", "form_data", "=", "array", "(", "'template_id'", "=>", "$", "template_id", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'gettemplatebyid'", ",", "$", "form_data", ")", ";", "$", "template", "=", "new", "Template", ";", "$", "template", "->", "setFolderId", "(", "(", "int", ")", "$", "xml", "->", "folder_id", ")", "->", "setTemplateId", "(", "(", "int", ")", "$", "xml", "->", "template_id", ")", "->", "setName", "(", "(", "string", ")", "$", "xml", "->", "template_name", ")", "->", "setSubject", "(", "(", "string", ")", "$", "xml", "->", "template_subject", ")", "->", "setBodyPlain", "(", "(", "string", ")", "$", "xml", "->", "body_plain", ")", "->", "setBodyHtml", "(", "(", "string", ")", "$", "xml", "->", "body_html", ")", "->", "setDescription", "(", "(", "string", ")", "$", "xml", "->", "template_description", ")", ";", "return", "$", "template", ";", "}" ]
@param $template_id @return Template @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969489
[ "@param", "$template_id" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L841-L859
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.createTemplate
public function createTemplate(Template &$template) { $form_data = array( 'template_name' => $template->getName(), 'template_subject' => $template->getSubject(), 'template_body_plain' => $template->getBodyPlain(), 'template_body_html' => $template->getBodyHtml(), 'template_body_mobile' => $template->getBodyMobile(), 'charset' => $template->getCharacterSet(), 'encoding' => $template->getCharacterEncoding(), 'folder_id' => $template->getFolderId() ); $data = $this->call('createtemplate', $form_data); $template->setTemplateId(trim($data[1])); //return $template; }
php
public function createTemplate(Template &$template) { $form_data = array( 'template_name' => $template->getName(), 'template_subject' => $template->getSubject(), 'template_body_plain' => $template->getBodyPlain(), 'template_body_html' => $template->getBodyHtml(), 'template_body_mobile' => $template->getBodyMobile(), 'charset' => $template->getCharacterSet(), 'encoding' => $template->getCharacterEncoding(), 'folder_id' => $template->getFolderId() ); $data = $this->call('createtemplate', $form_data); $template->setTemplateId(trim($data[1])); //return $template; }
[ "public", "function", "createTemplate", "(", "Template", "&", "$", "template", ")", "{", "$", "form_data", "=", "array", "(", "'template_name'", "=>", "$", "template", "->", "getName", "(", ")", ",", "'template_subject'", "=>", "$", "template", "->", "getSubject", "(", ")", ",", "'template_body_plain'", "=>", "$", "template", "->", "getBodyPlain", "(", ")", ",", "'template_body_html'", "=>", "$", "template", "->", "getBodyHtml", "(", ")", ",", "'template_body_mobile'", "=>", "$", "template", "->", "getBodyMobile", "(", ")", ",", "'charset'", "=>", "$", "template", "->", "getCharacterSet", "(", ")", ",", "'encoding'", "=>", "$", "template", "->", "getCharacterEncoding", "(", ")", ",", "'folder_id'", "=>", "$", "template", "->", "getFolderId", "(", ")", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'createtemplate'", ",", "$", "form_data", ")", ";", "$", "template", "->", "setTemplateId", "(", "trim", "(", "$", "data", "[", "1", "]", ")", ")", ";", "//return $template;", "}" ]
@param Template $template @return Template @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969469
[ "@param", "Template", "$template" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L897-L914
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.previewTemplate
public function previewTemplate(Template $template, $template_type) { $form_data = array( 'template_name' => $template->getName(), 'template_type' => $template_type ); $data = $this->call('templatepreview', $form_data); return $data; }
php
public function previewTemplate(Template $template, $template_type) { $form_data = array( 'template_name' => $template->getName(), 'template_type' => $template_type ); $data = $this->call('templatepreview', $form_data); return $data; }
[ "public", "function", "previewTemplate", "(", "Template", "$", "template", ",", "$", "template_type", ")", "{", "$", "form_data", "=", "array", "(", "'template_name'", "=>", "$", "template", "->", "getName", "(", ")", ",", "'template_type'", "=>", "$", "template_type", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'templatepreview'", ",", "$", "form_data", ")", ";", "return", "$", "data", ";", "}" ]
@param Template $template @param $template_type @return Template @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669775
[ "@param", "Template", "$template", "@param", "$template_type" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L950-L959
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showArticles
public function showArticles() { $form_data = array( 'headers' => 1 ); $data = $this->call('showarticlelist', $form_data, 'csv'); $csv = new \parseCSV($data); $articles = array(); foreach ($csv->data as $article_item) { $article = new Article; $article ->setId((int)$article_item['Article Number']) ->setName((string)$article_item['Name']) ->setDescription((string)$article_item['Article Description']) ->setFolderId((int)$article_item['Folder ID']); $articles[] = $article; } return $articles; }
php
public function showArticles() { $form_data = array( 'headers' => 1 ); $data = $this->call('showarticlelist', $form_data, 'csv'); $csv = new \parseCSV($data); $articles = array(); foreach ($csv->data as $article_item) { $article = new Article; $article ->setId((int)$article_item['Article Number']) ->setName((string)$article_item['Name']) ->setDescription((string)$article_item['Article Description']) ->setFolderId((int)$article_item['Folder ID']); $articles[] = $article; } return $articles; }
[ "public", "function", "showArticles", "(", ")", "{", "$", "form_data", "=", "array", "(", "'headers'", "=>", "1", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'showarticlelist'", ",", "$", "form_data", ",", "'csv'", ")", ";", "$", "csv", "=", "new", "\\", "parseCSV", "(", "$", "data", ")", ";", "$", "articles", "=", "array", "(", ")", ";", "foreach", "(", "$", "csv", "->", "data", "as", "$", "article_item", ")", "{", "$", "article", "=", "new", "Article", ";", "$", "article", "->", "setId", "(", "(", "int", ")", "$", "article_item", "[", "'Article Number'", "]", ")", "->", "setName", "(", "(", "string", ")", "$", "article_item", "[", "'Name'", "]", ")", "->", "setDescription", "(", "(", "string", ")", "$", "article_item", "[", "'Article Description'", "]", ")", "->", "setFolderId", "(", "(", "int", ")", "$", "article_item", "[", "'Folder ID'", "]", ")", ";", "$", "articles", "[", "]", "=", "$", "article", ";", "}", "return", "$", "articles", ";", "}" ]
@return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969509
[ "@return", "array", "@throws", "Exception" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L967-L988
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getArticleById
public function getArticleById(Article &$article) { $form_data = array( 'article_id' => $article->getId() ); $xml = $this->call('getarticlewithid', $form_data); $article ->setName((string)$xml->name) ->setTitle((string)$xml->title) ->setDescription((string)$xml->article_description) ->setDeck((string)$xml->deck) ->setCallout((string)$xml->callout) ->setBody((string)$xml->article_body) ->setAuthorName((string)$xml->author_name) ->setAuthorBio((string)$xml->author_bio) ->setAuthorEmail((string)$xml->author_email) ->setFolderId((int)$xml->folder_id); //return $article; }
php
public function getArticleById(Article &$article) { $form_data = array( 'article_id' => $article->getId() ); $xml = $this->call('getarticlewithid', $form_data); $article ->setName((string)$xml->name) ->setTitle((string)$xml->title) ->setDescription((string)$xml->article_description) ->setDeck((string)$xml->deck) ->setCallout((string)$xml->callout) ->setBody((string)$xml->article_body) ->setAuthorName((string)$xml->author_name) ->setAuthorBio((string)$xml->author_bio) ->setAuthorEmail((string)$xml->author_email) ->setFolderId((int)$xml->folder_id); //return $article; }
[ "public", "function", "getArticleById", "(", "Article", "&", "$", "article", ")", "{", "$", "form_data", "=", "array", "(", "'article_id'", "=>", "$", "article", "->", "getId", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'getarticlewithid'", ",", "$", "form_data", ")", ";", "$", "article", "->", "setName", "(", "(", "string", ")", "$", "xml", "->", "name", ")", "->", "setTitle", "(", "(", "string", ")", "$", "xml", "->", "title", ")", "->", "setDescription", "(", "(", "string", ")", "$", "xml", "->", "article_description", ")", "->", "setDeck", "(", "(", "string", ")", "$", "xml", "->", "deck", ")", "->", "setCallout", "(", "(", "string", ")", "$", "xml", "->", "callout", ")", "->", "setBody", "(", "(", "string", ")", "$", "xml", "->", "article_body", ")", "->", "setAuthorName", "(", "(", "string", ")", "$", "xml", "->", "author_name", ")", "->", "setAuthorBio", "(", "(", "string", ")", "$", "xml", "->", "author_bio", ")", "->", "setAuthorEmail", "(", "(", "string", ")", "$", "xml", "->", "author_email", ")", "->", "setFolderId", "(", "(", "int", ")", "$", "xml", "->", "folder_id", ")", ";", "//return $article;", "}" ]
@param Article $article @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669805
[ "@param", "Article", "$article" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L997-L1017
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getArticleByName
public function getArticleByName(Article &$article) { $form_data = array( 'article_name' => $article->getName() ); $xml = $this->call('getarticlewithname', $form_data); $article ->setId((int)$xml->article_id) ->setTitle((string)$xml->title) ->setDescription((string)$xml->article_description) ->setDeck((string)$xml->deck) ->setCallout((string)$xml->callout) ->setBody((string)$xml->article_body) ->setAuthorName((string)$xml->author_name) ->setAuthorBio((string)$xml->author_bio) ->setAuthorEmail((string)$xml->author_email) ->setFolderId((int)$xml->folder_id); //return $article; }
php
public function getArticleByName(Article &$article) { $form_data = array( 'article_name' => $article->getName() ); $xml = $this->call('getarticlewithname', $form_data); $article ->setId((int)$xml->article_id) ->setTitle((string)$xml->title) ->setDescription((string)$xml->article_description) ->setDeck((string)$xml->deck) ->setCallout((string)$xml->callout) ->setBody((string)$xml->article_body) ->setAuthorName((string)$xml->author_name) ->setAuthorBio((string)$xml->author_bio) ->setAuthorEmail((string)$xml->author_email) ->setFolderId((int)$xml->folder_id); //return $article; }
[ "public", "function", "getArticleByName", "(", "Article", "&", "$", "article", ")", "{", "$", "form_data", "=", "array", "(", "'article_name'", "=>", "$", "article", "->", "getName", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'getarticlewithname'", ",", "$", "form_data", ")", ";", "$", "article", "->", "setId", "(", "(", "int", ")", "$", "xml", "->", "article_id", ")", "->", "setTitle", "(", "(", "string", ")", "$", "xml", "->", "title", ")", "->", "setDescription", "(", "(", "string", ")", "$", "xml", "->", "article_description", ")", "->", "setDeck", "(", "(", "string", ")", "$", "xml", "->", "deck", ")", "->", "setCallout", "(", "(", "string", ")", "$", "xml", "->", "callout", ")", "->", "setBody", "(", "(", "string", ")", "$", "xml", "->", "article_body", ")", "->", "setAuthorName", "(", "(", "string", ")", "$", "xml", "->", "author_name", ")", "->", "setAuthorBio", "(", "(", "string", ")", "$", "xml", "->", "author_bio", ")", "->", "setAuthorEmail", "(", "(", "string", ")", "$", "xml", "->", "author_email", ")", "->", "setFolderId", "(", "(", "int", ")", "$", "xml", "->", "folder_id", ")", ";", "//return $article;", "}" ]
@param Article $article @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669805
[ "@param", "Article", "$article" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1026-L1046
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.copyArticle
public function copyArticle($article_name, $destination_article_name) { $form_data = array( 'article_name' => $article_name, 'dst_article_name' => $destination_article_name ); $data = $this->call('copyarticle', $form_data); return trim($data[1]); }
php
public function copyArticle($article_name, $destination_article_name) { $form_data = array( 'article_name' => $article_name, 'dst_article_name' => $destination_article_name ); $data = $this->call('copyarticle', $form_data); return trim($data[1]); }
[ "public", "function", "copyArticle", "(", "$", "article_name", ",", "$", "destination_article_name", ")", "{", "$", "form_data", "=", "array", "(", "'article_name'", "=>", "$", "article_name", ",", "'dst_article_name'", "=>", "$", "destination_article_name", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'copyarticle'", ",", "$", "form_data", ")", ";", "return", "trim", "(", "$", "data", "[", "1", "]", ")", ";", "}" ]
@param $article_name @param $destination_article_name @return string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669815
[ "@param", "$article_name", "@param", "$destination_article_name" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1057-L1066
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.createBlankArticle
public function createBlankArticle(Article &$article) { $form_data = array( 'article_name' => $article->getName() ); $data = $this->call('createblankarticle', $form_data); $article->setId((int)trim($data[1])); }
php
public function createBlankArticle(Article &$article) { $form_data = array( 'article_name' => $article->getName() ); $data = $this->call('createblankarticle', $form_data); $article->setId((int)trim($data[1])); }
[ "public", "function", "createBlankArticle", "(", "Article", "&", "$", "article", ")", "{", "$", "form_data", "=", "array", "(", "'article_name'", "=>", "$", "article", "->", "getName", "(", ")", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'createblankarticle'", ",", "$", "form_data", ")", ";", "$", "article", "->", "setId", "(", "(", "int", ")", "trim", "(", "$", "data", "[", "1", "]", ")", ")", ";", "}" ]
@param Article $article @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969499
[ "@param", "Article", "$article" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1075-L1083
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.createArticle
public function createArticle(Article &$article) { $form_data = array( 'article_name' => $article->getName(), 'article_title' => $article->getTitle(), 'article_description' => $article->getDescription(), 'deck' => $article->getDeck(), 'callout' => $article->getCallout(), 'author_name' => $article->getAuthorName(), 'author_bio' => $article->getAuthorBio(), 'author_email' => $article->getAuthorEmail(), 'folder_id' => $article->getFolderId(), 'article_body' => $article->getBody() ); $data = $this->call('createarticle', $form_data); $article->setId((int)trim($data[1])); }
php
public function createArticle(Article &$article) { $form_data = array( 'article_name' => $article->getName(), 'article_title' => $article->getTitle(), 'article_description' => $article->getDescription(), 'deck' => $article->getDeck(), 'callout' => $article->getCallout(), 'author_name' => $article->getAuthorName(), 'author_bio' => $article->getAuthorBio(), 'author_email' => $article->getAuthorEmail(), 'folder_id' => $article->getFolderId(), 'article_body' => $article->getBody() ); $data = $this->call('createarticle', $form_data); $article->setId((int)trim($data[1])); }
[ "public", "function", "createArticle", "(", "Article", "&", "$", "article", ")", "{", "$", "form_data", "=", "array", "(", "'article_name'", "=>", "$", "article", "->", "getName", "(", ")", ",", "'article_title'", "=>", "$", "article", "->", "getTitle", "(", ")", ",", "'article_description'", "=>", "$", "article", "->", "getDescription", "(", ")", ",", "'deck'", "=>", "$", "article", "->", "getDeck", "(", ")", ",", "'callout'", "=>", "$", "article", "->", "getCallout", "(", ")", ",", "'author_name'", "=>", "$", "article", "->", "getAuthorName", "(", ")", ",", "'author_bio'", "=>", "$", "article", "->", "getAuthorBio", "(", ")", ",", "'author_email'", "=>", "$", "article", "->", "getAuthorEmail", "(", ")", ",", "'folder_id'", "=>", "$", "article", "->", "getFolderId", "(", ")", ",", "'article_body'", "=>", "$", "article", "->", "getBody", "(", ")", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'createarticle'", ",", "$", "form_data", ")", ";", "$", "article", "->", "setId", "(", "(", "int", ")", "trim", "(", "$", "data", "[", "1", "]", ")", ")", ";", "}" ]
@param Article $article @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969499
[ "@param", "Article", "$article" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1092-L1109
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.updateArticle
public function updateArticle(Article $article) { $form_data = array( 'article_id' => $article->getId(), 'article_name' => $article->getName(), 'article_title' => $article->getTitle(), 'article_description' => $article->getDescription(), 'deck' => $article->getDeck(), 'callout' => $article->getCallout(), 'author_name' => $article->getAuthorName(), 'author_bio' => $article->getAuthorBio(), 'author_email' => $article->getAuthorEmail(), 'folder_id' => $article->getFolderId(), 'article_body' => $article->getBody() ); $data = $this->call('updatearticle', $form_data); return TRUE; }
php
public function updateArticle(Article $article) { $form_data = array( 'article_id' => $article->getId(), 'article_name' => $article->getName(), 'article_title' => $article->getTitle(), 'article_description' => $article->getDescription(), 'deck' => $article->getDeck(), 'callout' => $article->getCallout(), 'author_name' => $article->getAuthorName(), 'author_bio' => $article->getAuthorBio(), 'author_email' => $article->getAuthorEmail(), 'folder_id' => $article->getFolderId(), 'article_body' => $article->getBody() ); $data = $this->call('updatearticle', $form_data); return TRUE; }
[ "public", "function", "updateArticle", "(", "Article", "$", "article", ")", "{", "$", "form_data", "=", "array", "(", "'article_id'", "=>", "$", "article", "->", "getId", "(", ")", ",", "'article_name'", "=>", "$", "article", "->", "getName", "(", ")", ",", "'article_title'", "=>", "$", "article", "->", "getTitle", "(", ")", ",", "'article_description'", "=>", "$", "article", "->", "getDescription", "(", ")", ",", "'deck'", "=>", "$", "article", "->", "getDeck", "(", ")", ",", "'callout'", "=>", "$", "article", "->", "getCallout", "(", ")", ",", "'author_name'", "=>", "$", "article", "->", "getAuthorName", "(", ")", ",", "'author_bio'", "=>", "$", "article", "->", "getAuthorBio", "(", ")", ",", "'author_email'", "=>", "$", "article", "->", "getAuthorEmail", "(", ")", ",", "'folder_id'", "=>", "$", "article", "->", "getFolderId", "(", ")", ",", "'article_body'", "=>", "$", "article", "->", "getBody", "(", ")", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'updatearticle'", ",", "$", "form_data", ")", ";", "return", "TRUE", ";", "}" ]
@param Article $article @return boolean @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969519
[ "@param", "Article", "$article" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1119-L1137
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showABDefinitions
public function showABDefinitions() { $xml = $this->call('show_abdefinitions'); $ab_tests = array(); foreach ($xml->Data as $ab_test_item) { $ab_test = new ABTest; $is_testing_subject = $ab_test_item->test_subject == '1' ? TRUE : FALSE; $is_testing_from_address = $ab_test_item->test_from_address == '1' ? TRUE : FALSE; $is_testing_content = $ab_test_item->test_content == '1' ? TRUE : FALSE; $ab_test ->setId((int)$ab_test_item->id) ->setName((string)$ab_test_item->name) ->setDescription((string)$ab_test_item->description) ->setListId((int)$ab_test_item->list_id) ->setListName((string)$ab_test_item->list_name) ->setSegmentationRuleId((int)$ab_test_item->segmentation_rule_id) ->setSuppressionList((string)$ab_test_item->suppression_list) ->setMaxTime((int)$ab_test_item->max_time) ->setMeasuring((string)$ab_test_item->measuring) ->setNumSamples((int)$ab_test_item->num_samples) ->setSampleSize((int)$ab_test_item->sample_size) ->setSampleType((string)$ab_test_item->sample_type) ->setTestSubject((boolean)$is_testing_subject) ->setTestFromAddress((boolean)$is_testing_from_address) ->setTestContent((boolean)$is_testing_content) ->setTestEndsWhen((string)$ab_test_item->test_ends_when) ->setThreshold((int)$ab_test_item->threshold) ->setPostTestAction((string)$ab_test_item->post_test_action); $ab_tests[] = $ab_test; } return $ab_tests; }
php
public function showABDefinitions() { $xml = $this->call('show_abdefinitions'); $ab_tests = array(); foreach ($xml->Data as $ab_test_item) { $ab_test = new ABTest; $is_testing_subject = $ab_test_item->test_subject == '1' ? TRUE : FALSE; $is_testing_from_address = $ab_test_item->test_from_address == '1' ? TRUE : FALSE; $is_testing_content = $ab_test_item->test_content == '1' ? TRUE : FALSE; $ab_test ->setId((int)$ab_test_item->id) ->setName((string)$ab_test_item->name) ->setDescription((string)$ab_test_item->description) ->setListId((int)$ab_test_item->list_id) ->setListName((string)$ab_test_item->list_name) ->setSegmentationRuleId((int)$ab_test_item->segmentation_rule_id) ->setSuppressionList((string)$ab_test_item->suppression_list) ->setMaxTime((int)$ab_test_item->max_time) ->setMeasuring((string)$ab_test_item->measuring) ->setNumSamples((int)$ab_test_item->num_samples) ->setSampleSize((int)$ab_test_item->sample_size) ->setSampleType((string)$ab_test_item->sample_type) ->setTestSubject((boolean)$is_testing_subject) ->setTestFromAddress((boolean)$is_testing_from_address) ->setTestContent((boolean)$is_testing_content) ->setTestEndsWhen((string)$ab_test_item->test_ends_when) ->setThreshold((int)$ab_test_item->threshold) ->setPostTestAction((string)$ab_test_item->post_test_action); $ab_tests[] = $ab_test; } return $ab_tests; }
[ "public", "function", "showABDefinitions", "(", ")", "{", "$", "xml", "=", "$", "this", "->", "call", "(", "'show_abdefinitions'", ")", ";", "$", "ab_tests", "=", "array", "(", ")", ";", "foreach", "(", "$", "xml", "->", "Data", "as", "$", "ab_test_item", ")", "{", "$", "ab_test", "=", "new", "ABTest", ";", "$", "is_testing_subject", "=", "$", "ab_test_item", "->", "test_subject", "==", "'1'", "?", "TRUE", ":", "FALSE", ";", "$", "is_testing_from_address", "=", "$", "ab_test_item", "->", "test_from_address", "==", "'1'", "?", "TRUE", ":", "FALSE", ";", "$", "is_testing_content", "=", "$", "ab_test_item", "->", "test_content", "==", "'1'", "?", "TRUE", ":", "FALSE", ";", "$", "ab_test", "->", "setId", "(", "(", "int", ")", "$", "ab_test_item", "->", "id", ")", "->", "setName", "(", "(", "string", ")", "$", "ab_test_item", "->", "name", ")", "->", "setDescription", "(", "(", "string", ")", "$", "ab_test_item", "->", "description", ")", "->", "setListId", "(", "(", "int", ")", "$", "ab_test_item", "->", "list_id", ")", "->", "setListName", "(", "(", "string", ")", "$", "ab_test_item", "->", "list_name", ")", "->", "setSegmentationRuleId", "(", "(", "int", ")", "$", "ab_test_item", "->", "segmentation_rule_id", ")", "->", "setSuppressionList", "(", "(", "string", ")", "$", "ab_test_item", "->", "suppression_list", ")", "->", "setMaxTime", "(", "(", "int", ")", "$", "ab_test_item", "->", "max_time", ")", "->", "setMeasuring", "(", "(", "string", ")", "$", "ab_test_item", "->", "measuring", ")", "->", "setNumSamples", "(", "(", "int", ")", "$", "ab_test_item", "->", "num_samples", ")", "->", "setSampleSize", "(", "(", "int", ")", "$", "ab_test_item", "->", "sample_size", ")", "->", "setSampleType", "(", "(", "string", ")", "$", "ab_test_item", "->", "sample_type", ")", "->", "setTestSubject", "(", "(", "boolean", ")", "$", "is_testing_subject", ")", "->", "setTestFromAddress", "(", "(", "boolean", ")", "$", "is_testing_from_address", ")", "->", "setTestContent", "(", "(", "boolean", ")", "$", "is_testing_content", ")", "->", "setTestEndsWhen", "(", "(", "string", ")", "$", "ab_test_item", "->", "test_ends_when", ")", "->", "setThreshold", "(", "(", "int", ")", "$", "ab_test_item", "->", "threshold", ")", "->", "setPostTestAction", "(", "(", "string", ")", "$", "ab_test_item", "->", "post_test_action", ")", ";", "$", "ab_tests", "[", "]", "=", "$", "ab_test", ";", "}", "return", "$", "ab_tests", ";", "}" ]
@return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670035
[ "@return", "array", "@throws", "Exception" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1163-L1198
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getABDefinition
public function getABDefinition(&$ab_definition) { $form_data = array( 'ab_definition_id' => $ab_definition->getId() ); $xml = $this->call('getabdefinitionbyid', $form_data); $xml = $xml->Data; $is_testing_subject = $xml->test_subject == '1' ? TRUE : FALSE; $is_testing_from_address = $xml->test_from_address == '1' ? TRUE : FALSE; $is_testing_content = $xml->test_content == '1' ? TRUE : FALSE; $ab_definition ->setId((int)$xml->id) ->setName((string)$xml->name) ->setDescription((string)$xml->description) ->setListId((int)$xml->list_id) ->setListName((string)$xml->list_name) ->setSegmentationRuleId((int)$xml->segmentation_rule_id) ->setSuppressionList((string)$xml->suppression_list) ->setMaxTime((int)$xml->max_time) ->setMeasuring((string)$xml->measuring) ->setNumSamples((int)$xml->num_samples) ->setSampleSize((int)$xml->sample_size) ->setSampleType((string)$xml->sample_type) ->setTestSubject((boolean)$is_testing_subject) ->setTestFromAddress((boolean)$is_testing_from_address) ->setTestContent((boolean)$is_testing_content) ->setTestEndsWhen((string)$xml->test_ends_when) ->setThreshold((int)$xml->threshold) ->setPostTestAction((string)$xml->post_test_action); }
php
public function getABDefinition(&$ab_definition) { $form_data = array( 'ab_definition_id' => $ab_definition->getId() ); $xml = $this->call('getabdefinitionbyid', $form_data); $xml = $xml->Data; $is_testing_subject = $xml->test_subject == '1' ? TRUE : FALSE; $is_testing_from_address = $xml->test_from_address == '1' ? TRUE : FALSE; $is_testing_content = $xml->test_content == '1' ? TRUE : FALSE; $ab_definition ->setId((int)$xml->id) ->setName((string)$xml->name) ->setDescription((string)$xml->description) ->setListId((int)$xml->list_id) ->setListName((string)$xml->list_name) ->setSegmentationRuleId((int)$xml->segmentation_rule_id) ->setSuppressionList((string)$xml->suppression_list) ->setMaxTime((int)$xml->max_time) ->setMeasuring((string)$xml->measuring) ->setNumSamples((int)$xml->num_samples) ->setSampleSize((int)$xml->sample_size) ->setSampleType((string)$xml->sample_type) ->setTestSubject((boolean)$is_testing_subject) ->setTestFromAddress((boolean)$is_testing_from_address) ->setTestContent((boolean)$is_testing_content) ->setTestEndsWhen((string)$xml->test_ends_when) ->setThreshold((int)$xml->threshold) ->setPostTestAction((string)$xml->post_test_action); }
[ "public", "function", "getABDefinition", "(", "&", "$", "ab_definition", ")", "{", "$", "form_data", "=", "array", "(", "'ab_definition_id'", "=>", "$", "ab_definition", "->", "getId", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'getabdefinitionbyid'", ",", "$", "form_data", ")", ";", "$", "xml", "=", "$", "xml", "->", "Data", ";", "$", "is_testing_subject", "=", "$", "xml", "->", "test_subject", "==", "'1'", "?", "TRUE", ":", "FALSE", ";", "$", "is_testing_from_address", "=", "$", "xml", "->", "test_from_address", "==", "'1'", "?", "TRUE", ":", "FALSE", ";", "$", "is_testing_content", "=", "$", "xml", "->", "test_content", "==", "'1'", "?", "TRUE", ":", "FALSE", ";", "$", "ab_definition", "->", "setId", "(", "(", "int", ")", "$", "xml", "->", "id", ")", "->", "setName", "(", "(", "string", ")", "$", "xml", "->", "name", ")", "->", "setDescription", "(", "(", "string", ")", "$", "xml", "->", "description", ")", "->", "setListId", "(", "(", "int", ")", "$", "xml", "->", "list_id", ")", "->", "setListName", "(", "(", "string", ")", "$", "xml", "->", "list_name", ")", "->", "setSegmentationRuleId", "(", "(", "int", ")", "$", "xml", "->", "segmentation_rule_id", ")", "->", "setSuppressionList", "(", "(", "string", ")", "$", "xml", "->", "suppression_list", ")", "->", "setMaxTime", "(", "(", "int", ")", "$", "xml", "->", "max_time", ")", "->", "setMeasuring", "(", "(", "string", ")", "$", "xml", "->", "measuring", ")", "->", "setNumSamples", "(", "(", "int", ")", "$", "xml", "->", "num_samples", ")", "->", "setSampleSize", "(", "(", "int", ")", "$", "xml", "->", "sample_size", ")", "->", "setSampleType", "(", "(", "string", ")", "$", "xml", "->", "sample_type", ")", "->", "setTestSubject", "(", "(", "boolean", ")", "$", "is_testing_subject", ")", "->", "setTestFromAddress", "(", "(", "boolean", ")", "$", "is_testing_from_address", ")", "->", "setTestContent", "(", "(", "boolean", ")", "$", "is_testing_content", ")", "->", "setTestEndsWhen", "(", "(", "string", ")", "$", "xml", "->", "test_ends_when", ")", "->", "setThreshold", "(", "(", "int", ")", "$", "xml", "->", "threshold", ")", "->", "setPostTestAction", "(", "(", "string", ")", "$", "xml", "->", "post_test_action", ")", ";", "}" ]
@param $ab_definition @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969789
[ "@param", "$ab_definition" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1207-L1238
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.chooseABWinner
public function chooseABWinner($ab_definition_id) { $form_data = array( 'ab_definition_id' => $ab_definition_id ); $xml = $this->call('abmailwinner', $form_data); $ab_test_statistics = new ABTestStatistics; return TRUE; }
php
public function chooseABWinner($ab_definition_id) { $form_data = array( 'ab_definition_id' => $ab_definition_id ); $xml = $this->call('abmailwinner', $form_data); $ab_test_statistics = new ABTestStatistics; return TRUE; }
[ "public", "function", "chooseABWinner", "(", "$", "ab_definition_id", ")", "{", "$", "form_data", "=", "array", "(", "'ab_definition_id'", "=>", "$", "ab_definition_id", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'abmailwinner'", ",", "$", "form_data", ")", ";", "$", "ab_test_statistics", "=", "new", "ABTestStatistics", ";", "return", "TRUE", ";", "}" ]
@param $ab_definition_id @return bool @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670055 @todo Find out how to get $ab_definition_id @todo Create test in examples/
[ "@param", "$ab_definition_id" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1343-L1353
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.createCustomField
public function createCustomField(Field $field) { $form_data = array( 'fieldname' => $field->getName(), 'fieldtype' => $field->getType(), 'description' => $field->getDescription() ); $this->call('customfieldcreate', $form_data); return TRUE; }
php
public function createCustomField(Field $field) { $form_data = array( 'fieldname' => $field->getName(), 'fieldtype' => $field->getType(), 'description' => $field->getDescription() ); $this->call('customfieldcreate', $form_data); return TRUE; }
[ "public", "function", "createCustomField", "(", "Field", "$", "field", ")", "{", "$", "form_data", "=", "array", "(", "'fieldname'", "=>", "$", "field", "->", "getName", "(", ")", ",", "'fieldtype'", "=>", "$", "field", "->", "getType", "(", ")", ",", "'description'", "=>", "$", "field", "->", "getDescription", "(", ")", ")", ";", "$", "this", "->", "call", "(", "'customfieldcreate'", ",", "$", "form_data", ")", ";", "return", "TRUE", ";", "}" ]
@param Field $field @return boolean @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669835
[ "@param", "Field", "$field" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1363-L1373
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.deleteCustomField
public function deleteCustomField(Field $field) { $form_data = array( 'fieldname' => $field->getName() ); $this->call('customfielddelete', $form_data); return TRUE; }
php
public function deleteCustomField(Field $field) { $form_data = array( 'fieldname' => $field->getName() ); $this->call('customfielddelete', $form_data); return TRUE; }
[ "public", "function", "deleteCustomField", "(", "Field", "$", "field", ")", "{", "$", "form_data", "=", "array", "(", "'fieldname'", "=>", "$", "field", "->", "getName", "(", ")", ")", ";", "$", "this", "->", "call", "(", "'customfielddelete'", ",", "$", "form_data", ")", ";", "return", "TRUE", ";", "}" ]
@param Field $field @return boolean @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669845
[ "@param", "Field", "$field" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1383-L1391
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getSocialProviders
public function getSocialProviders() { $xml = $this->call('getsocialproviders'); $social_providers = array(); foreach ($xml->Data as $social_provider_item) { $social_provider = new SocialProvider; $social_provider ->setProviderId((int)$social_provider_item->social_provider_id) ->setProviderName((string)$social_provider_item->provider) ->setUsername((string)$social_provider_item->username); $social_providers[] = $social_provider; } return $social_providers; }
php
public function getSocialProviders() { $xml = $this->call('getsocialproviders'); $social_providers = array(); foreach ($xml->Data as $social_provider_item) { $social_provider = new SocialProvider; $social_provider ->setProviderId((int)$social_provider_item->social_provider_id) ->setProviderName((string)$social_provider_item->provider) ->setUsername((string)$social_provider_item->username); $social_providers[] = $social_provider; } return $social_providers; }
[ "public", "function", "getSocialProviders", "(", ")", "{", "$", "xml", "=", "$", "this", "->", "call", "(", "'getsocialproviders'", ")", ";", "$", "social_providers", "=", "array", "(", ")", ";", "foreach", "(", "$", "xml", "->", "Data", "as", "$", "social_provider_item", ")", "{", "$", "social_provider", "=", "new", "SocialProvider", ";", "$", "social_provider", "->", "setProviderId", "(", "(", "int", ")", "$", "social_provider_item", "->", "social_provider_id", ")", "->", "setProviderName", "(", "(", "string", ")", "$", "social_provider_item", "->", "provider", ")", "->", "setUsername", "(", "(", "string", ")", "$", "social_provider_item", "->", "username", ")", ";", "$", "social_providers", "[", "]", "=", "$", "social_provider", ";", "}", "return", "$", "social_providers", ";", "}" ]
@return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969549
[ "@return", "array", "@throws", "Exception" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1399-L1415
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getSocialProviderById
public function getSocialProviderById(SocialProvider &$social_provider) { $form_data = array( 'social_provider_id' => $social_provider->getProviderId() ); $xml = $this->call('getsocialproviderbyid', $form_data); $xml = $xml->Data; $social_provider ->setProviderName((string)$xml->provider) ->setUsername((string)$xml->username); }
php
public function getSocialProviderById(SocialProvider &$social_provider) { $form_data = array( 'social_provider_id' => $social_provider->getProviderId() ); $xml = $this->call('getsocialproviderbyid', $form_data); $xml = $xml->Data; $social_provider ->setProviderName((string)$xml->provider) ->setUsername((string)$xml->username); }
[ "public", "function", "getSocialProviderById", "(", "SocialProvider", "&", "$", "social_provider", ")", "{", "$", "form_data", "=", "array", "(", "'social_provider_id'", "=>", "$", "social_provider", "->", "getProviderId", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'getsocialproviderbyid'", ",", "$", "form_data", ")", ";", "$", "xml", "=", "$", "xml", "->", "Data", ";", "$", "social_provider", "->", "setProviderName", "(", "(", "string", ")", "$", "xml", "->", "provider", ")", "->", "setUsername", "(", "(", "string", ")", "$", "xml", "->", "username", ")", ";", "}" ]
@param SocialProvider $social_provider @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669885
[ "@param", "SocialProvider", "$social_provider" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1424-L1435
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getSocialProviderByUserName
public function getSocialProviderByUserName(SocialProvider &$social_provider) { $form_data = array( 'username' => $social_provider->getUsername(), 'provider' => $social_provider->getProviderName() ); $xml = $this->call('getsocialproviderbyusername', $form_data); $xml = $xml->Data; $social_provider ->setProviderId((int)$xml->social_provider_id); }
php
public function getSocialProviderByUserName(SocialProvider &$social_provider) { $form_data = array( 'username' => $social_provider->getUsername(), 'provider' => $social_provider->getProviderName() ); $xml = $this->call('getsocialproviderbyusername', $form_data); $xml = $xml->Data; $social_provider ->setProviderId((int)$xml->social_provider_id); }
[ "public", "function", "getSocialProviderByUserName", "(", "SocialProvider", "&", "$", "social_provider", ")", "{", "$", "form_data", "=", "array", "(", "'username'", "=>", "$", "social_provider", "->", "getUsername", "(", ")", ",", "'provider'", "=>", "$", "social_provider", "->", "getProviderName", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'getsocialproviderbyusername'", ",", "$", "form_data", ")", ";", "$", "xml", "=", "$", "xml", "->", "Data", ";", "$", "social_provider", "->", "setProviderId", "(", "(", "int", ")", "$", "xml", "->", "social_provider_id", ")", ";", "}" ]
@param SocialProvider $social_provider @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969559
[ "@param", "SocialProvider", "$social_provider" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1444-L1455
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.deleteSocialProviderById
public function deleteSocialProviderById(SocialProvider $social_provider) { $form_data = array( 'social_provider_id' => $social_provider->getProviderId() ); $this->call('deletesocialproviderbyid', $form_data); return TRUE; }
php
public function deleteSocialProviderById(SocialProvider $social_provider) { $form_data = array( 'social_provider_id' => $social_provider->getProviderId() ); $this->call('deletesocialproviderbyid', $form_data); return TRUE; }
[ "public", "function", "deleteSocialProviderById", "(", "SocialProvider", "$", "social_provider", ")", "{", "$", "form_data", "=", "array", "(", "'social_provider_id'", "=>", "$", "social_provider", "->", "getProviderId", "(", ")", ")", ";", "$", "this", "->", "call", "(", "'deletesocialproviderbyid'", ",", "$", "form_data", ")", ";", "return", "TRUE", ";", "}" ]
@param SocialProvider $social_provider @return bool @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969569
[ "@param", "SocialProvider", "$social_provider" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1465-L1473
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.deleteSocialProviderByUserName
public function deleteSocialProviderByUserName(SocialProvider $social_provider) { $form_data = array( 'provider' => $social_provider->getProviderName(), 'username' => $social_provider->getUsername() ); $this->call('deletesocialproviderbyusername', $form_data); return TRUE; }
php
public function deleteSocialProviderByUserName(SocialProvider $social_provider) { $form_data = array( 'provider' => $social_provider->getProviderName(), 'username' => $social_provider->getUsername() ); $this->call('deletesocialproviderbyusername', $form_data); return TRUE; }
[ "public", "function", "deleteSocialProviderByUserName", "(", "SocialProvider", "$", "social_provider", ")", "{", "$", "form_data", "=", "array", "(", "'provider'", "=>", "$", "social_provider", "->", "getProviderName", "(", ")", ",", "'username'", "=>", "$", "social_provider", "->", "getUsername", "(", ")", ")", ";", "$", "this", "->", "call", "(", "'deletesocialproviderbyusername'", ",", "$", "form_data", ")", ";", "return", "TRUE", ";", "}" ]
@param SocialProvider $social_provider @return bool @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969579
[ "@param", "SocialProvider", "$social_provider" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1483-L1492
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.setSocialPostForTemplate
public function setSocialPostForTemplate(Template $template, SocialProvider $social_provider, SocialPost $social_post) { $form_data = array( 'template_id' => $template->getTemplateId(), 'provider' => $social_provider->getProviderName(), 'post' => $social_post->getPost() ); $this->call('setsocialpostfortemplate', $form_data); return TRUE; }
php
public function setSocialPostForTemplate(Template $template, SocialProvider $social_provider, SocialPost $social_post) { $form_data = array( 'template_id' => $template->getTemplateId(), 'provider' => $social_provider->getProviderName(), 'post' => $social_post->getPost() ); $this->call('setsocialpostfortemplate', $form_data); return TRUE; }
[ "public", "function", "setSocialPostForTemplate", "(", "Template", "$", "template", ",", "SocialProvider", "$", "social_provider", ",", "SocialPost", "$", "social_post", ")", "{", "$", "form_data", "=", "array", "(", "'template_id'", "=>", "$", "template", "->", "getTemplateId", "(", ")", ",", "'provider'", "=>", "$", "social_provider", "->", "getProviderName", "(", ")", ",", "'post'", "=>", "$", "social_post", "->", "getPost", "(", ")", ")", ";", "$", "this", "->", "call", "(", "'setsocialpostfortemplate'", ",", "$", "form_data", ")", ";", "return", "TRUE", ";", "}" ]
@param Template $template @param SocialProvider $social_provider @param SocialPost $social_post @return bool @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969589
[ "@param", "Template", "$template", "@param", "SocialProvider", "$social_provider", "@param", "SocialPost", "$social_post" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1504-L1514
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.getSocialPostsByTemplateId
public function getSocialPostsByTemplateId(Template $template) { $form_data = array( 'template_id' => $template->getTemplateId() ); $xml = $this->call('getsocialpostsfortemplatebyid', $form_data); $social_posts = array(); foreach ($xml->Data as $social_post_item) { $social_post = new SocialPost(); $social_post ->setTemplateSocialPostId((int)$social_post_item->template_social_post_id) ->setTemplateId((int)$social_post_item->template_id) ->setProvider((string)$social_post_item->provider) ->setPost((string)$social_post_item->post); $social_posts[] = $social_post; } return $social_posts; }
php
public function getSocialPostsByTemplateId(Template $template) { $form_data = array( 'template_id' => $template->getTemplateId() ); $xml = $this->call('getsocialpostsfortemplatebyid', $form_data); $social_posts = array(); foreach ($xml->Data as $social_post_item) { $social_post = new SocialPost(); $social_post ->setTemplateSocialPostId((int)$social_post_item->template_social_post_id) ->setTemplateId((int)$social_post_item->template_id) ->setProvider((string)$social_post_item->provider) ->setPost((string)$social_post_item->post); $social_posts[] = $social_post; } return $social_posts; }
[ "public", "function", "getSocialPostsByTemplateId", "(", "Template", "$", "template", ")", "{", "$", "form_data", "=", "array", "(", "'template_id'", "=>", "$", "template", "->", "getTemplateId", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'getsocialpostsfortemplatebyid'", ",", "$", "form_data", ")", ";", "$", "social_posts", "=", "array", "(", ")", ";", "foreach", "(", "$", "xml", "->", "Data", "as", "$", "social_post_item", ")", "{", "$", "social_post", "=", "new", "SocialPost", "(", ")", ";", "$", "social_post", "->", "setTemplateSocialPostId", "(", "(", "int", ")", "$", "social_post_item", "->", "template_social_post_id", ")", "->", "setTemplateId", "(", "(", "int", ")", "$", "social_post_item", "->", "template_id", ")", "->", "setProvider", "(", "(", "string", ")", "$", "social_post_item", "->", "provider", ")", "->", "setPost", "(", "(", "string", ")", "$", "social_post_item", "->", "post", ")", ";", "$", "social_posts", "[", "]", "=", "$", "social_post", ";", "}", "return", "$", "social_posts", ";", "}" ]
@param Template $template @return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969599
[ "@param", "Template", "$template" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1524-L1543
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.sendOneOffMessage
public function sendOneOffMessage(Mail $message) { $form_data = array( 'list_id' => $message->getListId(), 'from' => $message->getFromAddress(), 'reply_to_address' => $message->getReplyToAddress(), 'errors_to' => $message->getBounceAddress(), 'sender' => $message->getSenderAddress(), 'to' => $message->getSendToAddress(), 'cc' => $message->getCcToAddress(), 'template_id' => $message->getTemplateId(), 'plain_text_body' => $message->getBodyText(), 'html_body' => $message->getBodyHtml(), 'subject' => $message->getSubject(), 'format' => $message->getFormat(), 'campaign_name' => $message->getCampaignName(), 'vmta' => $message->getVirtualMta(), 'first_name' => $message->getFirstName(), 'dup' => $message->isDuplicate(), 'ignore_optout' => $message->isIgnoreOptout(), 'charset' => $message->getCharacterEncoding(), 'data' => $message->getData(), ); $xml = $this->call('send', $form_data); return trim($xml[1]); }
php
public function sendOneOffMessage(Mail $message) { $form_data = array( 'list_id' => $message->getListId(), 'from' => $message->getFromAddress(), 'reply_to_address' => $message->getReplyToAddress(), 'errors_to' => $message->getBounceAddress(), 'sender' => $message->getSenderAddress(), 'to' => $message->getSendToAddress(), 'cc' => $message->getCcToAddress(), 'template_id' => $message->getTemplateId(), 'plain_text_body' => $message->getBodyText(), 'html_body' => $message->getBodyHtml(), 'subject' => $message->getSubject(), 'format' => $message->getFormat(), 'campaign_name' => $message->getCampaignName(), 'vmta' => $message->getVirtualMta(), 'first_name' => $message->getFirstName(), 'dup' => $message->isDuplicate(), 'ignore_optout' => $message->isIgnoreOptout(), 'charset' => $message->getCharacterEncoding(), 'data' => $message->getData(), ); $xml = $this->call('send', $form_data); return trim($xml[1]); }
[ "public", "function", "sendOneOffMessage", "(", "Mail", "$", "message", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "message", "->", "getListId", "(", ")", ",", "'from'", "=>", "$", "message", "->", "getFromAddress", "(", ")", ",", "'reply_to_address'", "=>", "$", "message", "->", "getReplyToAddress", "(", ")", ",", "'errors_to'", "=>", "$", "message", "->", "getBounceAddress", "(", ")", ",", "'sender'", "=>", "$", "message", "->", "getSenderAddress", "(", ")", ",", "'to'", "=>", "$", "message", "->", "getSendToAddress", "(", ")", ",", "'cc'", "=>", "$", "message", "->", "getCcToAddress", "(", ")", ",", "'template_id'", "=>", "$", "message", "->", "getTemplateId", "(", ")", ",", "'plain_text_body'", "=>", "$", "message", "->", "getBodyText", "(", ")", ",", "'html_body'", "=>", "$", "message", "->", "getBodyHtml", "(", ")", ",", "'subject'", "=>", "$", "message", "->", "getSubject", "(", ")", ",", "'format'", "=>", "$", "message", "->", "getFormat", "(", ")", ",", "'campaign_name'", "=>", "$", "message", "->", "getCampaignName", "(", ")", ",", "'vmta'", "=>", "$", "message", "->", "getVirtualMta", "(", ")", ",", "'first_name'", "=>", "$", "message", "->", "getFirstName", "(", ")", ",", "'dup'", "=>", "$", "message", "->", "isDuplicate", "(", ")", ",", "'ignore_optout'", "=>", "$", "message", "->", "isIgnoreOptout", "(", ")", ",", "'charset'", "=>", "$", "message", "->", "getCharacterEncoding", "(", ")", ",", "'data'", "=>", "$", "message", "->", "getData", "(", ")", ",", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'send'", ",", "$", "form_data", ")", ";", "return", "trim", "(", "$", "xml", "[", "1", "]", ")", ";", "}" ]
@param Mail $message @return string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969749
[ "@param", "Mail", "$message" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1582-L1608
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.launchCampaign
public function launchCampaign(Campaign &$campaign) { $form_data = array( 'list_id' => $campaign->getListId(), 'template_id' => $campaign->getTemplateId(), 'subject' => $campaign->getSubject(), 'seed_list_id' => $campaign->getSeedListId(), 'segmentation_id' => $campaign->getSegmentationId(), 'format' => $campaign->getFormat(), 'campaign_alias' => $campaign->getAlias(), 'target_rss' => $campaign->getRss(), 'vmta' => $campaign->getVmta(), 'ab_definition_id' => $campaign->getAbDefinitionId(), 'deployed_by_email' => $campaign->getDeployedByEmail(), 'return_task_id' => $campaign->getReturnTaskId(), 'delivery' => $campaign->getSeedDelivery(), 'notify_email' => $campaign->getSendNotification() ); $data = $this->call('launch', $form_data); if ($campaign->getReturnTaskId()) { $campaign->setTaskId(trim($data[2])); } }
php
public function launchCampaign(Campaign &$campaign) { $form_data = array( 'list_id' => $campaign->getListId(), 'template_id' => $campaign->getTemplateId(), 'subject' => $campaign->getSubject(), 'seed_list_id' => $campaign->getSeedListId(), 'segmentation_id' => $campaign->getSegmentationId(), 'format' => $campaign->getFormat(), 'campaign_alias' => $campaign->getAlias(), 'target_rss' => $campaign->getRss(), 'vmta' => $campaign->getVmta(), 'ab_definition_id' => $campaign->getAbDefinitionId(), 'deployed_by_email' => $campaign->getDeployedByEmail(), 'return_task_id' => $campaign->getReturnTaskId(), 'delivery' => $campaign->getSeedDelivery(), 'notify_email' => $campaign->getSendNotification() ); $data = $this->call('launch', $form_data); if ($campaign->getReturnTaskId()) { $campaign->setTaskId(trim($data[2])); } }
[ "public", "function", "launchCampaign", "(", "Campaign", "&", "$", "campaign", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "campaign", "->", "getListId", "(", ")", ",", "'template_id'", "=>", "$", "campaign", "->", "getTemplateId", "(", ")", ",", "'subject'", "=>", "$", "campaign", "->", "getSubject", "(", ")", ",", "'seed_list_id'", "=>", "$", "campaign", "->", "getSeedListId", "(", ")", ",", "'segmentation_id'", "=>", "$", "campaign", "->", "getSegmentationId", "(", ")", ",", "'format'", "=>", "$", "campaign", "->", "getFormat", "(", ")", ",", "'campaign_alias'", "=>", "$", "campaign", "->", "getAlias", "(", ")", ",", "'target_rss'", "=>", "$", "campaign", "->", "getRss", "(", ")", ",", "'vmta'", "=>", "$", "campaign", "->", "getVmta", "(", ")", ",", "'ab_definition_id'", "=>", "$", "campaign", "->", "getAbDefinitionId", "(", ")", ",", "'deployed_by_email'", "=>", "$", "campaign", "->", "getDeployedByEmail", "(", ")", ",", "'return_task_id'", "=>", "$", "campaign", "->", "getReturnTaskId", "(", ")", ",", "'delivery'", "=>", "$", "campaign", "->", "getSeedDelivery", "(", ")", ",", "'notify_email'", "=>", "$", "campaign", "->", "getSendNotification", "(", ")", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'launch'", ",", "$", "form_data", ")", ";", "if", "(", "$", "campaign", "->", "getReturnTaskId", "(", ")", ")", "{", "$", "campaign", "->", "setTaskId", "(", "trim", "(", "$", "data", "[", "2", "]", ")", ")", ";", "}", "}" ]
@param Campaign $campaign @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669985
[ "@param", "Campaign", "$campaign" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1653-L1678
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.scheduleCampaign
public function scheduleCampaign(Campaign &$campaign) { $form_data = array( 'list_id' => $campaign->getListId(), 'template_id' => $campaign->getTemplateId(), 'format' => $campaign->getFormat(), 'segmentation_id' => $campaign->getSegmentationId(), 'seed_list_id' => $campaign->getSeedListId(), 'suppression_list' => $campaign->getSupressionList(), 'set_data_macro_id' => $campaign->getDataMacroId(), 'campaign_alias' => $campaign->getAlias(), 'target_rss' => $campaign->getRss(), 'limit' => $campaign->getLimit(), 'fillin_name0' => $campaign->getFillinName0(), 'fillin_value0' => $campaign->getFillinValue0(), 'fillin_name1' => $campaign->getFillinName1(), 'fillin_value1' => $campaign->getFillinValue1(), 'fillin_name2' => $campaign->getFillinName2(), 'fillin_value2' => $campaign->getFillinValue2(), 'fillin_name3' => $campaign->getFillinName3(), 'fillin_value3' => $campaign->getFillinValue3(), 'fillin_name4' => $campaign->getFillinName4(), 'fillin_value4' => $campaign->getFillinValue4(), 'fillin_name5' => $campaign->getFillinName5(), 'fillin_value5' => $campaign->getFillinValue5(), 'fillin_name6' => $campaign->getFillinName6(), 'fillin_value6' => $campaign->getFillinValu60(), 'fillin_name7' => $campaign->getFillinName7(), 'fillin_value7' => $campaign->getFillinValue7(), 'fillin_name8' => $campaign->getFillinName8(), 'fillin_value8' => $campaign->getFillinValue8(), 'fillin_name9' => $campaign->getFillinName9(), 'fillin_value9' => $campaign->getFillinValue9(), 'delivery' => $campaign->getSeedDelivery(), 'notify_email' => $campaign->getSendNotification(), 'start_month' => $campaign->getStartMonth(), 'start_day' => $campaign->getStartDay(), 'start_year' => $campaign->getStartYear(), 'hour' => $campaign->getStartHour(), 'minute' => $campaign->getStartMinute(), 'end_month' => $campaign->getEndMonth(), 'end_day' => $campaign->getEndDay(), 'end_year' => $campaign->getEndYear(), 'no_end_date' => $campaign->getNoEndDate(), 'workflow_send_time' => $campaign->getWorkflowSendTime(), 'repeat_frequency' => $campaign->getRepeatFrequency() ); $this->call('schedule_deployment', $form_data); return TRUE; }
php
public function scheduleCampaign(Campaign &$campaign) { $form_data = array( 'list_id' => $campaign->getListId(), 'template_id' => $campaign->getTemplateId(), 'format' => $campaign->getFormat(), 'segmentation_id' => $campaign->getSegmentationId(), 'seed_list_id' => $campaign->getSeedListId(), 'suppression_list' => $campaign->getSupressionList(), 'set_data_macro_id' => $campaign->getDataMacroId(), 'campaign_alias' => $campaign->getAlias(), 'target_rss' => $campaign->getRss(), 'limit' => $campaign->getLimit(), 'fillin_name0' => $campaign->getFillinName0(), 'fillin_value0' => $campaign->getFillinValue0(), 'fillin_name1' => $campaign->getFillinName1(), 'fillin_value1' => $campaign->getFillinValue1(), 'fillin_name2' => $campaign->getFillinName2(), 'fillin_value2' => $campaign->getFillinValue2(), 'fillin_name3' => $campaign->getFillinName3(), 'fillin_value3' => $campaign->getFillinValue3(), 'fillin_name4' => $campaign->getFillinName4(), 'fillin_value4' => $campaign->getFillinValue4(), 'fillin_name5' => $campaign->getFillinName5(), 'fillin_value5' => $campaign->getFillinValue5(), 'fillin_name6' => $campaign->getFillinName6(), 'fillin_value6' => $campaign->getFillinValu60(), 'fillin_name7' => $campaign->getFillinName7(), 'fillin_value7' => $campaign->getFillinValue7(), 'fillin_name8' => $campaign->getFillinName8(), 'fillin_value8' => $campaign->getFillinValue8(), 'fillin_name9' => $campaign->getFillinName9(), 'fillin_value9' => $campaign->getFillinValue9(), 'delivery' => $campaign->getSeedDelivery(), 'notify_email' => $campaign->getSendNotification(), 'start_month' => $campaign->getStartMonth(), 'start_day' => $campaign->getStartDay(), 'start_year' => $campaign->getStartYear(), 'hour' => $campaign->getStartHour(), 'minute' => $campaign->getStartMinute(), 'end_month' => $campaign->getEndMonth(), 'end_day' => $campaign->getEndDay(), 'end_year' => $campaign->getEndYear(), 'no_end_date' => $campaign->getNoEndDate(), 'workflow_send_time' => $campaign->getWorkflowSendTime(), 'repeat_frequency' => $campaign->getRepeatFrequency() ); $this->call('schedule_deployment', $form_data); return TRUE; }
[ "public", "function", "scheduleCampaign", "(", "Campaign", "&", "$", "campaign", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "campaign", "->", "getListId", "(", ")", ",", "'template_id'", "=>", "$", "campaign", "->", "getTemplateId", "(", ")", ",", "'format'", "=>", "$", "campaign", "->", "getFormat", "(", ")", ",", "'segmentation_id'", "=>", "$", "campaign", "->", "getSegmentationId", "(", ")", ",", "'seed_list_id'", "=>", "$", "campaign", "->", "getSeedListId", "(", ")", ",", "'suppression_list'", "=>", "$", "campaign", "->", "getSupressionList", "(", ")", ",", "'set_data_macro_id'", "=>", "$", "campaign", "->", "getDataMacroId", "(", ")", ",", "'campaign_alias'", "=>", "$", "campaign", "->", "getAlias", "(", ")", ",", "'target_rss'", "=>", "$", "campaign", "->", "getRss", "(", ")", ",", "'limit'", "=>", "$", "campaign", "->", "getLimit", "(", ")", ",", "'fillin_name0'", "=>", "$", "campaign", "->", "getFillinName0", "(", ")", ",", "'fillin_value0'", "=>", "$", "campaign", "->", "getFillinValue0", "(", ")", ",", "'fillin_name1'", "=>", "$", "campaign", "->", "getFillinName1", "(", ")", ",", "'fillin_value1'", "=>", "$", "campaign", "->", "getFillinValue1", "(", ")", ",", "'fillin_name2'", "=>", "$", "campaign", "->", "getFillinName2", "(", ")", ",", "'fillin_value2'", "=>", "$", "campaign", "->", "getFillinValue2", "(", ")", ",", "'fillin_name3'", "=>", "$", "campaign", "->", "getFillinName3", "(", ")", ",", "'fillin_value3'", "=>", "$", "campaign", "->", "getFillinValue3", "(", ")", ",", "'fillin_name4'", "=>", "$", "campaign", "->", "getFillinName4", "(", ")", ",", "'fillin_value4'", "=>", "$", "campaign", "->", "getFillinValue4", "(", ")", ",", "'fillin_name5'", "=>", "$", "campaign", "->", "getFillinName5", "(", ")", ",", "'fillin_value5'", "=>", "$", "campaign", "->", "getFillinValue5", "(", ")", ",", "'fillin_name6'", "=>", "$", "campaign", "->", "getFillinName6", "(", ")", ",", "'fillin_value6'", "=>", "$", "campaign", "->", "getFillinValu60", "(", ")", ",", "'fillin_name7'", "=>", "$", "campaign", "->", "getFillinName7", "(", ")", ",", "'fillin_value7'", "=>", "$", "campaign", "->", "getFillinValue7", "(", ")", ",", "'fillin_name8'", "=>", "$", "campaign", "->", "getFillinName8", "(", ")", ",", "'fillin_value8'", "=>", "$", "campaign", "->", "getFillinValue8", "(", ")", ",", "'fillin_name9'", "=>", "$", "campaign", "->", "getFillinName9", "(", ")", ",", "'fillin_value9'", "=>", "$", "campaign", "->", "getFillinValue9", "(", ")", ",", "'delivery'", "=>", "$", "campaign", "->", "getSeedDelivery", "(", ")", ",", "'notify_email'", "=>", "$", "campaign", "->", "getSendNotification", "(", ")", ",", "'start_month'", "=>", "$", "campaign", "->", "getStartMonth", "(", ")", ",", "'start_day'", "=>", "$", "campaign", "->", "getStartDay", "(", ")", ",", "'start_year'", "=>", "$", "campaign", "->", "getStartYear", "(", ")", ",", "'hour'", "=>", "$", "campaign", "->", "getStartHour", "(", ")", ",", "'minute'", "=>", "$", "campaign", "->", "getStartMinute", "(", ")", ",", "'end_month'", "=>", "$", "campaign", "->", "getEndMonth", "(", ")", ",", "'end_day'", "=>", "$", "campaign", "->", "getEndDay", "(", ")", ",", "'end_year'", "=>", "$", "campaign", "->", "getEndYear", "(", ")", ",", "'no_end_date'", "=>", "$", "campaign", "->", "getNoEndDate", "(", ")", ",", "'workflow_send_time'", "=>", "$", "campaign", "->", "getWorkflowSendTime", "(", ")", ",", "'repeat_frequency'", "=>", "$", "campaign", "->", "getRepeatFrequency", "(", ")", ")", ";", "$", "this", "->", "call", "(", "'schedule_deployment'", ",", "$", "form_data", ")", ";", "return", "TRUE", ";", "}" ]
@param Campaign $campaign @return bool @throws Exception @todo Create test in examples/ API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204669995
[ "@param", "Campaign", "$campaign" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1690-L1740
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.processSpringbotAbandonedCart
public function processSpringbotAbandonedCart($from, $data) { $form_data = array( 'from' => $from, 'data' => $data ); $this->call('springbot_process_abandoned_cart', $form_data); return TRUE; }
php
public function processSpringbotAbandonedCart($from, $data) { $form_data = array( 'from' => $from, 'data' => $data ); $this->call('springbot_process_abandoned_cart', $form_data); return TRUE; }
[ "public", "function", "processSpringbotAbandonedCart", "(", "$", "from", ",", "$", "data", ")", "{", "$", "form_data", "=", "array", "(", "'from'", "=>", "$", "from", ",", "'data'", "=>", "$", "data", ")", ";", "$", "this", "->", "call", "(", "'springbot_process_abandoned_cart'", ",", "$", "form_data", ")", ";", "return", "TRUE", ";", "}" ]
@param $from @param $data @return bool @throws Exception @todo Create test in examples/ API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670005
[ "@param", "$from", "@param", "$data" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1753-L1762
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showCampaigns
public function showCampaigns($count) { $form_data = array( 'count' => $count, 'headers' => 1 ); $data = $this->call('show_campaigns', $form_data, 'csv'); $csv = new \parseCSV($data); $campaigns = array(); foreach ($csv->data as $campaign_item) { $campaign = new Report(); $campaign ->setCampaignId((int)$campaign_item['Campaign ID']) ->setListName((string)$campaign_item['List Name']) ->setSubject((string)$campaign_item['Subject']) ->setDate(\DateTime::createFromFormat('m/d/y h:i A', $campaign_item['Date'])) ->setRecipients((int)$campaign_item['Recipients']); $campaigns[] = $campaign; } return $campaigns; }
php
public function showCampaigns($count) { $form_data = array( 'count' => $count, 'headers' => 1 ); $data = $this->call('show_campaigns', $form_data, 'csv'); $csv = new \parseCSV($data); $campaigns = array(); foreach ($csv->data as $campaign_item) { $campaign = new Report(); $campaign ->setCampaignId((int)$campaign_item['Campaign ID']) ->setListName((string)$campaign_item['List Name']) ->setSubject((string)$campaign_item['Subject']) ->setDate(\DateTime::createFromFormat('m/d/y h:i A', $campaign_item['Date'])) ->setRecipients((int)$campaign_item['Recipients']); $campaigns[] = $campaign; } return $campaigns; }
[ "public", "function", "showCampaigns", "(", "$", "count", ")", "{", "$", "form_data", "=", "array", "(", "'count'", "=>", "$", "count", ",", "'headers'", "=>", "1", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'show_campaigns'", ",", "$", "form_data", ",", "'csv'", ")", ";", "$", "csv", "=", "new", "\\", "parseCSV", "(", "$", "data", ")", ";", "$", "campaigns", "=", "array", "(", ")", ";", "foreach", "(", "$", "csv", "->", "data", "as", "$", "campaign_item", ")", "{", "$", "campaign", "=", "new", "Report", "(", ")", ";", "$", "campaign", "->", "setCampaignId", "(", "(", "int", ")", "$", "campaign_item", "[", "'Campaign ID'", "]", ")", "->", "setListName", "(", "(", "string", ")", "$", "campaign_item", "[", "'List Name'", "]", ")", "->", "setSubject", "(", "(", "string", ")", "$", "campaign_item", "[", "'Subject'", "]", ")", "->", "setDate", "(", "\\", "DateTime", "::", "createFromFormat", "(", "'m/d/y h:i A'", ",", "$", "campaign_item", "[", "'Date'", "]", ")", ")", "->", "setRecipients", "(", "(", "int", ")", "$", "campaign_item", "[", "'Recipients'", "]", ")", ";", "$", "campaigns", "[", "]", "=", "$", "campaign", ";", "}", "return", "$", "campaigns", ";", "}" ]
@param $count @return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969759
[ "@param", "$count" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1772-L1795
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportCampaignList
public function reportCampaignList($start_date, $end_date, $show_hidden) { $form_data = array( 'from_date' => $start_date, 'to_date' => $end_date, 'show_hidden' => $show_hidden ); $xml = $this->call('rpt_campaign_list', $form_data); $campaigns = array(); foreach ($xml->Data as $campaign_item) { $campaign = new Report(); $campaign ->setCampaignId((int)$campaign_item->campaign_id) ->setListId((int)$campaign_item->list_id) ->setListName((string)$campaign_item->list_name) ->setSubject((string)$campaign_item->subject) ->setDate(\DateTime::createFromFormat('Y/m/d H:i:s', $campaign_item->deploy_date)) //2016-02-01 11:16:33 ->setRecipients((int)$campaign_item->pieces_sent) ->setTaskId((int)$campaign_item->task_id); $campaigns[] = $campaign; } return $campaigns; }
php
public function reportCampaignList($start_date, $end_date, $show_hidden) { $form_data = array( 'from_date' => $start_date, 'to_date' => $end_date, 'show_hidden' => $show_hidden ); $xml = $this->call('rpt_campaign_list', $form_data); $campaigns = array(); foreach ($xml->Data as $campaign_item) { $campaign = new Report(); $campaign ->setCampaignId((int)$campaign_item->campaign_id) ->setListId((int)$campaign_item->list_id) ->setListName((string)$campaign_item->list_name) ->setSubject((string)$campaign_item->subject) ->setDate(\DateTime::createFromFormat('Y/m/d H:i:s', $campaign_item->deploy_date)) //2016-02-01 11:16:33 ->setRecipients((int)$campaign_item->pieces_sent) ->setTaskId((int)$campaign_item->task_id); $campaigns[] = $campaign; } return $campaigns; }
[ "public", "function", "reportCampaignList", "(", "$", "start_date", ",", "$", "end_date", ",", "$", "show_hidden", ")", "{", "$", "form_data", "=", "array", "(", "'from_date'", "=>", "$", "start_date", ",", "'to_date'", "=>", "$", "end_date", ",", "'show_hidden'", "=>", "$", "show_hidden", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_campaign_list'", ",", "$", "form_data", ")", ";", "$", "campaigns", "=", "array", "(", ")", ";", "foreach", "(", "$", "xml", "->", "Data", "as", "$", "campaign_item", ")", "{", "$", "campaign", "=", "new", "Report", "(", ")", ";", "$", "campaign", "->", "setCampaignId", "(", "(", "int", ")", "$", "campaign_item", "->", "campaign_id", ")", "->", "setListId", "(", "(", "int", ")", "$", "campaign_item", "->", "list_id", ")", "->", "setListName", "(", "(", "string", ")", "$", "campaign_item", "->", "list_name", ")", "->", "setSubject", "(", "(", "string", ")", "$", "campaign_item", "->", "subject", ")", "->", "setDate", "(", "\\", "DateTime", "::", "createFromFormat", "(", "'Y/m/d H:i:s'", ",", "$", "campaign_item", "->", "deploy_date", ")", ")", "//2016-02-01 11:16:33", "->", "setRecipients", "(", "(", "int", ")", "$", "campaign_item", "->", "pieces_sent", ")", "->", "setTaskId", "(", "(", "int", ")", "$", "campaign_item", "->", "task_id", ")", ";", "$", "campaigns", "[", "]", "=", "$", "campaign", ";", "}", "return", "$", "campaigns", ";", "}" ]
@param $start_date @param $end_date @param $show_hidden @return array|\SimpleXMLElement|string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969769
[ "@param", "$start_date", "@param", "$end_date", "@param", "$show_hidden" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1807-L1832
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showCampaignStatistics
public function showCampaignStatistics(Report &$campaign_statistics) { $form_data = array( 'campaign_id' => $campaign_statistics->getCampaignId() ); $xml = $this->call('show_campaign_stats', $form_data); $campaign_statistics ->setTaskId((int)$xml->task_id) ->setListName((string)$xml->list_name) ->setListId((int)$xml->list_id) ->setSubject((string)$xml->subject) ->setDate(\DateTime::createFromFormat('m/d/y h:i A', $xml->date)) ->setRecipients($this->groupedNumberToInt($xml->recipients)) ->setAlias((string)$xml->alias) ->setTemplateName((string)$xml->template_name) ->setSegmentation((string)$xml->segmentation) ->setActive((string)$xml->active) ->setSetMacroId((int)$xml->set_macro_id) ->setCharacterSet((string)$xml->character_set) ->setUnicode((string)$xml->unicode) ->setQuotedPrintable((string)$xml->quoted_printable) ->setForcedFormat((string)$xml->forced_format) ->setDeployedBy((string)$xml->deployed_by) ->setAutoMultipart((boolean)$xml->auto_multipart) ->setWrapPlain((boolean)$xml->wrap_plain) ->setWrapHtml((boolean)$xml->wrap_html) ->setTrackOpens((boolean)$xml->track_opens) ->setTrackClicks((boolean)$xml->track_clicks) ->setHardBounces((int)$xml->hard_bounces) ->setSoftBounces((int)$xml->soft_bounces) ->setUnsubscribes((int)$xml->unsubscribes) ->setDisplayMessageCount((int)$xml->display_message_count) ->setTotalOpened((int)$xml->total_opened) ->setTotalClicks((int)$xml->total_clicks) ->setTotalFtafs((int)$xml->total_ftafs) ->setTotalOpenedUnique((int)$xml->total_opened_unique) ->setComplaintBounces((int)$xml->complaint_bounces) ->setBlockedBounces((int)$xml->blocked_bounces) ->setSocialShares((int)$xml->social_shares) ->setSocialViews((int)$xml->social_views) ->setSocialClicks((int)$xml->social_clicks) ->setSocialProviderCount((int)$xml->social_provider_count); foreach ($xml->provider as $social_provider) { switch ($social_provider) { case 'Digg': $campaign_statistics ->setDiggClicks((int)$social_provider->clicks) ->setDiggShares((int)$social_provider->shares) ->setDiggViews((int)$social_provider->views); break; case 'Facebook': $campaign_statistics ->setFacebookClicks((int)$social_provider->clicks) ->setFacebookShares((int)$social_provider->shares) ->setFacebookViews((int)$social_provider->views); break; case 'LinkedIn': $campaign_statistics ->setLinkedinClicks((int)$social_provider->clicks) ->setLinkedinShares((int)$social_provider->shares) ->setLinkedinViews((int)$social_provider->views); break; case 'Myspace': $campaign_statistics ->setMyspaceClicks((int)$social_provider->clicks) ->setMyspaceShares((int)$social_provider->shares) ->setMyspaceViews((int)$social_provider->views); break; case 'Twitter': $campaign_statistics ->setTwitterClicks((int)$social_provider->clicks) ->setTwitterShares((int)$social_provider->shares) ->setTwitterViews((int)$social_provider->views); break; case 'Google+': $campaign_statistics ->setGooglePlusClicks((int)$social_provider->clicks) ->setGooglePlusShares((int)$social_provider->shares) ->setGooglePlusViews((int)$social_provider->views); break; case 'StumbleUpon': $campaign_statistics ->setStumbleuponClicks((int)$social_provider->clicks) ->setStumbleuponShares((int)$social_provider->shares) ->setStumbleuponViews((int)$social_provider->views); break; case 'Pinterest': $campaign_statistics ->setPinterestClicks((int)$social_provider->clicks) ->setPinterestShares((int)$social_provider->shares) ->setPinterestViews((int)$social_provider->views); break; default: break; } } }
php
public function showCampaignStatistics(Report &$campaign_statistics) { $form_data = array( 'campaign_id' => $campaign_statistics->getCampaignId() ); $xml = $this->call('show_campaign_stats', $form_data); $campaign_statistics ->setTaskId((int)$xml->task_id) ->setListName((string)$xml->list_name) ->setListId((int)$xml->list_id) ->setSubject((string)$xml->subject) ->setDate(\DateTime::createFromFormat('m/d/y h:i A', $xml->date)) ->setRecipients($this->groupedNumberToInt($xml->recipients)) ->setAlias((string)$xml->alias) ->setTemplateName((string)$xml->template_name) ->setSegmentation((string)$xml->segmentation) ->setActive((string)$xml->active) ->setSetMacroId((int)$xml->set_macro_id) ->setCharacterSet((string)$xml->character_set) ->setUnicode((string)$xml->unicode) ->setQuotedPrintable((string)$xml->quoted_printable) ->setForcedFormat((string)$xml->forced_format) ->setDeployedBy((string)$xml->deployed_by) ->setAutoMultipart((boolean)$xml->auto_multipart) ->setWrapPlain((boolean)$xml->wrap_plain) ->setWrapHtml((boolean)$xml->wrap_html) ->setTrackOpens((boolean)$xml->track_opens) ->setTrackClicks((boolean)$xml->track_clicks) ->setHardBounces((int)$xml->hard_bounces) ->setSoftBounces((int)$xml->soft_bounces) ->setUnsubscribes((int)$xml->unsubscribes) ->setDisplayMessageCount((int)$xml->display_message_count) ->setTotalOpened((int)$xml->total_opened) ->setTotalClicks((int)$xml->total_clicks) ->setTotalFtafs((int)$xml->total_ftafs) ->setTotalOpenedUnique((int)$xml->total_opened_unique) ->setComplaintBounces((int)$xml->complaint_bounces) ->setBlockedBounces((int)$xml->blocked_bounces) ->setSocialShares((int)$xml->social_shares) ->setSocialViews((int)$xml->social_views) ->setSocialClicks((int)$xml->social_clicks) ->setSocialProviderCount((int)$xml->social_provider_count); foreach ($xml->provider as $social_provider) { switch ($social_provider) { case 'Digg': $campaign_statistics ->setDiggClicks((int)$social_provider->clicks) ->setDiggShares((int)$social_provider->shares) ->setDiggViews((int)$social_provider->views); break; case 'Facebook': $campaign_statistics ->setFacebookClicks((int)$social_provider->clicks) ->setFacebookShares((int)$social_provider->shares) ->setFacebookViews((int)$social_provider->views); break; case 'LinkedIn': $campaign_statistics ->setLinkedinClicks((int)$social_provider->clicks) ->setLinkedinShares((int)$social_provider->shares) ->setLinkedinViews((int)$social_provider->views); break; case 'Myspace': $campaign_statistics ->setMyspaceClicks((int)$social_provider->clicks) ->setMyspaceShares((int)$social_provider->shares) ->setMyspaceViews((int)$social_provider->views); break; case 'Twitter': $campaign_statistics ->setTwitterClicks((int)$social_provider->clicks) ->setTwitterShares((int)$social_provider->shares) ->setTwitterViews((int)$social_provider->views); break; case 'Google+': $campaign_statistics ->setGooglePlusClicks((int)$social_provider->clicks) ->setGooglePlusShares((int)$social_provider->shares) ->setGooglePlusViews((int)$social_provider->views); break; case 'StumbleUpon': $campaign_statistics ->setStumbleuponClicks((int)$social_provider->clicks) ->setStumbleuponShares((int)$social_provider->shares) ->setStumbleuponViews((int)$social_provider->views); break; case 'Pinterest': $campaign_statistics ->setPinterestClicks((int)$social_provider->clicks) ->setPinterestShares((int)$social_provider->shares) ->setPinterestViews((int)$social_provider->views); break; default: break; } } }
[ "public", "function", "showCampaignStatistics", "(", "Report", "&", "$", "campaign_statistics", ")", "{", "$", "form_data", "=", "array", "(", "'campaign_id'", "=>", "$", "campaign_statistics", "->", "getCampaignId", "(", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'show_campaign_stats'", ",", "$", "form_data", ")", ";", "$", "campaign_statistics", "->", "setTaskId", "(", "(", "int", ")", "$", "xml", "->", "task_id", ")", "->", "setListName", "(", "(", "string", ")", "$", "xml", "->", "list_name", ")", "->", "setListId", "(", "(", "int", ")", "$", "xml", "->", "list_id", ")", "->", "setSubject", "(", "(", "string", ")", "$", "xml", "->", "subject", ")", "->", "setDate", "(", "\\", "DateTime", "::", "createFromFormat", "(", "'m/d/y h:i A'", ",", "$", "xml", "->", "date", ")", ")", "->", "setRecipients", "(", "$", "this", "->", "groupedNumberToInt", "(", "$", "xml", "->", "recipients", ")", ")", "->", "setAlias", "(", "(", "string", ")", "$", "xml", "->", "alias", ")", "->", "setTemplateName", "(", "(", "string", ")", "$", "xml", "->", "template_name", ")", "->", "setSegmentation", "(", "(", "string", ")", "$", "xml", "->", "segmentation", ")", "->", "setActive", "(", "(", "string", ")", "$", "xml", "->", "active", ")", "->", "setSetMacroId", "(", "(", "int", ")", "$", "xml", "->", "set_macro_id", ")", "->", "setCharacterSet", "(", "(", "string", ")", "$", "xml", "->", "character_set", ")", "->", "setUnicode", "(", "(", "string", ")", "$", "xml", "->", "unicode", ")", "->", "setQuotedPrintable", "(", "(", "string", ")", "$", "xml", "->", "quoted_printable", ")", "->", "setForcedFormat", "(", "(", "string", ")", "$", "xml", "->", "forced_format", ")", "->", "setDeployedBy", "(", "(", "string", ")", "$", "xml", "->", "deployed_by", ")", "->", "setAutoMultipart", "(", "(", "boolean", ")", "$", "xml", "->", "auto_multipart", ")", "->", "setWrapPlain", "(", "(", "boolean", ")", "$", "xml", "->", "wrap_plain", ")", "->", "setWrapHtml", "(", "(", "boolean", ")", "$", "xml", "->", "wrap_html", ")", "->", "setTrackOpens", "(", "(", "boolean", ")", "$", "xml", "->", "track_opens", ")", "->", "setTrackClicks", "(", "(", "boolean", ")", "$", "xml", "->", "track_clicks", ")", "->", "setHardBounces", "(", "(", "int", ")", "$", "xml", "->", "hard_bounces", ")", "->", "setSoftBounces", "(", "(", "int", ")", "$", "xml", "->", "soft_bounces", ")", "->", "setUnsubscribes", "(", "(", "int", ")", "$", "xml", "->", "unsubscribes", ")", "->", "setDisplayMessageCount", "(", "(", "int", ")", "$", "xml", "->", "display_message_count", ")", "->", "setTotalOpened", "(", "(", "int", ")", "$", "xml", "->", "total_opened", ")", "->", "setTotalClicks", "(", "(", "int", ")", "$", "xml", "->", "total_clicks", ")", "->", "setTotalFtafs", "(", "(", "int", ")", "$", "xml", "->", "total_ftafs", ")", "->", "setTotalOpenedUnique", "(", "(", "int", ")", "$", "xml", "->", "total_opened_unique", ")", "->", "setComplaintBounces", "(", "(", "int", ")", "$", "xml", "->", "complaint_bounces", ")", "->", "setBlockedBounces", "(", "(", "int", ")", "$", "xml", "->", "blocked_bounces", ")", "->", "setSocialShares", "(", "(", "int", ")", "$", "xml", "->", "social_shares", ")", "->", "setSocialViews", "(", "(", "int", ")", "$", "xml", "->", "social_views", ")", "->", "setSocialClicks", "(", "(", "int", ")", "$", "xml", "->", "social_clicks", ")", "->", "setSocialProviderCount", "(", "(", "int", ")", "$", "xml", "->", "social_provider_count", ")", ";", "foreach", "(", "$", "xml", "->", "provider", "as", "$", "social_provider", ")", "{", "switch", "(", "$", "social_provider", ")", "{", "case", "'Digg'", ":", "$", "campaign_statistics", "->", "setDiggClicks", "(", "(", "int", ")", "$", "social_provider", "->", "clicks", ")", "->", "setDiggShares", "(", "(", "int", ")", "$", "social_provider", "->", "shares", ")", "->", "setDiggViews", "(", "(", "int", ")", "$", "social_provider", "->", "views", ")", ";", "break", ";", "case", "'Facebook'", ":", "$", "campaign_statistics", "->", "setFacebookClicks", "(", "(", "int", ")", "$", "social_provider", "->", "clicks", ")", "->", "setFacebookShares", "(", "(", "int", ")", "$", "social_provider", "->", "shares", ")", "->", "setFacebookViews", "(", "(", "int", ")", "$", "social_provider", "->", "views", ")", ";", "break", ";", "case", "'LinkedIn'", ":", "$", "campaign_statistics", "->", "setLinkedinClicks", "(", "(", "int", ")", "$", "social_provider", "->", "clicks", ")", "->", "setLinkedinShares", "(", "(", "int", ")", "$", "social_provider", "->", "shares", ")", "->", "setLinkedinViews", "(", "(", "int", ")", "$", "social_provider", "->", "views", ")", ";", "break", ";", "case", "'Myspace'", ":", "$", "campaign_statistics", "->", "setMyspaceClicks", "(", "(", "int", ")", "$", "social_provider", "->", "clicks", ")", "->", "setMyspaceShares", "(", "(", "int", ")", "$", "social_provider", "->", "shares", ")", "->", "setMyspaceViews", "(", "(", "int", ")", "$", "social_provider", "->", "views", ")", ";", "break", ";", "case", "'Twitter'", ":", "$", "campaign_statistics", "->", "setTwitterClicks", "(", "(", "int", ")", "$", "social_provider", "->", "clicks", ")", "->", "setTwitterShares", "(", "(", "int", ")", "$", "social_provider", "->", "shares", ")", "->", "setTwitterViews", "(", "(", "int", ")", "$", "social_provider", "->", "views", ")", ";", "break", ";", "case", "'Google+'", ":", "$", "campaign_statistics", "->", "setGooglePlusClicks", "(", "(", "int", ")", "$", "social_provider", "->", "clicks", ")", "->", "setGooglePlusShares", "(", "(", "int", ")", "$", "social_provider", "->", "shares", ")", "->", "setGooglePlusViews", "(", "(", "int", ")", "$", "social_provider", "->", "views", ")", ";", "break", ";", "case", "'StumbleUpon'", ":", "$", "campaign_statistics", "->", "setStumbleuponClicks", "(", "(", "int", ")", "$", "social_provider", "->", "clicks", ")", "->", "setStumbleuponShares", "(", "(", "int", ")", "$", "social_provider", "->", "shares", ")", "->", "setStumbleuponViews", "(", "(", "int", ")", "$", "social_provider", "->", "views", ")", ";", "break", ";", "case", "'Pinterest'", ":", "$", "campaign_statistics", "->", "setPinterestClicks", "(", "(", "int", ")", "$", "social_provider", "->", "clicks", ")", "->", "setPinterestShares", "(", "(", "int", ")", "$", "social_provider", "->", "shares", ")", "->", "setPinterestViews", "(", "(", "int", ")", "$", "social_provider", "->", "views", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "}" ]
@param Report $campaign_statistics @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969799
[ "@param", "Report", "$campaign_statistics" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1841-L1942
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showMultipleCampaginStatistics
public function showMultipleCampaginStatistics($campaign_ids) { $form_data = array( 'campaigns' => implode(',', $campaign_ids), 'headers' => 1 ); $data = $this->call('show_campaign_stats_multi', $form_data, 'csv'); $csv = new \parseCSV($data); $campaign_statistics = array(); foreach ($csv->data as $campaign_statistic_item) { $campaign = new Report(); $campaign ->setCampaignId((int)$campaign_statistic_item['Campaign ID']) ->setListName((string)$campaign_statistic_item['List Name']) ->setListId((int)$campaign_statistic_item['List ID']) ->setSubject((string)$campaign_statistic_item['Subject']) ->setDate(\DateTime::createFromFormat('m/d/y h:i A', $campaign_statistic_item['Date'])) ->setRecipients($this->groupedNumberToInt($campaign_statistic_item['Recipients'])) ->setAlias((string)$campaign_statistic_item['Alias']) ->setTemplateName((string)$campaign_statistic_item['Template Name']) ->setSegmentation((string)$campaign_statistic_item['Segmentation']) ->setActive((string)$campaign_statistic_item['Active']) ->setSetMacroId((int)$campaign_statistic_item['Set Macro ID']) ->setCharacterSet((string)$campaign_statistic_item['Character Set']) ->setUnicode((string)$campaign_statistic_item['Unicode']) ->setQuotedPrintable((string)$campaign_statistic_item['Quoted Printable']) ->setForcedFormat((string)$campaign_statistic_item['Forced Format']) ->setDeployedBy((string)$campaign_statistic_item['Deployed By']) ->setAutoMultipart((boolean)$this->stringToBoolean($campaign_statistic_item['Auto Multipart'])) ->setWrapPlain((boolean)$this->stringToBoolean($campaign_statistic_item['Wrap Plain'])) ->setWrapHtml((boolean)$this->stringToBoolean($campaign_statistic_item['Wrap HTML'])) ->setTrackOpens((boolean)$this->stringToBoolean($campaign_statistic_item['Track Opens'])) ->setTrackClicks((boolean)$this->stringToBoolean($campaign_statistic_item['Track Clicks'])) ->setDeliverability((boolean)$this->stringToBoolean($campaign_statistic_item['Deliverability'])) ->setHardBounces((int)$campaign_statistic_item['Hard Bounces']) ->setSoftBounces((int)$campaign_statistic_item['Soft Bounces']) ->setUnsubscribes((int)$campaign_statistic_item['Unsubscribes']) ->setDisplayMessageCount((int)$campaign_statistic_item['Display Message Count']) ->setTotalOpened((int)$campaign_statistic_item['Total Opened']) ->setTotalClicks((int)$campaign_statistic_item['Total Clicks']) ->setTotalFtafs((int)$campaign_statistic_item['Total FTAFs']) ->setTotalOpenedUnique((int)$campaign_statistic_item['Total Opened Unique']) ->setComplaintBounces((int)$campaign_statistic_item['Complaint Bounces']) ->setBlockedBounces((int)$campaign_statistic_item['Blocked Bounces']) ->setSocialShares((int)$campaign_statistic_item['Social Shares']) ->setSocialViews((int)$campaign_statistic_item['Social Views']) ->setSocialClicks((int)$campaign_statistic_item['Social Clicks']) ->setSocialProviderCount((int)$campaign_statistic_item['Social Provider Count']) ->setDiggClicks((int)$campaign_statistic_item['Digg Clicks']) ->setDiggShares((int)$campaign_statistic_item['Digg Shares']) ->setDiggViews((int)$campaign_statistic_item['Digg Views']) ->setFacebookClicks((int)$campaign_statistic_item['Facebook Clicks']) ->setFacebookShares((int)$campaign_statistic_item['Facebook Shares']) ->setFacebookViews((int)$campaign_statistic_item['Facebook Views']) ->setLinkedinClicks((int)$campaign_statistic_item['LinkedIn Clicks']) ->setLinkedinShares((int)$campaign_statistic_item['LinkedIn Shares']) ->setLinkedinViews((int)$campaign_statistic_item['LinkedIn Views']) ->setMyspaceClicks((int)$campaign_statistic_item['Myspace Clicks']) ->setMyspaceShares((int)$campaign_statistic_item['Myspace Shares']) ->setMyspaceViews((int)$campaign_statistic_item['Myspace Views']) ->setTwitterClicks((int)$campaign_statistic_item['Twitter Clicks']) ->setTwitterShares((int)$campaign_statistic_item['Twitter Shares']) ->setTwitterViews((int)$campaign_statistic_item['Twitter Views']) ->setGooglePlusClicks((int)$campaign_statistic_item['Google+ Clicks']) ->setGooglePlusShares((int)$campaign_statistic_item['Google+ Shares']) ->setGooglePlusViews((int)$campaign_statistic_item['Google+ Views']) ->setStumbleuponClicks((int)$campaign_statistic_item['StumbleUpon Clicks']) ->setStumbleuponShares((int)$campaign_statistic_item['StumbleUpon Shares']) ->setStumbleuponViews((int)$campaign_statistic_item['StumbleUpon Views']) ->setPinterestClicks((int)$campaign_statistic_item['Pinterest Clicks']) ->setPinterestShares((int)$campaign_statistic_item['Pinterest Shares']) ->setPinterestViews((int)$campaign_statistic_item['Pinterest Views']); $campaign_statistics[] = $campaign; } return $campaign_statistics; }
php
public function showMultipleCampaginStatistics($campaign_ids) { $form_data = array( 'campaigns' => implode(',', $campaign_ids), 'headers' => 1 ); $data = $this->call('show_campaign_stats_multi', $form_data, 'csv'); $csv = new \parseCSV($data); $campaign_statistics = array(); foreach ($csv->data as $campaign_statistic_item) { $campaign = new Report(); $campaign ->setCampaignId((int)$campaign_statistic_item['Campaign ID']) ->setListName((string)$campaign_statistic_item['List Name']) ->setListId((int)$campaign_statistic_item['List ID']) ->setSubject((string)$campaign_statistic_item['Subject']) ->setDate(\DateTime::createFromFormat('m/d/y h:i A', $campaign_statistic_item['Date'])) ->setRecipients($this->groupedNumberToInt($campaign_statistic_item['Recipients'])) ->setAlias((string)$campaign_statistic_item['Alias']) ->setTemplateName((string)$campaign_statistic_item['Template Name']) ->setSegmentation((string)$campaign_statistic_item['Segmentation']) ->setActive((string)$campaign_statistic_item['Active']) ->setSetMacroId((int)$campaign_statistic_item['Set Macro ID']) ->setCharacterSet((string)$campaign_statistic_item['Character Set']) ->setUnicode((string)$campaign_statistic_item['Unicode']) ->setQuotedPrintable((string)$campaign_statistic_item['Quoted Printable']) ->setForcedFormat((string)$campaign_statistic_item['Forced Format']) ->setDeployedBy((string)$campaign_statistic_item['Deployed By']) ->setAutoMultipart((boolean)$this->stringToBoolean($campaign_statistic_item['Auto Multipart'])) ->setWrapPlain((boolean)$this->stringToBoolean($campaign_statistic_item['Wrap Plain'])) ->setWrapHtml((boolean)$this->stringToBoolean($campaign_statistic_item['Wrap HTML'])) ->setTrackOpens((boolean)$this->stringToBoolean($campaign_statistic_item['Track Opens'])) ->setTrackClicks((boolean)$this->stringToBoolean($campaign_statistic_item['Track Clicks'])) ->setDeliverability((boolean)$this->stringToBoolean($campaign_statistic_item['Deliverability'])) ->setHardBounces((int)$campaign_statistic_item['Hard Bounces']) ->setSoftBounces((int)$campaign_statistic_item['Soft Bounces']) ->setUnsubscribes((int)$campaign_statistic_item['Unsubscribes']) ->setDisplayMessageCount((int)$campaign_statistic_item['Display Message Count']) ->setTotalOpened((int)$campaign_statistic_item['Total Opened']) ->setTotalClicks((int)$campaign_statistic_item['Total Clicks']) ->setTotalFtafs((int)$campaign_statistic_item['Total FTAFs']) ->setTotalOpenedUnique((int)$campaign_statistic_item['Total Opened Unique']) ->setComplaintBounces((int)$campaign_statistic_item['Complaint Bounces']) ->setBlockedBounces((int)$campaign_statistic_item['Blocked Bounces']) ->setSocialShares((int)$campaign_statistic_item['Social Shares']) ->setSocialViews((int)$campaign_statistic_item['Social Views']) ->setSocialClicks((int)$campaign_statistic_item['Social Clicks']) ->setSocialProviderCount((int)$campaign_statistic_item['Social Provider Count']) ->setDiggClicks((int)$campaign_statistic_item['Digg Clicks']) ->setDiggShares((int)$campaign_statistic_item['Digg Shares']) ->setDiggViews((int)$campaign_statistic_item['Digg Views']) ->setFacebookClicks((int)$campaign_statistic_item['Facebook Clicks']) ->setFacebookShares((int)$campaign_statistic_item['Facebook Shares']) ->setFacebookViews((int)$campaign_statistic_item['Facebook Views']) ->setLinkedinClicks((int)$campaign_statistic_item['LinkedIn Clicks']) ->setLinkedinShares((int)$campaign_statistic_item['LinkedIn Shares']) ->setLinkedinViews((int)$campaign_statistic_item['LinkedIn Views']) ->setMyspaceClicks((int)$campaign_statistic_item['Myspace Clicks']) ->setMyspaceShares((int)$campaign_statistic_item['Myspace Shares']) ->setMyspaceViews((int)$campaign_statistic_item['Myspace Views']) ->setTwitterClicks((int)$campaign_statistic_item['Twitter Clicks']) ->setTwitterShares((int)$campaign_statistic_item['Twitter Shares']) ->setTwitterViews((int)$campaign_statistic_item['Twitter Views']) ->setGooglePlusClicks((int)$campaign_statistic_item['Google+ Clicks']) ->setGooglePlusShares((int)$campaign_statistic_item['Google+ Shares']) ->setGooglePlusViews((int)$campaign_statistic_item['Google+ Views']) ->setStumbleuponClicks((int)$campaign_statistic_item['StumbleUpon Clicks']) ->setStumbleuponShares((int)$campaign_statistic_item['StumbleUpon Shares']) ->setStumbleuponViews((int)$campaign_statistic_item['StumbleUpon Views']) ->setPinterestClicks((int)$campaign_statistic_item['Pinterest Clicks']) ->setPinterestShares((int)$campaign_statistic_item['Pinterest Shares']) ->setPinterestViews((int)$campaign_statistic_item['Pinterest Views']); $campaign_statistics[] = $campaign; } return $campaign_statistics; }
[ "public", "function", "showMultipleCampaginStatistics", "(", "$", "campaign_ids", ")", "{", "$", "form_data", "=", "array", "(", "'campaigns'", "=>", "implode", "(", "','", ",", "$", "campaign_ids", ")", ",", "'headers'", "=>", "1", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'show_campaign_stats_multi'", ",", "$", "form_data", ",", "'csv'", ")", ";", "$", "csv", "=", "new", "\\", "parseCSV", "(", "$", "data", ")", ";", "$", "campaign_statistics", "=", "array", "(", ")", ";", "foreach", "(", "$", "csv", "->", "data", "as", "$", "campaign_statistic_item", ")", "{", "$", "campaign", "=", "new", "Report", "(", ")", ";", "$", "campaign", "->", "setCampaignId", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Campaign ID'", "]", ")", "->", "setListName", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'List Name'", "]", ")", "->", "setListId", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'List ID'", "]", ")", "->", "setSubject", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Subject'", "]", ")", "->", "setDate", "(", "\\", "DateTime", "::", "createFromFormat", "(", "'m/d/y h:i A'", ",", "$", "campaign_statistic_item", "[", "'Date'", "]", ")", ")", "->", "setRecipients", "(", "$", "this", "->", "groupedNumberToInt", "(", "$", "campaign_statistic_item", "[", "'Recipients'", "]", ")", ")", "->", "setAlias", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Alias'", "]", ")", "->", "setTemplateName", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Template Name'", "]", ")", "->", "setSegmentation", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Segmentation'", "]", ")", "->", "setActive", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Active'", "]", ")", "->", "setSetMacroId", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Set Macro ID'", "]", ")", "->", "setCharacterSet", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Character Set'", "]", ")", "->", "setUnicode", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Unicode'", "]", ")", "->", "setQuotedPrintable", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Quoted Printable'", "]", ")", "->", "setForcedFormat", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Forced Format'", "]", ")", "->", "setDeployedBy", "(", "(", "string", ")", "$", "campaign_statistic_item", "[", "'Deployed By'", "]", ")", "->", "setAutoMultipart", "(", "(", "boolean", ")", "$", "this", "->", "stringToBoolean", "(", "$", "campaign_statistic_item", "[", "'Auto Multipart'", "]", ")", ")", "->", "setWrapPlain", "(", "(", "boolean", ")", "$", "this", "->", "stringToBoolean", "(", "$", "campaign_statistic_item", "[", "'Wrap Plain'", "]", ")", ")", "->", "setWrapHtml", "(", "(", "boolean", ")", "$", "this", "->", "stringToBoolean", "(", "$", "campaign_statistic_item", "[", "'Wrap HTML'", "]", ")", ")", "->", "setTrackOpens", "(", "(", "boolean", ")", "$", "this", "->", "stringToBoolean", "(", "$", "campaign_statistic_item", "[", "'Track Opens'", "]", ")", ")", "->", "setTrackClicks", "(", "(", "boolean", ")", "$", "this", "->", "stringToBoolean", "(", "$", "campaign_statistic_item", "[", "'Track Clicks'", "]", ")", ")", "->", "setDeliverability", "(", "(", "boolean", ")", "$", "this", "->", "stringToBoolean", "(", "$", "campaign_statistic_item", "[", "'Deliverability'", "]", ")", ")", "->", "setHardBounces", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Hard Bounces'", "]", ")", "->", "setSoftBounces", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Soft Bounces'", "]", ")", "->", "setUnsubscribes", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Unsubscribes'", "]", ")", "->", "setDisplayMessageCount", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Display Message Count'", "]", ")", "->", "setTotalOpened", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Total Opened'", "]", ")", "->", "setTotalClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Total Clicks'", "]", ")", "->", "setTotalFtafs", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Total FTAFs'", "]", ")", "->", "setTotalOpenedUnique", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Total Opened Unique'", "]", ")", "->", "setComplaintBounces", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Complaint Bounces'", "]", ")", "->", "setBlockedBounces", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Blocked Bounces'", "]", ")", "->", "setSocialShares", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Social Shares'", "]", ")", "->", "setSocialViews", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Social Views'", "]", ")", "->", "setSocialClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Social Clicks'", "]", ")", "->", "setSocialProviderCount", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Social Provider Count'", "]", ")", "->", "setDiggClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Digg Clicks'", "]", ")", "->", "setDiggShares", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Digg Shares'", "]", ")", "->", "setDiggViews", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Digg Views'", "]", ")", "->", "setFacebookClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Facebook Clicks'", "]", ")", "->", "setFacebookShares", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Facebook Shares'", "]", ")", "->", "setFacebookViews", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Facebook Views'", "]", ")", "->", "setLinkedinClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'LinkedIn Clicks'", "]", ")", "->", "setLinkedinShares", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'LinkedIn Shares'", "]", ")", "->", "setLinkedinViews", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'LinkedIn Views'", "]", ")", "->", "setMyspaceClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Myspace Clicks'", "]", ")", "->", "setMyspaceShares", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Myspace Shares'", "]", ")", "->", "setMyspaceViews", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Myspace Views'", "]", ")", "->", "setTwitterClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Twitter Clicks'", "]", ")", "->", "setTwitterShares", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Twitter Shares'", "]", ")", "->", "setTwitterViews", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Twitter Views'", "]", ")", "->", "setGooglePlusClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Google+ Clicks'", "]", ")", "->", "setGooglePlusShares", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Google+ Shares'", "]", ")", "->", "setGooglePlusViews", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Google+ Views'", "]", ")", "->", "setStumbleuponClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'StumbleUpon Clicks'", "]", ")", "->", "setStumbleuponShares", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'StumbleUpon Shares'", "]", ")", "->", "setStumbleuponViews", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'StumbleUpon Views'", "]", ")", "->", "setPinterestClicks", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Pinterest Clicks'", "]", ")", "->", "setPinterestShares", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Pinterest Shares'", "]", ")", "->", "setPinterestViews", "(", "(", "int", ")", "$", "campaign_statistic_item", "[", "'Pinterest Views'", "]", ")", ";", "$", "campaign_statistics", "[", "]", "=", "$", "campaign", ";", "}", "return", "$", "campaign_statistics", ";", "}" ]
@param $campaign_ids @return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969809
[ "@param", "$campaign_ids" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L1952-L2029
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportCampaignClicks
public function reportCampaignClicks($campaign_id) { $form_data = array( 'campaign_id' => $campaign_id ); $xml = $this->call('rpt_click_overview', $form_data); $campaigns_clicks = array(); foreach ($xml->Data as $campaign_clicks_item) { $campaign_clicks = new CampaignClicks(); $campaign_clicks ->setUrl((string)$campaign_clicks_item->url) ->setTotalClicks((int)$campaign_clicks_item->total_clicks) ->setUniqueClicks((int)$campaign_clicks_item->unique_clicks) ->setTrackingUrlId((int)$campaign_clicks_item->tracking_url_id); $campaigns_clicks[] = $campaign_clicks; } return $campaigns_clicks; }
php
public function reportCampaignClicks($campaign_id) { $form_data = array( 'campaign_id' => $campaign_id ); $xml = $this->call('rpt_click_overview', $form_data); $campaigns_clicks = array(); foreach ($xml->Data as $campaign_clicks_item) { $campaign_clicks = new CampaignClicks(); $campaign_clicks ->setUrl((string)$campaign_clicks_item->url) ->setTotalClicks((int)$campaign_clicks_item->total_clicks) ->setUniqueClicks((int)$campaign_clicks_item->unique_clicks) ->setTrackingUrlId((int)$campaign_clicks_item->tracking_url_id); $campaigns_clicks[] = $campaign_clicks; } return $campaigns_clicks; }
[ "public", "function", "reportCampaignClicks", "(", "$", "campaign_id", ")", "{", "$", "form_data", "=", "array", "(", "'campaign_id'", "=>", "$", "campaign_id", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_click_overview'", ",", "$", "form_data", ")", ";", "$", "campaigns_clicks", "=", "array", "(", ")", ";", "foreach", "(", "$", "xml", "->", "Data", "as", "$", "campaign_clicks_item", ")", "{", "$", "campaign_clicks", "=", "new", "CampaignClicks", "(", ")", ";", "$", "campaign_clicks", "->", "setUrl", "(", "(", "string", ")", "$", "campaign_clicks_item", "->", "url", ")", "->", "setTotalClicks", "(", "(", "int", ")", "$", "campaign_clicks_item", "->", "total_clicks", ")", "->", "setUniqueClicks", "(", "(", "int", ")", "$", "campaign_clicks_item", "->", "unique_clicks", ")", "->", "setTrackingUrlId", "(", "(", "int", ")", "$", "campaign_clicks_item", "->", "tracking_url_id", ")", ";", "$", "campaigns_clicks", "[", "]", "=", "$", "campaign_clicks", ";", "}", "return", "$", "campaigns_clicks", ";", "}" ]
@param $campaign_id @return array @throws Exception API documentation: https://support.whatcounts.com/hc/en-us/articles/204670075
[ "@param", "$campaign_id" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2039-L2060
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportSubscriberClicks
public function reportSubscriberClicks($campaign_id, $url, $is_exact, $is_unique) { $form_data = array( 'campaign_id' => $campaign_id, 'url' => $url, 'exact' => $this->booleanToBit($is_exact), 'is_unique' => $this->booleanToBit($is_unique) ); $xml = $this->call('rpt_clicked_on', $form_data); $subscribers_clicks = array(); foreach ($xml->Data as $subscriber_click_item) { $subscriber_click = new SubscriberClicks(); $subscriber_click ->setEmail((string)$subscriber_click_item->email) ->setFirstName((string)$subscriber_click_item->first_name) ->setLastName((string)$subscriber_click_item->last_name) ->setEventDate(\DateTime::createFromFormat('Y-m-d H:i:s', $subscriber_click_item->event_date)); $subscribers_clicks[] = $subscriber_click; } return $subscribers_clicks; }
php
public function reportSubscriberClicks($campaign_id, $url, $is_exact, $is_unique) { $form_data = array( 'campaign_id' => $campaign_id, 'url' => $url, 'exact' => $this->booleanToBit($is_exact), 'is_unique' => $this->booleanToBit($is_unique) ); $xml = $this->call('rpt_clicked_on', $form_data); $subscribers_clicks = array(); foreach ($xml->Data as $subscriber_click_item) { $subscriber_click = new SubscriberClicks(); $subscriber_click ->setEmail((string)$subscriber_click_item->email) ->setFirstName((string)$subscriber_click_item->first_name) ->setLastName((string)$subscriber_click_item->last_name) ->setEventDate(\DateTime::createFromFormat('Y-m-d H:i:s', $subscriber_click_item->event_date)); $subscribers_clicks[] = $subscriber_click; } return $subscribers_clicks; }
[ "public", "function", "reportSubscriberClicks", "(", "$", "campaign_id", ",", "$", "url", ",", "$", "is_exact", ",", "$", "is_unique", ")", "{", "$", "form_data", "=", "array", "(", "'campaign_id'", "=>", "$", "campaign_id", ",", "'url'", "=>", "$", "url", ",", "'exact'", "=>", "$", "this", "->", "booleanToBit", "(", "$", "is_exact", ")", ",", "'is_unique'", "=>", "$", "this", "->", "booleanToBit", "(", "$", "is_unique", ")", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_clicked_on'", ",", "$", "form_data", ")", ";", "$", "subscribers_clicks", "=", "array", "(", ")", ";", "foreach", "(", "$", "xml", "->", "Data", "as", "$", "subscriber_click_item", ")", "{", "$", "subscriber_click", "=", "new", "SubscriberClicks", "(", ")", ";", "$", "subscriber_click", "->", "setEmail", "(", "(", "string", ")", "$", "subscriber_click_item", "->", "email", ")", "->", "setFirstName", "(", "(", "string", ")", "$", "subscriber_click_item", "->", "first_name", ")", "->", "setLastName", "(", "(", "string", ")", "$", "subscriber_click_item", "->", "last_name", ")", "->", "setEventDate", "(", "\\", "DateTime", "::", "createFromFormat", "(", "'Y-m-d H:i:s'", ",", "$", "subscriber_click_item", "->", "event_date", ")", ")", ";", "$", "subscribers_clicks", "[", "]", "=", "$", "subscriber_click", ";", "}", "return", "$", "subscribers_clicks", ";", "}" ]
@param $campaign_id @param $url @param $is_exact @param $is_unique @return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670085
[ "@param", "$campaign_id", "@param", "$url", "@param", "$is_exact", "@param", "$is_unique" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2073-L2097
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportDailyStatistics
public function reportDailyStatistics($campaign_id, $start_date, $end_date) { $form_data = array( 'campaign_id' => $campaign_id, 'from_date' => $start_date, 'to_date' => $end_date ); $xml = $this->call('rpt_daily_stats', $form_data); $reports = array(); foreach ($xml->Data as $daily_report) { $report = new Report(); $report ->setCampaignId((int)$daily_report->Campaign_ID) ->setEventDate(\DateTime::createFromFormat('m/d/Y', $daily_report->event_date)) ->setTotalSent((int)$daily_report->Total_sent) ->setTotalOpened((int)$daily_report->Total_opened) ->setTotalOpenedUnique((int)$daily_report->Unique_opened) ->setTotalClicks((int)$daily_report->Total_clickthroughs) ->setTotalClicksUnique((int)$daily_report->Unique_clickthroughs) ->setSoftBounces((int)$daily_report->Total_soft_bounced) ->setHardBounces((int)$daily_report->Total_hard_bounced) ->setUnsubscribes((int)$daily_report->Total_unsubscribed) ->setComplaintBounces((int)$daily_report->Total_complaints_bounced) ->setBlockedBounces((int)$daily_report->Total_blocked_bounced); $reports[] = $report; } return $reports; }
php
public function reportDailyStatistics($campaign_id, $start_date, $end_date) { $form_data = array( 'campaign_id' => $campaign_id, 'from_date' => $start_date, 'to_date' => $end_date ); $xml = $this->call('rpt_daily_stats', $form_data); $reports = array(); foreach ($xml->Data as $daily_report) { $report = new Report(); $report ->setCampaignId((int)$daily_report->Campaign_ID) ->setEventDate(\DateTime::createFromFormat('m/d/Y', $daily_report->event_date)) ->setTotalSent((int)$daily_report->Total_sent) ->setTotalOpened((int)$daily_report->Total_opened) ->setTotalOpenedUnique((int)$daily_report->Unique_opened) ->setTotalClicks((int)$daily_report->Total_clickthroughs) ->setTotalClicksUnique((int)$daily_report->Unique_clickthroughs) ->setSoftBounces((int)$daily_report->Total_soft_bounced) ->setHardBounces((int)$daily_report->Total_hard_bounced) ->setUnsubscribes((int)$daily_report->Total_unsubscribed) ->setComplaintBounces((int)$daily_report->Total_complaints_bounced) ->setBlockedBounces((int)$daily_report->Total_blocked_bounced); $reports[] = $report; } return $reports; }
[ "public", "function", "reportDailyStatistics", "(", "$", "campaign_id", ",", "$", "start_date", ",", "$", "end_date", ")", "{", "$", "form_data", "=", "array", "(", "'campaign_id'", "=>", "$", "campaign_id", ",", "'from_date'", "=>", "$", "start_date", ",", "'to_date'", "=>", "$", "end_date", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_daily_stats'", ",", "$", "form_data", ")", ";", "$", "reports", "=", "array", "(", ")", ";", "foreach", "(", "$", "xml", "->", "Data", "as", "$", "daily_report", ")", "{", "$", "report", "=", "new", "Report", "(", ")", ";", "$", "report", "->", "setCampaignId", "(", "(", "int", ")", "$", "daily_report", "->", "Campaign_ID", ")", "->", "setEventDate", "(", "\\", "DateTime", "::", "createFromFormat", "(", "'m/d/Y'", ",", "$", "daily_report", "->", "event_date", ")", ")", "->", "setTotalSent", "(", "(", "int", ")", "$", "daily_report", "->", "Total_sent", ")", "->", "setTotalOpened", "(", "(", "int", ")", "$", "daily_report", "->", "Total_opened", ")", "->", "setTotalOpenedUnique", "(", "(", "int", ")", "$", "daily_report", "->", "Unique_opened", ")", "->", "setTotalClicks", "(", "(", "int", ")", "$", "daily_report", "->", "Total_clickthroughs", ")", "->", "setTotalClicksUnique", "(", "(", "int", ")", "$", "daily_report", "->", "Unique_clickthroughs", ")", "->", "setSoftBounces", "(", "(", "int", ")", "$", "daily_report", "->", "Total_soft_bounced", ")", "->", "setHardBounces", "(", "(", "int", ")", "$", "daily_report", "->", "Total_hard_bounced", ")", "->", "setUnsubscribes", "(", "(", "int", ")", "$", "daily_report", "->", "Total_unsubscribed", ")", "->", "setComplaintBounces", "(", "(", "int", ")", "$", "daily_report", "->", "Total_complaints_bounced", ")", "->", "setBlockedBounces", "(", "(", "int", ")", "$", "daily_report", "->", "Total_blocked_bounced", ")", ";", "$", "reports", "[", "]", "=", "$", "report", ";", "}", "return", "$", "reports", ";", "}" ]
@param $campaign_id @param $start_date @param $end_date @return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670095
[ "@param", "$campaign_id", "@param", "$start_date", "@param", "$end_date" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2109-L2140
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportBrowserInfo
public function reportBrowserInfo($campaign_id, $by_subscriber=0, $os_name, $browser, $client_type) { $form_data = array( 'campaign_id' => $campaign_id, 'by_subscriber' => $by_subscriber, 'os_name' => $os_name, 'browser' => $browser, 'client_type' => $client_type ); $xml = $this->call('rpt_browser_info', $form_data); return $xml; }
php
public function reportBrowserInfo($campaign_id, $by_subscriber=0, $os_name, $browser, $client_type) { $form_data = array( 'campaign_id' => $campaign_id, 'by_subscriber' => $by_subscriber, 'os_name' => $os_name, 'browser' => $browser, 'client_type' => $client_type ); $xml = $this->call('rpt_browser_info', $form_data); return $xml; }
[ "public", "function", "reportBrowserInfo", "(", "$", "campaign_id", ",", "$", "by_subscriber", "=", "0", ",", "$", "os_name", ",", "$", "browser", ",", "$", "client_type", ")", "{", "$", "form_data", "=", "array", "(", "'campaign_id'", "=>", "$", "campaign_id", ",", "'by_subscriber'", "=>", "$", "by_subscriber", ",", "'os_name'", "=>", "$", "os_name", ",", "'browser'", "=>", "$", "browser", ",", "'client_type'", "=>", "$", "client_type", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_browser_info'", ",", "$", "form_data", ")", ";", "return", "$", "xml", ";", "}" ]
@param $campaign_id @param int $by_subscriber @param $os_name @param $browser @param $client_type @return array|\SimpleXMLElement|string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969819
[ "@param", "$campaign_id", "@param", "int", "$by_subscriber", "@param", "$os_name", "@param", "$browser", "@param", "$client_type" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2154-L2166
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportBounceStatistics
public function reportBounceStatistics($campaign_id, $bounce_type, $start_date, $end_date) { $form_data = array( 'campaign_id' => $campaign_id, 'bounce_type' => $bounce_type, 'from_date' => $start_date, 'to_date' => $end_date, 'headers' => 1 ); $data = $this->call('rpt_bounce_stats', $form_data, 'csv'); $data .= PHP_EOL; $csv = new \parseCSV($data); return $csv->data; }
php
public function reportBounceStatistics($campaign_id, $bounce_type, $start_date, $end_date) { $form_data = array( 'campaign_id' => $campaign_id, 'bounce_type' => $bounce_type, 'from_date' => $start_date, 'to_date' => $end_date, 'headers' => 1 ); $data = $this->call('rpt_bounce_stats', $form_data, 'csv'); $data .= PHP_EOL; $csv = new \parseCSV($data); return $csv->data; }
[ "public", "function", "reportBounceStatistics", "(", "$", "campaign_id", ",", "$", "bounce_type", ",", "$", "start_date", ",", "$", "end_date", ")", "{", "$", "form_data", "=", "array", "(", "'campaign_id'", "=>", "$", "campaign_id", ",", "'bounce_type'", "=>", "$", "bounce_type", ",", "'from_date'", "=>", "$", "start_date", ",", "'to_date'", "=>", "$", "end_date", ",", "'headers'", "=>", "1", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'rpt_bounce_stats'", ",", "$", "form_data", ",", "'csv'", ")", ";", "$", "data", ".=", "PHP_EOL", ";", "$", "csv", "=", "new", "\\", "parseCSV", "(", "$", "data", ")", ";", "return", "$", "csv", "->", "data", ";", "}" ]
@param $campaign_id @param $bounce_type @param $start_date @param $end_date @return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670105
[ "@param", "$campaign_id", "@param", "$bounce_type", "@param", "$start_date", "@param", "$end_date" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2179-L2193
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportTrackedEvents
public function reportTrackedEvents($event_type, $start_datetime, $end_datetime, $offset=0) { $form_data = array( 'event_type' => $event_type, 'start_datetime' => $start_datetime, 'end_datetime' => $end_datetime, 'offset' => $offset ); $xml = $this->call('rpt_tracked_events', $form_data); return json_decode(json_encode($xml), TRUE); }
php
public function reportTrackedEvents($event_type, $start_datetime, $end_datetime, $offset=0) { $form_data = array( 'event_type' => $event_type, 'start_datetime' => $start_datetime, 'end_datetime' => $end_datetime, 'offset' => $offset ); $xml = $this->call('rpt_tracked_events', $form_data); return json_decode(json_encode($xml), TRUE); }
[ "public", "function", "reportTrackedEvents", "(", "$", "event_type", ",", "$", "start_datetime", ",", "$", "end_datetime", ",", "$", "offset", "=", "0", ")", "{", "$", "form_data", "=", "array", "(", "'event_type'", "=>", "$", "event_type", ",", "'start_datetime'", "=>", "$", "start_datetime", ",", "'end_datetime'", "=>", "$", "end_datetime", ",", "'offset'", "=>", "$", "offset", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_tracked_events'", ",", "$", "form_data", ")", ";", "return", "json_decode", "(", "json_encode", "(", "$", "xml", ")", ",", "TRUE", ")", ";", "}" ]
@param $event_type @param $start_datetime @param $end_datetime @param $offset @return mixed @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969829
[ "@param", "$event_type", "@param", "$start_datetime", "@param", "$end_datetime", "@param", "$offset" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2206-L2217
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportTrackedEventsByCampaign
public function reportTrackedEventsByCampaign($campaign_id, $event_type, $start_datetime, $end_datetime, $offset=0) { $form_data = array( 'campaign_id' => $campaign_id, 'event_type' => $event_type, 'start_datetime' => $start_datetime, 'end_datetime' => $end_datetime, 'offset' => $offset ); $xml = $this->call('rpt_tracked_events_by_campaign', $form_data); return json_decode(json_encode($xml), TRUE); }
php
public function reportTrackedEventsByCampaign($campaign_id, $event_type, $start_datetime, $end_datetime, $offset=0) { $form_data = array( 'campaign_id' => $campaign_id, 'event_type' => $event_type, 'start_datetime' => $start_datetime, 'end_datetime' => $end_datetime, 'offset' => $offset ); $xml = $this->call('rpt_tracked_events_by_campaign', $form_data); return json_decode(json_encode($xml), TRUE); }
[ "public", "function", "reportTrackedEventsByCampaign", "(", "$", "campaign_id", ",", "$", "event_type", ",", "$", "start_datetime", ",", "$", "end_datetime", ",", "$", "offset", "=", "0", ")", "{", "$", "form_data", "=", "array", "(", "'campaign_id'", "=>", "$", "campaign_id", ",", "'event_type'", "=>", "$", "event_type", ",", "'start_datetime'", "=>", "$", "start_datetime", ",", "'end_datetime'", "=>", "$", "end_datetime", ",", "'offset'", "=>", "$", "offset", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_tracked_events_by_campaign'", ",", "$", "form_data", ")", ";", "return", "json_decode", "(", "json_encode", "(", "$", "xml", ")", ",", "TRUE", ")", ";", "}" ]
@param $campaign_id @param $event_type @param $start_datetime @param $end_datetime @param $offset @return mixed @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969839
[ "@param", "$campaign_id", "@param", "$event_type", "@param", "$start_datetime", "@param", "$end_datetime", "@param", "$offset" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2231-L2243
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showUserEvents
public function showUserEvents(Subscriber $subscriber) { $form_data = array( 'subscriber_id' => $subscriber->getSubscriberId(), 'headers' => 1 ); $data = $this->call('show_user_events', $form_data, 'csv'); $csv = new \parseCSV($data); $reports = array(); foreach ($csv->data as $reportItem) { $report = new Report; $report ->setEventName((string)$reportItem{'Event'}) ->setEventId((int)$reportItem{'Event ID'}) ->setListName((string)$reportItem{'List'}) ->setListId((int)$reportItem{'List ID'}) ->setDate(date_create_from_format('m/d/y h:i A', $reportItem{'Date'})); $reports[] = $report; } return $reports; }
php
public function showUserEvents(Subscriber $subscriber) { $form_data = array( 'subscriber_id' => $subscriber->getSubscriberId(), 'headers' => 1 ); $data = $this->call('show_user_events', $form_data, 'csv'); $csv = new \parseCSV($data); $reports = array(); foreach ($csv->data as $reportItem) { $report = new Report; $report ->setEventName((string)$reportItem{'Event'}) ->setEventId((int)$reportItem{'Event ID'}) ->setListName((string)$reportItem{'List'}) ->setListId((int)$reportItem{'List ID'}) ->setDate(date_create_from_format('m/d/y h:i A', $reportItem{'Date'})); $reports[] = $report; } return $reports; }
[ "public", "function", "showUserEvents", "(", "Subscriber", "$", "subscriber", ")", "{", "$", "form_data", "=", "array", "(", "'subscriber_id'", "=>", "$", "subscriber", "->", "getSubscriberId", "(", ")", ",", "'headers'", "=>", "1", ")", ";", "$", "data", "=", "$", "this", "->", "call", "(", "'show_user_events'", ",", "$", "form_data", ",", "'csv'", ")", ";", "$", "csv", "=", "new", "\\", "parseCSV", "(", "$", "data", ")", ";", "$", "reports", "=", "array", "(", ")", ";", "foreach", "(", "$", "csv", "->", "data", "as", "$", "reportItem", ")", "{", "$", "report", "=", "new", "Report", ";", "$", "report", "->", "setEventName", "(", "(", "string", ")", "$", "reportItem", "{", "'Event'", "}", ")", "->", "setEventId", "(", "(", "int", ")", "$", "reportItem", "{", "'Event ID'", "}", ")", "->", "setListName", "(", "(", "string", ")", "$", "reportItem", "{", "'List'", "}", ")", "->", "setListId", "(", "(", "int", ")", "$", "reportItem", "{", "'List ID'", "}", ")", "->", "setDate", "(", "date_create_from_format", "(", "'m/d/y h:i A'", ",", "$", "reportItem", "{", "'Date'", "}", ")", ")", ";", "$", "reports", "[", "]", "=", "$", "report", ";", "}", "return", "$", "reports", ";", "}" ]
@param Subscriber $subscriber @return array @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969849
[ "@param", "Subscriber", "$subscriber" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2253-L2276
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportSubscriberEvents
public function reportSubscriberEvents(Subscriber $subscriber, $event_type = NULL) { $form_data = array( 'subscriber_id' => $subscriber->getSubscriberId(), 'event_type' => $event_type, ); $xml = $this->call('rpt_subscriber_events', $form_data); $reports = array(); foreach ($xml->Data as $reportItem) { $report = new Report; $report ->setEventName((string)$reportItem->event) ->setEventId((int)$reportItem->event_id) ->setListName((string)$reportItem->list) ->setListId((int)$reportItem->list_id) ->setDate(date_create_from_format('m/d/y h:i A', $reportItem->date)); $reports[] = $report; } return $reports; }
php
public function reportSubscriberEvents(Subscriber $subscriber, $event_type = NULL) { $form_data = array( 'subscriber_id' => $subscriber->getSubscriberId(), 'event_type' => $event_type, ); $xml = $this->call('rpt_subscriber_events', $form_data); $reports = array(); foreach ($xml->Data as $reportItem) { $report = new Report; $report ->setEventName((string)$reportItem->event) ->setEventId((int)$reportItem->event_id) ->setListName((string)$reportItem->list) ->setListId((int)$reportItem->list_id) ->setDate(date_create_from_format('m/d/y h:i A', $reportItem->date)); $reports[] = $report; } return $reports; }
[ "public", "function", "reportSubscriberEvents", "(", "Subscriber", "$", "subscriber", ",", "$", "event_type", "=", "NULL", ")", "{", "$", "form_data", "=", "array", "(", "'subscriber_id'", "=>", "$", "subscriber", "->", "getSubscriberId", "(", ")", ",", "'event_type'", "=>", "$", "event_type", ",", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_subscriber_events'", ",", "$", "form_data", ")", ";", "$", "reports", "=", "array", "(", ")", ";", "foreach", "(", "$", "xml", "->", "Data", "as", "$", "reportItem", ")", "{", "$", "report", "=", "new", "Report", ";", "$", "report", "->", "setEventName", "(", "(", "string", ")", "$", "reportItem", "->", "event", ")", "->", "setEventId", "(", "(", "int", ")", "$", "reportItem", "->", "event_id", ")", "->", "setListName", "(", "(", "string", ")", "$", "reportItem", "->", "list", ")", "->", "setListId", "(", "(", "int", ")", "$", "reportItem", "->", "list_id", ")", "->", "setDate", "(", "date_create_from_format", "(", "'m/d/y h:i A'", ",", "$", "reportItem", "->", "date", ")", ")", ";", "$", "reports", "[", "]", "=", "$", "report", ";", "}", "return", "$", "reports", ";", "}" ]
@param Subscriber $subscriber @param null $event_type @return array|\SimpleXMLElement|string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670115
[ "@param", "Subscriber", "$subscriber", "@param", "null", "$event_type" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2287-L2310
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportUnsubscribes
public function reportUnsubscribes($list_id = NULL, $campaign_id = NULL) { $form_data = array( 'list_id' => $list_id, 'campaign_id' => $campaign_id ); $xml = $this->call('rpt_unsubscribe', $form_data); return json_decode(json_encode($xml), TRUE); }
php
public function reportUnsubscribes($list_id = NULL, $campaign_id = NULL) { $form_data = array( 'list_id' => $list_id, 'campaign_id' => $campaign_id ); $xml = $this->call('rpt_unsubscribe', $form_data); return json_decode(json_encode($xml), TRUE); }
[ "public", "function", "reportUnsubscribes", "(", "$", "list_id", "=", "NULL", ",", "$", "campaign_id", "=", "NULL", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "list_id", ",", "'campaign_id'", "=>", "$", "campaign_id", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_unsubscribe'", ",", "$", "form_data", ")", ";", "return", "json_decode", "(", "json_encode", "(", "$", "xml", ")", ",", "TRUE", ")", ";", "}" ]
@param null $list_id @param null $campaign_id @return array|\SimpleXMLElement|string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670125
[ "@param", "null", "$list_id", "@param", "null", "$campaign_id" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2321-L2330
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showOptouts
public function showOptouts($list_id, $days = 30) { $form_data = array( 'list_id' => $list_id, 'days' => $days ); $xml = $this->call('show_optout', $form_data); return $xml; }
php
public function showOptouts($list_id, $days = 30) { $form_data = array( 'list_id' => $list_id, 'days' => $days ); $xml = $this->call('show_optout', $form_data); return $xml; }
[ "public", "function", "showOptouts", "(", "$", "list_id", ",", "$", "days", "=", "30", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "list_id", ",", "'days'", "=>", "$", "days", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'show_optout'", ",", "$", "form_data", ")", ";", "return", "$", "xml", ";", "}" ]
@param $list_id @param int $days @return array|\SimpleXMLElement|string @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670135
[ "@param", "$list_id", "@param", "int", "$days" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2341-L2350
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.showHardBounces
public function showHardBounces($list_id, $days = 30) { $form_data = array( 'list_id' => $list_id, 'days' => $days ); $xml = $this->call('show_hard', $form_data); return json_decode(json_encode($xml->email), TRUE); }
php
public function showHardBounces($list_id, $days = 30) { $form_data = array( 'list_id' => $list_id, 'days' => $days ); $xml = $this->call('show_hard', $form_data); return json_decode(json_encode($xml->email), TRUE); }
[ "public", "function", "showHardBounces", "(", "$", "list_id", ",", "$", "days", "=", "30", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "list_id", ",", "'days'", "=>", "$", "days", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'show_hard'", ",", "$", "form_data", ")", ";", "return", "json_decode", "(", "json_encode", "(", "$", "xml", "->", "email", ")", ",", "TRUE", ")", ";", "}" ]
@param $list_id @param int $days @return mixed @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/204670145
[ "@param", "$list_id", "@param", "int", "$days" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2379-L2388
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportSubscriberByUpdate
public function reportSubscriberByUpdate($list_id, $start_datetime, $end_datetime) { $form_data = array( 'list_id' => $list_id, 'start_datetime' => $start_datetime, 'end_datetime' => $end_datetime ); $xml = $this->call('rpt_sub_by_update_datetime', $form_data); return json_decode(json_encode($xml), TRUE); }
php
public function reportSubscriberByUpdate($list_id, $start_datetime, $end_datetime) { $form_data = array( 'list_id' => $list_id, 'start_datetime' => $start_datetime, 'end_datetime' => $end_datetime ); $xml = $this->call('rpt_sub_by_update_datetime', $form_data); return json_decode(json_encode($xml), TRUE); }
[ "public", "function", "reportSubscriberByUpdate", "(", "$", "list_id", ",", "$", "start_datetime", ",", "$", "end_datetime", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "list_id", ",", "'start_datetime'", "=>", "$", "start_datetime", ",", "'end_datetime'", "=>", "$", "end_datetime", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_sub_by_update_datetime'", ",", "$", "form_data", ")", ";", "return", "json_decode", "(", "json_encode", "(", "$", "xml", ")", ",", "TRUE", ")", ";", "}" ]
@param $list_id @param $start_datetime @param $end_datetime @return mixed @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969669
[ "@param", "$list_id", "@param", "$start_datetime", "@param", "$end_datetime" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2460-L2470
ZayconFoods/whatcounts
src/ZayconWhatCounts/WhatCounts.php
WhatCounts.reportSubscribersInList
public function reportSubscribersInList($list_id, $offset=0) { $form_data = array( 'list_id' => $list_id, 'offset' => $offset ); $xml = $this->call('rpt_subscribers_in_list', $form_data); return json_decode(json_encode($xml), TRUE); }
php
public function reportSubscribersInList($list_id, $offset=0) { $form_data = array( 'list_id' => $list_id, 'offset' => $offset ); $xml = $this->call('rpt_subscribers_in_list', $form_data); return json_decode(json_encode($xml), TRUE); }
[ "public", "function", "reportSubscribersInList", "(", "$", "list_id", ",", "$", "offset", "=", "0", ")", "{", "$", "form_data", "=", "array", "(", "'list_id'", "=>", "$", "list_id", ",", "'offset'", "=>", "$", "offset", ")", ";", "$", "xml", "=", "$", "this", "->", "call", "(", "'rpt_subscribers_in_list'", ",", "$", "form_data", ")", ";", "return", "json_decode", "(", "json_encode", "(", "$", "xml", ")", ",", "TRUE", ")", ";", "}" ]
@param $list_id @param int $offset @return mixed @throws Exception API documentation: https://whatcounts.zendesk.com/hc/en-us/articles/203969429
[ "@param", "$list_id", "@param", "int", "$offset" ]
train
https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/WhatCounts.php#L2481-L2490
php-lug/lug
src/Bundle/GridBundle/Form/EventSubscriber/Batch/Doctrine/MongoDB/GridBatchSubscriber.php
GridBatchSubscriber.findChoices
protected function findChoices(GridInterface $grid, RepositoryInterface $repository, array $choices) { $result = $repository ->createQueryBuilderForCollection() ->field($repository->getProperty($grid->getResource()->getIdPropertyPath())) ->in($choices) ->getQuery() ->getIterator() ->toArray(); return count($result) === count($choices) ? $result : []; }
php
protected function findChoices(GridInterface $grid, RepositoryInterface $repository, array $choices) { $result = $repository ->createQueryBuilderForCollection() ->field($repository->getProperty($grid->getResource()->getIdPropertyPath())) ->in($choices) ->getQuery() ->getIterator() ->toArray(); return count($result) === count($choices) ? $result : []; }
[ "protected", "function", "findChoices", "(", "GridInterface", "$", "grid", ",", "RepositoryInterface", "$", "repository", ",", "array", "$", "choices", ")", "{", "$", "result", "=", "$", "repository", "->", "createQueryBuilderForCollection", "(", ")", "->", "field", "(", "$", "repository", "->", "getProperty", "(", "$", "grid", "->", "getResource", "(", ")", "->", "getIdPropertyPath", "(", ")", ")", ")", "->", "in", "(", "$", "choices", ")", "->", "getQuery", "(", ")", "->", "getIterator", "(", ")", "->", "toArray", "(", ")", ";", "return", "count", "(", "$", "result", ")", "===", "count", "(", "$", "choices", ")", "?", "$", "result", ":", "[", "]", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Form/EventSubscriber/Batch/Doctrine/MongoDB/GridBatchSubscriber.php#L26-L37
yuncms/yii2-authentication
frontend/controllers/AuthenticationController.php
AuthenticationController.actionIndex
public function actionIndex() { if (($model = Authentication::findOne(['user_id' => Yii::$app->user->id])) == null) { return $this->redirect(['create']); } return $this->render('index', [ 'model' => $model ]); }
php
public function actionIndex() { if (($model = Authentication::findOne(['user_id' => Yii::$app->user->id])) == null) { return $this->redirect(['create']); } return $this->render('index', [ 'model' => $model ]); }
[ "public", "function", "actionIndex", "(", ")", "{", "if", "(", "(", "$", "model", "=", "Authentication", "::", "findOne", "(", "[", "'user_id'", "=>", "Yii", "::", "$", "app", "->", "user", "->", "id", "]", ")", ")", "==", "null", ")", "{", "return", "$", "this", "->", "redirect", "(", "[", "'create'", "]", ")", ";", "}", "return", "$", "this", "->", "render", "(", "'index'", ",", "[", "'model'", "=>", "$", "model", "]", ")", ";", "}" ]
认证首页 @return string
[ "认证首页" ]
train
https://github.com/yuncms/yii2-authentication/blob/02b70f7d2587480edb6dcc18ce256db662f1ed0d/frontend/controllers/AuthenticationController.php#L59-L67
yuncms/yii2-authentication
frontend/controllers/AuthenticationController.php
AuthenticationController.actionCreate
public function actionCreate() { if ((Authentication::findOne(['user_id' => Yii::$app->user->id])) != null || Authentication::isAuthentication(Yii::$app->user->id)) { return $this->redirect(['index']); } $model = new Authentication(); $model->scenario = Authentication::SCENARIO_CREATE; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } return $this->render('create', [ 'model' => $model, ]); }
php
public function actionCreate() { if ((Authentication::findOne(['user_id' => Yii::$app->user->id])) != null || Authentication::isAuthentication(Yii::$app->user->id)) { return $this->redirect(['index']); } $model = new Authentication(); $model->scenario = Authentication::SCENARIO_CREATE; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } return $this->render('create', [ 'model' => $model, ]); }
[ "public", "function", "actionCreate", "(", ")", "{", "if", "(", "(", "Authentication", "::", "findOne", "(", "[", "'user_id'", "=>", "Yii", "::", "$", "app", "->", "user", "->", "id", "]", ")", ")", "!=", "null", "||", "Authentication", "::", "isAuthentication", "(", "Yii", "::", "$", "app", "->", "user", "->", "id", ")", ")", "{", "return", "$", "this", "->", "redirect", "(", "[", "'index'", "]", ")", ";", "}", "$", "model", "=", "new", "Authentication", "(", ")", ";", "$", "model", "->", "scenario", "=", "Authentication", "::", "SCENARIO_CREATE", ";", "if", "(", "$", "model", "->", "load", "(", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ")", "&&", "$", "model", "->", "save", "(", ")", ")", "{", "return", "$", "this", "->", "redirect", "(", "[", "'index'", "]", ")", ";", "}", "return", "$", "this", "->", "render", "(", "'create'", ",", "[", "'model'", "=>", "$", "model", ",", "]", ")", ";", "}" ]
提交实名认证 @return string|Response
[ "提交实名认证" ]
train
https://github.com/yuncms/yii2-authentication/blob/02b70f7d2587480edb6dcc18ce256db662f1ed0d/frontend/controllers/AuthenticationController.php#L73-L86
yuncms/yii2-authentication
frontend/controllers/AuthenticationController.php
AuthenticationController.actionUpdate
public function actionUpdate() { /** @var Authentication $model */ if (($model = Authentication::findOne(['user_id' => Yii::$app->user->id])) == null) { return $this->redirect(['create']); } $model->scenario = Authentication::SCENARIO_UPDATE; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } return $this->render('update', [ 'model' => $model, ]); }
php
public function actionUpdate() { /** @var Authentication $model */ if (($model = Authentication::findOne(['user_id' => Yii::$app->user->id])) == null) { return $this->redirect(['create']); } $model->scenario = Authentication::SCENARIO_UPDATE; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } return $this->render('update', [ 'model' => $model, ]); }
[ "public", "function", "actionUpdate", "(", ")", "{", "/** @var Authentication $model */", "if", "(", "(", "$", "model", "=", "Authentication", "::", "findOne", "(", "[", "'user_id'", "=>", "Yii", "::", "$", "app", "->", "user", "->", "id", "]", ")", ")", "==", "null", ")", "{", "return", "$", "this", "->", "redirect", "(", "[", "'create'", "]", ")", ";", "}", "$", "model", "->", "scenario", "=", "Authentication", "::", "SCENARIO_UPDATE", ";", "if", "(", "$", "model", "->", "load", "(", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ")", "&&", "$", "model", "->", "save", "(", ")", ")", "{", "return", "$", "this", "->", "redirect", "(", "[", "'index'", "]", ")", ";", "}", "return", "$", "this", "->", "render", "(", "'update'", ",", "[", "'model'", "=>", "$", "model", ",", "]", ")", ";", "}" ]
更新实名认证 @return string|Response
[ "更新实名认证" ]
train
https://github.com/yuncms/yii2-authentication/blob/02b70f7d2587480edb6dcc18ce256db662f1ed0d/frontend/controllers/AuthenticationController.php#L92-L105
ShaoZeMing/laravel-merchant
src/Controllers/AuthController.php
AuthController.postRegister
public function postRegister(Request $request) { $credentials = $request->only(['mobile', 'password']); $validator = Validator::make($credentials, [ 'mobile' => 'required', 'password' => 'required', ]); if ($validator->fails()) { return Redirect::back()->withInput()->withErrors($validator); } //这儿需要重写 return Redirect::back()->withInput()->withErrors(['mobile' => $this->getFailedLoginMessage()]); }
php
public function postRegister(Request $request) { $credentials = $request->only(['mobile', 'password']); $validator = Validator::make($credentials, [ 'mobile' => 'required', 'password' => 'required', ]); if ($validator->fails()) { return Redirect::back()->withInput()->withErrors($validator); } //这儿需要重写 return Redirect::back()->withInput()->withErrors(['mobile' => $this->getFailedLoginMessage()]); }
[ "public", "function", "postRegister", "(", "Request", "$", "request", ")", "{", "$", "credentials", "=", "$", "request", "->", "only", "(", "[", "'mobile'", ",", "'password'", "]", ")", ";", "$", "validator", "=", "Validator", "::", "make", "(", "$", "credentials", ",", "[", "'mobile'", "=>", "'required'", ",", "'password'", "=>", "'required'", ",", "]", ")", ";", "if", "(", "$", "validator", "->", "fails", "(", ")", ")", "{", "return", "Redirect", "::", "back", "(", ")", "->", "withInput", "(", ")", "->", "withErrors", "(", "$", "validator", ")", ";", "}", "//这儿需要重写", "return", "Redirect", "::", "back", "(", ")", "->", "withInput", "(", ")", "->", "withErrors", "(", "[", "'mobile'", "=>", "$", "this", "->", "getFailedLoginMessage", "(", ")", "]", ")", ";", "}" ]
@param Request $request @return mixed
[ "@param", "Request", "$request" ]
train
https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Controllers/AuthController.php#L40-L56
ShaoZeMing/laravel-merchant
src/Controllers/AuthController.php
AuthController.postLogin
public function postLogin(Request $request) { $credentials = $request->only(['mobile', 'password']); $validator = Validator::make($credentials, [ 'mobile' => 'required', 'password' => 'required', ]); if ($validator->fails()) { return Redirect::back()->withInput()->withErrors($validator); } if (Auth::guard('merchant')->attempt($credentials)) { merchant_toastr(trans('merchant.login_successful')); return redirect()->intended(config('merchant.route.prefix')); } return Redirect::back()->withInput()->withErrors(['mobile' => $this->getFailedLoginMessage()]); }
php
public function postLogin(Request $request) { $credentials = $request->only(['mobile', 'password']); $validator = Validator::make($credentials, [ 'mobile' => 'required', 'password' => 'required', ]); if ($validator->fails()) { return Redirect::back()->withInput()->withErrors($validator); } if (Auth::guard('merchant')->attempt($credentials)) { merchant_toastr(trans('merchant.login_successful')); return redirect()->intended(config('merchant.route.prefix')); } return Redirect::back()->withInput()->withErrors(['mobile' => $this->getFailedLoginMessage()]); }
[ "public", "function", "postLogin", "(", "Request", "$", "request", ")", "{", "$", "credentials", "=", "$", "request", "->", "only", "(", "[", "'mobile'", ",", "'password'", "]", ")", ";", "$", "validator", "=", "Validator", "::", "make", "(", "$", "credentials", ",", "[", "'mobile'", "=>", "'required'", ",", "'password'", "=>", "'required'", ",", "]", ")", ";", "if", "(", "$", "validator", "->", "fails", "(", ")", ")", "{", "return", "Redirect", "::", "back", "(", ")", "->", "withInput", "(", ")", "->", "withErrors", "(", "$", "validator", ")", ";", "}", "if", "(", "Auth", "::", "guard", "(", "'merchant'", ")", "->", "attempt", "(", "$", "credentials", ")", ")", "{", "merchant_toastr", "(", "trans", "(", "'merchant.login_successful'", ")", ")", ";", "return", "redirect", "(", ")", "->", "intended", "(", "config", "(", "'merchant.route.prefix'", ")", ")", ";", "}", "return", "Redirect", "::", "back", "(", ")", "->", "withInput", "(", ")", "->", "withErrors", "(", "[", "'mobile'", "=>", "$", "this", "->", "getFailedLoginMessage", "(", ")", "]", ")", ";", "}" ]
@param Request $request @return mixed
[ "@param", "Request", "$request" ]
train
https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Controllers/AuthController.php#L123-L142
ShaoZeMing/laravel-merchant
src/Controllers/AuthController.php
AuthController.settingForm
protected function settingForm() { return Administrator::form(function (Form $form) { $form->display('mobile', trans('merchant.mobile'))->rules('required'); $form->email('email', trans('merchant.email'))->rules('required'); $form->text('name', trans('merchant.name'))->rules('required'); $form->image('avatar', trans('merchant.avatar')); $form->password('password', trans('merchant.password'))->rules('confirmed|required'); $form->password('password_confirmation', trans('merchant.password_confirmation'))->rules('required') ->default(function ($form) { return $form->model()->password; }); $form->setAction(merchant_base_path('auth/setting')); $form->ignore(['password_confirmation']); $form->saving(function (Form $form) { if ($form->password && $form->model()->password != $form->password) { $form->password = bcrypt($form->password); } }); $form->saved(function () { merchant_toastr(trans('merchant.update_succeeded')); return redirect(merchant_base_path('auth/setting')); }); }); }
php
protected function settingForm() { return Administrator::form(function (Form $form) { $form->display('mobile', trans('merchant.mobile'))->rules('required'); $form->email('email', trans('merchant.email'))->rules('required'); $form->text('name', trans('merchant.name'))->rules('required'); $form->image('avatar', trans('merchant.avatar')); $form->password('password', trans('merchant.password'))->rules('confirmed|required'); $form->password('password_confirmation', trans('merchant.password_confirmation'))->rules('required') ->default(function ($form) { return $form->model()->password; }); $form->setAction(merchant_base_path('auth/setting')); $form->ignore(['password_confirmation']); $form->saving(function (Form $form) { if ($form->password && $form->model()->password != $form->password) { $form->password = bcrypt($form->password); } }); $form->saved(function () { merchant_toastr(trans('merchant.update_succeeded')); return redirect(merchant_base_path('auth/setting')); }); }); }
[ "protected", "function", "settingForm", "(", ")", "{", "return", "Administrator", "::", "form", "(", "function", "(", "Form", "$", "form", ")", "{", "$", "form", "->", "display", "(", "'mobile'", ",", "trans", "(", "'merchant.mobile'", ")", ")", "->", "rules", "(", "'required'", ")", ";", "$", "form", "->", "email", "(", "'email'", ",", "trans", "(", "'merchant.email'", ")", ")", "->", "rules", "(", "'required'", ")", ";", "$", "form", "->", "text", "(", "'name'", ",", "trans", "(", "'merchant.name'", ")", ")", "->", "rules", "(", "'required'", ")", ";", "$", "form", "->", "image", "(", "'avatar'", ",", "trans", "(", "'merchant.avatar'", ")", ")", ";", "$", "form", "->", "password", "(", "'password'", ",", "trans", "(", "'merchant.password'", ")", ")", "->", "rules", "(", "'confirmed|required'", ")", ";", "$", "form", "->", "password", "(", "'password_confirmation'", ",", "trans", "(", "'merchant.password_confirmation'", ")", ")", "->", "rules", "(", "'required'", ")", "->", "default", "(", "function", "(", "$", "form", ")", "{", "return", "$", "form", "->", "model", "(", ")", "->", "password", ";", "}", ")", ";", "$", "form", "->", "setAction", "(", "merchant_base_path", "(", "'auth/setting'", ")", ")", ";", "$", "form", "->", "ignore", "(", "[", "'password_confirmation'", "]", ")", ";", "$", "form", "->", "saving", "(", "function", "(", "Form", "$", "form", ")", "{", "if", "(", "$", "form", "->", "password", "&&", "$", "form", "->", "model", "(", ")", "->", "password", "!=", "$", "form", "->", "password", ")", "{", "$", "form", "->", "password", "=", "bcrypt", "(", "$", "form", "->", "password", ")", ";", "}", "}", ")", ";", "$", "form", "->", "saved", "(", "function", "(", ")", "{", "merchant_toastr", "(", "trans", "(", "'merchant.update_succeeded'", ")", ")", ";", "return", "redirect", "(", "merchant_base_path", "(", "'auth/setting'", ")", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
Model-form for user setting. @return Form
[ "Model", "-", "form", "for", "user", "setting", "." ]
train
https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Controllers/AuthController.php#L193-L221
znck/countries
src/Translator.php
Translator.get
public function get(string $key, string $locale = null) { list($country) = $this->parseKey($key); $locale = $locale ?? $this->fallbackLocale; $this->load($locale); if ($this->has($locale, $country)) { return $this->loaded[$locale][$country]; } return $key; }
php
public function get(string $key, string $locale = null) { list($country) = $this->parseKey($key); $locale = $locale ?? $this->fallbackLocale; $this->load($locale); if ($this->has($locale, $country)) { return $this->loaded[$locale][$country]; } return $key; }
[ "public", "function", "get", "(", "string", "$", "key", ",", "string", "$", "locale", "=", "null", ")", "{", "list", "(", "$", "country", ")", "=", "$", "this", "->", "parseKey", "(", "$", "key", ")", ";", "$", "locale", "=", "$", "locale", "??", "$", "this", "->", "fallbackLocale", ";", "$", "this", "->", "load", "(", "$", "locale", ")", ";", "if", "(", "$", "this", "->", "has", "(", "$", "locale", ",", "$", "country", ")", ")", "{", "return", "$", "this", "->", "loaded", "[", "$", "locale", "]", "[", "$", "country", "]", ";", "}", "return", "$", "key", ";", "}" ]
@param string $key @param string|null $locale @return string
[ "@param", "string", "$key", "@param", "string|null", "$locale" ]
train
https://github.com/znck/countries/blob/a78a2b302dfa8eacab8fe0c06127dbb37fa98fd3/src/Translator.php#L60-L73
znck/countries
src/Translator.php
Translator.getName
public function getName(string $key, string $locale = null) { return $this->get($key, $locale); }
php
public function getName(string $key, string $locale = null) { return $this->get($key, $locale); }
[ "public", "function", "getName", "(", "string", "$", "key", ",", "string", "$", "locale", "=", "null", ")", "{", "return", "$", "this", "->", "get", "(", "$", "key", ",", "$", "locale", ")", ";", "}" ]
@param string $key @param string|null $locale @return string
[ "@param", "string", "$key", "@param", "string|null", "$locale" ]
train
https://github.com/znck/countries/blob/a78a2b302dfa8eacab8fe0c06127dbb37fa98fd3/src/Translator.php#L81-L84
znck/countries
src/Translator.php
Translator.has
protected function has(string $locale, string $country) { return isset($this->loaded[$locale][$country]); }
php
protected function has(string $locale, string $country) { return isset($this->loaded[$locale][$country]); }
[ "protected", "function", "has", "(", "string", "$", "locale", ",", "string", "$", "country", ")", "{", "return", "isset", "(", "$", "this", "->", "loaded", "[", "$", "locale", "]", "[", "$", "country", "]", ")", ";", "}" ]
@param string $locale @param string $country @return bool
[ "@param", "string", "$locale", "@param", "string", "$country" ]
train
https://github.com/znck/countries/blob/a78a2b302dfa8eacab8fe0c06127dbb37fa98fd3/src/Translator.php#L104-L107
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.onRequestTerminate
public function onRequestTerminate() { // lets see if there were unhandled fatal errors $lasterror=error_get_last(); if(!is_null($lasterror)){ if($lasterror['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR)){ // fatal error occured // increase memory limit so we we can at least complete our error handling (in case it was Allowed memory size exhausted) // (adding 1MB, unless already unlimited) $memlim=Web2All_PHP_INI::getBytes(ini_get('memory_limit')); if($memlim!=-1){ ini_set('memory_limit',$memlim+1000000); } // then add this error to the observers $error = Web2All_Manager_Error::getInstance(); $exception = new Web2All_Manager_TriggerException($lasterror['type'], $lasterror['message'], $lasterror['file'], $lasterror['line'], array()); if ($error) { $error->setState($exception,$lasterror['type']); } } } }
php
public function onRequestTerminate() { // lets see if there were unhandled fatal errors $lasterror=error_get_last(); if(!is_null($lasterror)){ if($lasterror['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR)){ // fatal error occured // increase memory limit so we we can at least complete our error handling (in case it was Allowed memory size exhausted) // (adding 1MB, unless already unlimited) $memlim=Web2All_PHP_INI::getBytes(ini_get('memory_limit')); if($memlim!=-1){ ini_set('memory_limit',$memlim+1000000); } // then add this error to the observers $error = Web2All_Manager_Error::getInstance(); $exception = new Web2All_Manager_TriggerException($lasterror['type'], $lasterror['message'], $lasterror['file'], $lasterror['line'], array()); if ($error) { $error->setState($exception,$lasterror['type']); } } } }
[ "public", "function", "onRequestTerminate", "(", ")", "{", "// lets see if there were unhandled fatal errors\r", "$", "lasterror", "=", "error_get_last", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "lasterror", ")", ")", "{", "if", "(", "$", "lasterror", "[", "'type'", "]", "&", "(", "E_ERROR", "|", "E_PARSE", "|", "E_CORE_ERROR", "|", "E_COMPILE_ERROR", "|", "E_USER_ERROR", "|", "E_RECOVERABLE_ERROR", ")", ")", "{", "// fatal error occured\r", "// increase memory limit so we we can at least complete our error handling (in case it was Allowed memory size exhausted)\r", "// (adding 1MB, unless already unlimited)\r", "$", "memlim", "=", "Web2All_PHP_INI", "::", "getBytes", "(", "ini_get", "(", "'memory_limit'", ")", ")", ";", "if", "(", "$", "memlim", "!=", "-", "1", ")", "{", "ini_set", "(", "'memory_limit'", ",", "$", "memlim", "+", "1000000", ")", ";", "}", "// then add this error to the observers\r", "$", "error", "=", "Web2All_Manager_Error", "::", "getInstance", "(", ")", ";", "$", "exception", "=", "new", "Web2All_Manager_TriggerException", "(", "$", "lasterror", "[", "'type'", "]", ",", "$", "lasterror", "[", "'message'", "]", ",", "$", "lasterror", "[", "'file'", "]", ",", "$", "lasterror", "[", "'line'", "]", ",", "array", "(", ")", ")", ";", "if", "(", "$", "error", ")", "{", "$", "error", "->", "setState", "(", "$", "exception", ",", "$", "lasterror", "[", "'type'", "]", ")", ";", "}", "}", "}", "}" ]
Gets executed when request terminates WARNING: do not call exit() or errorhandling will break
[ "Gets", "executed", "when", "request", "terminates" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L508-L529
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.debugLog
public function debugLog($message) { if($this->DebugAddTime){ // adding datetime to message (useful when DebugMethod=='echoplain') if($this->DebugMultiLine){ // multiline is enabled, so add the time for each line in the $message $message_changed=''; foreach(explode("\n",$message) as $sub_msg){ if($message_changed!==''){ // only add a newline for each newline we lost due to the explode $message_changed.="\n"; } $message_changed.=date("Y-m-d H:i:s ").$sub_msg; } $message=$message_changed; }else{ $message=date("Y-m-d H:i:s ").$message; } } if($this->DebugMethod=='error_log'){ // error_log entries are automatically truncated at ~8130 chars. // by default the message is displayed as one single line where newlines are replaced by literal \n // in fact, all non ascii characters are replaced by escaped values (often \xnn) // we support two config settings to change this behaviour: error_log_multiline, error_log_wrap // both are enabled by default if($this->DebugMultiLine){ foreach(explode("\n",$message) as $sub_msg){ if($this->ManagerConfig['error_log_wrap']){ self::error_log_wrap($sub_msg); }else{ error_log($sub_msg); } } }else{ if($this->ManagerConfig['error_log_wrap']){ self::error_log_wrap($message); }else{ error_log($message); } } } else if($this->DebugMethod=='echoplain'){ echo $message."\n"; }else{ echo $message."<br />\n"; } }
php
public function debugLog($message) { if($this->DebugAddTime){ // adding datetime to message (useful when DebugMethod=='echoplain') if($this->DebugMultiLine){ // multiline is enabled, so add the time for each line in the $message $message_changed=''; foreach(explode("\n",$message) as $sub_msg){ if($message_changed!==''){ // only add a newline for each newline we lost due to the explode $message_changed.="\n"; } $message_changed.=date("Y-m-d H:i:s ").$sub_msg; } $message=$message_changed; }else{ $message=date("Y-m-d H:i:s ").$message; } } if($this->DebugMethod=='error_log'){ // error_log entries are automatically truncated at ~8130 chars. // by default the message is displayed as one single line where newlines are replaced by literal \n // in fact, all non ascii characters are replaced by escaped values (often \xnn) // we support two config settings to change this behaviour: error_log_multiline, error_log_wrap // both are enabled by default if($this->DebugMultiLine){ foreach(explode("\n",$message) as $sub_msg){ if($this->ManagerConfig['error_log_wrap']){ self::error_log_wrap($sub_msg); }else{ error_log($sub_msg); } } }else{ if($this->ManagerConfig['error_log_wrap']){ self::error_log_wrap($message); }else{ error_log($message); } } } else if($this->DebugMethod=='echoplain'){ echo $message."\n"; }else{ echo $message."<br />\n"; } }
[ "public", "function", "debugLog", "(", "$", "message", ")", "{", "if", "(", "$", "this", "->", "DebugAddTime", ")", "{", "// adding datetime to message (useful when DebugMethod=='echoplain')\r", "if", "(", "$", "this", "->", "DebugMultiLine", ")", "{", "// multiline is enabled, so add the time for each line in the $message\r", "$", "message_changed", "=", "''", ";", "foreach", "(", "explode", "(", "\"\\n\"", ",", "$", "message", ")", "as", "$", "sub_msg", ")", "{", "if", "(", "$", "message_changed", "!==", "''", ")", "{", "// only add a newline for each newline we lost due to the explode\r", "$", "message_changed", ".=", "\"\\n\"", ";", "}", "$", "message_changed", ".=", "date", "(", "\"Y-m-d H:i:s \"", ")", ".", "$", "sub_msg", ";", "}", "$", "message", "=", "$", "message_changed", ";", "}", "else", "{", "$", "message", "=", "date", "(", "\"Y-m-d H:i:s \"", ")", ".", "$", "message", ";", "}", "}", "if", "(", "$", "this", "->", "DebugMethod", "==", "'error_log'", ")", "{", "// error_log entries are automatically truncated at ~8130 chars.\r", "// by default the message is displayed as one single line where newlines are replaced by literal \\n\r", "// in fact, all non ascii characters are replaced by escaped values (often \\xnn)\r", "// we support two config settings to change this behaviour: error_log_multiline, error_log_wrap\r", "// both are enabled by default\r", "if", "(", "$", "this", "->", "DebugMultiLine", ")", "{", "foreach", "(", "explode", "(", "\"\\n\"", ",", "$", "message", ")", "as", "$", "sub_msg", ")", "{", "if", "(", "$", "this", "->", "ManagerConfig", "[", "'error_log_wrap'", "]", ")", "{", "self", "::", "error_log_wrap", "(", "$", "sub_msg", ")", ";", "}", "else", "{", "error_log", "(", "$", "sub_msg", ")", ";", "}", "}", "}", "else", "{", "if", "(", "$", "this", "->", "ManagerConfig", "[", "'error_log_wrap'", "]", ")", "{", "self", "::", "error_log_wrap", "(", "$", "message", ")", ";", "}", "else", "{", "error_log", "(", "$", "message", ")", ";", "}", "}", "}", "else", "if", "(", "$", "this", "->", "DebugMethod", "==", "'echoplain'", ")", "{", "echo", "$", "message", ".", "\"\\n\"", ";", "}", "else", "{", "echo", "$", "message", ".", "\"<br />\\n\"", ";", "}", "}" ]
Log the debug message to STDOUT (html) or STDERR Automaticly adds BR and newline when outputting to STDOUT. depends on config key 'debugmethod' which can be 'echo' or 'echoplain' or 'error_log' @param string $message
[ "Log", "the", "debug", "message", "to", "STDOUT", "(", "html", ")", "or", "STDERR", "Automaticly", "adds", "BR", "and", "newline", "when", "outputting", "to", "STDOUT", "." ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L588-L633
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.error_log_wrap
public static function error_log_wrap($message) { // msglen is the remain length of the message that needs to be written. $msglen=strlen($message); $i=0; while($msglen>0){ if($msglen>8000){ // the remaining message that needs to be written is still longer than 8000 bytes // so error_log only a chunk (start at offset: number of itereations * 8000) error_log(substr($message,$i*8000,8000)); $msglen=$msglen-8000; }else{ // less than 8000 bytes left, write the remainder (end) error_log(substr($message,$i*8000)); $msglen=0; } $i++; } }
php
public static function error_log_wrap($message) { // msglen is the remain length of the message that needs to be written. $msglen=strlen($message); $i=0; while($msglen>0){ if($msglen>8000){ // the remaining message that needs to be written is still longer than 8000 bytes // so error_log only a chunk (start at offset: number of itereations * 8000) error_log(substr($message,$i*8000,8000)); $msglen=$msglen-8000; }else{ // less than 8000 bytes left, write the remainder (end) error_log(substr($message,$i*8000)); $msglen=0; } $i++; } }
[ "public", "static", "function", "error_log_wrap", "(", "$", "message", ")", "{", "// msglen is the remain length of the message that needs to be written.\r", "$", "msglen", "=", "strlen", "(", "$", "message", ")", ";", "$", "i", "=", "0", ";", "while", "(", "$", "msglen", ">", "0", ")", "{", "if", "(", "$", "msglen", ">", "8000", ")", "{", "// the remaining message that needs to be written is still longer than 8000 bytes\r", "// so error_log only a chunk (start at offset: number of itereations * 8000)\r", "error_log", "(", "substr", "(", "$", "message", ",", "$", "i", "*", "8000", ",", "8000", ")", ")", ";", "$", "msglen", "=", "$", "msglen", "-", "8000", ";", "}", "else", "{", "// less than 8000 bytes left, write the remainder (end)\r", "error_log", "(", "substr", "(", "$", "message", ",", "$", "i", "*", "8000", ")", ")", ";", "$", "msglen", "=", "0", ";", "}", "$", "i", "++", ";", "}", "}" ]
Log the message to the error_log, but wrap at 8000 bytes to prevent automatic cutoff by the PHP error_log function @param string $message
[ "Log", "the", "message", "to", "the", "error_log", "but", "wrap", "at", "8000", "bytes", "to", "prevent", "automatic", "cutoff", "by", "the", "PHP", "error_log", "function" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L641-L659
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.debugLogCPU
public function debugLogCPU($message='') { // get resource usage $dat = getrusage(); $message.='[u:'.substr(($dat["ru_utime.tv_sec"]*1e6+$dat["ru_utime.tv_usec"])-$this->startUserCPU,0,-3).'ms / s:'.substr(($dat["ru_stime.tv_sec"]*1e6+$dat["ru_stime.tv_usec"])-$this->startSystemCPU,0,-3).'ms]'; $this->debugLog($message); }
php
public function debugLogCPU($message='') { // get resource usage $dat = getrusage(); $message.='[u:'.substr(($dat["ru_utime.tv_sec"]*1e6+$dat["ru_utime.tv_usec"])-$this->startUserCPU,0,-3).'ms / s:'.substr(($dat["ru_stime.tv_sec"]*1e6+$dat["ru_stime.tv_usec"])-$this->startSystemCPU,0,-3).'ms]'; $this->debugLog($message); }
[ "public", "function", "debugLogCPU", "(", "$", "message", "=", "''", ")", "{", "// get resource usage\r", "$", "dat", "=", "getrusage", "(", ")", ";", "$", "message", ".=", "'[u:'", ".", "substr", "(", "(", "$", "dat", "[", "\"ru_utime.tv_sec\"", "]", "*", "1e6", "+", "$", "dat", "[", "\"ru_utime.tv_usec\"", "]", ")", "-", "$", "this", "->", "startUserCPU", ",", "0", ",", "-", "3", ")", ".", "'ms / s:'", ".", "substr", "(", "(", "$", "dat", "[", "\"ru_stime.tv_sec\"", "]", "*", "1e6", "+", "$", "dat", "[", "\"ru_stime.tv_usec\"", "]", ")", "-", "$", "this", "->", "startSystemCPU", ",", "0", ",", "-", "3", ")", ".", "'ms]'", ";", "$", "this", "->", "debugLog", "(", "$", "message", ")", ";", "}" ]
Debug log the CPU used by the script Please note its only updated every 10ms. output: <user message>[u: <user time>ms / s:<system time>ms] @param string $message [optional message to prepend]
[ "Debug", "log", "the", "CPU", "used", "by", "the", "script" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L684-L690
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.getGlobalStorage
public function getGlobalStorage($name) { if (!$this->GlobalStorageExists($name)) { return false; } return $this->global_data->get($name); }
php
public function getGlobalStorage($name) { if (!$this->GlobalStorageExists($name)) { return false; } return $this->global_data->get($name); }
[ "public", "function", "getGlobalStorage", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "GlobalStorageExists", "(", "$", "name", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "global_data", "->", "get", "(", "$", "name", ")", ";", "}" ]
Retrieve from Global storage @param string $name @return mixed pointer to Plugin or false when not found
[ "Retrieve", "from", "Global", "storage" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L721-L726
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.globalStorageExists
final public function globalStorageExists($classname) { if (!isset($this->global_data)) { throw new Exception("Global storare is not initialised, can't check if object ".$classname." exists, forget to load parent::__construct?"); } return $this->global_data->offsetExists($classname); }
php
final public function globalStorageExists($classname) { if (!isset($this->global_data)) { throw new Exception("Global storare is not initialised, can't check if object ".$classname." exists, forget to load parent::__construct?"); } return $this->global_data->offsetExists($classname); }
[ "final", "public", "function", "globalStorageExists", "(", "$", "classname", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "global_data", ")", ")", "{", "throw", "new", "Exception", "(", "\"Global storare is not initialised, can't check if object \"", ".", "$", "classname", ".", "\" exists, forget to load parent::__construct?\"", ")", ";", "}", "return", "$", "this", "->", "global_data", "->", "offsetExists", "(", "$", "classname", ")", ";", "}" ]
Checks if $name exists in Global Storage @param string $name @return boolean
[ "Checks", "if", "$name", "exists", "in", "Global", "Storage" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L744-L749
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.includeClass
public static function includeClass($classname, $loadscheme='Web2All', $package='', $set_includedir=false) { // $path will be the relative path to the classfile by exploding the namespace $path = ''; $filename = $classname; // support namespaces if(strpos($classname,'\\')){ // ok, contains namespace $path_parts = explode('\\',$classname); $part_count=count($path_parts); $filename = $path_parts[$part_count-1]; $classname_without_namespaces = $filename; for ($i=0;($i<$part_count-1);$i++) { $path.=$path_parts[$i].DIRECTORY_SEPARATOR; } }else{ $classname_without_namespaces = $classname; } if ($loadscheme!='PLAIN') { $path_parts = explode("_",$classname_without_namespaces); $part_count=count($path_parts); $filename = $path_parts[$part_count-1]; for ($i=0;($i<$part_count-1);$i++) { $path.=$path_parts[$i].DIRECTORY_SEPARATOR; } } // depending on the scheme, select the suffix // PEAR class files do not have the .class in the name. // The Web2All scheme historically used ".class.php", but for // better compatibility we now also support the plain ".php". $classfilesuffixes=array('.class.php','.php'); switch($loadscheme){ case 'PEAR': case 'PLAIN': $classfilesuffixes=array('.php'); break; case 'INC': $classfilesuffixes=array('.inc.php'); break; } foreach(self::$frameworkRoots as $include_path){ if ($package) { $include_path.=$package.DIRECTORY_SEPARATOR; } foreach($classfilesuffixes as $classfilesuffix){ if(is_readable($include_path.$path.$filename.$classfilesuffix)){ // if set_includedir is true, then we have the include path of the package to // the PHP environment include path if ($set_includedir) { $pathArray = explode( PATH_SEPARATOR, get_include_path() ); // only add the path if its not already in the include path if (!in_array($include_path,$pathArray)) { $pathArray[]=$include_path; set_include_path(implode(PATH_SEPARATOR,$pathArray)); } } include_once($include_path.$path.$filename.$classfilesuffix); // ok once we found a file, we are done return; } } } }
php
public static function includeClass($classname, $loadscheme='Web2All', $package='', $set_includedir=false) { // $path will be the relative path to the classfile by exploding the namespace $path = ''; $filename = $classname; // support namespaces if(strpos($classname,'\\')){ // ok, contains namespace $path_parts = explode('\\',$classname); $part_count=count($path_parts); $filename = $path_parts[$part_count-1]; $classname_without_namespaces = $filename; for ($i=0;($i<$part_count-1);$i++) { $path.=$path_parts[$i].DIRECTORY_SEPARATOR; } }else{ $classname_without_namespaces = $classname; } if ($loadscheme!='PLAIN') { $path_parts = explode("_",$classname_without_namespaces); $part_count=count($path_parts); $filename = $path_parts[$part_count-1]; for ($i=0;($i<$part_count-1);$i++) { $path.=$path_parts[$i].DIRECTORY_SEPARATOR; } } // depending on the scheme, select the suffix // PEAR class files do not have the .class in the name. // The Web2All scheme historically used ".class.php", but for // better compatibility we now also support the plain ".php". $classfilesuffixes=array('.class.php','.php'); switch($loadscheme){ case 'PEAR': case 'PLAIN': $classfilesuffixes=array('.php'); break; case 'INC': $classfilesuffixes=array('.inc.php'); break; } foreach(self::$frameworkRoots as $include_path){ if ($package) { $include_path.=$package.DIRECTORY_SEPARATOR; } foreach($classfilesuffixes as $classfilesuffix){ if(is_readable($include_path.$path.$filename.$classfilesuffix)){ // if set_includedir is true, then we have the include path of the package to // the PHP environment include path if ($set_includedir) { $pathArray = explode( PATH_SEPARATOR, get_include_path() ); // only add the path if its not already in the include path if (!in_array($include_path,$pathArray)) { $pathArray[]=$include_path; set_include_path(implode(PATH_SEPARATOR,$pathArray)); } } include_once($include_path.$path.$filename.$classfilesuffix); // ok once we found a file, we are done return; } } } }
[ "public", "static", "function", "includeClass", "(", "$", "classname", ",", "$", "loadscheme", "=", "'Web2All'", ",", "$", "package", "=", "''", ",", "$", "set_includedir", "=", "false", ")", "{", "// $path will be the relative path to the classfile by exploding the namespace\r", "$", "path", "=", "''", ";", "$", "filename", "=", "$", "classname", ";", "// support namespaces\r", "if", "(", "strpos", "(", "$", "classname", ",", "'\\\\'", ")", ")", "{", "// ok, contains namespace\r", "$", "path_parts", "=", "explode", "(", "'\\\\'", ",", "$", "classname", ")", ";", "$", "part_count", "=", "count", "(", "$", "path_parts", ")", ";", "$", "filename", "=", "$", "path_parts", "[", "$", "part_count", "-", "1", "]", ";", "$", "classname_without_namespaces", "=", "$", "filename", ";", "for", "(", "$", "i", "=", "0", ";", "(", "$", "i", "<", "$", "part_count", "-", "1", ")", ";", "$", "i", "++", ")", "{", "$", "path", ".=", "$", "path_parts", "[", "$", "i", "]", ".", "DIRECTORY_SEPARATOR", ";", "}", "}", "else", "{", "$", "classname_without_namespaces", "=", "$", "classname", ";", "}", "if", "(", "$", "loadscheme", "!=", "'PLAIN'", ")", "{", "$", "path_parts", "=", "explode", "(", "\"_\"", ",", "$", "classname_without_namespaces", ")", ";", "$", "part_count", "=", "count", "(", "$", "path_parts", ")", ";", "$", "filename", "=", "$", "path_parts", "[", "$", "part_count", "-", "1", "]", ";", "for", "(", "$", "i", "=", "0", ";", "(", "$", "i", "<", "$", "part_count", "-", "1", ")", ";", "$", "i", "++", ")", "{", "$", "path", ".=", "$", "path_parts", "[", "$", "i", "]", ".", "DIRECTORY_SEPARATOR", ";", "}", "}", "// depending on the scheme, select the suffix\r", "// PEAR class files do not have the .class in the name.\r", "// The Web2All scheme historically used \".class.php\", but for \r", "// better compatibility we now also support the plain \".php\".\r", "$", "classfilesuffixes", "=", "array", "(", "'.class.php'", ",", "'.php'", ")", ";", "switch", "(", "$", "loadscheme", ")", "{", "case", "'PEAR'", ":", "case", "'PLAIN'", ":", "$", "classfilesuffixes", "=", "array", "(", "'.php'", ")", ";", "break", ";", "case", "'INC'", ":", "$", "classfilesuffixes", "=", "array", "(", "'.inc.php'", ")", ";", "break", ";", "}", "foreach", "(", "self", "::", "$", "frameworkRoots", "as", "$", "include_path", ")", "{", "if", "(", "$", "package", ")", "{", "$", "include_path", ".=", "$", "package", ".", "DIRECTORY_SEPARATOR", ";", "}", "foreach", "(", "$", "classfilesuffixes", "as", "$", "classfilesuffix", ")", "{", "if", "(", "is_readable", "(", "$", "include_path", ".", "$", "path", ".", "$", "filename", ".", "$", "classfilesuffix", ")", ")", "{", "// if set_includedir is true, then we have the include path of the package to\r", "// the PHP environment include path\r", "if", "(", "$", "set_includedir", ")", "{", "$", "pathArray", "=", "explode", "(", "PATH_SEPARATOR", ",", "get_include_path", "(", ")", ")", ";", "// only add the path if its not already in the include path\r", "if", "(", "!", "in_array", "(", "$", "include_path", ",", "$", "pathArray", ")", ")", "{", "$", "pathArray", "[", "]", "=", "$", "include_path", ";", "set_include_path", "(", "implode", "(", "PATH_SEPARATOR", ",", "$", "pathArray", ")", ")", ";", "}", "}", "include_once", "(", "$", "include_path", ".", "$", "path", ".", "$", "filename", ".", "$", "classfilesuffix", ")", ";", "// ok once we found a file, we are done\r", "return", ";", "}", "}", "}", "}" ]
Load the classfile for the given class This method will blindly include the first php file which it finds for the given classname. It will not throw exceptions and won't indicate if the operation succeeded. It is used by both the autoloader and the loadClass() method, which is historically the method used to load a class. @param string $classname @param string $loadscheme [optional (Web2All|PEAR|INC|PLAIN) defaults to Web2All] @param string $package [optional packagename] @param boolean $set_includedir [optional bool, set true to add the package dir to include path]
[ "Load", "the", "classfile", "for", "the", "given", "class" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L764-L829
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.loadClass
public static function loadClass($classname, $loadscheme='Web2All', $package='', $set_includedir=false) { $class_exists=class_exists($classname) || interface_exists($classname); if ($class_exists && !$set_includedir) { // if class already exists, we don't need to do a thing // but one CAVEAT: if the class was loaded with $set_includedir==false and now the $set_includedir==true // then we do not add the path to the include path. return; } self::includeClass($classname, $loadscheme, $package, $set_includedir); }
php
public static function loadClass($classname, $loadscheme='Web2All', $package='', $set_includedir=false) { $class_exists=class_exists($classname) || interface_exists($classname); if ($class_exists && !$set_includedir) { // if class already exists, we don't need to do a thing // but one CAVEAT: if the class was loaded with $set_includedir==false and now the $set_includedir==true // then we do not add the path to the include path. return; } self::includeClass($classname, $loadscheme, $package, $set_includedir); }
[ "public", "static", "function", "loadClass", "(", "$", "classname", ",", "$", "loadscheme", "=", "'Web2All'", ",", "$", "package", "=", "''", ",", "$", "set_includedir", "=", "false", ")", "{", "$", "class_exists", "=", "class_exists", "(", "$", "classname", ")", "||", "interface_exists", "(", "$", "classname", ")", ";", "if", "(", "$", "class_exists", "&&", "!", "$", "set_includedir", ")", "{", "// if class already exists, we don't need to do a thing\r", "// but one CAVEAT: if the class was loaded with $set_includedir==false and now the $set_includedir==true\r", "// then we do not add the path to the include path. \r", "return", ";", "}", "self", "::", "includeClass", "(", "$", "classname", ",", "$", "loadscheme", ",", "$", "package", ",", "$", "set_includedir", ")", ";", "}" ]
Include php file for Web2All_Manager_Plugin @param string $classname @param string $loadscheme [optional (Web2All|PEAR|INC|PLAIN) defaults to Web2All] @param string $package [optional packagename] @param boolean $set_includedir [optional bool, set true to add the package dir to include path]
[ "Include", "php", "file", "for", "Web2All_Manager_Plugin" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L839-L849
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.initClass
public function initClass($classname,$arguments=array(),$isplugin=true) { // when we no longer have any PHP 5.2 we can replace below with static::loadClass($classname); // we cannot use self::loadClass($classname); because it will break extending Main classes which // redefine the loadClass method. (we need late static binding) /* * If class cannot be found, include corresponding file */ $this->loadClass($classname); /* * If $classname still doesn't exists, the class cannot be started */ if (!class_exists($classname)) { throw new Exception("Class whith name '$classname' does not exists. Cannot initialise $classname",E_USER_ERROR); } /* * Start class and return object */ $reflectionObj = new ReflectionClass($classname); if($reflectionObj->isSubclassOf('Web2All_Manager_Plugin') || $isplugin){ // directly extends Web2All_Manager_Plugin so it expects the Web2All_Manager_Main object // as first constructor param. Or the $isplugin is set true so force first param to // Web2All_Manager_Main object. array_unshift($arguments,$this); }elseif($reflectionObj->implementsInterface('Web2All_Manager_PluginInterface')){ // class does not extend Web2All_Manager_Plugin, but the class still implements // the Web2All_Manager_PluginInterface so we can call the setWeb2All method to // init the object after construction. $obj=call_user_func_array(array(&$reflectionObj, 'newInstance'), $arguments); $obj->setWeb2All($this); return $obj; } return call_user_func_array(array(&$reflectionObj, 'newInstance'), $arguments); }
php
public function initClass($classname,$arguments=array(),$isplugin=true) { // when we no longer have any PHP 5.2 we can replace below with static::loadClass($classname); // we cannot use self::loadClass($classname); because it will break extending Main classes which // redefine the loadClass method. (we need late static binding) /* * If class cannot be found, include corresponding file */ $this->loadClass($classname); /* * If $classname still doesn't exists, the class cannot be started */ if (!class_exists($classname)) { throw new Exception("Class whith name '$classname' does not exists. Cannot initialise $classname",E_USER_ERROR); } /* * Start class and return object */ $reflectionObj = new ReflectionClass($classname); if($reflectionObj->isSubclassOf('Web2All_Manager_Plugin') || $isplugin){ // directly extends Web2All_Manager_Plugin so it expects the Web2All_Manager_Main object // as first constructor param. Or the $isplugin is set true so force first param to // Web2All_Manager_Main object. array_unshift($arguments,$this); }elseif($reflectionObj->implementsInterface('Web2All_Manager_PluginInterface')){ // class does not extend Web2All_Manager_Plugin, but the class still implements // the Web2All_Manager_PluginInterface so we can call the setWeb2All method to // init the object after construction. $obj=call_user_func_array(array(&$reflectionObj, 'newInstance'), $arguments); $obj->setWeb2All($this); return $obj; } return call_user_func_array(array(&$reflectionObj, 'newInstance'), $arguments); }
[ "public", "function", "initClass", "(", "$", "classname", ",", "$", "arguments", "=", "array", "(", ")", ",", "$", "isplugin", "=", "true", ")", "{", "// when we no longer have any PHP 5.2 we can replace below with static::loadClass($classname);\r", "// we cannot use self::loadClass($classname); because it will break extending Main classes which\r", "// redefine the loadClass method. (we need late static binding)\r", "/*\r\n * If class cannot be found, include corresponding file\r\n */", "$", "this", "->", "loadClass", "(", "$", "classname", ")", ";", "/*\r\n * If $classname still doesn't exists, the class cannot be started\r\n */", "if", "(", "!", "class_exists", "(", "$", "classname", ")", ")", "{", "throw", "new", "Exception", "(", "\"Class whith name '$classname' does not exists. Cannot initialise $classname\"", ",", "E_USER_ERROR", ")", ";", "}", "/*\r\n * Start class and return object\r\n */", "$", "reflectionObj", "=", "new", "ReflectionClass", "(", "$", "classname", ")", ";", "if", "(", "$", "reflectionObj", "->", "isSubclassOf", "(", "'Web2All_Manager_Plugin'", ")", "||", "$", "isplugin", ")", "{", "// directly extends Web2All_Manager_Plugin so it expects the Web2All_Manager_Main object\r", "// as first constructor param. Or the $isplugin is set true so force first param to\r", "// Web2All_Manager_Main object.\r", "array_unshift", "(", "$", "arguments", ",", "$", "this", ")", ";", "}", "elseif", "(", "$", "reflectionObj", "->", "implementsInterface", "(", "'Web2All_Manager_PluginInterface'", ")", ")", "{", "// class does not extend Web2All_Manager_Plugin, but the class still implements \r", "// the Web2All_Manager_PluginInterface so we can call the setWeb2All method to \r", "// init the object after construction.\r", "$", "obj", "=", "call_user_func_array", "(", "array", "(", "&", "$", "reflectionObj", ",", "'newInstance'", ")", ",", "$", "arguments", ")", ";", "$", "obj", "->", "setWeb2All", "(", "$", "this", ")", ";", "return", "$", "obj", ";", "}", "return", "call_user_func_array", "(", "array", "(", "&", "$", "reflectionObj", ",", "'newInstance'", ")", ",", "$", "arguments", ")", ";", "}" ]
Initialize Web2All_Manager_Plugin returns Web2All_Manager_Plugin object @param string $classname @param array $arguments @param boolean $isplugin Force the first constructor param to be the Web2All_Manager_Main object. Set false for automatically detection if this is required. @return object
[ "Initialize", "Web2All_Manager_Plugin", "returns", "Web2All_Manager_Plugin", "object" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L862-L897
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.getIP
public function getIP() { if ($this->ManagerConfig['get_ip_from_xforwarded'] && isset($_SERVER["HTTP_X_FORWARDED_FOR"]) && trim(strtolower($_SERVER["HTTP_X_FORWARDED_FOR"]))!='unknown' ) { // When viewed through an anonymous proxy, the address string can contain multiple ip's separated by commas. // http://www.jamescrowley.co.uk/2007/06/19/gotcha-http-x-forwarded-for-returns-multiple-ip-addresses/ $ip_array = explode(",", $_SERVER["HTTP_X_FORWARDED_FOR"]); // Use last ip addres, the last ip address is from the previous proxy, or from the user itself if there // was no previous proxy, HTTP_X_FORWARDED_FOR can't be trusted, only the last entry added by our (first) // trusted proxy server is the most trusted one we know. // The trusted_proxy_amount config defines how many proxies we can trust, defaults to 1 for($i=0;$i<$this->ManagerConfig['trusted_proxy_amount'];$i++){ if(count($ip_array)==0){ // no more ips in HTTP_X_FORWARDED_FOR // this means there are less actual proxies than our trusted_proxy_amount setting. // so people are bypassing our proxy of the trusted_proxy_amount setting is wrong. break; } $ip = array_pop($ip_array); } return trim($ip); } if (!isset($_SERVER["REMOTE_ADDR"])) { return ''; } return $_SERVER["REMOTE_ADDR"]; }
php
public function getIP() { if ($this->ManagerConfig['get_ip_from_xforwarded'] && isset($_SERVER["HTTP_X_FORWARDED_FOR"]) && trim(strtolower($_SERVER["HTTP_X_FORWARDED_FOR"]))!='unknown' ) { // When viewed through an anonymous proxy, the address string can contain multiple ip's separated by commas. // http://www.jamescrowley.co.uk/2007/06/19/gotcha-http-x-forwarded-for-returns-multiple-ip-addresses/ $ip_array = explode(",", $_SERVER["HTTP_X_FORWARDED_FOR"]); // Use last ip addres, the last ip address is from the previous proxy, or from the user itself if there // was no previous proxy, HTTP_X_FORWARDED_FOR can't be trusted, only the last entry added by our (first) // trusted proxy server is the most trusted one we know. // The trusted_proxy_amount config defines how many proxies we can trust, defaults to 1 for($i=0;$i<$this->ManagerConfig['trusted_proxy_amount'];$i++){ if(count($ip_array)==0){ // no more ips in HTTP_X_FORWARDED_FOR // this means there are less actual proxies than our trusted_proxy_amount setting. // so people are bypassing our proxy of the trusted_proxy_amount setting is wrong. break; } $ip = array_pop($ip_array); } return trim($ip); } if (!isset($_SERVER["REMOTE_ADDR"])) { return ''; } return $_SERVER["REMOTE_ADDR"]; }
[ "public", "function", "getIP", "(", ")", "{", "if", "(", "$", "this", "->", "ManagerConfig", "[", "'get_ip_from_xforwarded'", "]", "&&", "isset", "(", "$", "_SERVER", "[", "\"HTTP_X_FORWARDED_FOR\"", "]", ")", "&&", "trim", "(", "strtolower", "(", "$", "_SERVER", "[", "\"HTTP_X_FORWARDED_FOR\"", "]", ")", ")", "!=", "'unknown'", ")", "{", "// When viewed through an anonymous proxy, the address string can contain multiple ip's separated by commas.\r", "// http://www.jamescrowley.co.uk/2007/06/19/gotcha-http-x-forwarded-for-returns-multiple-ip-addresses/\r", "$", "ip_array", "=", "explode", "(", "\",\"", ",", "$", "_SERVER", "[", "\"HTTP_X_FORWARDED_FOR\"", "]", ")", ";", "// Use last ip addres, the last ip address is from the previous proxy, or from the user itself if there \r", "// was no previous proxy, HTTP_X_FORWARDED_FOR can't be trusted, only the last entry added by our (first) \r", "// trusted proxy server is the most trusted one we know. \r", "// The trusted_proxy_amount config defines how many proxies we can trust, defaults to 1\r", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "this", "->", "ManagerConfig", "[", "'trusted_proxy_amount'", "]", ";", "$", "i", "++", ")", "{", "if", "(", "count", "(", "$", "ip_array", ")", "==", "0", ")", "{", "// no more ips in HTTP_X_FORWARDED_FOR\r", "// this means there are less actual proxies than our trusted_proxy_amount setting.\r", "// so people are bypassing our proxy of the trusted_proxy_amount setting is wrong.\r", "break", ";", "}", "$", "ip", "=", "array_pop", "(", "$", "ip_array", ")", ";", "}", "return", "trim", "(", "$", "ip", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "_SERVER", "[", "\"REMOTE_ADDR\"", "]", ")", ")", "{", "return", "''", ";", "}", "return", "$", "_SERVER", "[", "\"REMOTE_ADDR\"", "]", ";", "}" ]
Returns the IP address from which the user is viewing the current page. Defaults to $_SERVER['REMOTE_ADDR'], unless the get_ip_from_xforwarded config is set to true, then $ _SERVER["HTTP_X_FORWARDED_FOR"] is used if available. Use get_ip_from_xforwarded only in a situation where we can trust HTTP_X_FORWARDED_FOR. Like when we generate this field ourself on our own proxy server. For logging purposes its perhaps better to both log REMOTE_ADDR and HTTP_X_FORWARDED_FOR when don't use our own proxy server. X-Forwarded-For: http://en.wikipedia.org/wiki/X-Forwarded-For @return string
[ "Returns", "the", "IP", "address", "from", "which", "the", "user", "is", "viewing", "the", "current", "page", ".", "Defaults", "to", "$_SERVER", "[", "REMOTE_ADDR", "]", "unless", "the", "get_ip_from_xforwarded", "config", "is", "set", "to", "true", "then", "$", "_SERVER", "[", "HTTP_X_FORWARDED_FOR", "]", "is", "used", "if", "available", "." ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L928-L953
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.newInstance
public static function newInstance($includefile='include.php') { // throws compile error if not found require_once(dirname(__FILE__).'/../../'.$includefile); if(!defined('WEB2ALL_CONFIG_CLASS')){ throw new Exception('WEB2ALL_CONFIG_CLASS not defined!'); } // load config class Web2All_Manager_Main::loadClass(WEB2ALL_CONFIG_CLASS); // instantiate config class $classname=WEB2ALL_CONFIG_CLASS; $config = new $classname(); // instantiate Web2All_Manager_Main return new Web2All_Manager_Main($config); }
php
public static function newInstance($includefile='include.php') { // throws compile error if not found require_once(dirname(__FILE__).'/../../'.$includefile); if(!defined('WEB2ALL_CONFIG_CLASS')){ throw new Exception('WEB2ALL_CONFIG_CLASS not defined!'); } // load config class Web2All_Manager_Main::loadClass(WEB2ALL_CONFIG_CLASS); // instantiate config class $classname=WEB2ALL_CONFIG_CLASS; $config = new $classname(); // instantiate Web2All_Manager_Main return new Web2All_Manager_Main($config); }
[ "public", "static", "function", "newInstance", "(", "$", "includefile", "=", "'include.php'", ")", "{", "// throws compile error if not found\r", "require_once", "(", "dirname", "(", "__FILE__", ")", ".", "'/../../'", ".", "$", "includefile", ")", ";", "if", "(", "!", "defined", "(", "'WEB2ALL_CONFIG_CLASS'", ")", ")", "{", "throw", "new", "Exception", "(", "'WEB2ALL_CONFIG_CLASS not defined!'", ")", ";", "}", "// load config class\r", "Web2All_Manager_Main", "::", "loadClass", "(", "WEB2ALL_CONFIG_CLASS", ")", ";", "// instantiate config class\r", "$", "classname", "=", "WEB2ALL_CONFIG_CLASS", ";", "$", "config", "=", "new", "$", "classname", "(", ")", ";", "// instantiate Web2All_Manager_Main\r", "return", "new", "Web2All_Manager_Main", "(", "$", "config", ")", ";", "}" ]
Instantiates Web2All_Manager_Main This shorthand instantiation has a few prequisites: - the include file /include/include.php must exist - this include file must have the WEB2ALL_CONFIG_CLASS constant defined - the WEB2ALL_CONFIG_CLASS constant must contain the classname of a config class which extends Web2All_Manager_Config Will generate E_COMPILE_ERROR if include.php does not exist Will throw Exception if classname is not defined or cannot be found This is a replacement for the auto_prepend_file mechanism we used in the .htaccess file. Usage: $web2all=Web2All_Manager_Main::newInstance(); @param string $includefile [optional, defaults to include.php] include file relative to the include directory. @return Web2All_Manager_Main
[ "Instantiates", "Web2All_Manager_Main" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L977-L995
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.registerIncludeRoot
public static function registerIncludeRoot($root=null) { if(is_null($root)){ $root = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; } if(!in_array($root, self::$frameworkRoots)){ self::$frameworkRoots[] = $root; return true; } return false; }
php
public static function registerIncludeRoot($root=null) { if(is_null($root)){ $root = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; } if(!in_array($root, self::$frameworkRoots)){ self::$frameworkRoots[] = $root; return true; } return false; }
[ "public", "static", "function", "registerIncludeRoot", "(", "$", "root", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "root", ")", ")", "{", "$", "root", "=", "dirname", "(", "__FILE__", ")", ".", "DIRECTORY_SEPARATOR", ".", "'..'", ".", "DIRECTORY_SEPARATOR", ".", "'..'", ".", "DIRECTORY_SEPARATOR", ";", "}", "if", "(", "!", "in_array", "(", "$", "root", ",", "self", "::", "$", "frameworkRoots", ")", ")", "{", "self", "::", "$", "frameworkRoots", "[", "]", "=", "$", "root", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Registers an include root directory Used by autoloader and loadClass() @param string $root directory path @return boolean was the directory added
[ "Registers", "an", "include", "root", "directory" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1005-L1015
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.unregisterIncludeRoot
public static function unregisterIncludeRoot($root) { $found_key=array_search($root, self::$frameworkRoots, true); if($found_key!==false){ unset(self::$frameworkRoots[$found_key]); return true; } return false; }
php
public static function unregisterIncludeRoot($root) { $found_key=array_search($root, self::$frameworkRoots, true); if($found_key!==false){ unset(self::$frameworkRoots[$found_key]); return true; } return false; }
[ "public", "static", "function", "unregisterIncludeRoot", "(", "$", "root", ")", "{", "$", "found_key", "=", "array_search", "(", "$", "root", ",", "self", "::", "$", "frameworkRoots", ",", "true", ")", ";", "if", "(", "$", "found_key", "!==", "false", ")", "{", "unset", "(", "self", "::", "$", "frameworkRoots", "[", "$", "found_key", "]", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Unregisters an include root directory @param string $root directory path @return boolean was the directory removed
[ "Unregisters", "an", "include", "root", "directory" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1023-L1031
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Main.registerAutoloader
public static function registerAutoloader($root=null) { self::registerIncludeRoot($root); if(!self::$autoloaderAdded){ self::$autoloaderAdded = true; return spl_autoload_register(array('Web2All_Manager_Main','loadClass')); } return true; }
php
public static function registerAutoloader($root=null) { self::registerIncludeRoot($root); if(!self::$autoloaderAdded){ self::$autoloaderAdded = true; return spl_autoload_register(array('Web2All_Manager_Main','loadClass')); } return true; }
[ "public", "static", "function", "registerAutoloader", "(", "$", "root", "=", "null", ")", "{", "self", "::", "registerIncludeRoot", "(", "$", "root", ")", ";", "if", "(", "!", "self", "::", "$", "autoloaderAdded", ")", "{", "self", "::", "$", "autoloaderAdded", "=", "true", ";", "return", "spl_autoload_register", "(", "array", "(", "'Web2All_Manager_Main'", ",", "'loadClass'", ")", ")", ";", "}", "return", "true", ";", "}" ]
Registers an autoloader for the Web2All framework it will call the Web2All_Manager_Main::loadClass @return boolean
[ "Registers", "an", "autoloader", "for", "the", "Web2All", "framework" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1050-L1058
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_ErrorObserverable.notifyObservers
public function notifyObservers() { /** * restore original error handler, to avoid problems when errors occurres * in handling other errors */ $this->Web2All->restoreErrorHandlers(); foreach($this->observers as $observer) { $observer->update($this); } foreach($this->observer_names as $classname) { $this->Web2All->PluginGlobal->$classname->update($this); } // set custom error handlers back $this->Web2All->setErrorHandlers(); }
php
public function notifyObservers() { /** * restore original error handler, to avoid problems when errors occurres * in handling other errors */ $this->Web2All->restoreErrorHandlers(); foreach($this->observers as $observer) { $observer->update($this); } foreach($this->observer_names as $classname) { $this->Web2All->PluginGlobal->$classname->update($this); } // set custom error handlers back $this->Web2All->setErrorHandlers(); }
[ "public", "function", "notifyObservers", "(", ")", "{", "/**\r\n * restore original error handler, to avoid problems when errors occurres\r\n * in handling other errors\r\n */", "$", "this", "->", "Web2All", "->", "restoreErrorHandlers", "(", ")", ";", "foreach", "(", "$", "this", "->", "observers", "as", "$", "observer", ")", "{", "$", "observer", "->", "update", "(", "$", "this", ")", ";", "}", "foreach", "(", "$", "this", "->", "observer_names", "as", "$", "classname", ")", "{", "$", "this", "->", "Web2All", "->", "PluginGlobal", "->", "$", "classname", "->", "update", "(", "$", "this", ")", ";", "}", "// set custom error handlers back\r", "$", "this", "->", "Web2All", "->", "setErrorHandlers", "(", ")", ";", "}" ]
If this object has changed, as indicated by the hasChanged method, then start observers as needed and notify them, and then call the clearChanged method to indicate that this object has no longer changed.
[ "If", "this", "object", "has", "changed", "as", "indicated", "by", "the", "hasChanged", "method", "then", "start", "observers", "as", "needed", "and", "notify", "them", "and", "then", "call", "the", "clearChanged", "method", "to", "indicate", "that", "this", "object", "has", "no", "longer", "changed", "." ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1173-L1187
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_ErrorObserverable.flushEmailErrors
public function flushEmailErrors() { foreach($this->observers as $observer) { if(get_class($observer)=='Web2All_ErrorObserver_Email'){ $observer->flushErrors(); } } foreach($this->observer_names as $classname) { if($classname=='Web2All_ErrorObserver_Email'){ $this->Web2All->PluginGlobal->$classname->flushErrors(); } } }
php
public function flushEmailErrors() { foreach($this->observers as $observer) { if(get_class($observer)=='Web2All_ErrorObserver_Email'){ $observer->flushErrors(); } } foreach($this->observer_names as $classname) { if($classname=='Web2All_ErrorObserver_Email'){ $this->Web2All->PluginGlobal->$classname->flushErrors(); } } }
[ "public", "function", "flushEmailErrors", "(", ")", "{", "foreach", "(", "$", "this", "->", "observers", "as", "$", "observer", ")", "{", "if", "(", "get_class", "(", "$", "observer", ")", "==", "'Web2All_ErrorObserver_Email'", ")", "{", "$", "observer", "->", "flushErrors", "(", ")", ";", "}", "}", "foreach", "(", "$", "this", "->", "observer_names", "as", "$", "classname", ")", "{", "if", "(", "$", "classname", "==", "'Web2All_ErrorObserver_Email'", ")", "{", "$", "this", "->", "Web2All", "->", "PluginGlobal", "->", "$", "classname", "->", "flushErrors", "(", ")", ";", "}", "}", "}" ]
flush e-mail errors if any If there are any errors queued for emailing they will be e-mailed and the errorstate will be reset. This is useful for long running processes like daemons.
[ "flush", "e", "-", "mail", "errors", "if", "any" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1195-L1206
web2all/framework
src/Web2All/Manager/Main.class.php
Countable.getInstance
public static function getInstance() { if(self::$DebugLevel >= Web2All_Manager_Main::DEBUGLEVEL_FULL) { echo "[Vraag een instantie van de Web2All_Manager_Registry Class op]<br />\n"; } if (!Web2All_Manager_Registry::$instance) { Web2All_Manager_Registry::$instance = new Web2All_Manager_Registry; } return Web2All_Manager_Registry::$instance; }
php
public static function getInstance() { if(self::$DebugLevel >= Web2All_Manager_Main::DEBUGLEVEL_FULL) { echo "[Vraag een instantie van de Web2All_Manager_Registry Class op]<br />\n"; } if (!Web2All_Manager_Registry::$instance) { Web2All_Manager_Registry::$instance = new Web2All_Manager_Registry; } return Web2All_Manager_Registry::$instance; }
[ "public", "static", "function", "getInstance", "(", ")", "{", "if", "(", "self", "::", "$", "DebugLevel", ">=", "Web2All_Manager_Main", "::", "DEBUGLEVEL_FULL", ")", "{", "echo", "\"[Vraag een instantie van de Web2All_Manager_Registry Class op]<br />\\n\"", ";", "}", "if", "(", "!", "Web2All_Manager_Registry", "::", "$", "instance", ")", "{", "Web2All_Manager_Registry", "::", "$", "instance", "=", "new", "Web2All_Manager_Registry", ";", "}", "return", "Web2All_Manager_Registry", "::", "$", "instance", ";", "}" ]
factory method to return the singleton instance @return Web2All_Manager_Registry object
[ "factory", "method", "to", "return", "the", "singleton", "instance" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1486-L1494
web2all/framework
src/Web2All/Manager/Main.class.php
Countable.offsetGet
public function offsetGet($offset) { if (!$this->offsetExists($offset)) { throw new RangeException("Var $offset doesn't exists in Web2All_Manager_Registry"); return false; } return $this->vars[$offset]; }
php
public function offsetGet($offset) { if (!$this->offsetExists($offset)) { throw new RangeException("Var $offset doesn't exists in Web2All_Manager_Registry"); return false; } return $this->vars[$offset]; }
[ "public", "function", "offsetGet", "(", "$", "offset", ")", "{", "if", "(", "!", "$", "this", "->", "offsetExists", "(", "$", "offset", ")", ")", "{", "throw", "new", "RangeException", "(", "\"Var $offset doesn't exists in Web2All_Manager_Registry\"", ")", ";", "return", "false", ";", "}", "return", "$", "this", "->", "vars", "[", "$", "offset", "]", ";", "}" ]
-- ArrayAccess Get value for registry $key, returns false if not found @param string $offset @return unknown
[ "--", "ArrayAccess", "Get", "value", "for", "registry", "$key", "returns", "false", "if", "not", "found" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1582-L1588
web2all/framework
src/Web2All/Manager/Main.class.php
Countable.offsetSet
public function offsetSet($offset,$value) { if ($this->offsetExists($offset)) { throw new RangeException("Var $offset allready exists in Web2All_Manager_Registry"); return false; } $this->vars[$offset]=&$value; return true; }
php
public function offsetSet($offset,$value) { if ($this->offsetExists($offset)) { throw new RangeException("Var $offset allready exists in Web2All_Manager_Registry"); return false; } $this->vars[$offset]=&$value; return true; }
[ "public", "function", "offsetSet", "(", "$", "offset", ",", "$", "value", ")", "{", "if", "(", "$", "this", "->", "offsetExists", "(", "$", "offset", ")", ")", "{", "throw", "new", "RangeException", "(", "\"Var $offset allready exists in Web2All_Manager_Registry\"", ")", ";", "return", "false", ";", "}", "$", "this", "->", "vars", "[", "$", "offset", "]", "=", "&", "$", "value", ";", "return", "true", ";", "}" ]
-- ArrayAccess Set registry variable $offset whith value $var Returns if succeeded or not @param string $offset @param unknown_type $value @return boolean
[ "--", "ArrayAccess", "Set", "registry", "variable", "$offset", "whith", "value", "$var", "Returns", "if", "succeeded", "or", "not" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1599-L1606
web2all/framework
src/Web2All/Manager/Main.class.php
Countable.offsetUnset
public function offsetUnset($offset) { if (!$this->offsetExists($offset)) { throw new RangeException("Var $offset doesn't exists in Web2All_Manager_Registry"); return false; } unset($this->vars[$offset]); return true; }
php
public function offsetUnset($offset) { if (!$this->offsetExists($offset)) { throw new RangeException("Var $offset doesn't exists in Web2All_Manager_Registry"); return false; } unset($this->vars[$offset]); return true; }
[ "public", "function", "offsetUnset", "(", "$", "offset", ")", "{", "if", "(", "!", "$", "this", "->", "offsetExists", "(", "$", "offset", ")", ")", "{", "throw", "new", "RangeException", "(", "\"Var $offset doesn't exists in Web2All_Manager_Registry\"", ")", ";", "return", "false", ";", "}", "unset", "(", "$", "this", "->", "vars", "[", "$", "offset", "]", ")", ";", "return", "true", ";", "}" ]
Remove variable $key from registry, returns false if not found @param unknown_type $var @return boolean
[ "Remove", "variable", "$key", "from", "registry", "returns", "false", "if", "not", "found" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1614-L1621
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Config.makeConfig
public function makeConfig($pluginname,$defaultpluginconfig,$overrulingconfig=null) { $pluginconfig=array(); $customconfig=array(); if (isset($this->$pluginname) && is_array($this->$pluginname)) { $customconfig=$this->$pluginname; } $pluginconfig=array_merge($defaultpluginconfig,$customconfig); // override config values if (isset($overrulingconfig) && is_array($overrulingconfig)) { $pluginconfig=array_merge($pluginconfig,$overrulingconfig); } return $pluginconfig; }
php
public function makeConfig($pluginname,$defaultpluginconfig,$overrulingconfig=null) { $pluginconfig=array(); $customconfig=array(); if (isset($this->$pluginname) && is_array($this->$pluginname)) { $customconfig=$this->$pluginname; } $pluginconfig=array_merge($defaultpluginconfig,$customconfig); // override config values if (isset($overrulingconfig) && is_array($overrulingconfig)) { $pluginconfig=array_merge($pluginconfig,$overrulingconfig); } return $pluginconfig; }
[ "public", "function", "makeConfig", "(", "$", "pluginname", ",", "$", "defaultpluginconfig", ",", "$", "overrulingconfig", "=", "null", ")", "{", "$", "pluginconfig", "=", "array", "(", ")", ";", "$", "customconfig", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "$", "pluginname", ")", "&&", "is_array", "(", "$", "this", "->", "$", "pluginname", ")", ")", "{", "$", "customconfig", "=", "$", "this", "->", "$", "pluginname", ";", "}", "$", "pluginconfig", "=", "array_merge", "(", "$", "defaultpluginconfig", ",", "$", "customconfig", ")", ";", "// override config values\r", "if", "(", "isset", "(", "$", "overrulingconfig", ")", "&&", "is_array", "(", "$", "overrulingconfig", ")", ")", "{", "$", "pluginconfig", "=", "array_merge", "(", "$", "pluginconfig", ",", "$", "overrulingconfig", ")", ";", "}", "return", "$", "pluginconfig", ";", "}" ]
Build a config array for a specific plugin, if config settings are not set, use the default config value. All keys in $overrulingconfig will always override the values in this config and the defaultconfig. @param string $pluginname @param array $defaultpluginconfig @param array $overrulingconfig [optional] all key/values will be leading @return array
[ "Build", "a", "config", "array", "for", "a", "specific", "plugin", "if", "config", "settings", "are", "not", "set", "use", "the", "default", "config", "value", ".", "All", "keys", "in", "$overrulingconfig", "will", "always", "override", "the", "values", "in", "this", "config", "and", "the", "defaultconfig", "." ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1742-L1758
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Config.validateConfig
function validateConfig($pluginname,$requiredconfig=array(),$overrulingconfig=null) { // first check if the pluginconfig is available at all if (!(isset($this->$pluginname) && is_array($this->$pluginname))) { throw new Exception('No config defined for plugin '.$pluginname); } // then for each key in $requiredconfig check if it is available in this config and // validate it // *TODO* implement different validation types. foreach ($requiredconfig as $configkey => $validation_type) { if (!array_key_exists($configkey,$this->$pluginname) && !(is_array($overrulingconfig) && array_key_exists($configkey,$overrulingconfig))) { // config key doesn't exist, raise error throw new Exception('Required config key '.$configkey.' for plugin '.$pluginname.' is not defined'); } } return true; }
php
function validateConfig($pluginname,$requiredconfig=array(),$overrulingconfig=null) { // first check if the pluginconfig is available at all if (!(isset($this->$pluginname) && is_array($this->$pluginname))) { throw new Exception('No config defined for plugin '.$pluginname); } // then for each key in $requiredconfig check if it is available in this config and // validate it // *TODO* implement different validation types. foreach ($requiredconfig as $configkey => $validation_type) { if (!array_key_exists($configkey,$this->$pluginname) && !(is_array($overrulingconfig) && array_key_exists($configkey,$overrulingconfig))) { // config key doesn't exist, raise error throw new Exception('Required config key '.$configkey.' for plugin '.$pluginname.' is not defined'); } } return true; }
[ "function", "validateConfig", "(", "$", "pluginname", ",", "$", "requiredconfig", "=", "array", "(", ")", ",", "$", "overrulingconfig", "=", "null", ")", "{", "// first check if the pluginconfig is available at all\r", "if", "(", "!", "(", "isset", "(", "$", "this", "->", "$", "pluginname", ")", "&&", "is_array", "(", "$", "this", "->", "$", "pluginname", ")", ")", ")", "{", "throw", "new", "Exception", "(", "'No config defined for plugin '", ".", "$", "pluginname", ")", ";", "}", "// then for each key in $requiredconfig check if it is available in this config and\r", "// validate it\r", "// *TODO* implement different validation types.\r", "foreach", "(", "$", "requiredconfig", "as", "$", "configkey", "=>", "$", "validation_type", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "configkey", ",", "$", "this", "->", "$", "pluginname", ")", "&&", "!", "(", "is_array", "(", "$", "overrulingconfig", ")", "&&", "array_key_exists", "(", "$", "configkey", ",", "$", "overrulingconfig", ")", ")", ")", "{", "// config key doesn't exist, raise error\r", "throw", "new", "Exception", "(", "'Required config key '", ".", "$", "configkey", ".", "' for plugin '", ".", "$", "pluginname", ".", "' is not defined'", ")", ";", "}", "}", "return", "true", ";", "}" ]
Validate a specific plugin config against the given array with config keys. The pluginconfig must exist and each configkey in requiredconfig must exist also. When not valid, an exception will be thrown (can be catched in calling method) @param string $pluginname @param array $requiredconfig @param array $overrulingconfig [optional] overruled config values do not need to be present in config @return boolean (always true) throws Exception on error
[ "Validate", "a", "specific", "plugin", "config", "against", "the", "given", "array", "with", "config", "keys", ".", "The", "pluginconfig", "must", "exist", "and", "each", "configkey", "in", "requiredconfig", "must", "exist", "also", ".", "When", "not", "valid", "an", "exception", "will", "be", "thrown", "(", "can", "be", "catched", "in", "calling", "method", ")" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1771-L1788
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_Error.getInstance
public static function getInstance() { if(self::$instance && self::$instance->Web2All->DebugLevel >= Web2All_Manager_Main::DEBUGLEVEL_FULL) { // we can only log if $instance is set, because this a static method and // we don't have a reference to the web2all class. self::$instance->Web2All->debugLog( "[Vraag een instantie van de Web2All_Manager_Error Class op]"); } return self::$instance; }
php
public static function getInstance() { if(self::$instance && self::$instance->Web2All->DebugLevel >= Web2All_Manager_Main::DEBUGLEVEL_FULL) { // we can only log if $instance is set, because this a static method and // we don't have a reference to the web2all class. self::$instance->Web2All->debugLog( "[Vraag een instantie van de Web2All_Manager_Error Class op]"); } return self::$instance; }
[ "public", "static", "function", "getInstance", "(", ")", "{", "if", "(", "self", "::", "$", "instance", "&&", "self", "::", "$", "instance", "->", "Web2All", "->", "DebugLevel", ">=", "Web2All_Manager_Main", "::", "DEBUGLEVEL_FULL", ")", "{", "// we can only log if $instance is set, because this a static method and\r", "// we don't have a reference to the web2all class.\r", "self", "::", "$", "instance", "->", "Web2All", "->", "debugLog", "(", "\"[Vraag een instantie van de Web2All_Manager_Error Class op]\"", ")", ";", "}", "return", "self", "::", "$", "instance", ";", "}" ]
factory method to return the singleton instance @return Web2All_Manager_Error object
[ "factory", "method", "to", "return", "the", "singleton", "instance" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L1837-L1844
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_Manager_ClassInclude.loadClassname
public static function loadClassname($classname,$loadscheme='Web2All', $package='', $set_includedir=false) { Web2All_Manager_Main::loadClass($classname,$loadscheme,$package,$set_includedir); }
php
public static function loadClassname($classname,$loadscheme='Web2All', $package='', $set_includedir=false) { Web2All_Manager_Main::loadClass($classname,$loadscheme,$package,$set_includedir); }
[ "public", "static", "function", "loadClassname", "(", "$", "classname", ",", "$", "loadscheme", "=", "'Web2All'", ",", "$", "package", "=", "''", ",", "$", "set_includedir", "=", "false", ")", "{", "Web2All_Manager_Main", "::", "loadClass", "(", "$", "classname", ",", "$", "loadscheme", ",", "$", "package", ",", "$", "set_includedir", ")", ";", "}" ]
Include php file @param string $classname @param string $loadscheme [optional (Web2All|PEAR|INC|PLAIN) defaults to Web2All] @param string $package [optional packagename] @param boolean $set_includedir [optional bool, set true to add the package dir to include path]
[ "Include", "php", "file" ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L2035-L2037
web2all/framework
src/Web2All/Manager/Main.class.php
Web2All_PHP_INI.getBytes
public static function getBytes($size_str) { switch (substr ($size_str, -1)) { case 'M': case 'm': return (int)$size_str * 1048576; case 'K': case 'k': return (int)$size_str * 1024; case 'G': case 'g': return (int)$size_str * 1073741824; default: return $size_str; } }
php
public static function getBytes($size_str) { switch (substr ($size_str, -1)) { case 'M': case 'm': return (int)$size_str * 1048576; case 'K': case 'k': return (int)$size_str * 1024; case 'G': case 'g': return (int)$size_str * 1073741824; default: return $size_str; } }
[ "public", "static", "function", "getBytes", "(", "$", "size_str", ")", "{", "switch", "(", "substr", "(", "$", "size_str", ",", "-", "1", ")", ")", "{", "case", "'M'", ":", "case", "'m'", ":", "return", "(", "int", ")", "$", "size_str", "*", "1048576", ";", "case", "'K'", ":", "case", "'k'", ":", "return", "(", "int", ")", "$", "size_str", "*", "1024", ";", "case", "'G'", ":", "case", "'g'", ":", "return", "(", "int", ")", "$", "size_str", "*", "1073741824", ";", "default", ":", "return", "$", "size_str", ";", "}", "}" ]
converts possible shorthand notations from the php ini to bytes. see: http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes original code from: http://nl2.php.net/manual/en/function.ini-get.php#96996 @return int
[ "converts", "possible", "shorthand", "notations", "from", "the", "php", "ini", "to", "bytes", "." ]
train
https://github.com/web2all/framework/blob/6990dc3700efad3207ec6e710124f7ba18891b31/src/Web2All/Manager/Main.class.php#L2106-L2115