repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
GrafiteInc/CMS | src/Controllers/AssetController.php | AssetController.asset | public function asset($encPath, $contentType, Filesystem $fileSystem)
{
return $this->service->asset($encPath, $contentType, $fileSystem);
} | php | public function asset($encPath, $contentType, Filesystem $fileSystem)
{
return $this->service->asset($encPath, $contentType, $fileSystem);
} | [
"public",
"function",
"asset",
"(",
"$",
"encPath",
",",
"$",
"contentType",
",",
"Filesystem",
"$",
"fileSystem",
")",
"{",
"return",
"$",
"this",
"->",
"service",
"->",
"asset",
"(",
"$",
"encPath",
",",
"$",
"contentType",
",",
"$",
"fileSystem",
")",... | Gets an asset.
@param string $encPath
@param string $contentType
@return Provides the valid | [
"Gets",
"an",
"asset",
"."
] | train | https://github.com/GrafiteInc/CMS/blob/d3cefadc0ff50dbd968050e7bddb592b141a9b5d/src/Controllers/AssetController.php#L63-L66 |
GrafiteInc/CMS | src/Services/ValidationService.php | ValidationService.check | public function check($form, $jsonInput = false)
{
$result = [];
$errors = [];
$inputs = [];
if (is_array($form)) {
$fields = $form;
} else {
$conditions = Cms::config('validation.'.$form);
$fields = $conditions;
}
if (!is_array($fields)) {
$fields = [$fields];
}
$validationRules = $validationInputs = [];
foreach ($fields as $key => $value) {
if (isset($fields[$key])) {
$inputs[$key] = $this->getInput($key, $jsonInput);
$validationInputs[$key] = $this->getInput($key, $jsonInput);
$validationRules[$key] = $fields[$key];
}
}
$validation = Validator::make($validationInputs, $validationRules);
if ($validation->fails()) {
$errors = $validation->messages();
}
if (!$jsonInput) {
$result['redirect'] = Redirect::back()->with('errors', $errors)->with('inputs', $this->inputsArray($jsonInput));
}
if (!empty($errors)) {
$result['errors'] = $errors;
} else {
$result['errors'] = false;
}
$result['inputs'] = $this->inputsArray($jsonInput);
return $result;
} | php | public function check($form, $jsonInput = false)
{
$result = [];
$errors = [];
$inputs = [];
if (is_array($form)) {
$fields = $form;
} else {
$conditions = Cms::config('validation.'.$form);
$fields = $conditions;
}
if (!is_array($fields)) {
$fields = [$fields];
}
$validationRules = $validationInputs = [];
foreach ($fields as $key => $value) {
if (isset($fields[$key])) {
$inputs[$key] = $this->getInput($key, $jsonInput);
$validationInputs[$key] = $this->getInput($key, $jsonInput);
$validationRules[$key] = $fields[$key];
}
}
$validation = Validator::make($validationInputs, $validationRules);
if ($validation->fails()) {
$errors = $validation->messages();
}
if (!$jsonInput) {
$result['redirect'] = Redirect::back()->with('errors', $errors)->with('inputs', $this->inputsArray($jsonInput));
}
if (!empty($errors)) {
$result['errors'] = $errors;
} else {
$result['errors'] = false;
}
$result['inputs'] = $this->inputsArray($jsonInput);
return $result;
} | [
"public",
"function",
"check",
"(",
"$",
"form",
",",
"$",
"jsonInput",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"errors",
"=",
"[",
"]",
";",
"$",
"inputs",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"form",
... | Validation check.
@param string $form form in question from the config
@param string $module module name
@param bool $jsonInput JSON input
@return array | [
"Validation",
"check",
"."
] | train | https://github.com/GrafiteInc/CMS/blob/d3cefadc0ff50dbd968050e7bddb592b141a9b5d/src/Services/ValidationService.php#L23-L69 |
GrafiteInc/CMS | src/Services/ValidationService.php | ValidationService.errors | public function errors($format = 'array')
{
$errorMessage = '';
$errors = Session::get('errors') ?: false;
if (!$errors) {
return false;
}
if ($format === 'string') {
foreach ($errors as $error => $message) {
$errorMessage .= $message.'<br>';
}
} else {
$errorMessage = Session::get('errors');
}
return $errorMessage;
} | php | public function errors($format = 'array')
{
$errorMessage = '';
$errors = Session::get('errors') ?: false;
if (!$errors) {
return false;
}
if ($format === 'string') {
foreach ($errors as $error => $message) {
$errorMessage .= $message.'<br>';
}
} else {
$errorMessage = Session::get('errors');
}
return $errorMessage;
} | [
"public",
"function",
"errors",
"(",
"$",
"format",
"=",
"'array'",
")",
"{",
"$",
"errorMessage",
"=",
"''",
";",
"$",
"errors",
"=",
"Session",
"::",
"get",
"(",
"'errors'",
")",
"?",
":",
"false",
";",
"if",
"(",
"!",
"$",
"errors",
")",
"{",
... | ValidationService Errors.
@param string $format Type of error request
@return mixed | [
"ValidationService",
"Errors",
"."
] | train | https://github.com/GrafiteInc/CMS/blob/d3cefadc0ff50dbd968050e7bddb592b141a9b5d/src/Services/ValidationService.php#L91-L109 |
GrafiteInc/CMS | src/Services/ValidationService.php | ValidationService.getInput | private function getInput($key, $jsonInput)
{
if ($jsonInput) {
$input = Input::json($key);
} elseif (Input::file($key)) {
$input = Input::file($key);
} else {
$input = Input::get($key);
}
return $input;
} | php | private function getInput($key, $jsonInput)
{
if ($jsonInput) {
$input = Input::json($key);
} elseif (Input::file($key)) {
$input = Input::file($key);
} else {
$input = Input::get($key);
}
return $input;
} | [
"private",
"function",
"getInput",
"(",
"$",
"key",
",",
"$",
"jsonInput",
")",
"{",
"if",
"(",
"$",
"jsonInput",
")",
"{",
"$",
"input",
"=",
"Input",
"::",
"json",
"(",
"$",
"key",
")",
";",
"}",
"elseif",
"(",
"Input",
"::",
"file",
"(",
"$",
... | Get input.
@param string $key Input name
@param bool $jsonInput JSON or not
@return mixed | [
"Get",
"input",
"."
] | train | https://github.com/GrafiteInc/CMS/blob/d3cefadc0ff50dbd968050e7bddb592b141a9b5d/src/Services/ValidationService.php#L135-L146 |
GrafiteInc/CMS | src/Services/ValidationService.php | ValidationService.inputsArray | private function inputsArray($jsonInput)
{
if ($jsonInput) {
$inputs = Input::json();
} else {
$inputs = Input::all();
// Don't send the token back
unset($inputs['_token']);
foreach ($inputs as $key => $value) {
if (Input::file($key)) {
unset($inputs[$key]);
}
}
}
return $inputs;
} | php | private function inputsArray($jsonInput)
{
if ($jsonInput) {
$inputs = Input::json();
} else {
$inputs = Input::all();
// Don't send the token back
unset($inputs['_token']);
foreach ($inputs as $key => $value) {
if (Input::file($key)) {
unset($inputs[$key]);
}
}
}
return $inputs;
} | [
"private",
"function",
"inputsArray",
"(",
"$",
"jsonInput",
")",
"{",
"if",
"(",
"$",
"jsonInput",
")",
"{",
"$",
"inputs",
"=",
"Input",
"::",
"json",
"(",
")",
";",
"}",
"else",
"{",
"$",
"inputs",
"=",
"Input",
"::",
"all",
"(",
")",
";",
"//... | Get the inputs as an array.
@param bool $jsonInput JSON or not
@return array | [
"Get",
"the",
"inputs",
"as",
"an",
"array",
"."
] | train | https://github.com/GrafiteInc/CMS/blob/d3cefadc0ff50dbd968050e7bddb592b141a9b5d/src/Services/ValidationService.php#L155-L173 |
spatie/url-signer | src/BaseUrlSigner.php | BaseUrlSigner.sign | public function sign($url, $expiration)
{
$url = UrlImmutable::createFromUrl($url);
$expiration = $this->getExpirationTimestamp($expiration);
$signature = $this->createSignature((string) $url, $expiration);
return (string) $this->signUrl($url, $expiration, $signature);
} | php | public function sign($url, $expiration)
{
$url = UrlImmutable::createFromUrl($url);
$expiration = $this->getExpirationTimestamp($expiration);
$signature = $this->createSignature((string) $url, $expiration);
return (string) $this->signUrl($url, $expiration, $signature);
} | [
"public",
"function",
"sign",
"(",
"$",
"url",
",",
"$",
"expiration",
")",
"{",
"$",
"url",
"=",
"UrlImmutable",
"::",
"createFromUrl",
"(",
"$",
"url",
")",
";",
"$",
"expiration",
"=",
"$",
"this",
"->",
"getExpirationTimestamp",
"(",
"$",
"expiration... | Get a secure URL to a controller action.
@param string $url
@param \DateTime|int $expiration
@return string
@throws InvalidExpiration | [
"Get",
"a",
"secure",
"URL",
"to",
"a",
"controller",
"action",
"."
] | train | https://github.com/spatie/url-signer/blob/d337639e0be473d96ffb5b9716f911cbfaf0ecb9/src/BaseUrlSigner.php#L61-L69 |
spatie/url-signer | src/BaseUrlSigner.php | BaseUrlSigner.signUrl | protected function signUrl(UrlImmutable $url, $expiration, $signature)
{
$query = $url->getQuery();
$query->modify([
$this->expiresParameter => $expiration,
$this->signatureParameter => $signature,
]);
$urlSigner = $url->setQuery($query);
return $urlSigner;
} | php | protected function signUrl(UrlImmutable $url, $expiration, $signature)
{
$query = $url->getQuery();
$query->modify([
$this->expiresParameter => $expiration,
$this->signatureParameter => $signature,
]);
$urlSigner = $url->setQuery($query);
return $urlSigner;
} | [
"protected",
"function",
"signUrl",
"(",
"UrlImmutable",
"$",
"url",
",",
"$",
"expiration",
",",
"$",
"signature",
")",
"{",
"$",
"query",
"=",
"$",
"url",
"->",
"getQuery",
"(",
")",
";",
"$",
"query",
"->",
"modify",
"(",
"[",
"$",
"this",
"->",
... | Add expiration and signature query parameters to an url.
@param \League\Url\UrlImmutable $url
@param string $expiration
@param string $signature
@return \League\Url\UrlImmutable | [
"Add",
"expiration",
"and",
"signature",
"query",
"parameters",
"to",
"an",
"url",
"."
] | train | https://github.com/spatie/url-signer/blob/d337639e0be473d96ffb5b9716f911cbfaf0ecb9/src/BaseUrlSigner.php#L80-L92 |
spatie/url-signer | src/BaseUrlSigner.php | BaseUrlSigner.validate | public function validate($url)
{
$url = UrlImmutable::createFromUrl($url);
$query = $url->getQuery();
if ($this->isMissingAQueryParameter($query)) {
return false;
}
$expiration = $query[$this->expiresParameter];
if (!$this->isFuture($expiration)) {
return false;
}
if (!$this->hasValidSignature($url)) {
return false;
}
return true;
} | php | public function validate($url)
{
$url = UrlImmutable::createFromUrl($url);
$query = $url->getQuery();
if ($this->isMissingAQueryParameter($query)) {
return false;
}
$expiration = $query[$this->expiresParameter];
if (!$this->isFuture($expiration)) {
return false;
}
if (!$this->hasValidSignature($url)) {
return false;
}
return true;
} | [
"public",
"function",
"validate",
"(",
"$",
"url",
")",
"{",
"$",
"url",
"=",
"UrlImmutable",
"::",
"createFromUrl",
"(",
"$",
"url",
")",
";",
"$",
"query",
"=",
"$",
"url",
"->",
"getQuery",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isMissing... | Validate a signed url.
@param string $url
@return bool | [
"Validate",
"a",
"signed",
"url",
"."
] | train | https://github.com/spatie/url-signer/blob/d337639e0be473d96ffb5b9716f911cbfaf0ecb9/src/BaseUrlSigner.php#L101-L122 |
spatie/url-signer | src/BaseUrlSigner.php | BaseUrlSigner.isMissingAQueryParameter | protected function isMissingAQueryParameter(QueryInterface $query)
{
if (!isset($query[$this->expiresParameter])) {
return true;
}
if (!isset($query[$this->signatureParameter])) {
return true;
}
return false;
} | php | protected function isMissingAQueryParameter(QueryInterface $query)
{
if (!isset($query[$this->expiresParameter])) {
return true;
}
if (!isset($query[$this->signatureParameter])) {
return true;
}
return false;
} | [
"protected",
"function",
"isMissingAQueryParameter",
"(",
"QueryInterface",
"$",
"query",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"query",
"[",
"$",
"this",
"->",
"expiresParameter",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
... | Check if a query is missing a necessary parameter.
@param \League\Url\Components\QueryInterface $query
@return bool | [
"Check",
"if",
"a",
"query",
"is",
"missing",
"a",
"necessary",
"parameter",
"."
] | train | https://github.com/spatie/url-signer/blob/d337639e0be473d96ffb5b9716f911cbfaf0ecb9/src/BaseUrlSigner.php#L131-L142 |
spatie/url-signer | src/BaseUrlSigner.php | BaseUrlSigner.getIntendedUrl | protected function getIntendedUrl(UrlImmutable $url)
{
$intendedQuery = $url->getQuery();
$intendedQuery->modify([
$this->expiresParameter => null,
$this->signatureParameter => null,
]);
$intendedUrl = $url->setQuery($intendedQuery);
return $intendedUrl;
} | php | protected function getIntendedUrl(UrlImmutable $url)
{
$intendedQuery = $url->getQuery();
$intendedQuery->modify([
$this->expiresParameter => null,
$this->signatureParameter => null,
]);
$intendedUrl = $url->setQuery($intendedQuery);
return $intendedUrl;
} | [
"protected",
"function",
"getIntendedUrl",
"(",
"UrlImmutable",
"$",
"url",
")",
"{",
"$",
"intendedQuery",
"=",
"$",
"url",
"->",
"getQuery",
"(",
")",
";",
"$",
"intendedQuery",
"->",
"modify",
"(",
"[",
"$",
"this",
"->",
"expiresParameter",
"=>",
"null... | Retrieve the intended URL by stripping off the UrlSigner specific parameters.
@param \League\Url\UrlImmutable $url
@return \League\Url\UrlImmutable | [
"Retrieve",
"the",
"intended",
"URL",
"by",
"stripping",
"off",
"the",
"UrlSigner",
"specific",
"parameters",
"."
] | train | https://github.com/spatie/url-signer/blob/d337639e0be473d96ffb5b9716f911cbfaf0ecb9/src/BaseUrlSigner.php#L163-L175 |
spatie/url-signer | src/BaseUrlSigner.php | BaseUrlSigner.getExpirationTimestamp | protected function getExpirationTimestamp($expiration)
{
if (is_int($expiration)) {
$expiration = (new DateTime())->modify((int) $expiration.' days');
}
if (!$expiration instanceof DateTime) {
throw new InvalidExpiration('Expiration date must be an instance of DateTime or an integer');
}
if (!$this->isFuture($expiration->getTimestamp())) {
throw new InvalidExpiration('Expiration date must be in the future');
}
return (string) $expiration->getTimestamp();
} | php | protected function getExpirationTimestamp($expiration)
{
if (is_int($expiration)) {
$expiration = (new DateTime())->modify((int) $expiration.' days');
}
if (!$expiration instanceof DateTime) {
throw new InvalidExpiration('Expiration date must be an instance of DateTime or an integer');
}
if (!$this->isFuture($expiration->getTimestamp())) {
throw new InvalidExpiration('Expiration date must be in the future');
}
return (string) $expiration->getTimestamp();
} | [
"protected",
"function",
"getExpirationTimestamp",
"(",
"$",
"expiration",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"expiration",
")",
")",
"{",
"$",
"expiration",
"=",
"(",
"new",
"DateTime",
"(",
")",
")",
"->",
"modify",
"(",
"(",
"int",
")",
"$",
... | Retrieve the expiration timestamp for a link based on an absolute DateTime or a relative number of days.
@param \DateTime|int $expiration The expiration date of this link.
- DateTime: The value will be used as expiration date
- int: The expiration time will be set to X days from now
@throws \Spatie\UrlSigner\Exceptions\InvalidExpiration
@return string | [
"Retrieve",
"the",
"expiration",
"timestamp",
"for",
"a",
"link",
"based",
"on",
"an",
"absolute",
"DateTime",
"or",
"a",
"relative",
"number",
"of",
"days",
"."
] | train | https://github.com/spatie/url-signer/blob/d337639e0be473d96ffb5b9716f911cbfaf0ecb9/src/BaseUrlSigner.php#L188-L203 |
spatie/url-signer | src/BaseUrlSigner.php | BaseUrlSigner.hasValidSignature | protected function hasValidSignature(UrlImmutable $url)
{
$query = $url->getQuery();
$expiration = $query[$this->expiresParameter];
$providedSignature = $query[$this->signatureParameter];
$intendedUrl = $this->getIntendedUrl($url);
$validSignature = $this->createSignature($intendedUrl, $expiration);
return hash_equals($validSignature, $providedSignature);
} | php | protected function hasValidSignature(UrlImmutable $url)
{
$query = $url->getQuery();
$expiration = $query[$this->expiresParameter];
$providedSignature = $query[$this->signatureParameter];
$intendedUrl = $this->getIntendedUrl($url);
$validSignature = $this->createSignature($intendedUrl, $expiration);
return hash_equals($validSignature, $providedSignature);
} | [
"protected",
"function",
"hasValidSignature",
"(",
"UrlImmutable",
"$",
"url",
")",
"{",
"$",
"query",
"=",
"$",
"url",
"->",
"getQuery",
"(",
")",
";",
"$",
"expiration",
"=",
"$",
"query",
"[",
"$",
"this",
"->",
"expiresParameter",
"]",
";",
"$",
"p... | Determine if the url has a forged signature.
@param \League\Url\UrlImmutable $url
@return bool | [
"Determine",
"if",
"the",
"url",
"has",
"a",
"forged",
"signature",
"."
] | train | https://github.com/spatie/url-signer/blob/d337639e0be473d96ffb5b9716f911cbfaf0ecb9/src/BaseUrlSigner.php#L212-L224 |
maximilienGilet/notification-bundle | Controller/NotificationController.php | NotificationController.listAction | public function listAction($notifiable)
{
$notifiableRepo = $this->get('doctrine.orm.entity_manager')->getRepository('MgiletNotificationBundle:NotifiableNotification');
$notificationList = $notifiableRepo->findAllForNotifiableId($notifiable);
return $this->render('@MgiletNotification/notifications.html.twig', array(
'notificationList' => $notificationList,
'notifiableNotifications' => $notificationList // deprecated: alias for backward compatibility only
));
} | php | public function listAction($notifiable)
{
$notifiableRepo = $this->get('doctrine.orm.entity_manager')->getRepository('MgiletNotificationBundle:NotifiableNotification');
$notificationList = $notifiableRepo->findAllForNotifiableId($notifiable);
return $this->render('@MgiletNotification/notifications.html.twig', array(
'notificationList' => $notificationList,
'notifiableNotifications' => $notificationList // deprecated: alias for backward compatibility only
));
} | [
"public",
"function",
"listAction",
"(",
"$",
"notifiable",
")",
"{",
"$",
"notifiableRepo",
"=",
"$",
"this",
"->",
"get",
"(",
"'doctrine.orm.entity_manager'",
")",
"->",
"getRepository",
"(",
"'MgiletNotificationBundle:NotifiableNotification'",
")",
";",
"$",
"no... | List of all notifications
@Route("/{notifiable}", name="notification_list")
@Method("GET")
@param NotifiableInterface $notifiable
@return \Symfony\Component\HttpFoundation\Response | [
"List",
"of",
"all",
"notifications"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Controller/NotificationController.php#L28-L36 |
maximilienGilet/notification-bundle | Controller/NotificationController.php | NotificationController.markAsSeenAction | public function markAsSeenAction($notifiable, $notification)
{
$manager = $this->get('mgilet.notification');
$manager->markAsSeen(
$manager->getNotifiableInterface($manager->getNotifiableEntityById($notifiable)),
$manager->getNotification($notification),
true
);
return new JsonResponse(true);
} | php | public function markAsSeenAction($notifiable, $notification)
{
$manager = $this->get('mgilet.notification');
$manager->markAsSeen(
$manager->getNotifiableInterface($manager->getNotifiableEntityById($notifiable)),
$manager->getNotification($notification),
true
);
return new JsonResponse(true);
} | [
"public",
"function",
"markAsSeenAction",
"(",
"$",
"notifiable",
",",
"$",
"notification",
")",
"{",
"$",
"manager",
"=",
"$",
"this",
"->",
"get",
"(",
"'mgilet.notification'",
")",
";",
"$",
"manager",
"->",
"markAsSeen",
"(",
"$",
"manager",
"->",
"get... | Set a Notification as seen
@Route("/{notifiable}/mark_as_seen/{notification}", name="notification_mark_as_seen")
@Method("POST")
@param int $notifiable
@param Notification $notification
@return JsonResponse
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Doctrine\ORM\OptimisticLockException
@throws \Doctrine\ORM\NonUniqueResultException
@throws \Doctrine\ORM\EntityNotFoundException
@throws \LogicException | [
"Set",
"a",
"Notification",
"as",
"seen"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Controller/NotificationController.php#L54-L64 |
maximilienGilet/notification-bundle | Controller/NotificationController.php | NotificationController.markAsUnSeenAction | public function markAsUnSeenAction($notifiable, $notification)
{
$manager = $this->get('mgilet.notification');
$manager->markAsUnseen(
$manager->getNotifiableInterface($manager->getNotifiableEntityById($notifiable)),
$manager->getNotification($notification),
true
);
return new JsonResponse(true);
} | php | public function markAsUnSeenAction($notifiable, $notification)
{
$manager = $this->get('mgilet.notification');
$manager->markAsUnseen(
$manager->getNotifiableInterface($manager->getNotifiableEntityById($notifiable)),
$manager->getNotification($notification),
true
);
return new JsonResponse(true);
} | [
"public",
"function",
"markAsUnSeenAction",
"(",
"$",
"notifiable",
",",
"$",
"notification",
")",
"{",
"$",
"manager",
"=",
"$",
"this",
"->",
"get",
"(",
"'mgilet.notification'",
")",
";",
"$",
"manager",
"->",
"markAsUnseen",
"(",
"$",
"manager",
"->",
... | Set a Notification as unseen
@Route("/{notifiable}/mark_as_unseen/{notification}", name="notification_mark_as_unseen")
@Method("POST")
@param $notifiable
@param $notification
@return JsonResponse
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Doctrine\ORM\OptimisticLockException
@throws \Doctrine\ORM\NonUniqueResultException
@throws \Doctrine\ORM\EntityNotFoundException
@throws \LogicException | [
"Set",
"a",
"Notification",
"as",
"unseen"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Controller/NotificationController.php#L82-L92 |
maximilienGilet/notification-bundle | Controller/NotificationController.php | NotificationController.markAllAsSeenAction | public function markAllAsSeenAction($notifiable)
{
$manager = $this->get('mgilet.notification');
$manager->markAllAsSeen(
$manager->getNotifiableInterface($manager->getNotifiableEntityById($notifiable)),
true
);
return new JsonResponse(true);
} | php | public function markAllAsSeenAction($notifiable)
{
$manager = $this->get('mgilet.notification');
$manager->markAllAsSeen(
$manager->getNotifiableInterface($manager->getNotifiableEntityById($notifiable)),
true
);
return new JsonResponse(true);
} | [
"public",
"function",
"markAllAsSeenAction",
"(",
"$",
"notifiable",
")",
"{",
"$",
"manager",
"=",
"$",
"this",
"->",
"get",
"(",
"'mgilet.notification'",
")",
";",
"$",
"manager",
"->",
"markAllAsSeen",
"(",
"$",
"manager",
"->",
"getNotifiableInterface",
"(... | Set all Notifications for a User as seen
@Route("/{notifiable}/markAllAsSeen", name="notification_mark_all_as_seen")
@Method("POST")
@param $notifiable
@return JsonResponse
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Doctrine\ORM\OptimisticLockException | [
"Set",
"all",
"Notifications",
"for",
"a",
"User",
"as",
"seen"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Controller/NotificationController.php#L106-L115 |
maximilienGilet/notification-bundle | Twig/NotificationExtension.php | NotificationExtension.render | public function render(NotifiableInterface $notifiable, array $options = array())
{
if (!array_key_exists('seen', $options)) {
$options['seen'] = true;
}
return $this->renderNotifications($notifiable, $options);
} | php | public function render(NotifiableInterface $notifiable, array $options = array())
{
if (!array_key_exists('seen', $options)) {
$options['seen'] = true;
}
return $this->renderNotifications($notifiable, $options);
} | [
"public",
"function",
"render",
"(",
"NotifiableInterface",
"$",
"notifiable",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'seen'",
",",
"$",
"options",
")",
")",
"{",
"$",
"options",
"[",
"... | Rendering notifications in Twig
@param array $options
@param NotifiableInterface $notifiable
@return null|string
@throws \RuntimeException
@throws \InvalidArgumentException | [
"Rendering",
"notifications",
"in",
"Twig"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Twig/NotificationExtension.php#L70-L77 |
maximilienGilet/notification-bundle | Twig/NotificationExtension.php | NotificationExtension.renderNotifications | public function renderNotifications(NotifiableInterface $notifiable, array $options)
{
$order = array_key_exists('order', $options) ? $options['order'] : null;
$limit = array_key_exists('limit', $options) ? $options['limit'] : null;
$offset = array_key_exists('offset', $options) ? $options['offset'] : null;
if ($options['seen']) {
$notifications = $this->notificationManager->getNotifications($notifiable, $order, $limit, $offset);
} else {
$notifications = $this->notificationManager->getUnseenNotifications($notifiable, $order, $limit, $offset);
}
// if the template option is set, use custom template
$template = array_key_exists('template', $options) ? $options['template'] : '@MgiletNotification/notification_list.html.twig';
return $this->twig->render($template,
array(
'notificationList' => $notifications
)
);
} | php | public function renderNotifications(NotifiableInterface $notifiable, array $options)
{
$order = array_key_exists('order', $options) ? $options['order'] : null;
$limit = array_key_exists('limit', $options) ? $options['limit'] : null;
$offset = array_key_exists('offset', $options) ? $options['offset'] : null;
if ($options['seen']) {
$notifications = $this->notificationManager->getNotifications($notifiable, $order, $limit, $offset);
} else {
$notifications = $this->notificationManager->getUnseenNotifications($notifiable, $order, $limit, $offset);
}
// if the template option is set, use custom template
$template = array_key_exists('template', $options) ? $options['template'] : '@MgiletNotification/notification_list.html.twig';
return $this->twig->render($template,
array(
'notificationList' => $notifications
)
);
} | [
"public",
"function",
"renderNotifications",
"(",
"NotifiableInterface",
"$",
"notifiable",
",",
"array",
"$",
"options",
")",
"{",
"$",
"order",
"=",
"array_key_exists",
"(",
"'order'",
",",
"$",
"options",
")",
"?",
"$",
"options",
"[",
"'order'",
"]",
":"... | Render notifications of the notifiable as a list
@param NotifiableInterface $notifiable
@param array $options
@return string
@throws \RuntimeException
@throws \InvalidArgumentException | [
"Render",
"notifications",
"of",
"the",
"notifiable",
"as",
"a",
"list"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Twig/NotificationExtension.php#L90-L110 |
maximilienGilet/notification-bundle | Twig/NotificationExtension.php | NotificationExtension.generatePath | public function generatePath($route, $notifiable, NotificationInterface $notification = null)
{
if ($notifiable instanceof NotifiableInterface) {
$notifiableId = $this->notificationManager->getNotifiableEntity($notifiable)->getId();
} elseif ($notifiable instanceof NotifiableEntity) {
$notifiableId = $notifiable->getId();
} else {
throw new InvalidArgumentException('You must provide a NotifiableInterface or NotifiableEntity object');
}
switch ($route) {
case 'notification_list':
return $this->router->generate(
'notification_list',
array('notifiable' => $notifiableId)
);
break;
case 'notification_mark_as_seen':
if (!$notification) {
throw new \InvalidArgumentException('You must provide a Notification Entity');
}
return $this->router->generate(
'notification_mark_as_seen',
array(
'notifiable' => $notifiableId,
'notification' => $notification->getId()
)
);
break;
case 'notification_mark_as_unseen':
if (!$notification) {
throw new \InvalidArgumentException('You must provide a Notification Entity');
}
return $this->router->generate(
'notification_mark_as_unseen',
array(
'notifiable' => $notifiableId,
'notification' => $notification->getId()
)
);
break;
case 'notification_mark_all_as_seen':
return $this->router->generate('notification_mark_all_as_seen', array('notifiable' => $notifiableId));
break;
default:
return new \InvalidArgumentException('You must provide a valid route path. Paths availables : notification_list, notification_mark_as_seen, notification_mark_as_unseen, notification_mark_all_as_seen');
}
} | php | public function generatePath($route, $notifiable, NotificationInterface $notification = null)
{
if ($notifiable instanceof NotifiableInterface) {
$notifiableId = $this->notificationManager->getNotifiableEntity($notifiable)->getId();
} elseif ($notifiable instanceof NotifiableEntity) {
$notifiableId = $notifiable->getId();
} else {
throw new InvalidArgumentException('You must provide a NotifiableInterface or NotifiableEntity object');
}
switch ($route) {
case 'notification_list':
return $this->router->generate(
'notification_list',
array('notifiable' => $notifiableId)
);
break;
case 'notification_mark_as_seen':
if (!$notification) {
throw new \InvalidArgumentException('You must provide a Notification Entity');
}
return $this->router->generate(
'notification_mark_as_seen',
array(
'notifiable' => $notifiableId,
'notification' => $notification->getId()
)
);
break;
case 'notification_mark_as_unseen':
if (!$notification) {
throw new \InvalidArgumentException('You must provide a Notification Entity');
}
return $this->router->generate(
'notification_mark_as_unseen',
array(
'notifiable' => $notifiableId,
'notification' => $notification->getId()
)
);
break;
case 'notification_mark_all_as_seen':
return $this->router->generate('notification_mark_all_as_seen', array('notifiable' => $notifiableId));
break;
default:
return new \InvalidArgumentException('You must provide a valid route path. Paths availables : notification_list, notification_mark_as_seen, notification_mark_as_unseen, notification_mark_all_as_seen');
}
} | [
"public",
"function",
"generatePath",
"(",
"$",
"route",
",",
"$",
"notifiable",
",",
"NotificationInterface",
"$",
"notification",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"notifiable",
"instanceof",
"NotifiableInterface",
")",
"{",
"$",
"notifiableId",
"=",
"$... | Returns the path to the NotificationController action
@param $route
@param $notifiable
@param NotificationInterface|null $notification
@return \InvalidArgumentException|string
@throws \RuntimeException
@throws \Doctrine\DBAL\Exception\InvalidArgumentException
@throws \Doctrine\ORM\OptimisticLockException
@throws \Doctrine\ORM\ORMInvalidArgumentException
@throws \InvalidArgumentException | [
"Returns",
"the",
"path",
"to",
"the",
"NotificationController",
"action"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Twig/NotificationExtension.php#L159-L208 |
maximilienGilet/notification-bundle | NotifiableDiscovery.php | NotifiableDiscovery.getNotifiableName | public function getNotifiableName(NotifiableInterface $notifiable)
{
// fixes the case when the notifiable is a proxy
$class = ClassUtils::getRealClass(get_class($notifiable));
$annotation = $this->annotationReader->getClassAnnotation(new \ReflectionClass($class), 'Mgilet\NotificationBundle\Annotation\Notifiable');
if ($annotation) {
return $annotation->getName();
}
return null;
} | php | public function getNotifiableName(NotifiableInterface $notifiable)
{
// fixes the case when the notifiable is a proxy
$class = ClassUtils::getRealClass(get_class($notifiable));
$annotation = $this->annotationReader->getClassAnnotation(new \ReflectionClass($class), 'Mgilet\NotificationBundle\Annotation\Notifiable');
if ($annotation) {
return $annotation->getName();
}
return null;
} | [
"public",
"function",
"getNotifiableName",
"(",
"NotifiableInterface",
"$",
"notifiable",
")",
"{",
"// fixes the case when the notifiable is a proxy",
"$",
"class",
"=",
"ClassUtils",
"::",
"getRealClass",
"(",
"get_class",
"(",
"$",
"notifiable",
")",
")",
";",
"$",... | @param NotifiableInterface $notifiable
@return string|null | [
"@param",
"NotifiableInterface",
"$notifiable"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/NotifiableDiscovery.php#L57-L67 |
maximilienGilet/notification-bundle | NotifiableDiscovery.php | NotifiableDiscovery.discoverNotifiables | private function discoverNotifiables()
{
/** @var ClassMetadata[] $entities */
$entities = $this->em->getMetadataFactory()->getAllMetadata();
foreach ($entities as $entity) {
$class = $entity->name;
$annotation = $this->annotationReader->getClassAnnotation(new \ReflectionClass($class), 'Mgilet\NotificationBundle\Annotation\Notifiable');
if ($annotation) {
$this->notifiables[$annotation->getName()] = [
'class' => $entity->name,
'annotation' => $annotation,
'identifiers' => $entity->getIdentifier()
];
}
}
} | php | private function discoverNotifiables()
{
/** @var ClassMetadata[] $entities */
$entities = $this->em->getMetadataFactory()->getAllMetadata();
foreach ($entities as $entity) {
$class = $entity->name;
$annotation = $this->annotationReader->getClassAnnotation(new \ReflectionClass($class), 'Mgilet\NotificationBundle\Annotation\Notifiable');
if ($annotation) {
$this->notifiables[$annotation->getName()] = [
'class' => $entity->name,
'annotation' => $annotation,
'identifiers' => $entity->getIdentifier()
];
}
}
} | [
"private",
"function",
"discoverNotifiables",
"(",
")",
"{",
"/** @var ClassMetadata[] $entities */",
"$",
"entities",
"=",
"$",
"this",
"->",
"em",
"->",
"getMetadataFactory",
"(",
")",
"->",
"getAllMetadata",
"(",
")",
";",
"foreach",
"(",
"$",
"entities",
"as... | Discovers workers
@throws \InvalidArgumentException | [
"Discovers",
"workers"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/NotifiableDiscovery.php#L73-L88 |
maximilienGilet/notification-bundle | Entity/NotifiableEntity.php | NotifiableEntity.addNotifiableNotification | public function addNotifiableNotification(NotifiableNotification $notifiableNotification)
{
if (!$this->notifiableNotifications->contains($notifiableNotification)) {
$this->notifiableNotifications[] = $notifiableNotification;
$notifiableNotification->setNotifiableEntity($this);
}
return $this;
} | php | public function addNotifiableNotification(NotifiableNotification $notifiableNotification)
{
if (!$this->notifiableNotifications->contains($notifiableNotification)) {
$this->notifiableNotifications[] = $notifiableNotification;
$notifiableNotification->setNotifiableEntity($this);
}
return $this;
} | [
"public",
"function",
"addNotifiableNotification",
"(",
"NotifiableNotification",
"$",
"notifiableNotification",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"notifiableNotifications",
"->",
"contains",
"(",
"$",
"notifiableNotification",
")",
")",
"{",
"$",
"this",... | @param NotifiableNotification $notifiableNotification
@return $this | [
"@param",
"NotifiableNotification",
"$notifiableNotification"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/NotifiableEntity.php#L121-L129 |
maximilienGilet/notification-bundle | Entity/Repository/NotifiableNotificationRepository.php | NotifiableNotificationRepository.findOne | public function findOne($notification_id, $notifiable_id)
{
return $this->createQueryBuilder('nn')
->join('nn.notification', 'n')
->join('nn.notifiableEntity', 'ne')
->where('n.id = :notification_id')
->andWhere('ne.id = :notifiable_id')
->setParameter('notification_id', $notification_id)
->setParameter('notifiable_id', $notifiable_id)
->getQuery()
->getOneOrNullResult()
;
} | php | public function findOne($notification_id, $notifiable_id)
{
return $this->createQueryBuilder('nn')
->join('nn.notification', 'n')
->join('nn.notifiableEntity', 'ne')
->where('n.id = :notification_id')
->andWhere('ne.id = :notifiable_id')
->setParameter('notification_id', $notification_id)
->setParameter('notifiable_id', $notifiable_id)
->getQuery()
->getOneOrNullResult()
;
} | [
"public",
"function",
"findOne",
"(",
"$",
"notification_id",
",",
"$",
"notifiable_id",
")",
"{",
"return",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'nn'",
")",
"->",
"join",
"(",
"'nn.notification'",
",",
"'n'",
")",
"->",
"join",
"(",
"'nn.notifiabl... | @param $notification_id
@param $notifiable_id
@return NotifiableNotification|null
@throws \Doctrine\ORM\NonUniqueResultException | [
"@param",
"$notification_id",
"@param",
"$notifiable_id"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/Repository/NotifiableNotificationRepository.php#L24-L36 |
maximilienGilet/notification-bundle | Entity/Repository/NotifiableNotificationRepository.php | NotifiableNotificationRepository.findAllForNotifiable | public function findAllForNotifiable($notifiable_identifier, $notifiable_class, $order = 'DESC')
{
return $this->createQueryBuilder('nn')
->join('nn.notifiableEntity', 'ne')
->join('nn.notification', 'no')
->where('ne.identifier = :identifier')
->andWhere('ne.class = :class')
->setParameter('identifier', $notifiable_identifier)
->setParameter('class', $notifiable_class)
->orderBy('no.id', $order)
->getQuery()
->getResult()
;
} | php | public function findAllForNotifiable($notifiable_identifier, $notifiable_class, $order = 'DESC')
{
return $this->createQueryBuilder('nn')
->join('nn.notifiableEntity', 'ne')
->join('nn.notification', 'no')
->where('ne.identifier = :identifier')
->andWhere('ne.class = :class')
->setParameter('identifier', $notifiable_identifier)
->setParameter('class', $notifiable_class)
->orderBy('no.id', $order)
->getQuery()
->getResult()
;
} | [
"public",
"function",
"findAllForNotifiable",
"(",
"$",
"notifiable_identifier",
",",
"$",
"notifiable_class",
",",
"$",
"order",
"=",
"'DESC'",
")",
"{",
"return",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'nn'",
")",
"->",
"join",
"(",
"'nn.notifiableEnti... | Get all NotifiableNotifications for a notifiable
@param $notifiable_identifier
@param $notifiable_class
@param string $order
@return NotifiableNotification[] | [
"Get",
"all",
"NotifiableNotifications",
"for",
"a",
"notifiable"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/Repository/NotifiableNotificationRepository.php#L47-L60 |
maximilienGilet/notification-bundle | Entity/Repository/NotifiableNotificationRepository.php | NotifiableNotificationRepository.findAllByNotifiable | public function findAllByNotifiable($identifier, $class, $seen = null, $order = 'DESC', $limit = null,
$offset = null)
{
$qb = $this->findAllByNotifiableQb($identifier, $class, $order);
if ($seen !== null) {
$whereSeen = $seen ? 1 : 0;
$qb
->andWhere('nn.seen = :seen')
->setParameter('seen', $whereSeen)
;
}
if (null !== $limit) {
$qb->setMaxResults($limit);
}
if (null !== $offset) {
$qb->setFirstResult($offset);
}
return $qb->getQuery()->getResult();
} | php | public function findAllByNotifiable($identifier, $class, $seen = null, $order = 'DESC', $limit = null,
$offset = null)
{
$qb = $this->findAllByNotifiableQb($identifier, $class, $order);
if ($seen !== null) {
$whereSeen = $seen ? 1 : 0;
$qb
->andWhere('nn.seen = :seen')
->setParameter('seen', $whereSeen)
;
}
if (null !== $limit) {
$qb->setMaxResults($limit);
}
if (null !== $offset) {
$qb->setFirstResult($offset);
}
return $qb->getQuery()->getResult();
} | [
"public",
"function",
"findAllByNotifiable",
"(",
"$",
"identifier",
",",
"$",
"class",
",",
"$",
"seen",
"=",
"null",
",",
"$",
"order",
"=",
"'DESC'",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"$",
"qb",
"=",
"$",... | @param $identifier
@param $class
@param bool|null $seen
@param string $order
@param null|int $limit
@param null|int $offset
@return array | [
"@param",
"$identifier",
"@param",
"$class",
"@param",
"bool|null",
"$seen",
"@param",
"string",
"$order",
"@param",
"null|int",
"$limit",
"@param",
"null|int",
"$offset"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/Repository/NotifiableNotificationRepository.php#L72-L93 |
maximilienGilet/notification-bundle | Entity/Repository/NotifiableNotificationRepository.php | NotifiableNotificationRepository.findAllByNotifiableQb | public function findAllByNotifiableQb($identifier, $class, $order = 'DESC')
{
return $this->createQueryBuilder('nn')
->addSelect('n')
->join('nn.notification', 'n')
->join('nn.notifiableEntity', 'ne')
->where('ne.identifier = :identifier')
->andWhere('ne.class = :class')
->orderBy('n.id', $order)
->setParameter('identifier', $identifier)
->setParameter('class', $class)
;
} | php | public function findAllByNotifiableQb($identifier, $class, $order = 'DESC')
{
return $this->createQueryBuilder('nn')
->addSelect('n')
->join('nn.notification', 'n')
->join('nn.notifiableEntity', 'ne')
->where('ne.identifier = :identifier')
->andWhere('ne.class = :class')
->orderBy('n.id', $order)
->setParameter('identifier', $identifier)
->setParameter('class', $class)
;
} | [
"public",
"function",
"findAllByNotifiableQb",
"(",
"$",
"identifier",
",",
"$",
"class",
",",
"$",
"order",
"=",
"'DESC'",
")",
"{",
"return",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'nn'",
")",
"->",
"addSelect",
"(",
"'n'",
")",
"->",
"join",
"... | @param $identifier
@param $class
@param string $order
@return \Doctrine\ORM\QueryBuilder | [
"@param",
"$identifier",
"@param",
"$class",
"@param",
"string",
"$order"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/Repository/NotifiableNotificationRepository.php#L102-L114 |
maximilienGilet/notification-bundle | Entity/Repository/NotifiableNotificationRepository.php | NotifiableNotificationRepository.findAllForNotifiableIdQb | public function findAllForNotifiableIdQb($id, $order = 'DESC')
{
return $this->createQueryBuilder('nn')
->addSelect('n')
->join('nn.notification', 'n')
->join('nn.notifiableEntity', 'ne')
->where('ne.id = :id')
->orderBy('n.id', $order)
->setParameter('id', $id)
;
} | php | public function findAllForNotifiableIdQb($id, $order = 'DESC')
{
return $this->createQueryBuilder('nn')
->addSelect('n')
->join('nn.notification', 'n')
->join('nn.notifiableEntity', 'ne')
->where('ne.id = :id')
->orderBy('n.id', $order)
->setParameter('id', $id)
;
} | [
"public",
"function",
"findAllForNotifiableIdQb",
"(",
"$",
"id",
",",
"$",
"order",
"=",
"'DESC'",
")",
"{",
"return",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'nn'",
")",
"->",
"addSelect",
"(",
"'n'",
")",
"->",
"join",
"(",
"'nn.notification'",
"... | @param $id
@param string $order
@return \Doctrine\ORM\QueryBuilder | [
"@param",
"$id",
"@param",
"string",
"$order"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/Repository/NotifiableNotificationRepository.php#L122-L132 |
maximilienGilet/notification-bundle | Entity/Repository/NotifiableNotificationRepository.php | NotifiableNotificationRepository.getNotificationCoundQb | protected function getNotificationCoundQb($notifiable_identifier, $notifiable_class)
{
return $this->createQueryBuilder('nn')
->select('COUNT(nn.id)')
->join('nn.notifiableEntity', 'ne')
->where('ne.identifier = :notifiable_identifier')
->andWhere('ne.class = :notifiable_class')
->setParameter('notifiable_identifier', $notifiable_identifier)
->setParameter('notifiable_class', $notifiable_class)
;
} | php | protected function getNotificationCoundQb($notifiable_identifier, $notifiable_class)
{
return $this->createQueryBuilder('nn')
->select('COUNT(nn.id)')
->join('nn.notifiableEntity', 'ne')
->where('ne.identifier = :notifiable_identifier')
->andWhere('ne.class = :notifiable_class')
->setParameter('notifiable_identifier', $notifiable_identifier)
->setParameter('notifiable_class', $notifiable_class)
;
} | [
"protected",
"function",
"getNotificationCoundQb",
"(",
"$",
"notifiable_identifier",
",",
"$",
"notifiable_class",
")",
"{",
"return",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'nn'",
")",
"->",
"select",
"(",
"'COUNT(nn.id)'",
")",
"->",
"join",
"(",
"'nn... | @param $notifiable_identifier
@param $notifiable_class
@return \Doctrine\ORM\QueryBuilder | [
"@param",
"$notifiable_identifier",
"@param",
"$notifiable_class"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/Repository/NotifiableNotificationRepository.php#L153-L163 |
maximilienGilet/notification-bundle | Entity/Repository/NotifiableNotificationRepository.php | NotifiableNotificationRepository.getNotificationCount | public function getNotificationCount($notifiable_identifier, $notifiable_class, $seen = null)
{
$qb = $this->getNotificationCoundQb($notifiable_identifier, $notifiable_class);
if ($seen !== null) {
$whereSeen = $seen ? 1 : 0;
$qb
->andWhere('nn.seen = :seen')
->setParameter('seen', $whereSeen);
}
return $qb->getQuery()->getSingleScalarResult();
} | php | public function getNotificationCount($notifiable_identifier, $notifiable_class, $seen = null)
{
$qb = $this->getNotificationCoundQb($notifiable_identifier, $notifiable_class);
if ($seen !== null) {
$whereSeen = $seen ? 1 : 0;
$qb
->andWhere('nn.seen = :seen')
->setParameter('seen', $whereSeen);
}
return $qb->getQuery()->getSingleScalarResult();
} | [
"public",
"function",
"getNotificationCount",
"(",
"$",
"notifiable_identifier",
",",
"$",
"notifiable_class",
",",
"$",
"seen",
"=",
"null",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"getNotificationCoundQb",
"(",
"$",
"notifiable_identifier",
",",
"$",
"n... | Get the count of Notifications for a Notifiable entity.
seen option results :
null : get all notifications
true : get seen notifications
false : get unseen notifications
@param string $notifiable_identifier
@param string $notifiable_class
@param bool|null $seen
@return int
@throws \Doctrine\ORM\NonUniqueResultException
@throws \Doctrine\ORM\NoResultException | [
"Get",
"the",
"count",
"of",
"Notifications",
"for",
"a",
"Notifiable",
"entity",
"."
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/Repository/NotifiableNotificationRepository.php#L181-L192 |
maximilienGilet/notification-bundle | Entity/Repository/NotifiableRepository.php | NotifiableRepository.findNotifiableInterface | public function findNotifiableInterface(NotifiableEntity $notifiableEntity, array $mapping)
{
// create the querybuilder from the entity
$qb = $this->createQueryBuilder('n')->select('e')->from($notifiableEntity->getClass(), 'e');
// map the identifier(s) to the value(s)
$identifiers = explode('-', $notifiableEntity->getIdentifier());
foreach ($mapping as $key => $identifier) {
$qb->andWhere(sprintf('e.%s = :%s', $identifier, $identifier));
$qb->setParameter($identifier, $identifiers[$key]);
}
return $qb->getQuery()->getOneOrNullResult();
} | php | public function findNotifiableInterface(NotifiableEntity $notifiableEntity, array $mapping)
{
// create the querybuilder from the entity
$qb = $this->createQueryBuilder('n')->select('e')->from($notifiableEntity->getClass(), 'e');
// map the identifier(s) to the value(s)
$identifiers = explode('-', $notifiableEntity->getIdentifier());
foreach ($mapping as $key => $identifier) {
$qb->andWhere(sprintf('e.%s = :%s', $identifier, $identifier));
$qb->setParameter($identifier, $identifiers[$key]);
}
return $qb->getQuery()->getOneOrNullResult();
} | [
"public",
"function",
"findNotifiableInterface",
"(",
"NotifiableEntity",
"$",
"notifiableEntity",
",",
"array",
"$",
"mapping",
")",
"{",
"// create the querybuilder from the entity",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'n'",
")",
"->",
"... | @param NotifiableEntity $notifiableEntity
@param array $mapping
@return NotifiableInterface|null
@throws \Doctrine\ORM\NonUniqueResultException | [
"@param",
"NotifiableEntity",
"$notifiableEntity",
"@param",
"array",
"$mapping"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/Repository/NotifiableRepository.php#L19-L32 |
maximilienGilet/notification-bundle | Entity/Repository/NotifiableRepository.php | NotifiableRepository.findAllByNotification | public function findAllByNotification($id, $seen = null)
{
$qb = $this
->createQueryBuilder('notifiable')
->join('notifiable.notifiableNotifications', 'nn')
->join('nn.notification', 'notification')
->where('notification.id = :notification_id')
->setParameter('notification_id', $id)
;
if ($seen !== null) {
$whereSeen = $seen ? 1 : 0;
$qb
->andWhere('nn.seen = :seen')
->setParameter('seen', $whereSeen)
;
}
return $qb->getQuery()->getResult();
} | php | public function findAllByNotification($id, $seen = null)
{
$qb = $this
->createQueryBuilder('notifiable')
->join('notifiable.notifiableNotifications', 'nn')
->join('nn.notification', 'notification')
->where('notification.id = :notification_id')
->setParameter('notification_id', $id)
;
if ($seen !== null) {
$whereSeen = $seen ? 1 : 0;
$qb
->andWhere('nn.seen = :seen')
->setParameter('seen', $whereSeen)
;
}
return $qb->getQuery()->getResult();
} | [
"public",
"function",
"findAllByNotification",
"(",
"$",
"id",
",",
"$",
"seen",
"=",
"null",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'notifiable'",
")",
"->",
"join",
"(",
"'notifiable.notifiableNotifications'",
",",
"'nn'",
... | @param $id
@param bool|null $seen
@return NotifiableInterface[] | [
"@param",
"$id",
"@param",
"bool|null",
"$seen"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/Repository/NotifiableRepository.php#L40-L59 |
maximilienGilet/notification-bundle | Entity/NotifiableNotification.php | NotifiableNotification.jsonSerialize | public function jsonSerialize()
{
return [
'id' => $this->getId(),
'seen' => $this->isSeen(),
'notification' => $this->getNotification(),
// for the notifiable, we serialize only the id:
// - we don't need not want the FQCN exposed
// - most of the time we will have a proxy and don't want to trigger lazy loading
'notifiable' => [ 'id' => $this->getNotifiableEntity()->getId() ]
];
} | php | public function jsonSerialize()
{
return [
'id' => $this->getId(),
'seen' => $this->isSeen(),
'notification' => $this->getNotification(),
// for the notifiable, we serialize only the id:
// - we don't need not want the FQCN exposed
// - most of the time we will have a proxy and don't want to trigger lazy loading
'notifiable' => [ 'id' => $this->getNotifiableEntity()->getId() ]
];
} | [
"public",
"function",
"jsonSerialize",
"(",
")",
"{",
"return",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"'seen'",
"=>",
"$",
"this",
"->",
"isSeen",
"(",
")",
",",
"'notification'",
"=>",
"$",
"this",
"->",
"getNotification",
"(",... | {@inheritdoc} | [
"{"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Entity/NotifiableNotification.php#L122-L133 |
maximilienGilet/notification-bundle | Model/Notification.php | Notification.addNotifiableNotification | public function addNotifiableNotification(NotifiableNotification $notifiableNotification)
{
if (!$this->notifiableNotifications->contains($notifiableNotification)) {
$this->notifiableNotifications[] = $notifiableNotification;
$notifiableNotification->setNotification($this);
}
return $this;
} | php | public function addNotifiableNotification(NotifiableNotification $notifiableNotification)
{
if (!$this->notifiableNotifications->contains($notifiableNotification)) {
$this->notifiableNotifications[] = $notifiableNotification;
$notifiableNotification->setNotification($this);
}
return $this;
} | [
"public",
"function",
"addNotifiableNotification",
"(",
"NotifiableNotification",
"$",
"notifiableNotification",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"notifiableNotifications",
"->",
"contains",
"(",
"$",
"notifiableNotification",
")",
")",
"{",
"$",
"this",... | @param NotifiableNotification $notifiableNotification
@return $this | [
"@param",
"NotifiableNotification",
"$notifiableNotification"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Model/Notification.php#L165-L173 |
maximilienGilet/notification-bundle | Model/Notification.php | Notification.removeNotifiableNotification | public function removeNotifiableNotification(NotifiableNotification $notifiableNotification)
{
if ($this->notifiableNotifications->contains($notifiableNotification)) {
$this->notifiableNotifications->removeElement($notifiableNotification);
$notifiableNotification->setNotification(null);
}
return $this;
} | php | public function removeNotifiableNotification(NotifiableNotification $notifiableNotification)
{
if ($this->notifiableNotifications->contains($notifiableNotification)) {
$this->notifiableNotifications->removeElement($notifiableNotification);
$notifiableNotification->setNotification(null);
}
return $this;
} | [
"public",
"function",
"removeNotifiableNotification",
"(",
"NotifiableNotification",
"$",
"notifiableNotification",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"notifiableNotifications",
"->",
"contains",
"(",
"$",
"notifiableNotification",
")",
")",
"{",
"$",
"this",
"... | @param NotifiableNotification $notifiableNotification
@return $this | [
"@param",
"NotifiableNotification",
"$notifiableNotification"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Model/Notification.php#L180-L188 |
maximilienGilet/notification-bundle | Model/Notification.php | Notification.jsonSerialize | public function jsonSerialize()
{
return [
'id' => $this->getId(),
'date' => $this->getDate()->format(\DateTime::ISO8601),
'subject' => $this->getSubject(),
'message' => $this->getMessage(),
'link' => $this->getLink()
];
} | php | public function jsonSerialize()
{
return [
'id' => $this->getId(),
'date' => $this->getDate()->format(\DateTime::ISO8601),
'subject' => $this->getSubject(),
'message' => $this->getMessage(),
'link' => $this->getLink()
];
} | [
"public",
"function",
"jsonSerialize",
"(",
")",
"{",
"return",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"'date'",
"=>",
"$",
"this",
"->",
"getDate",
"(",
")",
"->",
"format",
"(",
"\\",
"DateTime",
"::",
"ISO8601",
")",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Model/Notification.php#L201-L210 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.getNotifiable | public function getNotifiable($name)
{
$notifiables = $this->getDiscoveryNotifiables();
if (isset($notifiables[$name])) {
return $notifiables[$name];
}
throw new \RuntimeException('Notifiable not found.');
} | php | public function getNotifiable($name)
{
$notifiables = $this->getDiscoveryNotifiables();
if (isset($notifiables[$name])) {
return $notifiables[$name];
}
throw new \RuntimeException('Notifiable not found.');
} | [
"public",
"function",
"getNotifiable",
"(",
"$",
"name",
")",
"{",
"$",
"notifiables",
"=",
"$",
"this",
"->",
"getDiscoveryNotifiables",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"notifiables",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
... | Returns one notifiable by name
@param $name
@return array
@throws \InvalidArgumentException
@throws \RuntimeException | [
"Returns",
"one",
"notifiable",
"by",
"name"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L70-L78 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.getNotifiableIdentifier | public function getNotifiableIdentifier(NotifiableInterface $notifiable)
{
$name = $this->getNotifiableName($notifiable);
return $this->getNotifiable($name)['identifiers'];
} | php | public function getNotifiableIdentifier(NotifiableInterface $notifiable)
{
$name = $this->getNotifiableName($notifiable);
return $this->getNotifiable($name)['identifiers'];
} | [
"public",
"function",
"getNotifiableIdentifier",
"(",
"NotifiableInterface",
"$",
"notifiable",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getNotifiableName",
"(",
"$",
"notifiable",
")",
";",
"return",
"$",
"this",
"->",
"getNotifiable",
"(",
"$",
"name"... | @param NotifiableInterface $notifiable
@return array
@throws \RuntimeException
@throws \InvalidArgumentException | [
"@param",
"NotifiableInterface",
"$notifiable"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L99-L104 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.getNotifiableEntityIdentifiers | public function getNotifiableEntityIdentifiers(NotifiableEntity $notifiableEntity)
{
$discoveryNotifiables = $this->getDiscoveryNotifiables();
foreach ($discoveryNotifiables as $notifiable) {
if ($notifiable['class'] === $notifiableEntity->getClass()) {
return $notifiable['identifiers'];
}
}
throw new \RuntimeException('Unable to get the NotifiableEntity identifiers. This could be an Entity mapping issue');
} | php | public function getNotifiableEntityIdentifiers(NotifiableEntity $notifiableEntity)
{
$discoveryNotifiables = $this->getDiscoveryNotifiables();
foreach ($discoveryNotifiables as $notifiable) {
if ($notifiable['class'] === $notifiableEntity->getClass()) {
return $notifiable['identifiers'];
}
}
throw new \RuntimeException('Unable to get the NotifiableEntity identifiers. This could be an Entity mapping issue');
} | [
"public",
"function",
"getNotifiableEntityIdentifiers",
"(",
"NotifiableEntity",
"$",
"notifiableEntity",
")",
"{",
"$",
"discoveryNotifiables",
"=",
"$",
"this",
"->",
"getDiscoveryNotifiables",
"(",
")",
";",
"foreach",
"(",
"$",
"discoveryNotifiables",
"as",
"$",
... | Get the identifier mapping for a NotifiableEntity
@param NotifiableEntity $notifiableEntity
@return array
@throws \RuntimeException
@throws \InvalidArgumentException | [
"Get",
"the",
"identifier",
"mapping",
"for",
"a",
"NotifiableEntity"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L115-L124 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.generateIdentifier | public function generateIdentifier(NotifiableInterface $notifiable)
{
$Notifiableidentifiers = $this->getNotifiableIdentifier($notifiable);
$identifierValues = array();
foreach ($Notifiableidentifiers as $identifier) {
$method = sprintf('get%s', ucfirst($identifier));
$identifierValues[] = $notifiable->$method();
}
return implode('-', $identifierValues);
} | php | public function generateIdentifier(NotifiableInterface $notifiable)
{
$Notifiableidentifiers = $this->getNotifiableIdentifier($notifiable);
$identifierValues = array();
foreach ($Notifiableidentifiers as $identifier) {
$method = sprintf('get%s', ucfirst($identifier));
$identifierValues[] = $notifiable->$method();
}
return implode('-', $identifierValues);
} | [
"public",
"function",
"generateIdentifier",
"(",
"NotifiableInterface",
"$",
"notifiable",
")",
"{",
"$",
"Notifiableidentifiers",
"=",
"$",
"this",
"->",
"getNotifiableIdentifier",
"(",
"$",
"notifiable",
")",
";",
"$",
"identifierValues",
"=",
"array",
"(",
")",... | Generates the identifier value to store a NotifiableEntity
@param NotifiableInterface $notifiable
@return string
@throws \RuntimeException
@throws \InvalidArgumentException | [
"Generates",
"the",
"identifier",
"value",
"to",
"store",
"a",
"NotifiableEntity"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L136-L146 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.getNotifiableEntity | public function getNotifiableEntity(NotifiableInterface $notifiable)
{
$identifier = $this->generateIdentifier($notifiable);
$class = ClassUtils::getRealClass(get_class($notifiable));
$entity = $this->notifiableRepository->findOneBy(array(
'identifier' => $identifier,
'class' => $class
));
if (!$entity) {
$entity = new NotifiableEntity($identifier, $class);
$this->om->persist($entity);
$this->om->flush();
}
return $entity;
} | php | public function getNotifiableEntity(NotifiableInterface $notifiable)
{
$identifier = $this->generateIdentifier($notifiable);
$class = ClassUtils::getRealClass(get_class($notifiable));
$entity = $this->notifiableRepository->findOneBy(array(
'identifier' => $identifier,
'class' => $class
));
if (!$entity) {
$entity = new NotifiableEntity($identifier, $class);
$this->om->persist($entity);
$this->om->flush();
}
return $entity;
} | [
"public",
"function",
"getNotifiableEntity",
"(",
"NotifiableInterface",
"$",
"notifiable",
")",
"{",
"$",
"identifier",
"=",
"$",
"this",
"->",
"generateIdentifier",
"(",
"$",
"notifiable",
")",
";",
"$",
"class",
"=",
"ClassUtils",
"::",
"getRealClass",
"(",
... | Get a NotifiableEntity form a NotifiableInterface
@param NotifiableInterface $notifiable
@return NotifiableEntity
@throws \Doctrine\ORM\OptimisticLockException
@throws \Doctrine\ORM\ORMInvalidArgumentException
@throws \RuntimeException
@throws \InvalidArgumentException | [
"Get",
"a",
"NotifiableEntity",
"form",
"a",
"NotifiableInterface"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L159-L175 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.getNotifiableInterface | public function getNotifiableInterface(NotifiableEntity $notifiableEntity)
{
return $this->notifiableRepository->findNotifiableInterface(
$notifiableEntity,
$this->getNotifiableEntityIdentifiers($notifiableEntity)
);
} | php | public function getNotifiableInterface(NotifiableEntity $notifiableEntity)
{
return $this->notifiableRepository->findNotifiableInterface(
$notifiableEntity,
$this->getNotifiableEntityIdentifiers($notifiableEntity)
);
} | [
"public",
"function",
"getNotifiableInterface",
"(",
"NotifiableEntity",
"$",
"notifiableEntity",
")",
"{",
"return",
"$",
"this",
"->",
"notifiableRepository",
"->",
"findNotifiableInterface",
"(",
"$",
"notifiableEntity",
",",
"$",
"this",
"->",
"getNotifiableEntityId... | @param NotifiableEntity $notifiableEntity
@return NotifiableInterface
@throws \RuntimeException
@throws \InvalidArgumentException | [
"@param",
"NotifiableEntity",
"$notifiableEntity"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L185-L191 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.getNotifiableNotification | private function getNotifiableNotification(NotifiableInterface $notifiable, NotificationInterface $notification)
{
return $this->notifiableNotificationRepository->findOne(
$notification->getId(),
$this->getNotifiableEntity($notifiable)
);
} | php | private function getNotifiableNotification(NotifiableInterface $notifiable, NotificationInterface $notification)
{
return $this->notifiableNotificationRepository->findOne(
$notification->getId(),
$this->getNotifiableEntity($notifiable)
);
} | [
"private",
"function",
"getNotifiableNotification",
"(",
"NotifiableInterface",
"$",
"notifiable",
",",
"NotificationInterface",
"$",
"notification",
")",
"{",
"return",
"$",
"this",
"->",
"notifiableNotificationRepository",
"->",
"findOne",
"(",
"$",
"notification",
"-... | @param NotifiableInterface $notifiable
@param NotificationInterface $notification
@return NotifiableNotification|null
@throws \Doctrine\ORM\OptimisticLockException
@throws \Doctrine\ORM\ORMInvalidArgumentException
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Doctrine\ORM\NonUniqueResultException | [
"@param",
"NotifiableInterface",
"$notifiable",
"@param",
"NotificationInterface",
"$notification"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L214-L220 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.getUnseenNotifications | public function getUnseenNotifications(NotifiableInterface $notifiable, $order = 'DESC', $limit = null,
$offset = null)
{
return $this->notifiableNotificationRepository->findAllByNotifiable(
$this->generateIdentifier($notifiable),
ClassUtils::getRealClass(get_class($notifiable)),
false,
$order,
$limit,
$offset
);
} | php | public function getUnseenNotifications(NotifiableInterface $notifiable, $order = 'DESC', $limit = null,
$offset = null)
{
return $this->notifiableNotificationRepository->findAllByNotifiable(
$this->generateIdentifier($notifiable),
ClassUtils::getRealClass(get_class($notifiable)),
false,
$order,
$limit,
$offset
);
} | [
"public",
"function",
"getUnseenNotifications",
"(",
"NotifiableInterface",
"$",
"notifiable",
",",
"$",
"order",
"=",
"'DESC'",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"notifiableNotificationRepo... | @param NotifiableInterface $notifiable
@param string $order
@param null|int $limit
@param null|int $offset
@return array | [
"@param",
"NotifiableInterface",
"$notifiable",
"@param",
"string",
"$order",
"@param",
"null|int",
"$limit",
"@param",
"null|int",
"$offset"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L277-L288 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.createNotification | public function createNotification($subject, $message = null, $link = null)
{
$notification = new Notification();
$notification
->setSubject($subject)
->setMessage($message)
->setLink($link);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::CREATED, $event);
return $notification;
} | php | public function createNotification($subject, $message = null, $link = null)
{
$notification = new Notification();
$notification
->setSubject($subject)
->setMessage($message)
->setLink($link);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::CREATED, $event);
return $notification;
} | [
"public",
"function",
"createNotification",
"(",
"$",
"subject",
",",
"$",
"message",
"=",
"null",
",",
"$",
"link",
"=",
"null",
")",
"{",
"$",
"notification",
"=",
"new",
"Notification",
"(",
")",
";",
"$",
"notification",
"->",
"setSubject",
"(",
"$",... | @param string $subject
@param string $message
@param string $link
@return Notification | [
"@param",
"string",
"$subject",
"@param",
"string",
"$message",
"@param",
"string",
"$link"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L331-L343 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.addNotification | public function addNotification($notifiables, NotificationInterface $notification, $flush = false)
{
foreach ($notifiables as $notifiable) {
$entity = $this->getNotifiableEntity($notifiable);
$notifiableNotification = new NotifiableNotification();
$entity->addNotifiableNotification($notifiableNotification);
$notification->addNotifiableNotification($notifiableNotification);
$event = new NotificationEvent($notification, $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::ASSIGNED, $event);
}
$this->flush($flush);
} | php | public function addNotification($notifiables, NotificationInterface $notification, $flush = false)
{
foreach ($notifiables as $notifiable) {
$entity = $this->getNotifiableEntity($notifiable);
$notifiableNotification = new NotifiableNotification();
$entity->addNotifiableNotification($notifiableNotification);
$notification->addNotifiableNotification($notifiableNotification);
$event = new NotificationEvent($notification, $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::ASSIGNED, $event);
}
$this->flush($flush);
} | [
"public",
"function",
"addNotification",
"(",
"$",
"notifiables",
",",
"NotificationInterface",
"$",
"notification",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"notifiables",
"as",
"$",
"notifiable",
")",
"{",
"$",
"entity",
"=",
"$",
... | Add a Notification to a list of NotifiableInterface entities
@param NotifiableInterface[] $notifiables
@param NotificationInterface $notification
@param bool $flush
@throws \Doctrine\ORM\OptimisticLockException
@throws \Doctrine\ORM\ORMInvalidArgumentException
@throws \InvalidArgumentException
@throws \RuntimeException | [
"Add",
"a",
"Notification",
"to",
"a",
"list",
"of",
"NotifiableInterface",
"entities"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L357-L371 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.removeNotification | public function removeNotification(array $notifiables, NotificationInterface $notification, $flush = false)
{
$repo = $this->om->getRepository('MgiletNotificationBundle:NotifiableNotification');
foreach ($notifiables as $notifiable) {
$repo->createQueryBuilder('nn')
->delete()
->where('nn.notifiableEntity = :entity')
->andWhere('nn.notification = :notification')
->setParameter('entity', $this->getNotifiableEntity($notifiable))
->setParameter('notification', $notification)
->getQuery()
->execute();
$event = new NotificationEvent($notification, $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::REMOVED, $event);
}
$this->flush($flush);
} | php | public function removeNotification(array $notifiables, NotificationInterface $notification, $flush = false)
{
$repo = $this->om->getRepository('MgiletNotificationBundle:NotifiableNotification');
foreach ($notifiables as $notifiable) {
$repo->createQueryBuilder('nn')
->delete()
->where('nn.notifiableEntity = :entity')
->andWhere('nn.notification = :notification')
->setParameter('entity', $this->getNotifiableEntity($notifiable))
->setParameter('notification', $notification)
->getQuery()
->execute();
$event = new NotificationEvent($notification, $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::REMOVED, $event);
}
$this->flush($flush);
} | [
"public",
"function",
"removeNotification",
"(",
"array",
"$",
"notifiables",
",",
"NotificationInterface",
"$",
"notification",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"$",
"repo",
"=",
"$",
"this",
"->",
"om",
"->",
"getRepository",
"(",
"'MgiletNotificat... | Deletes the link between a Notifiable and a Notification
@param array $notifiables
@param NotificationInterface $notification
@param bool $flush
@throws \Doctrine\ORM\ORMInvalidArgumentException
@throws \Doctrine\ORM\OptimisticLockException
@throws \InvalidArgumentException
@throws \RuntimeException | [
"Deletes",
"the",
"link",
"between",
"a",
"Notifiable",
"and",
"a",
"Notification"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L385-L403 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.deleteNotification | public function deleteNotification(NotificationInterface $notification, $flush = false)
{
$this->om->remove($notification);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::DELETED, $event);
} | php | public function deleteNotification(NotificationInterface $notification, $flush = false)
{
$this->om->remove($notification);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::DELETED, $event);
} | [
"public",
"function",
"deleteNotification",
"(",
"NotificationInterface",
"$",
"notification",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"remove",
"(",
"$",
"notification",
")",
";",
"$",
"this",
"->",
"flush",
"(",
"$",
"... | @param NotificationInterface $notification
@param bool $flush
@throws \Doctrine\ORM\ORMInvalidArgumentException
@throws \Doctrine\ORM\OptimisticLockException | [
"@param",
"NotificationInterface",
"$notification"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L413-L420 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.markAsSeen | public function markAsSeen(NotifiableInterface $notifiable, NotificationInterface $notification, $flush = false)
{
$nn = $this->getNotifiableNotification($notifiable, $notification);
if ($nn) {
$nn->setSeen(true);
$event = new NotificationEvent($notification, $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::SEEN, $event);
$this->flush($flush);
} else {
throw new EntityNotFoundException('The link between the notifiable and the notification has not been found');
}
} | php | public function markAsSeen(NotifiableInterface $notifiable, NotificationInterface $notification, $flush = false)
{
$nn = $this->getNotifiableNotification($notifiable, $notification);
if ($nn) {
$nn->setSeen(true);
$event = new NotificationEvent($notification, $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::SEEN, $event);
$this->flush($flush);
} else {
throw new EntityNotFoundException('The link between the notifiable and the notification has not been found');
}
} | [
"public",
"function",
"markAsSeen",
"(",
"NotifiableInterface",
"$",
"notifiable",
",",
"NotificationInterface",
"$",
"notification",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"$",
"nn",
"=",
"$",
"this",
"->",
"getNotifiableNotification",
"(",
"$",
"notifiable... | @param NotifiableInterface $notifiable
@param NotificationInterface $notification
@param bool $flush
@throws EntityNotFoundException
@throws \Doctrine\ORM\OptimisticLockException
@throws \Doctrine\ORM\NonUniqueResultException | [
"@param",
"NotifiableInterface",
"$notifiable",
"@param",
"NotificationInterface",
"$notification",
"@param",
"bool",
"$flush"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L431-L442 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.markAsUnseen | public function markAsUnseen(NotifiableInterface $notifiable, NotificationInterface $notification, $flush = false)
{
$nn = $this->getNotifiableNotification($notifiable, $notification);
if ($nn) {
$nn->setSeen(false);
$event = new NotificationEvent($notification, $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::UNSEEN, $event);
$this->flush($flush);
} else {
throw new EntityNotFoundException('The link between the notifiable and the notification has not been found');
}
} | php | public function markAsUnseen(NotifiableInterface $notifiable, NotificationInterface $notification, $flush = false)
{
$nn = $this->getNotifiableNotification($notifiable, $notification);
if ($nn) {
$nn->setSeen(false);
$event = new NotificationEvent($notification, $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::UNSEEN, $event);
$this->flush($flush);
} else {
throw new EntityNotFoundException('The link between the notifiable and the notification has not been found');
}
} | [
"public",
"function",
"markAsUnseen",
"(",
"NotifiableInterface",
"$",
"notifiable",
",",
"NotificationInterface",
"$",
"notification",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"$",
"nn",
"=",
"$",
"this",
"->",
"getNotifiableNotification",
"(",
"$",
"notifiab... | @param NotifiableInterface $notifiable
@param NotificationInterface $notification
@param bool $flush
@throws EntityNotFoundException
@throws \Doctrine\ORM\NonUniqueResultException
@throws \Doctrine\ORM\OptimisticLockException | [
"@param",
"NotifiableInterface",
"$notifiable",
"@param",
"NotificationInterface",
"$notification",
"@param",
"bool",
"$flush"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L453-L464 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.markAllAsSeen | public function markAllAsSeen(NotifiableInterface $notifiable, $flush = false)
{
$nns = $this->notifiableNotificationRepository->findAllForNotifiable(
$this->generateIdentifier($notifiable),
ClassUtils::getRealClass(get_class($notifiable))
);
foreach ($nns as $nn) {
$nn->setSeen(true);
$event = new NotificationEvent($nn->getNotification(), $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::SEEN, $event);
}
$this->flush($flush);
} | php | public function markAllAsSeen(NotifiableInterface $notifiable, $flush = false)
{
$nns = $this->notifiableNotificationRepository->findAllForNotifiable(
$this->generateIdentifier($notifiable),
ClassUtils::getRealClass(get_class($notifiable))
);
foreach ($nns as $nn) {
$nn->setSeen(true);
$event = new NotificationEvent($nn->getNotification(), $notifiable);
$this->dispatcher->dispatch(MgiletNotificationEvents::SEEN, $event);
}
$this->flush($flush);
} | [
"public",
"function",
"markAllAsSeen",
"(",
"NotifiableInterface",
"$",
"notifiable",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"$",
"nns",
"=",
"$",
"this",
"->",
"notifiableNotificationRepository",
"->",
"findAllForNotifiable",
"(",
"$",
"this",
"->",
"genera... | @param NotifiableInterface $notifiable
@param bool $flush
@throws \InvalidArgumentException
@throws \RuntimeException
@throws \Doctrine\ORM\OptimisticLockException | [
"@param",
"NotifiableInterface",
"$notifiable",
"@param",
"bool",
"$flush"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L474-L486 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.isSeen | public function isSeen(NotifiableInterface $notifiable, NotificationInterface $notification)
{
$nn = $this->getNotifiableNotification($notifiable, $notification);
if ($nn) {
return $nn->isSeen();
}
throw new EntityNotFoundException('The link between the notifiable and the notification has not been found');
} | php | public function isSeen(NotifiableInterface $notifiable, NotificationInterface $notification)
{
$nn = $this->getNotifiableNotification($notifiable, $notification);
if ($nn) {
return $nn->isSeen();
}
throw new EntityNotFoundException('The link between the notifiable and the notification has not been found');
} | [
"public",
"function",
"isSeen",
"(",
"NotifiableInterface",
"$",
"notifiable",
",",
"NotificationInterface",
"$",
"notification",
")",
"{",
"$",
"nn",
"=",
"$",
"this",
"->",
"getNotifiableNotification",
"(",
"$",
"notifiable",
",",
"$",
"notification",
")",
";"... | @param NotifiableInterface $notifiable
@param NotificationInterface $notification
@return bool
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Doctrine\ORM\NonUniqueResultException
@throws EntityNotFoundException | [
"@param",
"NotifiableInterface",
"$notifiable",
"@param",
"NotificationInterface",
"$notification"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L498-L506 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.getNotificationCount | public function getNotificationCount(NotifiableInterface $notifiable)
{
return $this->notifiableNotificationRepository->getNotificationCount(
$this->generateIdentifier($notifiable),
ClassUtils::getRealClass(get_class($notifiable))
);
} | php | public function getNotificationCount(NotifiableInterface $notifiable)
{
return $this->notifiableNotificationRepository->getNotificationCount(
$this->generateIdentifier($notifiable),
ClassUtils::getRealClass(get_class($notifiable))
);
} | [
"public",
"function",
"getNotificationCount",
"(",
"NotifiableInterface",
"$",
"notifiable",
")",
"{",
"return",
"$",
"this",
"->",
"notifiableNotificationRepository",
"->",
"getNotificationCount",
"(",
"$",
"this",
"->",
"generateIdentifier",
"(",
"$",
"notifiable",
... | @param NotifiableInterface $notifiable
@return int
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Doctrine\ORM\NonUniqueResultException
@throws \Doctrine\ORM\NoResultException | [
"@param",
"NotifiableInterface",
"$notifiable"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L517-L523 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.setDate | public function setDate(NotificationInterface $notification, \DateTime $dateTime, $flush = false)
{
$notification->setDate($dateTime);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);
return $notification;
} | php | public function setDate(NotificationInterface $notification, \DateTime $dateTime, $flush = false)
{
$notification->setDate($dateTime);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);
return $notification;
} | [
"public",
"function",
"setDate",
"(",
"NotificationInterface",
"$",
"notification",
",",
"\\",
"DateTime",
"$",
"dateTime",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"$",
"notification",
"->",
"setDate",
"(",
"$",
"dateTime",
")",
";",
"$",
"this",
"->",
... | @param NotificationInterface $notification
@param \DateTime $dateTime
@param bool $flush
@return NotificationInterface
@throws \Doctrine\ORM\OptimisticLockException | [
"@param",
"NotificationInterface",
"$notification",
"@param",
"\\",
"DateTime",
"$dateTime",
"@param",
"bool",
"$flush"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L569-L578 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.setSubject | public function setSubject(NotificationInterface $notification, $subject, $flush = false)
{
$notification->setSubject($subject);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);
return $notification;
} | php | public function setSubject(NotificationInterface $notification, $subject, $flush = false)
{
$notification->setSubject($subject);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);
return $notification;
} | [
"public",
"function",
"setSubject",
"(",
"NotificationInterface",
"$",
"notification",
",",
"$",
"subject",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"$",
"notification",
"->",
"setSubject",
"(",
"$",
"subject",
")",
";",
"$",
"this",
"->",
"flush",
"(",
... | @param NotificationInterface $notification
@param string $subject
@param bool $flush
@return NotificationInterface
@throws \Doctrine\ORM\OptimisticLockException | [
"@param",
"NotificationInterface",
"$notification",
"@param",
"string",
"$subject",
"@param",
"bool",
"$flush"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L588-L597 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.setMessage | public function setMessage(NotificationInterface $notification, $message, $flush = false)
{
$notification->setMessage($message);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);
return $notification;
} | php | public function setMessage(NotificationInterface $notification, $message, $flush = false)
{
$notification->setMessage($message);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);
return $notification;
} | [
"public",
"function",
"setMessage",
"(",
"NotificationInterface",
"$",
"notification",
",",
"$",
"message",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"$",
"notification",
"->",
"setMessage",
"(",
"$",
"message",
")",
";",
"$",
"this",
"->",
"flush",
"(",
... | @param NotificationInterface $notification
@param string $message
@param bool $flush
@return NotificationInterface
@throws \Doctrine\ORM\OptimisticLockException | [
"@param",
"NotificationInterface",
"$notification",
"@param",
"string",
"$message",
"@param",
"bool",
"$flush"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L607-L616 |
maximilienGilet/notification-bundle | Manager/NotificationManager.php | NotificationManager.setLink | public function setLink(NotificationInterface $notification, $link, $flush = false)
{
$notification->setLink($link);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);
return $notification;
} | php | public function setLink(NotificationInterface $notification, $link, $flush = false)
{
$notification->setLink($link);
$this->flush($flush);
$event = new NotificationEvent($notification);
$this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);
return $notification;
} | [
"public",
"function",
"setLink",
"(",
"NotificationInterface",
"$",
"notification",
",",
"$",
"link",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"$",
"notification",
"->",
"setLink",
"(",
"$",
"link",
")",
";",
"$",
"this",
"->",
"flush",
"(",
"$",
"fl... | @param NotificationInterface $notification
@param string $link
@param bool $flush
@return NotificationInterface
@throws \Doctrine\ORM\OptimisticLockException | [
"@param",
"NotificationInterface",
"$notification",
"@param",
"string",
"$link",
"@param",
"bool",
"$flush"
] | train | https://github.com/maximilienGilet/notification-bundle/blob/68fe794787176f60977a98ecf0d6b9ef86109e53/Manager/NotificationManager.php#L626-L635 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonRecommendationList.php | AmazonRecommendationList.setFilter | public function setFilter($a) {
$this->resetFilters();
if (is_array($a)) {
$i = 1;
foreach ($a as $c => $r) {
if (empty($r) || !is_array($r)) {
$this->resetFilters();
return false;
}
$prefix = 'CategoryQueryList.CategoryQuery.'.$i;
$this->options[$prefix.'.RecommendationCategory'] = $c;
$j = 1;
foreach ($r as $k => $x) {
$this->options[$prefix.'.FilterOptions.FilterOption.'.$j] = $k.'='.$x;
$j++;
}
$i++;
}
} else {
return false;
}
/*
* Valid filters for ListingQuality recommendations:
* QualitySet: "Defect" or "Quarantine"
* ListingStatus: "Active" or "Inactive"
* Valid filters for Selection, Fulfillment, GlobalSelling, and Advertising recommendations:
* BrandName: any brand name
* ProductCategory: any product category
* Valid filters for Selection recommendations:
* IncludeCommonRecommendations: "true" or "false"
*/
} | php | public function setFilter($a) {
$this->resetFilters();
if (is_array($a)) {
$i = 1;
foreach ($a as $c => $r) {
if (empty($r) || !is_array($r)) {
$this->resetFilters();
return false;
}
$prefix = 'CategoryQueryList.CategoryQuery.'.$i;
$this->options[$prefix.'.RecommendationCategory'] = $c;
$j = 1;
foreach ($r as $k => $x) {
$this->options[$prefix.'.FilterOptions.FilterOption.'.$j] = $k.'='.$x;
$j++;
}
$i++;
}
} else {
return false;
}
/*
* Valid filters for ListingQuality recommendations:
* QualitySet: "Defect" or "Quarantine"
* ListingStatus: "Active" or "Inactive"
* Valid filters for Selection, Fulfillment, GlobalSelling, and Advertising recommendations:
* BrandName: any brand name
* ProductCategory: any product category
* Valid filters for Selection recommendations:
* IncludeCommonRecommendations: "true" or "false"
*/
} | [
"public",
"function",
"setFilter",
"(",
"$",
"a",
")",
"{",
"$",
"this",
"->",
"resetFilters",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"a",
")",
")",
"{",
"$",
"i",
"=",
"1",
";",
"foreach",
"(",
"$",
"a",
"as",
"$",
"c",
"=>",
"$",
... | Sets the category filter. (Optional)
If this parameter is set, Amazon will only return recommendations that
match the given filters. If this parameter is not sent, Amazon will return
all recommendations for each category.
The given array should be two-dimensional, with the first level indexed by
the name of the category, and the second level as a list of key/value pairs
of filters for that specific category.
See <i>setCategory</i> for a list of valid categories.
See the comment inside for a list of valid filters.
@param array $a <p>See above.</p>
@return boolean <b>FALSE</b> if improper input
@see setCategory | [
"Sets",
"the",
"category",
"filter",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonRecommendationList.php#L97-L128 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonRecommendationList.php | AmazonRecommendationList.resetFilters | public function resetFilters() {
foreach($this->options as $op=>$junk) {
if(preg_match("#CategoryQueryList#",$op)) {
unset($this->options[$op]);
}
}
} | php | public function resetFilters() {
foreach($this->options as $op=>$junk) {
if(preg_match("#CategoryQueryList#",$op)) {
unset($this->options[$op]);
}
}
} | [
"public",
"function",
"resetFilters",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#CategoryQueryList#\"",
",",
"$",
"op",
")",
")",
"{",
"unset",
"(",
"$"... | Removes filter options.
Use this in case you change your mind and want to remove the filter
parameters you previously set. | [
"Removes",
"filter",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonRecommendationList.php#L136-L142 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonRecommendationList.php | AmazonRecommendationList.prepareTimes | protected function prepareTimes() {
$this->options['Action'] = 'GetLastUpdatedTimeForRecommendations';
$this->throttleGroup = 'GetLastUpdatedTimeForRecommendations';
unset($this->options['NextToken']);
unset($this->options['RecommendationCategory']);
$this->resetFilters();
$this->updated = array();
} | php | protected function prepareTimes() {
$this->options['Action'] = 'GetLastUpdatedTimeForRecommendations';
$this->throttleGroup = 'GetLastUpdatedTimeForRecommendations';
unset($this->options['NextToken']);
unset($this->options['RecommendationCategory']);
$this->resetFilters();
$this->updated = array();
} | [
"protected",
"function",
"prepareTimes",
"(",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'Action'",
"]",
"=",
"'GetLastUpdatedTimeForRecommendations'",
";",
"$",
"this",
"->",
"throttleGroup",
"=",
"'GetLastUpdatedTimeForRecommendations'",
";",
"unset",
"(",
"$",... | Sets up options for using <i>fetchLastUpdateTimes</i>.
This changes key options for using <i>fetchLastUpdateTimes</i>.
Please note: because this operation does not use all of the parameters,
the following parameters are removed:
category, filters, and token. | [
"Sets",
"up",
"options",
"for",
"using",
"<i",
">",
"fetchLastUpdateTimes<",
"/",
"i",
">",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonRecommendationList.php#L188-L195 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonRecommendationList.php | AmazonRecommendationList.prepareToken | protected function prepareToken() {
$this->throttleGroup = 'ListRecommendations';
if ($this->tokenFlag && $this->tokenUseFlag) {
$this->options['Action'] = 'ListRecommendationsByNextToken';
//When using tokens, only the NextToken option should be used
unset($this->options['RecommendationCategory']);
$this->resetFilters();
} else {
$this->options['Action'] = 'ListRecommendations';
unset($this->options['NextToken']);
$this->list = array();
$this->listkey = null;
if (isset($this->options['RecommendationCategory'])) {
$this->listkey = $this->options['RecommendationCategory'];
}
}
} | php | protected function prepareToken() {
$this->throttleGroup = 'ListRecommendations';
if ($this->tokenFlag && $this->tokenUseFlag) {
$this->options['Action'] = 'ListRecommendationsByNextToken';
//When using tokens, only the NextToken option should be used
unset($this->options['RecommendationCategory']);
$this->resetFilters();
} else {
$this->options['Action'] = 'ListRecommendations';
unset($this->options['NextToken']);
$this->list = array();
$this->listkey = null;
if (isset($this->options['RecommendationCategory'])) {
$this->listkey = $this->options['RecommendationCategory'];
}
}
} | [
"protected",
"function",
"prepareToken",
"(",
")",
"{",
"$",
"this",
"->",
"throttleGroup",
"=",
"'ListRecommendations'",
";",
"if",
"(",
"$",
"this",
"->",
"tokenFlag",
"&&",
"$",
"this",
"->",
"tokenUseFlag",
")",
"{",
"$",
"this",
"->",
"options",
"[",
... | Sets up options for using tokens.
This changes key options for switching between simply fetching a list and
fetching the rest of a list using a token. Please note: because the
operation for using tokens does not use any other parameters, all other
parameters will be removed. | [
"Sets",
"up",
"options",
"for",
"using",
"tokens",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonRecommendationList.php#L252-L269 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonRecommendationList.php | AmazonRecommendationList.parseXML | protected function parseXML($xml){
if (!$xml) {
return false;
}
if ($xml->InventoryRecommendationsLastUpdated) {
$this->updated['Inventory'] = (string)$xml->InventoryRecommendationsLastUpdated;
}
if ($xml->SelectionRecommendationsLastUpdated) {
$this->updated['Selection'] = (string)$xml->SelectionRecommendationsLastUpdated;
}
if ($xml->PricingRecommendationsLastUpdated) {
$this->updated['Pricing'] = (string)$xml->PricingRecommendationsLastUpdated;
}
if ($xml->FulfillmentRecommendationsLastUpdated) {
$this->updated['Fulfillment'] = (string)$xml->FulfillmentRecommendationsLastUpdated;
}
if ($xml->GlobalSellingRecommendationsLastUpdated) {
$this->updated['GlobalSelling'] = (string)$xml->GlobalSellingRecommendationsLastUpdated;
}
if ($xml->AdvertisingRecommendationsLastUpdated) {
$this->updated['Advertising'] = (string)$xml->AdvertisingRecommendationsLastUpdated;
}
if (isset($xml->InventoryRecommendations)) {
foreach ($xml->InventoryRecommendations->children() as $x) {
$this->list['Inventory'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->SelectionRecommendations)) {
foreach ($xml->SelectionRecommendations->children() as $x) {
$this->list['Selection'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->PricingRecommendations)) {
foreach ($xml->PricingRecommendations->children() as $x) {
$this->list['Pricing'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->FulfillmentRecommendations)) {
foreach ($xml->FulfillmentRecommendations->children() as $x) {
$this->list['Fulfillment'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->ListingQualityRecommendations)) {
foreach ($xml->ListingQualityRecommendations->children() as $x) {
$this->list['ListingQuality'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->GlobalSellingRecommendations)) {
foreach ($xml->GlobalSellingRecommendations->children() as $x) {
$this->list['GlobalSelling'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->AdvertisingRecommendations)) {
foreach ($xml->AdvertisingRecommendations->children() as $x) {
$this->list['Advertising'][] = $this->parseRecommendation($x);
}
}
} | php | protected function parseXML($xml){
if (!$xml) {
return false;
}
if ($xml->InventoryRecommendationsLastUpdated) {
$this->updated['Inventory'] = (string)$xml->InventoryRecommendationsLastUpdated;
}
if ($xml->SelectionRecommendationsLastUpdated) {
$this->updated['Selection'] = (string)$xml->SelectionRecommendationsLastUpdated;
}
if ($xml->PricingRecommendationsLastUpdated) {
$this->updated['Pricing'] = (string)$xml->PricingRecommendationsLastUpdated;
}
if ($xml->FulfillmentRecommendationsLastUpdated) {
$this->updated['Fulfillment'] = (string)$xml->FulfillmentRecommendationsLastUpdated;
}
if ($xml->GlobalSellingRecommendationsLastUpdated) {
$this->updated['GlobalSelling'] = (string)$xml->GlobalSellingRecommendationsLastUpdated;
}
if ($xml->AdvertisingRecommendationsLastUpdated) {
$this->updated['Advertising'] = (string)$xml->AdvertisingRecommendationsLastUpdated;
}
if (isset($xml->InventoryRecommendations)) {
foreach ($xml->InventoryRecommendations->children() as $x) {
$this->list['Inventory'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->SelectionRecommendations)) {
foreach ($xml->SelectionRecommendations->children() as $x) {
$this->list['Selection'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->PricingRecommendations)) {
foreach ($xml->PricingRecommendations->children() as $x) {
$this->list['Pricing'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->FulfillmentRecommendations)) {
foreach ($xml->FulfillmentRecommendations->children() as $x) {
$this->list['Fulfillment'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->ListingQualityRecommendations)) {
foreach ($xml->ListingQualityRecommendations->children() as $x) {
$this->list['ListingQuality'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->GlobalSellingRecommendations)) {
foreach ($xml->GlobalSellingRecommendations->children() as $x) {
$this->list['GlobalSelling'][] = $this->parseRecommendation($x);
}
}
if (isset($xml->AdvertisingRecommendations)) {
foreach ($xml->AdvertisingRecommendations->children() as $x) {
$this->list['Advertising'][] = $this->parseRecommendation($x);
}
}
} | [
"protected",
"function",
"parseXML",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"xml",
"->",
"InventoryRecommendationsLastUpdated",
")",
"{",
"$",
"this",
"->",
"updated",
"[",
"'Invent... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonRecommendationList.php#L278-L337 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonRecommendationList.php | AmazonRecommendationList.parseRecommendation | protected function parseRecommendation($xml) {
$r = array();
foreach ($xml->children() as $x) {
if (isset($x->Asin)) {
$r[$x->getName()]['ASIN'] = (string)$x->Asin;
$r[$x->getName()]['SKU'] = (string)$x->Sku;
$r[$x->getName()]['UPC'] = (string)$x->Upc;
} else if (isset($x->CurrencyCode)) {
$r[$x->getName()]['Amount'] = (string)$x->Amount;
$r[$x->getName()]['CurrencyCode'] = (string)$x->CurrencyCode;
} else if (isset($x->Height)) {
$r[$x->getName()]['Height']['Value'] = (string)$x->Height->Value;
$r[$x->getName()]['Height']['Unit'] = (string)$x->Height->Unit;
$r[$x->getName()]['Width']['Value'] = (string)$x->Width->Value;
$r[$x->getName()]['Width']['Unit'] = (string)$x->Width->Unit;
$r[$x->getName()]['Length']['Value'] = (string)$x->Length->Value;
$r[$x->getName()]['Length']['Unit'] = (string)$x->Length->Unit;
$r[$x->getName()]['Weight']['Value'] = (string)$x->Weight->Value;
$r[$x->getName()]['Weight']['Unit'] = (string)$x->Weight->Unit;
} else {
$r[$x->getName()] = (string)$x;
}
}
return $r;
} | php | protected function parseRecommendation($xml) {
$r = array();
foreach ($xml->children() as $x) {
if (isset($x->Asin)) {
$r[$x->getName()]['ASIN'] = (string)$x->Asin;
$r[$x->getName()]['SKU'] = (string)$x->Sku;
$r[$x->getName()]['UPC'] = (string)$x->Upc;
} else if (isset($x->CurrencyCode)) {
$r[$x->getName()]['Amount'] = (string)$x->Amount;
$r[$x->getName()]['CurrencyCode'] = (string)$x->CurrencyCode;
} else if (isset($x->Height)) {
$r[$x->getName()]['Height']['Value'] = (string)$x->Height->Value;
$r[$x->getName()]['Height']['Unit'] = (string)$x->Height->Unit;
$r[$x->getName()]['Width']['Value'] = (string)$x->Width->Value;
$r[$x->getName()]['Width']['Unit'] = (string)$x->Width->Unit;
$r[$x->getName()]['Length']['Value'] = (string)$x->Length->Value;
$r[$x->getName()]['Length']['Unit'] = (string)$x->Length->Unit;
$r[$x->getName()]['Weight']['Value'] = (string)$x->Weight->Value;
$r[$x->getName()]['Weight']['Unit'] = (string)$x->Weight->Unit;
} else {
$r[$x->getName()] = (string)$x;
}
}
return $r;
} | [
"protected",
"function",
"parseRecommendation",
"(",
"$",
"xml",
")",
"{",
"$",
"r",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"->",
"children",
"(",
")",
"as",
"$",
"x",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"x",
"->",
"Asin",
... | Parses XML response for a single recommendation into an array.
@param SimpleXMLElement $xml
@return array parsed structure from XML | [
"Parses",
"XML",
"response",
"for",
"a",
"single",
"recommendation",
"into",
"an",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonRecommendationList.php#L344-L368 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportScheduleList.php | AmazonReportScheduleList.setReportTypes | public function setReportTypes($s){
if (is_string($s)){
$this->resetReportTypes();
$this->options['ReportTypeList.Type.1'] = $s;
} else if (is_array($s)){
$this->resetReportTypes();
$i = 1;
foreach ($s as $x){
$this->options['ReportTypeList.Type.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | php | public function setReportTypes($s){
if (is_string($s)){
$this->resetReportTypes();
$this->options['ReportTypeList.Type.1'] = $s;
} else if (is_array($s)){
$this->resetReportTypes();
$i = 1;
foreach ($s as $x){
$this->options['ReportTypeList.Type.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | [
"public",
"function",
"setReportTypes",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"s",
")",
")",
"{",
"$",
"this",
"->",
"resetReportTypes",
"(",
")",
";",
"$",
"this",
"->",
"options",
"[",
"'ReportTypeList.Type.1'",
"]",
"=",
"$",
... | Sets the report type(s). (Optional)
This method sets the list of report types to be sent in the next request.
@param array|string $s <p>A list of report types, or a single type string.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"report",
"type",
"(",
"s",
")",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportScheduleList.php#L94-L108 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportScheduleList.php | AmazonReportScheduleList.resetReportTypes | public function resetReportTypes(){
foreach($this->options as $op=>$junk){
if(preg_match("#ReportTypeList#",$op)){
unset($this->options[$op]);
}
}
} | php | public function resetReportTypes(){
foreach($this->options as $op=>$junk){
if(preg_match("#ReportTypeList#",$op)){
unset($this->options[$op]);
}
}
} | [
"public",
"function",
"resetReportTypes",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#ReportTypeList#\"",
",",
"$",
"op",
")",
")",
"{",
"unset",
"(",
"$... | Removes report type options.
Use this in case you change your mind and want to remove the Report Type
parameters you previously set. | [
"Removes",
"report",
"type",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportScheduleList.php#L116-L122 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportScheduleList.php | AmazonReportScheduleList.fetchReportList | public function fetchReportList($r = true){
$this->prepareToken();
$url = $this->urlbase.$this->urlbranch;
$query = $this->genQuery();
$path = $this->options['Action'].'Result';
if ($this->mockMode){
$xml = $this->fetchMockFile()->$path;
} else {
$response = $this->sendRequest($url, array('Post'=>$query));
if (!$this->checkResponse($response)){
return false;
}
$xml = simplexml_load_string($response['body'])->$path;
}
$this->parseXML($xml);
$this->checkToken($xml);
if ($this->tokenFlag && $this->tokenUseFlag && $r === true){
while ($this->tokenFlag){
$this->log("Recursively fetching more Report Schedules");
$this->fetchReportList(false);
}
}
} | php | public function fetchReportList($r = true){
$this->prepareToken();
$url = $this->urlbase.$this->urlbranch;
$query = $this->genQuery();
$path = $this->options['Action'].'Result';
if ($this->mockMode){
$xml = $this->fetchMockFile()->$path;
} else {
$response = $this->sendRequest($url, array('Post'=>$query));
if (!$this->checkResponse($response)){
return false;
}
$xml = simplexml_load_string($response['body'])->$path;
}
$this->parseXML($xml);
$this->checkToken($xml);
if ($this->tokenFlag && $this->tokenUseFlag && $r === true){
while ($this->tokenFlag){
$this->log("Recursively fetching more Report Schedules");
$this->fetchReportList(false);
}
}
} | [
"public",
"function",
"fetchReportList",
"(",
"$",
"r",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"prepareToken",
"(",
")",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"urlbase",
".",
"$",
"this",
"->",
"urlbranch",
";",
"$",
"query",
"=",
"$",
"this"... | Fetches a list of Report Schedules from Amazon.
Submits a <i>GetReportScheduleList</i> request to Amazon. Amazon will send
the list back as a response, which can be retrieved using <i>getList</i>.
Other methods are available for fetching specific values from the list.
This operation can potentially involve tokens.
@param boolean $r [optional] <p>When set to <b>FALSE</b>, the function will not recurse, defaults to <b>TRUE</b></p>
@return boolean <b>FALSE</b> if something goes wrong | [
"Fetches",
"a",
"list",
"of",
"Report",
"Schedules",
"from",
"Amazon",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportScheduleList.php#L134-L167 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportScheduleList.php | AmazonReportScheduleList.prepareToken | protected function prepareToken(){
include($this->env);
if ($this->tokenFlag && $this->tokenUseFlag){
$this->options['Action'] = 'GetReportScheduleListByNextToken';
if(isset($THROTTLE_LIMIT_REPORTTOKEN)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTTOKEN;
}
if(isset($THROTTLE_TIME_REPORTTOKEN)) {
$this->throttleTime = $THROTTLE_TIME_REPORTTOKEN;
}
$this->throttleGroup = 'GetReportScheduleListByNextToken';
$this->resetReportTypes();
} else {
$this->options['Action'] = 'GetReportScheduleList';
if(isset($THROTTLE_LIMIT_REPORTSCHEDULE)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTSCHEDULE;
}
if(isset($THROTTLE_TIME_REPORTSCHEDULE)) {
$this->throttleTime = $THROTTLE_TIME_REPORTSCHEDULE;
}
$this->throttleGroup = 'GetReportScheduleList';
unset($this->options['NextToken']);
$this->scheduleList = array();
$this->index = 0;
}
} | php | protected function prepareToken(){
include($this->env);
if ($this->tokenFlag && $this->tokenUseFlag){
$this->options['Action'] = 'GetReportScheduleListByNextToken';
if(isset($THROTTLE_LIMIT_REPORTTOKEN)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTTOKEN;
}
if(isset($THROTTLE_TIME_REPORTTOKEN)) {
$this->throttleTime = $THROTTLE_TIME_REPORTTOKEN;
}
$this->throttleGroup = 'GetReportScheduleListByNextToken';
$this->resetReportTypes();
} else {
$this->options['Action'] = 'GetReportScheduleList';
if(isset($THROTTLE_LIMIT_REPORTSCHEDULE)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTSCHEDULE;
}
if(isset($THROTTLE_TIME_REPORTSCHEDULE)) {
$this->throttleTime = $THROTTLE_TIME_REPORTSCHEDULE;
}
$this->throttleGroup = 'GetReportScheduleList';
unset($this->options['NextToken']);
$this->scheduleList = array();
$this->index = 0;
}
} | [
"protected",
"function",
"prepareToken",
"(",
")",
"{",
"include",
"(",
"$",
"this",
"->",
"env",
")",
";",
"if",
"(",
"$",
"this",
"->",
"tokenFlag",
"&&",
"$",
"this",
"->",
"tokenUseFlag",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'Action'",
"... | Sets up options for using tokens.
This changes key options for switching between simply fetching a list and
fetching the rest of a list using a token. Please note: because the
operation for using tokens does not use any other parameters, all other
parameters will be removed. | [
"Sets",
"up",
"options",
"for",
"using",
"tokens",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportScheduleList.php#L177-L202 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportScheduleList.php | AmazonReportScheduleList.prepareCount | protected function prepareCount(){
include($this->env);
$this->options['Action'] = 'GetReportScheduleCount';
if(isset($THROTTLE_LIMIT_REPORTSCHEDULE)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTSCHEDULE;
}
if(isset($THROTTLE_TIME_REPORTSCHEDULE)) {
$this->throttleTime = $THROTTLE_TIME_REPORTSCHEDULE;
}
$this->throttleGroup = 'GetReportScheduleCount';
unset($this->options['NextToken']);
} | php | protected function prepareCount(){
include($this->env);
$this->options['Action'] = 'GetReportScheduleCount';
if(isset($THROTTLE_LIMIT_REPORTSCHEDULE)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTSCHEDULE;
}
if(isset($THROTTLE_TIME_REPORTSCHEDULE)) {
$this->throttleTime = $THROTTLE_TIME_REPORTSCHEDULE;
}
$this->throttleGroup = 'GetReportScheduleCount';
unset($this->options['NextToken']);
} | [
"protected",
"function",
"prepareCount",
"(",
")",
"{",
"include",
"(",
"$",
"this",
"->",
"env",
")",
";",
"$",
"this",
"->",
"options",
"[",
"'Action'",
"]",
"=",
"'GetReportScheduleCount'",
";",
"if",
"(",
"isset",
"(",
"$",
"THROTTLE_LIMIT_REPORTSCHEDULE... | Sets up options for using <i>countFeeds</i>.
This changes key options for using <i>countFeeds</i>. Please note: because the
operation for counting feeds does not use all of the parameters, some of the
parameters will be removed. The following parameters are removed:
request IDs, max count, and token. | [
"Sets",
"up",
"options",
"for",
"using",
"<i",
">",
"countFeeds<",
"/",
"i",
">",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportScheduleList.php#L268-L279 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportScheduleList.php | AmazonReportScheduleList.getReportType | public function getReportType($i = 0){
if (!isset($this->scheduleList)){
return false;
}
if (is_int($i)){
return $this->scheduleList[$i]['ReportType'];
} else {
return false;
}
} | php | public function getReportType($i = 0){
if (!isset($this->scheduleList)){
return false;
}
if (is_int($i)){
return $this->scheduleList[$i]['ReportType'];
} else {
return false;
}
} | [
"public",
"function",
"getReportType",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"scheduleList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
... | Returns the report type for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"report",
"type",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportScheduleList.php#L288-L297 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportScheduleList.php | AmazonReportScheduleList.getSchedule | public function getSchedule($i = 0){
if (!isset($this->scheduleList)){
return false;
}
if (is_int($i)){
return $this->scheduleList[$i]['Schedule'];
} else {
return false;
}
} | php | public function getSchedule($i = 0){
if (!isset($this->scheduleList)){
return false;
}
if (is_int($i)){
return $this->scheduleList[$i]['Schedule'];
} else {
return false;
}
} | [
"public",
"function",
"getSchedule",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"scheduleList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$... | Returns the schedule for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"schedule",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportScheduleList.php#L306-L315 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportScheduleList.php | AmazonReportScheduleList.getScheduledDate | public function getScheduledDate($i = 0){
if (!isset($this->scheduleList)){
return false;
}
if (is_int($i)){
return $this->scheduleList[$i]['ScheduledDate'];
} else {
return false;
}
} | php | public function getScheduledDate($i = 0){
if (!isset($this->scheduleList)){
return false;
}
if (is_int($i)){
return $this->scheduleList[$i]['ScheduledDate'];
} else {
return false;
}
} | [
"public",
"function",
"getScheduledDate",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"scheduleList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",... | Returns the date the specified report is scheduled for.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"date",
"the",
"specified",
"report",
"is",
"scheduled",
"for",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportScheduleList.php#L324-L333 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportScheduleList.php | AmazonReportScheduleList.getList | public function getList($i = null){
if (!isset($this->scheduleList)){
return false;
}
if (is_int($i)){
return $this->scheduleList[$i];
} else {
return $this->scheduleList;
}
} | php | public function getList($i = null){
if (!isset($this->scheduleList)){
return false;
}
if (is_int($i)){
return $this->scheduleList[$i];
} else {
return $this->scheduleList;
}
} | [
"public",
"function",
"getList",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"scheduleList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$"... | Returns the full list.
This method will return <b>FALSE</b> if the list has not yet been filled.
The array for a single report will have the following fields:
<ul>
<li><b>ReportType</b></li>
<li><b>Schedule</b></li>
<li><b>ScheduledDate</b></li>
</ul>
@param int $i [optional] <p>List index to retrieve the value from. Defaults to NULL.</p>
@return array|boolean multi-dimensional array, or <b>FALSE</b> if list not filled yet | [
"Returns",
"the",
"full",
"list",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportScheduleList.php#L348-L357 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setOrderId | public function setOrderId($id) {
if (is_string($id)){
$this->options['ShipmentRequestDetails.AmazonOrderId'] = $id;
} else {
$this->log("Tried to set AmazonOrderId to invalid value",'Warning');
return false;
}
} | php | public function setOrderId($id) {
if (is_string($id)){
$this->options['ShipmentRequestDetails.AmazonOrderId'] = $id;
} else {
$this->log("Tried to set AmazonOrderId to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setOrderId",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShipmentRequestDetails.AmazonOrderId'",
"]",
"=",
"$",
"id",
";",
"}",
"else",
"{",
"$",
"this",
... | Sets the Amazon Order ID. (Required)
This method sets the Amazon Order ID to be sent in the next request.
This parameter is required for creating a shipment on Amazon.
@param string $id <p>Amazon Order ID</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Amazon",
"Order",
"ID",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L56-L63 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setSellerOrderId | public function setSellerOrderId($id) {
if (is_string($id) || is_numeric($id)){
$this->options['ShipmentRequestDetails.SellerOrderId'] = $id;
} else {
$this->log("Tried to set SellerOrderId to invalid value",'Warning');
return false;
}
} | php | public function setSellerOrderId($id) {
if (is_string($id) || is_numeric($id)){
$this->options['ShipmentRequestDetails.SellerOrderId'] = $id;
} else {
$this->log("Tried to set SellerOrderId to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setSellerOrderId",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"id",
")",
"||",
"is_numeric",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShipmentRequestDetails.SellerOrderId'",
"]",
"=",
"$"... | Sets the Seller Order ID. (Optional)
This method sets the Seller Order ID to be sent in the next request.
@param string $id <p>Maximum 64 characters.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Seller",
"Order",
"ID",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L72-L79 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setItems | public function setItems($a){
if (is_null($a) || is_string($a) || !$a){
$this->log("Tried to set Items to invalid values",'Warning');
return false;
}
$this->resetItems();
$i = 1;
foreach ($a as $x){
if (is_array($x) && isset($x['OrderItemId']) && isset($x['Quantity'])){
$this->options['ShipmentRequestDetails.ItemList.Item.'.$i.'.OrderItemId'] = $x['OrderItemId'];
$this->options['ShipmentRequestDetails.ItemList.Item.'.$i.'.Quantity'] = $x['Quantity'];
$i++;
} else {
$this->resetItems();
$this->log("Tried to set Items with invalid array",'Warning');
return false;
}
}
} | php | public function setItems($a){
if (is_null($a) || is_string($a) || !$a){
$this->log("Tried to set Items to invalid values",'Warning');
return false;
}
$this->resetItems();
$i = 1;
foreach ($a as $x){
if (is_array($x) && isset($x['OrderItemId']) && isset($x['Quantity'])){
$this->options['ShipmentRequestDetails.ItemList.Item.'.$i.'.OrderItemId'] = $x['OrderItemId'];
$this->options['ShipmentRequestDetails.ItemList.Item.'.$i.'.Quantity'] = $x['Quantity'];
$i++;
} else {
$this->resetItems();
$this->log("Tried to set Items with invalid array",'Warning');
return false;
}
}
} | [
"public",
"function",
"setItems",
"(",
"$",
"a",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"a",
")",
"||",
"is_string",
"(",
"$",
"a",
")",
"||",
"!",
"$",
"a",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Tried to set Items to invalid values\"",
",",... | Sets the items. (Required)
This method sets the items to be sent in the next request.
This parameter is required for creating a shipment on Amazon.
The array provided should contain a list of arrays, each with the following fields:
<ul>
<li><b>OrderItemId</b> - identifier later used in the response</li>
<li><b>Quantity</b> - numeric</li>
</ul>
@param array $a <p>See above.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"items",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L94-L112 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setAddress | public function setAddress($a){
if (empty($a) || !is_array($a)){
$this->log("Tried to set ShipFromAddress to invalid values",'Warning');
return false;
}
$this->resetAddress();
$this->options['ShipmentRequestDetails.ShipFromAddress.Name'] = $a['Name'];
$this->options['ShipmentRequestDetails.ShipFromAddress.AddressLine1'] = $a['AddressLine1'];
if (isset($a['AddressLine2'])){
$this->options['ShipmentRequestDetails.ShipFromAddress.AddressLine2'] = $a['AddressLine2'];
}
if (isset($a['AddressLine3'])){
$this->options['ShipmentRequestDetails.ShipFromAddress.AddressLine3'] = $a['AddressLine3'];
}
if (isset($a['DistrictOrCounty'])){
$this->options['ShipmentRequestDetails.ShipFromAddress.DistrictOrCounty'] = $a['DistrictOrCounty'];
}
$this->options['ShipmentRequestDetails.ShipFromAddress.Email'] = $a['Email'];
$this->options['ShipmentRequestDetails.ShipFromAddress.City'] = $a['City'];
if (isset($a['StateOrProvinceCode'])){
$this->options['ShipmentRequestDetails.ShipFromAddress.StateOrProvinceCode'] = $a['StateOrProvinceCode'];
}
$this->options['ShipmentRequestDetails.ShipFromAddress.PostalCode'] = $a['PostalCode'];
$this->options['ShipmentRequestDetails.ShipFromAddress.CountryCode'] = $a['CountryCode'];
$this->options['ShipmentRequestDetails.ShipFromAddress.Phone'] = $a['Phone'];
} | php | public function setAddress($a){
if (empty($a) || !is_array($a)){
$this->log("Tried to set ShipFromAddress to invalid values",'Warning');
return false;
}
$this->resetAddress();
$this->options['ShipmentRequestDetails.ShipFromAddress.Name'] = $a['Name'];
$this->options['ShipmentRequestDetails.ShipFromAddress.AddressLine1'] = $a['AddressLine1'];
if (isset($a['AddressLine2'])){
$this->options['ShipmentRequestDetails.ShipFromAddress.AddressLine2'] = $a['AddressLine2'];
}
if (isset($a['AddressLine3'])){
$this->options['ShipmentRequestDetails.ShipFromAddress.AddressLine3'] = $a['AddressLine3'];
}
if (isset($a['DistrictOrCounty'])){
$this->options['ShipmentRequestDetails.ShipFromAddress.DistrictOrCounty'] = $a['DistrictOrCounty'];
}
$this->options['ShipmentRequestDetails.ShipFromAddress.Email'] = $a['Email'];
$this->options['ShipmentRequestDetails.ShipFromAddress.City'] = $a['City'];
if (isset($a['StateOrProvinceCode'])){
$this->options['ShipmentRequestDetails.ShipFromAddress.StateOrProvinceCode'] = $a['StateOrProvinceCode'];
}
$this->options['ShipmentRequestDetails.ShipFromAddress.PostalCode'] = $a['PostalCode'];
$this->options['ShipmentRequestDetails.ShipFromAddress.CountryCode'] = $a['CountryCode'];
$this->options['ShipmentRequestDetails.ShipFromAddress.Phone'] = $a['Phone'];
} | [
"public",
"function",
"setAddress",
"(",
"$",
"a",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"a",
")",
"||",
"!",
"is_array",
"(",
"$",
"a",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Tried to set ShipFromAddress to invalid values\"",
",",
"'Warning'... | Sets the address. (Required)
This method sets the shipper's address to be sent in the next request.
This parameter is required for creating a shipment on Amazon.
The array provided should have the following fields:
<ul>
<li><b>Name</b> - max: 30 char</li>
<li><b>AddressLine1</b> - max: 180 char</li>
<li><b>AddressLine2</b> (optional) - max: 60 char</li>
<li><b>AddressLine3</b> (optional) - max: 60 char</li>
<li><b>DistrictOrCounty</b> (optional) - max: 30 char</li>
<li><b>Email</b> - max: 256 char</li>
<li><b>City</b> - max: 30 char</li>
<li><b>StateOrProvinceCode</b> (optional) - max: 30 char</li>
<li><b>PostalCode</b> - max: 30 char</li>
<li><b>CountryCode</b> - 2 digits</li>
<li><b>Phone</b> - max: 20 char</li>
</ul>
@param array $a <p>See above.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"address",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L150-L175 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.resetAddress | protected function resetAddress(){
foreach($this->options as $op=>$junk){
if(preg_match("#ShipmentRequestDetails.ShipFromAddress#",$op)){
unset($this->options[$op]);
}
}
} | php | protected function resetAddress(){
foreach($this->options as $op=>$junk){
if(preg_match("#ShipmentRequestDetails.ShipFromAddress#",$op)){
unset($this->options[$op]);
}
}
} | [
"protected",
"function",
"resetAddress",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#ShipmentRequestDetails.ShipFromAddress#\"",
",",
"$",
"op",
")",
")",
"{",... | Resets the address options.
Since address is a required parameter, these options should not be removed
without replacing them, so this method is not public. | [
"Resets",
"the",
"address",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L183-L189 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setPackageDimensions | public function setPackageDimensions($d) {
if (empty($d) || !is_array($d)){
$this->log("Tried to set PackageDimensions to invalid values",'Warning');
return false;
}
$this->resetPackageDimensions();
$this->options['ShipmentRequestDetails.PackageDimensions.Length'] = $d['Length'];
$this->options['ShipmentRequestDetails.PackageDimensions.Width'] = $d['Width'];
$this->options['ShipmentRequestDetails.PackageDimensions.Height'] = $d['Height'];
$this->options['ShipmentRequestDetails.PackageDimensions.Unit'] = $d['Unit'];
} | php | public function setPackageDimensions($d) {
if (empty($d) || !is_array($d)){
$this->log("Tried to set PackageDimensions to invalid values",'Warning');
return false;
}
$this->resetPackageDimensions();
$this->options['ShipmentRequestDetails.PackageDimensions.Length'] = $d['Length'];
$this->options['ShipmentRequestDetails.PackageDimensions.Width'] = $d['Width'];
$this->options['ShipmentRequestDetails.PackageDimensions.Height'] = $d['Height'];
$this->options['ShipmentRequestDetails.PackageDimensions.Unit'] = $d['Unit'];
} | [
"public",
"function",
"setPackageDimensions",
"(",
"$",
"d",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"d",
")",
"||",
"!",
"is_array",
"(",
"$",
"d",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Tried to set PackageDimensions to invalid values\"",
",",
... | Sets the package dimensions. (Required)
This method sets the package dimensions to be sent in the next request.
This parameter is required for creating a shipment on Amazon.
If this parameter is set, the predefined package name cannot be set.
The array provided should have the following fields:
<ul>
<li><b>Length</b> - positive decimal number</li>
<li><b>Width</b> - positive decimal number</li>
<li><b>Height</b> - positive decimal number</li>
<li><b>Unit</b> - "inches" or "centimeters"</li>
</ul>
@param array $d <p>See above.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"package",
"dimensions",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L207-L217 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setPredefinedPackage | public function setPredefinedPackage($s) {
$this->resetPackageDimensions();
if (is_string($s) && $s){
$this->options['ShipmentRequestDetails.PackageDimensions.PredefinedPackageDimensions'] = $s;
} else {
return false;
}
/*
* List of valid Predefined Packages:
* FedEx_Box_10kg ~ 15.81 x 12.94 x 10.19 in
* FedEx_Box_25kg ~ 54.80 x 42.10 x 33.50 in
* FedEx_Box_Extra_Large_1 ~ 11.88 x 11.00 x 10.75 in
* FedEx_Box_Extra_Large_2 ~ 15.75 x 14.13 x 6.00 in
* FedEx_Box_Large_1 ~ 17.50 x 12.38 x 3.00 in
* FedEx_Box_Large_2 ~ 11.25 x 8.75 x 7.75 in
* FedEx_Box_Medium_1 ~ 13.25 x 11.50 x 2.38 in
* FedEx_Box_Medium_2 ~ 11.25 x 8.75 x 4.38 in
* FedEx_Box_Small_1 ~ 12.38 x 10.88 x 1.50 in
* FedEx_Box_Small_2 ~ 11.25 x 8.75 x 4.38 in
* FedEx_Envelope ~ 12.50 x 9.50 x 0.80 in
* FedEx_Padded_Pak ~ 11.75 x 14.75 x 2.00 in
* FedEx_Pak_1 ~ 15.50 x 12.00 x 0.80 in
* FedEx_Pak_2 ~ 12.75 x 10.25 x 0.80 in
* FedEx_Tube ~ 38.00 x 6.00 x 6.00 in
* FedEx_XL_Pak ~ 17.50 x 20.75 x 2.00 in
* UPS_Box_10kg ~ 41.00 x 33.50 x 26.50 cm
* UPS_Box_25kg ~ 48.40 x 43.30 x 35.00 cm
* UPS_Express_Box ~ 46.00 x 31.50 x 9.50 cm
* UPS_Express_Box_Large ~ 18.00 x 13.00 x 3.00 in
* UPS_Express_Box_Medium ~ 15.00 x 11.00 x 3.00 in
* UPS_Express_Box_Small ~ 13.00 x 11.00 x 2.00 in
* UPS_Express_Envelope ~ 12.50 x 9.50 x 2.00 in
* UPS_Express_Hard_Pak ~ 14.75 x 11.50 x 2.00 in
* UPS_Express_Legal_Envelope ~ 15.00 x 9.50 x 2.00 in
* UPS_Express_Pak ~ 16.00 x 12.75 x 2.00 in
* UPS_Express_Tube ~ 97.00 x 19.00 x 16.50 cm
* UPS_Laboratory_Pak ~ 17.25 x 12.75 x 2.00 in
* UPS_Pad_Pak ~ 14.75 x 11.00 x 2.00 in
* UPS_Pallet ~ 120.00 x 80.00 x 200.00 cm
* USPS_Card ~ 6.00 x 4.25 x 0.01 in
* USPS_Flat ~ 15.00 x 12.00 x 0.75 in
* USPS_FlatRateCardboardEnvelope ~ 12.50 x 9.50 x 4.00 in
* USPS_FlatRateEnvelope ~ 12.50 x 9.50 x 4.00 in
* USPS_FlatRateGiftCardEnvelope ~ 10.00 x 7.00 x 4.00 in
* USPS_FlatRateLegalEnvelope ~ 15.00 x 9.50 x 4.00 in
* USPS_FlatRatePaddedEnvelope ~ 12.50 x 9.50 x 4.00 in
* USPS_FlatRateWindowEnvelope ~ 10.00 x 5.00 x 4.00 in
* USPS_LargeFlatRateBoardGameBox ~ 24.06 x 11.88 x 3.13 in
* USPS_LargeFlatRateBox ~ 12.25 x 12.25 x 6.00 in
* USPS_Letter ~ 11.50 x 6.13 x 0.25 in
* USPS_MediumFlatRateBox1 ~ 11.25 x 8.75 x 6.00 in
* USPS_MediumFlatRateBox2 ~ 14.00 x 12.00 x 3.50 in
* USPS_RegionalRateBoxA1 ~ 10.13 x 7.13 x 5.00 in
* USPS_RegionalRateBoxA2 ~ 13.06 x 11.06 x 2.50 in
* USPS_RegionalRateBoxB1 ~ 16.25 x 14.50 x 3.00 in
* USPS_RegionalRateBoxB2 ~ 12.25 x 10.50 x 5.50 in
* USPS_RegionalRateBoxC ~ 15.00 x 12.00 x 12.00 in
* USPS_SmallFlatRateBox ~ 8.69 x 5.44 x 1.75 in
* USPS_SmallFlatRateEnvelope ~ 10.00 x 6.00 x 4.00 in
*/
} | php | public function setPredefinedPackage($s) {
$this->resetPackageDimensions();
if (is_string($s) && $s){
$this->options['ShipmentRequestDetails.PackageDimensions.PredefinedPackageDimensions'] = $s;
} else {
return false;
}
/*
* List of valid Predefined Packages:
* FedEx_Box_10kg ~ 15.81 x 12.94 x 10.19 in
* FedEx_Box_25kg ~ 54.80 x 42.10 x 33.50 in
* FedEx_Box_Extra_Large_1 ~ 11.88 x 11.00 x 10.75 in
* FedEx_Box_Extra_Large_2 ~ 15.75 x 14.13 x 6.00 in
* FedEx_Box_Large_1 ~ 17.50 x 12.38 x 3.00 in
* FedEx_Box_Large_2 ~ 11.25 x 8.75 x 7.75 in
* FedEx_Box_Medium_1 ~ 13.25 x 11.50 x 2.38 in
* FedEx_Box_Medium_2 ~ 11.25 x 8.75 x 4.38 in
* FedEx_Box_Small_1 ~ 12.38 x 10.88 x 1.50 in
* FedEx_Box_Small_2 ~ 11.25 x 8.75 x 4.38 in
* FedEx_Envelope ~ 12.50 x 9.50 x 0.80 in
* FedEx_Padded_Pak ~ 11.75 x 14.75 x 2.00 in
* FedEx_Pak_1 ~ 15.50 x 12.00 x 0.80 in
* FedEx_Pak_2 ~ 12.75 x 10.25 x 0.80 in
* FedEx_Tube ~ 38.00 x 6.00 x 6.00 in
* FedEx_XL_Pak ~ 17.50 x 20.75 x 2.00 in
* UPS_Box_10kg ~ 41.00 x 33.50 x 26.50 cm
* UPS_Box_25kg ~ 48.40 x 43.30 x 35.00 cm
* UPS_Express_Box ~ 46.00 x 31.50 x 9.50 cm
* UPS_Express_Box_Large ~ 18.00 x 13.00 x 3.00 in
* UPS_Express_Box_Medium ~ 15.00 x 11.00 x 3.00 in
* UPS_Express_Box_Small ~ 13.00 x 11.00 x 2.00 in
* UPS_Express_Envelope ~ 12.50 x 9.50 x 2.00 in
* UPS_Express_Hard_Pak ~ 14.75 x 11.50 x 2.00 in
* UPS_Express_Legal_Envelope ~ 15.00 x 9.50 x 2.00 in
* UPS_Express_Pak ~ 16.00 x 12.75 x 2.00 in
* UPS_Express_Tube ~ 97.00 x 19.00 x 16.50 cm
* UPS_Laboratory_Pak ~ 17.25 x 12.75 x 2.00 in
* UPS_Pad_Pak ~ 14.75 x 11.00 x 2.00 in
* UPS_Pallet ~ 120.00 x 80.00 x 200.00 cm
* USPS_Card ~ 6.00 x 4.25 x 0.01 in
* USPS_Flat ~ 15.00 x 12.00 x 0.75 in
* USPS_FlatRateCardboardEnvelope ~ 12.50 x 9.50 x 4.00 in
* USPS_FlatRateEnvelope ~ 12.50 x 9.50 x 4.00 in
* USPS_FlatRateGiftCardEnvelope ~ 10.00 x 7.00 x 4.00 in
* USPS_FlatRateLegalEnvelope ~ 15.00 x 9.50 x 4.00 in
* USPS_FlatRatePaddedEnvelope ~ 12.50 x 9.50 x 4.00 in
* USPS_FlatRateWindowEnvelope ~ 10.00 x 5.00 x 4.00 in
* USPS_LargeFlatRateBoardGameBox ~ 24.06 x 11.88 x 3.13 in
* USPS_LargeFlatRateBox ~ 12.25 x 12.25 x 6.00 in
* USPS_Letter ~ 11.50 x 6.13 x 0.25 in
* USPS_MediumFlatRateBox1 ~ 11.25 x 8.75 x 6.00 in
* USPS_MediumFlatRateBox2 ~ 14.00 x 12.00 x 3.50 in
* USPS_RegionalRateBoxA1 ~ 10.13 x 7.13 x 5.00 in
* USPS_RegionalRateBoxA2 ~ 13.06 x 11.06 x 2.50 in
* USPS_RegionalRateBoxB1 ~ 16.25 x 14.50 x 3.00 in
* USPS_RegionalRateBoxB2 ~ 12.25 x 10.50 x 5.50 in
* USPS_RegionalRateBoxC ~ 15.00 x 12.00 x 12.00 in
* USPS_SmallFlatRateBox ~ 8.69 x 5.44 x 1.75 in
* USPS_SmallFlatRateEnvelope ~ 10.00 x 6.00 x 4.00 in
*/
} | [
"public",
"function",
"setPredefinedPackage",
"(",
"$",
"s",
")",
"{",
"$",
"this",
"->",
"resetPackageDimensions",
"(",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"s",
")",
"&&",
"$",
"s",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShipmentReques... | Sets the Predefined Package Dimensions. (Required)
This method sets the predefined package name to be sent in the next request.
Package dimensions are required for creating a shipment on Amazon.
This parameter can be used instead of setting the package dimensions.
If this parameter is set, the manual package dimensions cannot be set.
@param string $s <p>A value from the list of valid package names.
See the comment inside the function for the complete list.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Predefined",
"Package",
"Dimensions",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L230-L290 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.resetPackageDimensions | protected function resetPackageDimensions(){
foreach($this->options as $op=>$junk){
if(preg_match("#ShipmentRequestDetails.PackageDimensions#",$op)){
unset($this->options[$op]);
}
}
} | php | protected function resetPackageDimensions(){
foreach($this->options as $op=>$junk){
if(preg_match("#ShipmentRequestDetails.PackageDimensions#",$op)){
unset($this->options[$op]);
}
}
} | [
"protected",
"function",
"resetPackageDimensions",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#ShipmentRequestDetails.PackageDimensions#\"",
",",
"$",
"op",
")",
... | Resets the package dimension options.
Since dimensions are a required parameter, these options should not be removed
without replacing them, so this method is not public. | [
"Resets",
"the",
"package",
"dimension",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L298-L304 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setWeight | public function setWeight($v, $u = 'g') {
if (!empty($v) && !empty($u) && is_numeric($v) && ($u == 'oz' || $u == 'g')){
$this->options['ShipmentRequestDetails.Weight.Value'] = $v;
$this->options['ShipmentRequestDetails.Weight.Unit'] = $u;
} else {
return false;
}
} | php | public function setWeight($v, $u = 'g') {
if (!empty($v) && !empty($u) && is_numeric($v) && ($u == 'oz' || $u == 'g')){
$this->options['ShipmentRequestDetails.Weight.Value'] = $v;
$this->options['ShipmentRequestDetails.Weight.Unit'] = $u;
} else {
return false;
}
} | [
"public",
"function",
"setWeight",
"(",
"$",
"v",
",",
"$",
"u",
"=",
"'g'",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"v",
")",
"&&",
"!",
"empty",
"(",
"$",
"u",
")",
"&&",
"is_numeric",
"(",
"$",
"v",
")",
"&&",
"(",
"$",
"u",
"==",
... | Sets the weight. (Required)
This method sets the shipment weight to be sent in the next request.
@param string $v <p>Decimal number</p>
@param string $u <p>"oz" for ounces, or "g" for grams, defaults to grams</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"weight",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L314-L321 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setMaxArrivalDate | public function setMaxArrivalDate($d) {
try{
$this->options['ShipmentRequestDetails.MustArriveByDate'] = $this->genTime($d);
} catch (Exception $e){
unset($this->options['ShipmentRequestDetails.MustArriveByDate']);
$this->log('Error: '.$e->getMessage(), 'Warning');
return false;
}
} | php | public function setMaxArrivalDate($d) {
try{
$this->options['ShipmentRequestDetails.MustArriveByDate'] = $this->genTime($d);
} catch (Exception $e){
unset($this->options['ShipmentRequestDetails.MustArriveByDate']);
$this->log('Error: '.$e->getMessage(), 'Warning');
return false;
}
} | [
"public",
"function",
"setMaxArrivalDate",
"(",
"$",
"d",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShipmentRequestDetails.MustArriveByDate'",
"]",
"=",
"$",
"this",
"->",
"genTime",
"(",
"$",
"d",
")",
";",
"}",
"catch",
"(",
"Exception",... | Sets the date by which the package must arrive. (Optional)
This method sets the maximum date to be sent in the next request.
If this parameter is set, Amazon will only give services which
will be able to deliver by the given date.
@param string $d <p>A time string</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"date",
"by",
"which",
"the",
"package",
"must",
"arrive",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L332-L340 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setDeliveryOption | public function setDeliveryOption($s) {
$options = array(
'DeliveryConfirmationWithAdultSignature',
'DeliveryConfirmationWithSignature',
'DeliveryConfirmationWithoutSignature',
'NoTracking'
);
if (in_array($s, $options)){
$this->options['ShipmentRequestDetails.ShippingServiceOptions.DeliveryExperience'] = $s;
} else {
$this->log("Tried to set DeliveryExperience to invalid value",'Warning');
return false;
}
} | php | public function setDeliveryOption($s) {
$options = array(
'DeliveryConfirmationWithAdultSignature',
'DeliveryConfirmationWithSignature',
'DeliveryConfirmationWithoutSignature',
'NoTracking'
);
if (in_array($s, $options)){
$this->options['ShipmentRequestDetails.ShippingServiceOptions.DeliveryExperience'] = $s;
} else {
$this->log("Tried to set DeliveryExperience to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setDeliveryOption",
"(",
"$",
"s",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"'DeliveryConfirmationWithAdultSignature'",
",",
"'DeliveryConfirmationWithSignature'",
",",
"'DeliveryConfirmationWithoutSignature'",
",",
"'NoTracking'",
")",
";",
"if... | Sets the Delivery Experience Option. (Required)
This method sets the delivery experience shipping option to be sent in the next request.
This parameter is required for creating a shipment on Amazon.
@param string $s <p>"DeliveryConfirmationWithAdultSignature",
"DeliveryConfirmationWithSignature",
"DeliveryConfirmationWithoutSignature",
or "NoTracking"</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Delivery",
"Experience",
"Option",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L370-L383 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setDeclaredValue | public function setDeclaredValue($v, $c) {
if (!empty($v) && !empty($c) && is_numeric($v) && is_string($c) && !is_numeric($c)){
$this->options['ShipmentRequestDetails.ShippingServiceOptions.DeclaredValue.Amount'] = $v;
$this->options['ShipmentRequestDetails.ShippingServiceOptions.DeclaredValue.CurrencyCode'] = $c;
} else {
return false;
}
} | php | public function setDeclaredValue($v, $c) {
if (!empty($v) && !empty($c) && is_numeric($v) && is_string($c) && !is_numeric($c)){
$this->options['ShipmentRequestDetails.ShippingServiceOptions.DeclaredValue.Amount'] = $v;
$this->options['ShipmentRequestDetails.ShippingServiceOptions.DeclaredValue.CurrencyCode'] = $c;
} else {
return false;
}
} | [
"public",
"function",
"setDeclaredValue",
"(",
"$",
"v",
",",
"$",
"c",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"v",
")",
"&&",
"!",
"empty",
"(",
"$",
"c",
")",
"&&",
"is_numeric",
"(",
"$",
"v",
")",
"&&",
"is_string",
"(",
"$",
"c",
"... | Sets the Declared Value. (Optional)
This method sets the declared value to be sent in the next request.
If this parameter is set and is higher than the carrier's minimum insurance amount,
the seller will be charged more for the additional insurance.
@param string $v <p>Money amount</p>
@param string $c <p>ISO 4217 currency code (ex: USD)</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Declared",
"Value",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L395-L402 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setLabelFormat | public function setLabelFormat($f) {
if (is_string($f)){
$this->options['ShipmentRequestDetails.ShippingServiceOptions.LabelFormat'] = $f;
} else {
$this->log("Tried to set LabelFormat to invalid value",'Warning');
return false;
}
} | php | public function setLabelFormat($f) {
if (is_string($f)){
$this->options['ShipmentRequestDetails.ShippingServiceOptions.LabelFormat'] = $f;
} else {
$this->log("Tried to set LabelFormat to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setLabelFormat",
"(",
"$",
"f",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"f",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShipmentRequestDetails.ShippingServiceOptions.LabelFormat'",
"]",
"=",
"$",
"f",
";",
"}",
"else",
"... | Sets the Label Format. (Optional)
This method sets the label format to be sent in the next request.
@param string $f <p>Label format (ex: "PNG")</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Label",
"Format",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L428-L435 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setCustomText | public function setCustomText($t) {
if (is_string($t)){
$this->options['ShipmentRequestDetails.LabelCustomization.CustomTextForLabel'] = $t;
} else {
$this->log("Tried to set CustomTextForLabel to invalid value",'Warning');
return false;
}
} | php | public function setCustomText($t) {
if (is_string($t)){
$this->options['ShipmentRequestDetails.LabelCustomization.CustomTextForLabel'] = $t;
} else {
$this->log("Tried to set CustomTextForLabel to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setCustomText",
"(",
"$",
"t",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"t",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShipmentRequestDetails.LabelCustomization.CustomTextForLabel'",
"]",
"=",
"$",
"t",
";",
"}",
"else",
... | Sets the Custom Text for the Label. (Optional)
This method sets the custom text for the label to be sent in the next request.
@param string $t <p>Up to 14 characters</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Custom",
"Text",
"for",
"the",
"Label",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L444-L451 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setLabelId | public function setLabelId($id) {
$options = array(
'AmazonOrderId'
);
if (in_array($id, $options)){
$this->options['ShipmentRequestDetails.LabelCustomization.StandardIdForLabel'] = $id;
} else {
$this->log("Tried to set StandardIdForLabel to invalid value",'Warning');
return false;
}
} | php | public function setLabelId($id) {
$options = array(
'AmazonOrderId'
);
if (in_array($id, $options)){
$this->options['ShipmentRequestDetails.LabelCustomization.StandardIdForLabel'] = $id;
} else {
$this->log("Tried to set StandardIdForLabel to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setLabelId",
"(",
"$",
"id",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"'AmazonOrderId'",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"id",
",",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShipmentRequ... | Sets the Standard ID for the Label. (Optional)
This method sets the standard ID option for the label to be sent in the next request.
@param string $id <p>"AmazonOrderId"</p> | [
"Sets",
"the",
"Standard",
"ID",
"for",
"the",
"Label",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L459-L469 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setService | public function setService($id) {
if (is_string($id)){
$this->options['ShippingServiceId'] = $id;
} else {
$this->log("Tried to set ShippingServiceId to invalid value",'Warning');
return false;
}
} | php | public function setService($id) {
if (is_string($id)){
$this->options['ShippingServiceId'] = $id;
} else {
$this->log("Tried to set ShippingServiceId to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setService",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShippingServiceId'",
"]",
"=",
"$",
"id",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"log",
"... | Sets the Shipping Service ID. (Required)
This method sets the shipping service ID to be sent in the next request.
This parameter is required for creating a shipment on Amazon.
@param string $id <p>Service ID</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Shipping",
"Service",
"ID",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L479-L486 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setServiceOffer | public function setServiceOffer($id) {
if (is_string($id)){
$this->options['ShippingServiceOfferId'] = $id;
} else {
$this->log("Tried to set ShippingServiceOfferId to invalid value",'Warning');
return false;
}
} | php | public function setServiceOffer($id) {
if (is_string($id)){
$this->options['ShippingServiceOfferId'] = $id;
} else {
$this->log("Tried to set ShippingServiceOfferId to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setServiceOffer",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShippingServiceOfferId'",
"]",
"=",
"$",
"id",
";",
"}",
"else",
"{",
"$",
"this",
"->",
... | Sets the Shipping Service Offer ID. (Optional)
This method sets the shipping service offer ID to be sent in the next request.
@param string $id <p>Service Offer ID</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Shipping",
"Service",
"Offer",
"ID",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L495-L502 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.setHazmat | public function setHazmat($h) {
$options = array(
'None',
'LQHazmat'
);
if (in_array($h, $options)){
$this->options['HazmatType'] = $h;
} else {
$this->log("Tried to set HazmatType to invalid value",'Warning');
return false;
}
} | php | public function setHazmat($h) {
$options = array(
'None',
'LQHazmat'
);
if (in_array($h, $options)){
$this->options['HazmatType'] = $h;
} else {
$this->log("Tried to set HazmatType to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setHazmat",
"(",
"$",
"h",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"'None'",
",",
"'LQHazmat'",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"h",
",",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'H... | Sets the Hazmat Type. (Optional)
This method sets the hazmat type to be sent in the next request.
@param string $h <p>"None" or "LQHazmat"</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Hazmat",
"Type",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L511-L522 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.fetchServices | public function fetchServices() {
$services = new AmazonMerchantServiceList($this->storeName, $this->mockMode, $this->mockFiles, $this->config);
$services->mockIndex = $this->mockIndex;
$services->setLogPath($this->logpath);
$services->setDetailsByCreator($this);
$services->fetchServices();
return $services;
} | php | public function fetchServices() {
$services = new AmazonMerchantServiceList($this->storeName, $this->mockMode, $this->mockFiles, $this->config);
$services->mockIndex = $this->mockIndex;
$services->setLogPath($this->logpath);
$services->setDetailsByCreator($this);
$services->fetchServices();
return $services;
} | [
"public",
"function",
"fetchServices",
"(",
")",
"{",
"$",
"services",
"=",
"new",
"AmazonMerchantServiceList",
"(",
"$",
"this",
"->",
"storeName",
",",
"$",
"this",
"->",
"mockMode",
",",
"$",
"this",
"->",
"mockFiles",
",",
"$",
"this",
"->",
"config",
... | Fetches eligible services for the shipment from Amazon using the current options.
See the <i>AmazonMerchantServiceList</i> class for more information on the returned object.
The following parameters are required: Amazon order ID, item list, shipping address,
package dimensions, shipment weight, delivery experience option, and carrier pick-up option.
@return AmazonMerchantServiceList container for services | [
"Fetches",
"eligible",
"services",
"for",
"the",
"shipment",
"from",
"Amazon",
"using",
"the",
"current",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L532-L539 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipmentCreator.php | AmazonMerchantShipmentCreator.parseXML | protected function parseXML($xml){
if (!$xml){
return false;
}
$this->shipment = new AmazonMerchantShipment($this->storeName, NULL, $xml, $this->mockMode, $this->mockFiles, $this->config);
$this->shipment->setLogPath($this->logpath);
$this->shipment->mockIndex = $this->mockIndex;
} | php | protected function parseXML($xml){
if (!$xml){
return false;
}
$this->shipment = new AmazonMerchantShipment($this->storeName, NULL, $xml, $this->mockMode, $this->mockFiles, $this->config);
$this->shipment->setLogPath($this->logpath);
$this->shipment->mockIndex = $this->mockIndex;
} | [
"protected",
"function",
"parseXML",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"shipment",
"=",
"new",
"AmazonMerchantShipment",
"(",
"$",
"this",
"->",
"storeName",
",",
"NULL",
... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipmentCreator.php#L614-L622 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipment.php | AmazonMerchantShipment.setShipmentId | public function setShipmentId($id){
if (is_string($id) || is_numeric($id)){
$this->options['ShipmentId'] = $id;
} else {
$this->log("Tried to set ShipmentId to invalid value",'Warning');
return false;
}
} | php | public function setShipmentId($id){
if (is_string($id) || is_numeric($id)){
$this->options['ShipmentId'] = $id;
} else {
$this->log("Tried to set ShipmentId to invalid value",'Warning');
return false;
}
} | [
"public",
"function",
"setShipmentId",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"id",
")",
"||",
"is_numeric",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'ShipmentId'",
"]",
"=",
"$",
"id",
";",
"}",
"el... | Sets the Shipment ID. (Required)
This method sets the shipment ID to be sent in the next request.
This parameter is required for fetching the shipment from Amazon.
@param string $id <p>either string or number</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Shipment",
"ID",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipment.php#L66-L73 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipment.php | AmazonMerchantShipment.fetchShipment | public function fetchShipment(){
if (!array_key_exists('ShipmentId',$this->options)){
$this->log("Shipment ID must be set in order to fetch it!",'Warning');
return false;
}
$this->options['Action'] = 'GetShipment';
$url = $this->urlbase.$this->urlbranch;
$query = $this->genQuery();
$path = $this->options['Action'].'Result';
if ($this->mockMode){
$xml = $this->fetchMockFile();
} else {
$response = $this->sendRequest($url, array('Post'=>$query));
if (!$this->checkResponse($response)){
return false;
}
$xml = simplexml_load_string($response['body']);
}
$this->parseXML($xml->$path);
} | php | public function fetchShipment(){
if (!array_key_exists('ShipmentId',$this->options)){
$this->log("Shipment ID must be set in order to fetch it!",'Warning');
return false;
}
$this->options['Action'] = 'GetShipment';
$url = $this->urlbase.$this->urlbranch;
$query = $this->genQuery();
$path = $this->options['Action'].'Result';
if ($this->mockMode){
$xml = $this->fetchMockFile();
} else {
$response = $this->sendRequest($url, array('Post'=>$query));
if (!$this->checkResponse($response)){
return false;
}
$xml = simplexml_load_string($response['body']);
}
$this->parseXML($xml->$path);
} | [
"public",
"function",
"fetchShipment",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'ShipmentId'",
",",
"$",
"this",
"->",
"options",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Shipment ID must be set in order to fetch it!\"",
",",
"'Warning'",... | Fetches the specified merchant-fulfilled shipment from Amazon.
Submits a <i>GetShipment</i> request to Amazon. In order to do this,
a shipment ID is required. Amazon will send
the data back as a response, which can be retrieved using <i>getShipment</i>.
Other methods are available for fetching specific values from the shipment.
@return boolean <b>FALSE</b> if something goes wrong | [
"Fetches",
"the",
"specified",
"merchant",
"-",
"fulfilled",
"shipment",
"from",
"Amazon",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipment.php#L84-L110 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipment.php | AmazonMerchantShipment.parseXML | protected function parseXML($xml) {
if (!$xml || !$xml->Shipment){
return false;
}
$d = $xml->Shipment;
$this->data['ShipmentId'] = (string)$d->ShipmentId;
$this->data['AmazonOrderId'] = (string)$d->AmazonOrderId;
if (isset($d->SellerOrderId)) {
$this->data['SellerOrderId'] = (string)$d->SellerOrderId;
}
$this->data['Status'] = (string)$d->Status;
if (isset($d->TrackingId)) {
$this->data['TrackingId'] = (string)$d->TrackingId;
}
$this->data['CreatedDate'] = (string)$d->CreatedDate;
if (isset($d->LastUpdatedDate)) {
$this->data['LastUpdatedDate'] = (string)$d->LastUpdatedDate;
}
$this->data['Weight']['Value'] = (string)$d->Weight->Value;
$this->data['Weight']['Unit'] = (string)$d->Weight->Unit;
$this->data['Insurance']['Amount'] = (string)$d->Insurance->Amount;
$this->data['Insurance']['CurrencyCode'] = (string)$d->Insurance->CurrencyCode;
if (isset($d->Label)) {
$this->data['Label']['Dimensions']['Length'] = (string)$d->Label->Dimensions->Length;
$this->data['Label']['Dimensions']['Width'] = (string)$d->Label->Dimensions->Width;
$this->data['Label']['Dimensions']['Unit'] = (string)$d->Label->Dimensions->Unit;
$this->data['Label']['FileContents']['Contents'] = (string)$d->Label->FileContents->Contents;
$this->data['Label']['FileContents']['FileType'] = (string)$d->Label->FileContents->FileType;
$this->data['Label']['FileContents']['Checksum'] = (string)$d->Label->FileContents->Checksum;
if (isset($d->Label->CustomTextForLabel)) {
$this->data['Label']['CustomTextForLabel'] = (string)$d->Label->CustomTextForLabel;
}
if (isset($d->Label->LabelFormat)) {
$this->data['Label']['LabelFormat'] = (string)$d->Label->LabelFormat;
}
if (isset($d->Label->StandardIdForLabel)) {
$this->data['Label']['StandardIdForLabel'] = (string)$d->Label->StandardIdForLabel;
}
}
$this->data['ItemList'] = array();
foreach ($d->ItemList->children() as $x) {
$temp = array();
$temp['OrderItemId'] = (string)$x->OrderItemId;
$temp['Quantity'] = (string)$x->Quantity;
$this->data['ItemList'][] = $temp;
}
if (isset($d->PackageDimensions->Length)) {
$this->data['PackageDimensions']['Length'] = (string)$d->PackageDimensions->Length;
$this->data['PackageDimensions']['Width'] = (string)$d->PackageDimensions->Width;
$this->data['PackageDimensions']['Height'] = (string)$d->PackageDimensions->Height;
$this->data['PackageDimensions']['Unit'] = (string)$d->PackageDimensions->Unit;
}
if (isset($d->PackageDimensions->PredefinedPackageDimensions)) {
$this->data['PackageDimensions']['PredefinedPackageDimensions'] = (string)$d->PackageDimensions->PredefinedPackageDimensions;
}
//Ship From Address
$this->data['ShipFromAddress']['Name'] = (string)$d->ShipFromAddress->Name;
$this->data['ShipFromAddress']['AddressLine1'] = (string)$d->ShipFromAddress->AddressLine1;
if (isset($d->ShipFromAddress->AddressLine3)) {
$this->data['ShipFromAddress']['AddressLine2'] = (string)$d->ShipFromAddress->AddressLine2;
}
if (isset($d->ShipFromAddress->AddressLine3)) {
$this->data['ShipFromAddress']['AddressLine2'] = (string)$d->ShipFromAddress->AddressLine3;
}
if (isset($d->ShipFromAddress->DistrictOrCounty)) {
$this->data['ShipFromAddress']['DistrictOrCounty'] = (string)$d->ShipFromAddress->DistrictOrCounty;
}
$this->data['ShipFromAddress']['Email'] = (string)$d->ShipFromAddress->Email;
$this->data['ShipFromAddress']['City'] = (string)$d->ShipFromAddress->City;
if (isset($d->ShipFromAddress->StateOrProvinceCode)) {
$this->data['ShipFromAddress']['StateOrProvinceCode'] = (string)$d->ShipFromAddress->StateOrProvinceCode;
}
$this->data['ShipFromAddress']['PostalCode'] = (string)$d->ShipFromAddress->PostalCode;
$this->data['ShipFromAddress']['CountryCode'] = (string)$d->ShipFromAddress->CountryCode;
$this->data['ShipFromAddress']['Phone'] = (string)$d->ShipFromAddress->Phone;
//Ship To Address
$this->data['ShipToAddress']['Name'] = (string)$d->ShipToAddress->Name;
$this->data['ShipToAddress']['AddressLine1'] = (string)$d->ShipToAddress->AddressLine1;
if (isset($d->ShipToAddress->AddressLine3)) {
$this->data['ShipToAddress']['AddressLine2'] = (string)$d->ShipToAddress->AddressLine2;
}
if (isset($d->ShipToAddress->AddressLine3)) {
$this->data['ShipToAddress']['AddressLine2'] = (string)$d->ShipToAddress->AddressLine3;
}
if (isset($d->ShipToAddress->DistrictOrCounty)) {
$this->data['ShipToAddress']['DistrictOrCounty'] = (string)$d->ShipToAddress->DistrictOrCounty;
}
$this->data['ShipToAddress']['Email'] = (string)$d->ShipToAddress->Email;
$this->data['ShipToAddress']['City'] = (string)$d->ShipToAddress->City;
if (isset($d->ShipToAddress->StateOrProvinceCode)) {
$this->data['ShipToAddress']['StateOrProvinceCode'] = (string)$d->ShipToAddress->StateOrProvinceCode;
}
$this->data['ShipToAddress']['PostalCode'] = (string)$d->ShipToAddress->PostalCode;
$this->data['ShipToAddress']['CountryCode'] = (string)$d->ShipToAddress->CountryCode;
$this->data['ShipToAddress']['Phone'] = (string)$d->ShipToAddress->Phone;
//Service
$this->data['ShippingService']['ShippingServiceName'] = (string)$d->ShippingService->ShippingServiceName;
$this->data['ShippingService']['CarrierName'] = (string)$d->ShippingService->CarrierName;
$this->data['ShippingService']['ShippingServiceId'] = (string)$d->ShippingService->ShippingServiceId;
$this->data['ShippingService']['ShippingServiceOfferId'] = (string)$d->ShippingService->ShippingServiceOfferId;
$this->data['ShippingService']['ShipDate'] = (string)$d->ShippingService->ShipDate;
if (isset($d->ShippingService->EarliestEstimatedDeliveryDate)) {
$this->data['ShippingService']['EarliestEstimatedDeliveryDate'] = (string)$d->ShippingService->EarliestEstimatedDeliveryDate;
}
if (isset($d->ShippingService->LatestEstimatedDeliveryDate)) {
$this->data['ShippingService']['LatestEstimatedDeliveryDate'] = (string)$d->ShippingService->LatestEstimatedDeliveryDate;
}
$this->data['ShippingService']['Rate']['Amount'] = (string)$d->ShippingService->Rate->Amount;
$this->data['ShippingService']['Rate']['CurrencyCode'] = (string)$d->ShippingService->Rate->CurrencyCode;
$this->data['ShippingService']['DeliveryExperience'] = (string)$d->ShippingService->ShippingServiceOptions->DeliveryExperience;
$this->data['ShippingService']['CarrierWillPickUp'] = (string)$d->ShippingService->ShippingServiceOptions->CarrierWillPickUp;
if (isset($d->ShippingService->ShippingServiceOptions->DeclaredValue)) {
$this->data['ShippingService']['DeclaredValue']['Amount'] = (string)$d->ShippingService->ShippingServiceOptions->DeclaredValue->Amount;
$this->data['ShippingService']['DeclaredValue']['CurrencyCode'] = (string)$d->ShippingService->ShippingServiceOptions->DeclaredValue->CurrencyCode;
}
} | php | protected function parseXML($xml) {
if (!$xml || !$xml->Shipment){
return false;
}
$d = $xml->Shipment;
$this->data['ShipmentId'] = (string)$d->ShipmentId;
$this->data['AmazonOrderId'] = (string)$d->AmazonOrderId;
if (isset($d->SellerOrderId)) {
$this->data['SellerOrderId'] = (string)$d->SellerOrderId;
}
$this->data['Status'] = (string)$d->Status;
if (isset($d->TrackingId)) {
$this->data['TrackingId'] = (string)$d->TrackingId;
}
$this->data['CreatedDate'] = (string)$d->CreatedDate;
if (isset($d->LastUpdatedDate)) {
$this->data['LastUpdatedDate'] = (string)$d->LastUpdatedDate;
}
$this->data['Weight']['Value'] = (string)$d->Weight->Value;
$this->data['Weight']['Unit'] = (string)$d->Weight->Unit;
$this->data['Insurance']['Amount'] = (string)$d->Insurance->Amount;
$this->data['Insurance']['CurrencyCode'] = (string)$d->Insurance->CurrencyCode;
if (isset($d->Label)) {
$this->data['Label']['Dimensions']['Length'] = (string)$d->Label->Dimensions->Length;
$this->data['Label']['Dimensions']['Width'] = (string)$d->Label->Dimensions->Width;
$this->data['Label']['Dimensions']['Unit'] = (string)$d->Label->Dimensions->Unit;
$this->data['Label']['FileContents']['Contents'] = (string)$d->Label->FileContents->Contents;
$this->data['Label']['FileContents']['FileType'] = (string)$d->Label->FileContents->FileType;
$this->data['Label']['FileContents']['Checksum'] = (string)$d->Label->FileContents->Checksum;
if (isset($d->Label->CustomTextForLabel)) {
$this->data['Label']['CustomTextForLabel'] = (string)$d->Label->CustomTextForLabel;
}
if (isset($d->Label->LabelFormat)) {
$this->data['Label']['LabelFormat'] = (string)$d->Label->LabelFormat;
}
if (isset($d->Label->StandardIdForLabel)) {
$this->data['Label']['StandardIdForLabel'] = (string)$d->Label->StandardIdForLabel;
}
}
$this->data['ItemList'] = array();
foreach ($d->ItemList->children() as $x) {
$temp = array();
$temp['OrderItemId'] = (string)$x->OrderItemId;
$temp['Quantity'] = (string)$x->Quantity;
$this->data['ItemList'][] = $temp;
}
if (isset($d->PackageDimensions->Length)) {
$this->data['PackageDimensions']['Length'] = (string)$d->PackageDimensions->Length;
$this->data['PackageDimensions']['Width'] = (string)$d->PackageDimensions->Width;
$this->data['PackageDimensions']['Height'] = (string)$d->PackageDimensions->Height;
$this->data['PackageDimensions']['Unit'] = (string)$d->PackageDimensions->Unit;
}
if (isset($d->PackageDimensions->PredefinedPackageDimensions)) {
$this->data['PackageDimensions']['PredefinedPackageDimensions'] = (string)$d->PackageDimensions->PredefinedPackageDimensions;
}
//Ship From Address
$this->data['ShipFromAddress']['Name'] = (string)$d->ShipFromAddress->Name;
$this->data['ShipFromAddress']['AddressLine1'] = (string)$d->ShipFromAddress->AddressLine1;
if (isset($d->ShipFromAddress->AddressLine3)) {
$this->data['ShipFromAddress']['AddressLine2'] = (string)$d->ShipFromAddress->AddressLine2;
}
if (isset($d->ShipFromAddress->AddressLine3)) {
$this->data['ShipFromAddress']['AddressLine2'] = (string)$d->ShipFromAddress->AddressLine3;
}
if (isset($d->ShipFromAddress->DistrictOrCounty)) {
$this->data['ShipFromAddress']['DistrictOrCounty'] = (string)$d->ShipFromAddress->DistrictOrCounty;
}
$this->data['ShipFromAddress']['Email'] = (string)$d->ShipFromAddress->Email;
$this->data['ShipFromAddress']['City'] = (string)$d->ShipFromAddress->City;
if (isset($d->ShipFromAddress->StateOrProvinceCode)) {
$this->data['ShipFromAddress']['StateOrProvinceCode'] = (string)$d->ShipFromAddress->StateOrProvinceCode;
}
$this->data['ShipFromAddress']['PostalCode'] = (string)$d->ShipFromAddress->PostalCode;
$this->data['ShipFromAddress']['CountryCode'] = (string)$d->ShipFromAddress->CountryCode;
$this->data['ShipFromAddress']['Phone'] = (string)$d->ShipFromAddress->Phone;
//Ship To Address
$this->data['ShipToAddress']['Name'] = (string)$d->ShipToAddress->Name;
$this->data['ShipToAddress']['AddressLine1'] = (string)$d->ShipToAddress->AddressLine1;
if (isset($d->ShipToAddress->AddressLine3)) {
$this->data['ShipToAddress']['AddressLine2'] = (string)$d->ShipToAddress->AddressLine2;
}
if (isset($d->ShipToAddress->AddressLine3)) {
$this->data['ShipToAddress']['AddressLine2'] = (string)$d->ShipToAddress->AddressLine3;
}
if (isset($d->ShipToAddress->DistrictOrCounty)) {
$this->data['ShipToAddress']['DistrictOrCounty'] = (string)$d->ShipToAddress->DistrictOrCounty;
}
$this->data['ShipToAddress']['Email'] = (string)$d->ShipToAddress->Email;
$this->data['ShipToAddress']['City'] = (string)$d->ShipToAddress->City;
if (isset($d->ShipToAddress->StateOrProvinceCode)) {
$this->data['ShipToAddress']['StateOrProvinceCode'] = (string)$d->ShipToAddress->StateOrProvinceCode;
}
$this->data['ShipToAddress']['PostalCode'] = (string)$d->ShipToAddress->PostalCode;
$this->data['ShipToAddress']['CountryCode'] = (string)$d->ShipToAddress->CountryCode;
$this->data['ShipToAddress']['Phone'] = (string)$d->ShipToAddress->Phone;
//Service
$this->data['ShippingService']['ShippingServiceName'] = (string)$d->ShippingService->ShippingServiceName;
$this->data['ShippingService']['CarrierName'] = (string)$d->ShippingService->CarrierName;
$this->data['ShippingService']['ShippingServiceId'] = (string)$d->ShippingService->ShippingServiceId;
$this->data['ShippingService']['ShippingServiceOfferId'] = (string)$d->ShippingService->ShippingServiceOfferId;
$this->data['ShippingService']['ShipDate'] = (string)$d->ShippingService->ShipDate;
if (isset($d->ShippingService->EarliestEstimatedDeliveryDate)) {
$this->data['ShippingService']['EarliestEstimatedDeliveryDate'] = (string)$d->ShippingService->EarliestEstimatedDeliveryDate;
}
if (isset($d->ShippingService->LatestEstimatedDeliveryDate)) {
$this->data['ShippingService']['LatestEstimatedDeliveryDate'] = (string)$d->ShippingService->LatestEstimatedDeliveryDate;
}
$this->data['ShippingService']['Rate']['Amount'] = (string)$d->ShippingService->Rate->Amount;
$this->data['ShippingService']['Rate']['CurrencyCode'] = (string)$d->ShippingService->Rate->CurrencyCode;
$this->data['ShippingService']['DeliveryExperience'] = (string)$d->ShippingService->ShippingServiceOptions->DeliveryExperience;
$this->data['ShippingService']['CarrierWillPickUp'] = (string)$d->ShippingService->ShippingServiceOptions->CarrierWillPickUp;
if (isset($d->ShippingService->ShippingServiceOptions->DeclaredValue)) {
$this->data['ShippingService']['DeclaredValue']['Amount'] = (string)$d->ShippingService->ShippingServiceOptions->DeclaredValue->Amount;
$this->data['ShippingService']['DeclaredValue']['CurrencyCode'] = (string)$d->ShippingService->ShippingServiceOptions->DeclaredValue->CurrencyCode;
}
} | [
"protected",
"function",
"parseXML",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"!",
"$",
"xml",
"||",
"!",
"$",
"xml",
"->",
"Shipment",
")",
"{",
"return",
"false",
";",
"}",
"$",
"d",
"=",
"$",
"xml",
"->",
"Shipment",
";",
"$",
"this",
"->",
"da... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipment.php#L119-L238 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipment.php | AmazonMerchantShipment.getWeight | public function getWeight($only = false){
if (isset($this->data['Weight'])){
if ($only){
return $this->data['Weight']['Value'];
} else {
return $this->data['Weight'];
}
} else {
return false;
}
} | php | public function getWeight($only = false){
if (isset($this->data['Weight'])){
if ($only){
return $this->data['Weight']['Value'];
} else {
return $this->data['Weight'];
}
} else {
return false;
}
} | [
"public",
"function",
"getWeight",
"(",
"$",
"only",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'Weight'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"only",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"'... | Returns the weight.
This method will return <b>FALSE</b> if the weight has not been set yet.
If an array is returned, it will have the fields <b>Value</b> and <b>Unit</b>.
@param boolean $only [optional] <p>set to <b>TRUE</b> to get only the value</p>
@return array|string|boolean array, single value, or <b>FALSE</b> if weight not set yet | [
"Returns",
"the",
"weight",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipment.php#L438-L448 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipment.php | AmazonMerchantShipment.getInsurance | public function getInsurance($only = false){
if (isset($this->data['Insurance'])){
if ($only){
return $this->data['Insurance']['Amount'];
} else {
return $this->data['Insurance'];
}
} else {
return false;
}
} | php | public function getInsurance($only = false){
if (isset($this->data['Insurance'])){
if ($only){
return $this->data['Insurance']['Amount'];
} else {
return $this->data['Insurance'];
}
} else {
return false;
}
} | [
"public",
"function",
"getInsurance",
"(",
"$",
"only",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'Insurance'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"only",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"["... | Returns the insurance amount.
This method will return <b>FALSE</b> if the insurance amount has not been set yet.
If an array is returned, it will have the fields <b>Amount</b> and <b>CurrencyCode</b>.
@param boolean $only [optional] <p>set to <b>TRUE</b> to get only the value</p>
@return array|string|boolean array, single value, or <b>FALSE</b> if insurance amount not set yet | [
"Returns",
"the",
"insurance",
"amount",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipment.php#L458-L468 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipment.php | AmazonMerchantShipment.getServiceRate | public function getServiceRate($only = false){
if (isset($this->data['ShippingService'])){
if ($only){
return $this->data['ShippingService']['Rate']['Amount'];
} else {
return $this->data['ShippingService']['Rate'];
}
} else {
return false;
}
} | php | public function getServiceRate($only = false){
if (isset($this->data['ShippingService'])){
if ($only){
return $this->data['ShippingService']['Rate']['Amount'];
} else {
return $this->data['ShippingService']['Rate'];
}
} else {
return false;
}
} | [
"public",
"function",
"getServiceRate",
"(",
"$",
"only",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'ShippingService'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"only",
")",
"{",
"return",
"$",
"this",
"->",
"data... | Returns the service rate.
This method will return <b>FALSE</b> if the service has not been set yet.
If an array is returned, it will have the fields <b>Amount</b> and <b>CurrencyCode</b>.
@param boolean $only [optional] <p>set to <b>TRUE</b> to get only the value</p>
@return array|string|boolean array, single value, or <b>FALSE</b> if service not set yet
@see getService | [
"Returns",
"the",
"service",
"rate",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipment.php#L507-L517 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipment.php | AmazonMerchantShipment.getDeclaredValue | public function getDeclaredValue($only = false){
if (isset($this->data['ShippingService']['DeclaredValue'])){
if ($only){
return $this->data['ShippingService']['DeclaredValue']['Amount'];
} else {
return $this->data['ShippingService']['DeclaredValue'];
}
} else {
return false;
}
} | php | public function getDeclaredValue($only = false){
if (isset($this->data['ShippingService']['DeclaredValue'])){
if ($only){
return $this->data['ShippingService']['DeclaredValue']['Amount'];
} else {
return $this->data['ShippingService']['DeclaredValue'];
}
} else {
return false;
}
} | [
"public",
"function",
"getDeclaredValue",
"(",
"$",
"only",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'ShippingService'",
"]",
"[",
"'DeclaredValue'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"only",
")",
"{",
"retu... | Returns the declared value.
This method will return <b>FALSE</b> if the declared value has not been set yet.
If an array is returned, it will have the fields <b>Amount</b> and <b>CurrencyCode</b>.
@param boolean $only [optional] <p>set to <b>TRUE</b> to get only the value</p>
@return array|string|boolean array, single value, or <b>FALSE</b> if declared value not set yet
@see getService | [
"Returns",
"the",
"declared",
"value",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipment.php#L528-L538 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipment.php | AmazonMerchantShipment.getLabelData | public function getLabelData($raw = FALSE){
if (isset($this->data['Label'])){
if ($raw) {
return $this->data['Label'];
}
//decode label file automatically
$r = $this->data['Label'];
$convert = $this->getLabelFileContents(FALSE);
if ($convert) {
$r['FileContents']['Contents'] = $convert;
}
return $r;
} else {
return false;
}
} | php | public function getLabelData($raw = FALSE){
if (isset($this->data['Label'])){
if ($raw) {
return $this->data['Label'];
}
//decode label file automatically
$r = $this->data['Label'];
$convert = $this->getLabelFileContents(FALSE);
if ($convert) {
$r['FileContents']['Contents'] = $convert;
}
return $r;
} else {
return false;
}
} | [
"public",
"function",
"getLabelData",
"(",
"$",
"raw",
"=",
"FALSE",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'Label'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"raw",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"'... | Returns an array containing all of the Label information.
This method will return <b>FALSE</b> if the label has not been set yet.
The returned array will have the following fields:
<ul>
<li><b>Dimensions</b>:
<ul>
<li><b>Length</b></li>
<li><b>Width</b></li>
<li><b>Unit</b></li>
</ul>
</li>
<li><b>FileContents</b>:
<ul>
<li><b>Contents</b></li>
<li><b>FileType</b></li>
<li><b>Checksum</b></li>
</ul>
</li>
<li><b>CustomTextForLabel</b></li>
<li><b>LabelFormat</b></li>
<li><b>StandardIdForLabel</b></li>
</ul>
@param boolean $raw [optional] <p>Set to TRUE to get the raw, double-encoded file contents.</p>
@return array|boolean multi-dimensional array, or <b>FALSE</b> if label not set yet | [
"Returns",
"an",
"array",
"containing",
"all",
"of",
"the",
"Label",
"information",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipment.php#L567-L582 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonMerchantShipment.php | AmazonMerchantShipment.getLabelFileContents | public function getLabelFileContents($raw = FALSE){
if (isset($this->data['Label']['FileContents']['Contents'])){
if ($raw) {
return $this->data['Label']['FileContents']['Contents'];
}
try {
return gzdecode(base64_decode($this->data['Label']['FileContents']['Contents']));
} catch (Exception $ex) {
$this->log('Failed to convert label file, file might be corrupt: '.$ex->getMessage(), 'Urgent');
}
return false;
} else {
return false;
}
} | php | public function getLabelFileContents($raw = FALSE){
if (isset($this->data['Label']['FileContents']['Contents'])){
if ($raw) {
return $this->data['Label']['FileContents']['Contents'];
}
try {
return gzdecode(base64_decode($this->data['Label']['FileContents']['Contents']));
} catch (Exception $ex) {
$this->log('Failed to convert label file, file might be corrupt: '.$ex->getMessage(), 'Urgent');
}
return false;
} else {
return false;
}
} | [
"public",
"function",
"getLabelFileContents",
"(",
"$",
"raw",
"=",
"FALSE",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'Label'",
"]",
"[",
"'FileContents'",
"]",
"[",
"'Contents'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"raw",
... | Returns the file contents for the Label.
This method will return <b>FALSE</b> if the status has not been set yet.
@param boolean $raw [optional] <p>Set to TRUE to get the raw, double-encoded file contents.</p>
@return string|boolean single value, or <b>FALSE</b> if status not set yet | [
"Returns",
"the",
"file",
"contents",
"for",
"the",
"Label",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonMerchantShipment.php#L591-L605 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.