id
int32 0
241k
| repo
stringlengths 6
63
| path
stringlengths 5
140
| func_name
stringlengths 3
151
| original_string
stringlengths 84
13k
| language
stringclasses 1
value | code
stringlengths 84
13k
| code_tokens
list | docstring
stringlengths 3
47.2k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 91
247
|
|---|---|---|---|---|---|---|---|---|---|---|---|
227,300
|
AaronJan/Housekeeper
|
src/Housekeeper/Repository.php
|
Repository.newModelInstance
|
protected function newModelInstance()
{
if (is_null($this->fullModelClassName)) {
$this->fullModelClassName = $this->model();
}
return new $this->fullModelClassName;
}
|
php
|
protected function newModelInstance()
{
if (is_null($this->fullModelClassName)) {
$this->fullModelClassName = $this->model();
}
return new $this->fullModelClassName;
}
|
[
"protected",
"function",
"newModelInstance",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"fullModelClassName",
")",
")",
"{",
"$",
"this",
"->",
"fullModelClassName",
"=",
"$",
"this",
"->",
"model",
"(",
")",
";",
"}",
"return",
"new",
"$",
"this",
"->",
"fullModelClassName",
";",
"}"
] |
Make a new Model instance.
@return Model
|
[
"Make",
"a",
"new",
"Model",
"instance",
"."
] |
9a5f9547e65532111f839c50cd665e9d4ff6cd3f
|
https://github.com/AaronJan/Housekeeper/blob/9a5f9547e65532111f839c50cd665e9d4ff6cd3f/src/Housekeeper/Repository.php#L150-L157
|
227,301
|
AaronJan/Housekeeper
|
src/Housekeeper/Repository.php
|
Repository.getConfig
|
protected function getConfig($key, $default = null)
{
$config = $this->getApp()->make('config');
return $config->get($key, $default);
}
|
php
|
protected function getConfig($key, $default = null)
{
$config = $this->getApp()->make('config');
return $config->get($key, $default);
}
|
[
"protected",
"function",
"getConfig",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getApp",
"(",
")",
"->",
"make",
"(",
"'config'",
")",
";",
"return",
"$",
"config",
"->",
"get",
"(",
"$",
"key",
",",
"$",
"default",
")",
";",
"}"
] |
Read configure from configure file, if it's not exists, "default" will be
returned.
@param $key
@param null $default
@return mixed
|
[
"Read",
"configure",
"from",
"configure",
"file",
"if",
"it",
"s",
"not",
"exists",
"default",
"will",
"be",
"returned",
"."
] |
9a5f9547e65532111f839c50cd665e9d4ff6cd3f
|
https://github.com/AaronJan/Housekeeper/blob/9a5f9547e65532111f839c50cd665e9d4ff6cd3f/src/Housekeeper/Repository.php#L167-L172
|
227,302
|
AaronJan/Housekeeper
|
src/Housekeeper/Repository.php
|
Repository.initialize
|
protected function initialize()
{
$this->injectionContainer = new InjectionContainer();
$model = $this->newModelInstance();
// The model instance must be an instance of `Model` class from
// `Laravel`, otherwise just throw an exception.
if (! $model instanceof Model) {
throw new RepositoryException(
"Class \"" . get_class($model) . "\" must be an instance of " . Model::class
);
}
// Load configures from `housekeeper.php` or just use default settings.
$this->perPage = $this->getConfig('housekeeper.paginate.per_page', 15);
}
|
php
|
protected function initialize()
{
$this->injectionContainer = new InjectionContainer();
$model = $this->newModelInstance();
// The model instance must be an instance of `Model` class from
// `Laravel`, otherwise just throw an exception.
if (! $model instanceof Model) {
throw new RepositoryException(
"Class \"" . get_class($model) . "\" must be an instance of " . Model::class
);
}
// Load configures from `housekeeper.php` or just use default settings.
$this->perPage = $this->getConfig('housekeeper.paginate.per_page', 15);
}
|
[
"protected",
"function",
"initialize",
"(",
")",
"{",
"$",
"this",
"->",
"injectionContainer",
"=",
"new",
"InjectionContainer",
"(",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"newModelInstance",
"(",
")",
";",
"// The model instance must be an instance of `Model` class from",
"// `Laravel`, otherwise just throw an exception.",
"if",
"(",
"!",
"$",
"model",
"instanceof",
"Model",
")",
"{",
"throw",
"new",
"RepositoryException",
"(",
"\"Class \\\"\"",
".",
"get_class",
"(",
"$",
"model",
")",
".",
"\"\\\" must be an instance of \"",
".",
"Model",
"::",
"class",
")",
";",
"}",
"// Load configures from `housekeeper.php` or just use default settings.",
"$",
"this",
"->",
"perPage",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"'housekeeper.paginate.per_page'",
",",
"15",
")",
";",
"}"
] |
Validate the model that provided by `model` method, and load configures.
|
[
"Validate",
"the",
"model",
"that",
"provided",
"by",
"model",
"method",
"and",
"load",
"configures",
"."
] |
9a5f9547e65532111f839c50cd665e9d4ff6cd3f
|
https://github.com/AaronJan/Housekeeper/blob/9a5f9547e65532111f839c50cd665e9d4ff6cd3f/src/Housekeeper/Repository.php#L177-L193
|
227,303
|
AaronJan/Housekeeper
|
src/Housekeeper/Repository.php
|
Repository.resetPlan
|
protected function resetPlan()
{
$this->defaultPlan = new Plan($this->newModelInstance());
$this->plans = [];
$this->planStep = null;
}
|
php
|
protected function resetPlan()
{
$this->defaultPlan = new Plan($this->newModelInstance());
$this->plans = [];
$this->planStep = null;
}
|
[
"protected",
"function",
"resetPlan",
"(",
")",
"{",
"$",
"this",
"->",
"defaultPlan",
"=",
"new",
"Plan",
"(",
"$",
"this",
"->",
"newModelInstance",
"(",
")",
")",
";",
"$",
"this",
"->",
"plans",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"planStep",
"=",
"null",
";",
"}"
] |
Reset the Plan object for the next use.
|
[
"Reset",
"the",
"Plan",
"object",
"for",
"the",
"next",
"use",
"."
] |
9a5f9547e65532111f839c50cd665e9d4ff6cd3f
|
https://github.com/AaronJan/Housekeeper/blob/9a5f9547e65532111f839c50cd665e9d4ff6cd3f/src/Housekeeper/Repository.php#L226-L231
|
227,304
|
AaronJan/Housekeeper
|
src/Housekeeper/Repository.php
|
Repository.paginate
|
public function paginate($limit = null, $columns = ['*'], $pageName = 'page', $page = null)
{
return $this->simpleWrap(Action::READ, [$this, '_paginate']);
}
|
php
|
public function paginate($limit = null, $columns = ['*'], $pageName = 'page', $page = null)
{
return $this->simpleWrap(Action::READ, [$this, '_paginate']);
}
|
[
"public",
"function",
"paginate",
"(",
"$",
"limit",
"=",
"null",
",",
"$",
"columns",
"=",
"[",
"'*'",
"]",
",",
"$",
"pageName",
"=",
"'page'",
",",
"$",
"page",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"simpleWrap",
"(",
"Action",
"::",
"READ",
",",
"[",
"$",
"this",
",",
"'_paginate'",
"]",
")",
";",
"}"
] |
Same as the "paginate" method of Eloquent.
@param int|null $limit
@param array $columns
@return LengthAwarePaginator
|
[
"Same",
"as",
"the",
"paginate",
"method",
"of",
"Eloquent",
"."
] |
9a5f9547e65532111f839c50cd665e9d4ff6cd3f
|
https://github.com/AaronJan/Housekeeper/blob/9a5f9547e65532111f839c50cd665e9d4ff6cd3f/src/Housekeeper/Repository.php#L790-L793
|
227,305
|
AaronJan/Housekeeper
|
src/Housekeeper/Repository.php
|
Repository.getByField
|
public function getByField($field, $value = null, $columns = ['*'])
{
return $this->simpleWrap(Action::READ, [$this, '_getByField']);
}
|
php
|
public function getByField($field, $value = null, $columns = ['*'])
{
return $this->simpleWrap(Action::READ, [$this, '_getByField']);
}
|
[
"public",
"function",
"getByField",
"(",
"$",
"field",
",",
"$",
"value",
"=",
"null",
",",
"$",
"columns",
"=",
"[",
"'*'",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"simpleWrap",
"(",
"Action",
"::",
"READ",
",",
"[",
"$",
"this",
",",
"'_getByField'",
"]",
")",
";",
"}"
] |
Get models by a simple equality query.
@param $field
@param null $value
@param array $columns
@return array|EloquentCollection
|
[
"Get",
"models",
"by",
"a",
"simple",
"equality",
"query",
"."
] |
9a5f9547e65532111f839c50cd665e9d4ff6cd3f
|
https://github.com/AaronJan/Housekeeper/blob/9a5f9547e65532111f839c50cd665e9d4ff6cd3f/src/Housekeeper/Repository.php#L815-L818
|
227,306
|
thephpleague/omnipay-gocardless
|
src/Message/AbstractRequest.php
|
AbstractRequest.generateNonce
|
protected function generateNonce()
{
$nonce = '';
for ($i = 0; $i < 64; $i++) {
// append random ASCII character
$nonce .= chr(mt_rand(33, 126));
}
return base64_encode($nonce);
}
|
php
|
protected function generateNonce()
{
$nonce = '';
for ($i = 0; $i < 64; $i++) {
// append random ASCII character
$nonce .= chr(mt_rand(33, 126));
}
return base64_encode($nonce);
}
|
[
"protected",
"function",
"generateNonce",
"(",
")",
"{",
"$",
"nonce",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"64",
";",
"$",
"i",
"++",
")",
"{",
"// append random ASCII character",
"$",
"nonce",
".=",
"chr",
"(",
"mt_rand",
"(",
"33",
",",
"126",
")",
")",
";",
"}",
"return",
"base64_encode",
"(",
"$",
"nonce",
")",
";",
"}"
] |
Generate a nonce for each request
|
[
"Generate",
"a",
"nonce",
"for",
"each",
"request"
] |
f4f707921273b196ab526f3dbf3790cca0c77a80
|
https://github.com/thephpleague/omnipay-gocardless/blob/f4f707921273b196ab526f3dbf3790cca0c77a80/src/Message/AbstractRequest.php#L151-L160
|
227,307
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/UPnP/IGD.php
|
IGD.getRedirections
|
public function getRedirections(){
$rest = $this->getService( self::API_UPNP_IGD_REDIRECTION);
$rest->GET();
return $rest->getResultAsArray( models\UPnP\UpnpIgdRedirection::class);
}
|
php
|
public function getRedirections(){
$rest = $this->getService( self::API_UPNP_IGD_REDIRECTION);
$rest->GET();
return $rest->getResultAsArray( models\UPnP\UpnpIgdRedirection::class);
}
|
[
"public",
"function",
"getRedirections",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_UPNP_IGD_REDIRECTION",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResultAsArray",
"(",
"models",
"\\",
"UPnP",
"\\",
"UpnpIgdRedirection",
"::",
"class",
")",
";",
"}"
] |
Get the list of current redirection
@return models\UPnP\UpnpIgdRedirection[]
|
[
"Get",
"the",
"list",
"of",
"current",
"redirection"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/UPnP/IGD.php#L43-L48
|
227,308
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/UPnP/IGD.php
|
IGD.deleteRedirectionFromId
|
public function deleteRedirectionFromId( $redirectionId){
$rest = $this->getService( self::API_UPNP_IGD_REDIRECTION . $redirectionId);
$rest->DELETE();
return $rest->getSuccess();
}
|
php
|
public function deleteRedirectionFromId( $redirectionId){
$rest = $this->getService( self::API_UPNP_IGD_REDIRECTION . $redirectionId);
$rest->DELETE();
return $rest->getSuccess();
}
|
[
"public",
"function",
"deleteRedirectionFromId",
"(",
"$",
"redirectionId",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_UPNP_IGD_REDIRECTION",
".",
"$",
"redirectionId",
")",
";",
"$",
"rest",
"->",
"DELETE",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Delete a redirection
@param $redirectionId
@return bool
|
[
"Delete",
"a",
"redirection"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/UPnP/IGD.php#L55-L60
|
227,309
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/VPN/Server/IpPool.php
|
IpPool.getReservations
|
public function getReservations(){
$rest = $this->getService( self::API_VPN_IPPOOL);
$rest->GET();
return $rest->getResult();
}
|
php
|
public function getReservations(){
$rest = $this->getService( self::API_VPN_IPPOOL);
$rest->GET();
return $rest->getResult();
}
|
[
"public",
"function",
"getReservations",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_VPN_IPPOOL",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
")",
";",
"}"
] |
Get the VPN server IP pool reservations
@return array
|
[
"Get",
"the",
"VPN",
"server",
"IP",
"pool",
"reservations"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/IpPool.php#L18-L23
|
227,310
|
brucepc/sum-up
|
src/Customer/PaymentInstrument/PaymentInstrumentClient.php
|
PaymentInstrumentClient.disable
|
public function disable(PaymentInstrumentInterface $paymentInstrument):?bool
{
$uri = $this->getEndPoint().'/'.$paymentInstrument->getToken();
return $this->request('delete', $paymentInstrument, $uri);
}
|
php
|
public function disable(PaymentInstrumentInterface $paymentInstrument):?bool
{
$uri = $this->getEndPoint().'/'.$paymentInstrument->getToken();
return $this->request('delete', $paymentInstrument, $uri);
}
|
[
"public",
"function",
"disable",
"(",
"PaymentInstrumentInterface",
"$",
"paymentInstrument",
")",
":",
"?",
"bool",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getEndPoint",
"(",
")",
".",
"'/'",
".",
"$",
"paymentInstrument",
"->",
"getToken",
"(",
")",
";",
"return",
"$",
"this",
"->",
"request",
"(",
"'delete'",
",",
"$",
"paymentInstrument",
",",
"$",
"uri",
")",
";",
"}"
] |
Delete an paymentInstrument from server.
@param PaymentInstrumentInterface $paymentInstrument
@return bool
|
[
"Delete",
"an",
"paymentInstrument",
"from",
"server",
"."
] |
4b9b046b6c629000b74dc762a96cb24208dc758e
|
https://github.com/brucepc/sum-up/blob/4b9b046b6c629000b74dc762a96cb24208dc758e/src/Customer/PaymentInstrument/PaymentInstrumentClient.php#L81-L86
|
227,311
|
cartalyst/alerts
|
src/Native/AlertsBootstrapper.php
|
AlertsBootstrapper.createFlashNotifier
|
protected function createFlashNotifier($alerts)
{
if ($session = $this->createSession()) {
$alerts->addNotifier(
new FlashNotifier('flash', static::$config, $session)
);
}
}
|
php
|
protected function createFlashNotifier($alerts)
{
if ($session = $this->createSession()) {
$alerts->addNotifier(
new FlashNotifier('flash', static::$config, $session)
);
}
}
|
[
"protected",
"function",
"createFlashNotifier",
"(",
"$",
"alerts",
")",
"{",
"if",
"(",
"$",
"session",
"=",
"$",
"this",
"->",
"createSession",
"(",
")",
")",
"{",
"$",
"alerts",
"->",
"addNotifier",
"(",
"new",
"FlashNotifier",
"(",
"'flash'",
",",
"static",
"::",
"$",
"config",
",",
"$",
"session",
")",
")",
";",
"}",
"}"
] |
Creates and adds a new flash notifier.
@param \Cartalyst\Alerts\Alerts $alerts
@return void
|
[
"Creates",
"and",
"adds",
"a",
"new",
"flash",
"notifier",
"."
] |
00639a88ef11645aacd2756b654fec7b2796fa9a
|
https://github.com/cartalyst/alerts/blob/00639a88ef11645aacd2756b654fec7b2796fa9a/src/Native/AlertsBootstrapper.php#L98-L105
|
227,312
|
cartalyst/alerts
|
src/Native/AlertsBootstrapper.php
|
AlertsBootstrapper.createSession
|
protected function createSession()
{
if (class_exists('Illuminate\Filesystem\Filesystem') && class_exists('Illuminate\Session\FileSessionHandler')) {
$fileSessionHandler = new FileSessionHandler(new Filesystem(), __DIR__.'/../../../../../storage/sessions', 5);
$store = new Store('alerts', $fileSessionHandler);
return new NativeSession($store);
}
}
|
php
|
protected function createSession()
{
if (class_exists('Illuminate\Filesystem\Filesystem') && class_exists('Illuminate\Session\FileSessionHandler')) {
$fileSessionHandler = new FileSessionHandler(new Filesystem(), __DIR__.'/../../../../../storage/sessions', 5);
$store = new Store('alerts', $fileSessionHandler);
return new NativeSession($store);
}
}
|
[
"protected",
"function",
"createSession",
"(",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'Illuminate\\Filesystem\\Filesystem'",
")",
"&&",
"class_exists",
"(",
"'Illuminate\\Session\\FileSessionHandler'",
")",
")",
"{",
"$",
"fileSessionHandler",
"=",
"new",
"FileSessionHandler",
"(",
"new",
"Filesystem",
"(",
")",
",",
"__DIR__",
".",
"'/../../../../../storage/sessions'",
",",
"5",
")",
";",
"$",
"store",
"=",
"new",
"Store",
"(",
"'alerts'",
",",
"$",
"fileSessionHandler",
")",
";",
"return",
"new",
"NativeSession",
"(",
"$",
"store",
")",
";",
"}",
"}"
] |
Creates a session instance.
@return \Cartalyst\Alerts\Storage\StorageInterface|null
|
[
"Creates",
"a",
"session",
"instance",
"."
] |
00639a88ef11645aacd2756b654fec7b2796fa9a
|
https://github.com/cartalyst/alerts/blob/00639a88ef11645aacd2756b654fec7b2796fa9a/src/Native/AlertsBootstrapper.php#L112-L121
|
227,313
|
alphayax/freebox_api_php
|
freebox/api/v3/services/download/Download.php
|
Download.addFromUrl
|
public function addFromUrl( $download_url, $download_dir = null, $recursive = false, $username = null, $password = null, $archive_password = null, $cookies = null){
$this->addFromUrls( [$download_url], $download_dir, $recursive, $username, $password, $archive_password, $cookies);
}
|
php
|
public function addFromUrl( $download_url, $download_dir = null, $recursive = false, $username = null, $password = null, $archive_password = null, $cookies = null){
$this->addFromUrls( [$download_url], $download_dir, $recursive, $username, $password, $archive_password, $cookies);
}
|
[
"public",
"function",
"addFromUrl",
"(",
"$",
"download_url",
",",
"$",
"download_dir",
"=",
"null",
",",
"$",
"recursive",
"=",
"false",
",",
"$",
"username",
"=",
"null",
",",
"$",
"password",
"=",
"null",
",",
"$",
"archive_password",
"=",
"null",
",",
"$",
"cookies",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addFromUrls",
"(",
"[",
"$",
"download_url",
"]",
",",
"$",
"download_dir",
",",
"$",
"recursive",
",",
"$",
"username",
",",
"$",
"password",
",",
"$",
"archive_password",
",",
"$",
"cookies",
")",
";",
"}"
] |
Add a download task with the specified URL
@param string $download_url
@param string $download_dir
@param bool|false $recursive
@param null $username
@param null $password
@param null $archive_password
@param null $cookies
@return int Download Id
|
[
"Add",
"a",
"download",
"task",
"with",
"the",
"specified",
"URL"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/download/Download.php#L107-L109
|
227,314
|
alphayax/freebox_api_php
|
freebox/api/v3/services/download/Download.php
|
Download.addFromUrls
|
public function addFromUrls( $download_urls = [], $download_dir = null, $recursive = false, $username = null, $password = null, $archive_password = null, $cookies = null){
$params = [];
if( empty( $download_urls)){
throw new \Exception( 'At lease one url is needed');
}
if( count( $download_urls) == 1){
$params['download_url'] = $download_urls[0];
} else {
$params['download_url_list'] = implode( PHP_EOL, $download_urls);
}
if( ! empty( $download_dir)){
$params['download_dir'] = base64_encode( $download_dir);
}
if( ! empty( $recursive)){
$params['download_dir'] = $recursive;
}
if( ! empty( $username)){
$params['username'] = $username;
$params['password'] = $password;
}
if( ! empty( $archive_password)){
$params['archive_password'] = $archive_password;
}
if( ! empty( $cookies)){
$params['cookies'] = $cookies;
}
$data = http_build_query( $params);
$rest = $this->getService( self::API_DOWNLOAD_ADD);
$rest->setContentType_XFormURLEncoded();
$rest->POST( $data);
return $rest->getResult()['id'];
}
|
php
|
public function addFromUrls( $download_urls = [], $download_dir = null, $recursive = false, $username = null, $password = null, $archive_password = null, $cookies = null){
$params = [];
if( empty( $download_urls)){
throw new \Exception( 'At lease one url is needed');
}
if( count( $download_urls) == 1){
$params['download_url'] = $download_urls[0];
} else {
$params['download_url_list'] = implode( PHP_EOL, $download_urls);
}
if( ! empty( $download_dir)){
$params['download_dir'] = base64_encode( $download_dir);
}
if( ! empty( $recursive)){
$params['download_dir'] = $recursive;
}
if( ! empty( $username)){
$params['username'] = $username;
$params['password'] = $password;
}
if( ! empty( $archive_password)){
$params['archive_password'] = $archive_password;
}
if( ! empty( $cookies)){
$params['cookies'] = $cookies;
}
$data = http_build_query( $params);
$rest = $this->getService( self::API_DOWNLOAD_ADD);
$rest->setContentType_XFormURLEncoded();
$rest->POST( $data);
return $rest->getResult()['id'];
}
|
[
"public",
"function",
"addFromUrls",
"(",
"$",
"download_urls",
"=",
"[",
"]",
",",
"$",
"download_dir",
"=",
"null",
",",
"$",
"recursive",
"=",
"false",
",",
"$",
"username",
"=",
"null",
",",
"$",
"password",
"=",
"null",
",",
"$",
"archive_password",
"=",
"null",
",",
"$",
"cookies",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"download_urls",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'At lease one url is needed'",
")",
";",
"}",
"if",
"(",
"count",
"(",
"$",
"download_urls",
")",
"==",
"1",
")",
"{",
"$",
"params",
"[",
"'download_url'",
"]",
"=",
"$",
"download_urls",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"$",
"params",
"[",
"'download_url_list'",
"]",
"=",
"implode",
"(",
"PHP_EOL",
",",
"$",
"download_urls",
")",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"download_dir",
")",
")",
"{",
"$",
"params",
"[",
"'download_dir'",
"]",
"=",
"base64_encode",
"(",
"$",
"download_dir",
")",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"recursive",
")",
")",
"{",
"$",
"params",
"[",
"'download_dir'",
"]",
"=",
"$",
"recursive",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"username",
")",
")",
"{",
"$",
"params",
"[",
"'username'",
"]",
"=",
"$",
"username",
";",
"$",
"params",
"[",
"'password'",
"]",
"=",
"$",
"password",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"archive_password",
")",
")",
"{",
"$",
"params",
"[",
"'archive_password'",
"]",
"=",
"$",
"archive_password",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"cookies",
")",
")",
"{",
"$",
"params",
"[",
"'cookies'",
"]",
"=",
"$",
"cookies",
";",
"}",
"$",
"data",
"=",
"http_build_query",
"(",
"$",
"params",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_DOWNLOAD_ADD",
")",
";",
"$",
"rest",
"->",
"setContentType_XFormURLEncoded",
"(",
")",
";",
"$",
"rest",
"->",
"POST",
"(",
"$",
"data",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
")",
"[",
"'id'",
"]",
";",
"}"
] |
Add a download task with all the specified URLs
@param array $download_urls A list of URL
@param string $download_dir The download destination directory (optional: will use the configuration download_dir by default)
@param bool $recursive If true the download will be recursive
@param string $username Auth username (optional)
@param string $password Auth password (optional)
@param string $archive_password The password required to extract downloaded content (only relevant for nzb)
@param string $cookies The http cookies (to be able to pass session cookies along with url)
@return int Download Id
@throws \Exception
|
[
"Add",
"a",
"download",
"task",
"with",
"all",
"the",
"specified",
"URLs"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/download/Download.php#L123-L163
|
227,315
|
alphayax/freebox_api_php
|
freebox/api/v3/services/download/Download.php
|
Download.updateFilePriority
|
public function updateFilePriority( $downloadTaskId, $FileId, $Priority){
$Service = sprintf( self::API_DOWNLOAD_FILES, $downloadTaskId);
$rest = $this->getService( $Service . DIRECTORY_SEPARATOR . $FileId);
$rest->PUT([
'priority' => $Priority,
]);
return $rest->getSuccess();
}
|
php
|
public function updateFilePriority( $downloadTaskId, $FileId, $Priority){
$Service = sprintf( self::API_DOWNLOAD_FILES, $downloadTaskId);
$rest = $this->getService( $Service . DIRECTORY_SEPARATOR . $FileId);
$rest->PUT([
'priority' => $Priority,
]);
return $rest->getSuccess();
}
|
[
"public",
"function",
"updateFilePriority",
"(",
"$",
"downloadTaskId",
",",
"$",
"FileId",
",",
"$",
"Priority",
")",
"{",
"$",
"Service",
"=",
"sprintf",
"(",
"self",
"::",
"API_DOWNLOAD_FILES",
",",
"$",
"downloadTaskId",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"$",
"Service",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"FileId",
")",
";",
"$",
"rest",
"->",
"PUT",
"(",
"[",
"'priority'",
"=>",
"$",
"Priority",
",",
"]",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Update a download priority
@param int $downloadTaskId
@param string $FileId
@param string $Priority
@see alphayax\freebox\api\v3\symbols\Download\File\Priority
@return bool
|
[
"Update",
"a",
"download",
"priority"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/download/Download.php#L216-L224
|
227,316
|
jk/RestServer
|
src/JK/RestServer/RestServer.php
|
RestServer.handle
|
public function handle()
{
// Access-Control-Allow-Origin header should always be set
$this->header_manager->addHeader("Access-Control-Allow-Origin", join(', ', $this->cors_allowed_origin));
$http_methods_allowed = HttpMethods::getMethodsWhereRequestBodyIsAllowed();
$http_methods_allowed[] = HttpMethods::GET;
if (in_array($this->getMethod(), $http_methods_allowed)) {
try {
$this->data = $this->getData();
} catch (RestException $e) {
$this->handleError($e->getCode(), $e->getMessage());
}
}
list($obj, $method, $params, $this->params, $keys) = $this->findUrl();
if ($obj) {
if (is_string($obj)) {
if (class_exists($obj)) {
$obj = new $obj();
} else {
throw new Exception("Class $obj does not exist");
}
}
$obj->server = $this;
try {
if (method_exists($obj, 'init')) {
$obj->init();
}
if (empty($keys['noAuth'])) {
if (method_exists($this, 'doServerWideAuthorization')) {
if (!$this->doServerWideAuthorization()) {
$this->unauthorized(false);
}
} elseif (method_exists($obj, 'authorize')) {
// Standard behaviour
if (!$obj->authorize()) {
$this->unauthorized(false);
}
}
}
$accept_language_header = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])
? $_SERVER['HTTP_ACCEPT_LANGUAGE']
: '';
$language = new Language(
$this->supported_languages,
$this->default_language,
$accept_language_header
);
$params = $this->injectLanguageIntoMethodParameters($language, $obj, $method, $params);
$result = call_user_func_array(array($obj, $method), $params);
$this->automaticContentLanguageHeaderDispatch($language);
} catch (RestException $e) {
$this->handleError($e->getCode(), $e->getMessage());
}
if (!empty($result)) {
$this->sendData($result);
}
} elseif (!isset($obj) && $this->getMethod() == HttpMethods::OPTIONS) {
$this->handleCorsPreflightRequest();
} else {
$this->handleError(HttpStatusCodes::NOT_FOUND);
}
}
|
php
|
public function handle()
{
// Access-Control-Allow-Origin header should always be set
$this->header_manager->addHeader("Access-Control-Allow-Origin", join(', ', $this->cors_allowed_origin));
$http_methods_allowed = HttpMethods::getMethodsWhereRequestBodyIsAllowed();
$http_methods_allowed[] = HttpMethods::GET;
if (in_array($this->getMethod(), $http_methods_allowed)) {
try {
$this->data = $this->getData();
} catch (RestException $e) {
$this->handleError($e->getCode(), $e->getMessage());
}
}
list($obj, $method, $params, $this->params, $keys) = $this->findUrl();
if ($obj) {
if (is_string($obj)) {
if (class_exists($obj)) {
$obj = new $obj();
} else {
throw new Exception("Class $obj does not exist");
}
}
$obj->server = $this;
try {
if (method_exists($obj, 'init')) {
$obj->init();
}
if (empty($keys['noAuth'])) {
if (method_exists($this, 'doServerWideAuthorization')) {
if (!$this->doServerWideAuthorization()) {
$this->unauthorized(false);
}
} elseif (method_exists($obj, 'authorize')) {
// Standard behaviour
if (!$obj->authorize()) {
$this->unauthorized(false);
}
}
}
$accept_language_header = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])
? $_SERVER['HTTP_ACCEPT_LANGUAGE']
: '';
$language = new Language(
$this->supported_languages,
$this->default_language,
$accept_language_header
);
$params = $this->injectLanguageIntoMethodParameters($language, $obj, $method, $params);
$result = call_user_func_array(array($obj, $method), $params);
$this->automaticContentLanguageHeaderDispatch($language);
} catch (RestException $e) {
$this->handleError($e->getCode(), $e->getMessage());
}
if (!empty($result)) {
$this->sendData($result);
}
} elseif (!isset($obj) && $this->getMethod() == HttpMethods::OPTIONS) {
$this->handleCorsPreflightRequest();
} else {
$this->handleError(HttpStatusCodes::NOT_FOUND);
}
}
|
[
"public",
"function",
"handle",
"(",
")",
"{",
"// Access-Control-Allow-Origin header should always be set",
"$",
"this",
"->",
"header_manager",
"->",
"addHeader",
"(",
"\"Access-Control-Allow-Origin\"",
",",
"join",
"(",
"', '",
",",
"$",
"this",
"->",
"cors_allowed_origin",
")",
")",
";",
"$",
"http_methods_allowed",
"=",
"HttpMethods",
"::",
"getMethodsWhereRequestBodyIsAllowed",
"(",
")",
";",
"$",
"http_methods_allowed",
"[",
"]",
"=",
"HttpMethods",
"::",
"GET",
";",
"if",
"(",
"in_array",
"(",
"$",
"this",
"->",
"getMethod",
"(",
")",
",",
"$",
"http_methods_allowed",
")",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"data",
"=",
"$",
"this",
"->",
"getData",
"(",
")",
";",
"}",
"catch",
"(",
"RestException",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"handleError",
"(",
"$",
"e",
"->",
"getCode",
"(",
")",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"list",
"(",
"$",
"obj",
",",
"$",
"method",
",",
"$",
"params",
",",
"$",
"this",
"->",
"params",
",",
"$",
"keys",
")",
"=",
"$",
"this",
"->",
"findUrl",
"(",
")",
";",
"if",
"(",
"$",
"obj",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"obj",
")",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"obj",
")",
")",
"{",
"$",
"obj",
"=",
"new",
"$",
"obj",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Exception",
"(",
"\"Class $obj does not exist\"",
")",
";",
"}",
"}",
"$",
"obj",
"->",
"server",
"=",
"$",
"this",
";",
"try",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"obj",
",",
"'init'",
")",
")",
"{",
"$",
"obj",
"->",
"init",
"(",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"keys",
"[",
"'noAuth'",
"]",
")",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'doServerWideAuthorization'",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"doServerWideAuthorization",
"(",
")",
")",
"{",
"$",
"this",
"->",
"unauthorized",
"(",
"false",
")",
";",
"}",
"}",
"elseif",
"(",
"method_exists",
"(",
"$",
"obj",
",",
"'authorize'",
")",
")",
"{",
"// Standard behaviour",
"if",
"(",
"!",
"$",
"obj",
"->",
"authorize",
"(",
")",
")",
"{",
"$",
"this",
"->",
"unauthorized",
"(",
"false",
")",
";",
"}",
"}",
"}",
"$",
"accept_language_header",
"=",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTP_ACCEPT_LANGUAGE'",
"]",
")",
"?",
"$",
"_SERVER",
"[",
"'HTTP_ACCEPT_LANGUAGE'",
"]",
":",
"''",
";",
"$",
"language",
"=",
"new",
"Language",
"(",
"$",
"this",
"->",
"supported_languages",
",",
"$",
"this",
"->",
"default_language",
",",
"$",
"accept_language_header",
")",
";",
"$",
"params",
"=",
"$",
"this",
"->",
"injectLanguageIntoMethodParameters",
"(",
"$",
"language",
",",
"$",
"obj",
",",
"$",
"method",
",",
"$",
"params",
")",
";",
"$",
"result",
"=",
"call_user_func_array",
"(",
"array",
"(",
"$",
"obj",
",",
"$",
"method",
")",
",",
"$",
"params",
")",
";",
"$",
"this",
"->",
"automaticContentLanguageHeaderDispatch",
"(",
"$",
"language",
")",
";",
"}",
"catch",
"(",
"RestException",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"handleError",
"(",
"$",
"e",
"->",
"getCode",
"(",
")",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"result",
")",
")",
"{",
"$",
"this",
"->",
"sendData",
"(",
"$",
"result",
")",
";",
"}",
"}",
"elseif",
"(",
"!",
"isset",
"(",
"$",
"obj",
")",
"&&",
"$",
"this",
"->",
"getMethod",
"(",
")",
"==",
"HttpMethods",
"::",
"OPTIONS",
")",
"{",
"$",
"this",
"->",
"handleCorsPreflightRequest",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"handleError",
"(",
"HttpStatusCodes",
"::",
"NOT_FOUND",
")",
";",
"}",
"}"
] |
This is the main method every webserver must have called
@throws Exception Will be thrown if there's a severe problem with the underlying PHP
@throws RestException Will be thrown if there's a formal error with the client request
|
[
"This",
"is",
"the",
"main",
"method",
"every",
"webserver",
"must",
"have",
"called"
] |
477e6a0f0b601008bf96db9767492d5b35637d0b
|
https://github.com/jk/RestServer/blob/477e6a0f0b601008bf96db9767492d5b35637d0b/src/JK/RestServer/RestServer.php#L140-L212
|
227,317
|
jk/RestServer
|
src/JK/RestServer/RestServer.php
|
RestServer.handleCorsPreflightRequest
|
protected function handleCorsPreflightRequest()
{
// Automatic CORS preflight response
$existing_verbs = array();
foreach (HttpMethods::getAllMethods() as $http_verb) {
if (isset($this->map[$http_verb])) {
$urls = $this->map[$http_verb];
foreach (array_keys($urls) as $url) {
if (strstr($url, '$')) {
$matches = $this->matchRequestUriWithMap($this->getPath(), $url);
if (count($matches) > 0) {
$existing_verbs[] = $http_verb;
break;
}
} elseif (isset($this->map[$http_verb][$this->getPath()])) {
$existing_verbs[] = $http_verb;
break;
}
}
}
}
// OPTIONS is always part of the allowed methods
$existing_verbs[] = HttpMethods::OPTIONS;
// RFC5789: PATCH verb OPTIONS response
// RFC4180: "Spaces are considered part of a field and should not be ignored."
$comma_devider = ',';
$this->header_manager->addHeader('Allow', join($comma_devider, $existing_verbs));
// CORS Headers
// Access-Control-Allow-Origin will be handled in ::handle()
$this->header_manager->addHeader('Access-Control-Allow-Methods', join($comma_devider, $existing_verbs));
$this->header_manager->addHeader('Access-Control-Max-Age', intval($this->cors_max_age));
if (count($this->cors_allowed_headers) > 0) {
$this->header_manager->addHeader('Access-Control-Allow-Headers',
join($comma_devider, $this->cors_allowed_headers));
}
$this->sendData('');
}
|
php
|
protected function handleCorsPreflightRequest()
{
// Automatic CORS preflight response
$existing_verbs = array();
foreach (HttpMethods::getAllMethods() as $http_verb) {
if (isset($this->map[$http_verb])) {
$urls = $this->map[$http_verb];
foreach (array_keys($urls) as $url) {
if (strstr($url, '$')) {
$matches = $this->matchRequestUriWithMap($this->getPath(), $url);
if (count($matches) > 0) {
$existing_verbs[] = $http_verb;
break;
}
} elseif (isset($this->map[$http_verb][$this->getPath()])) {
$existing_verbs[] = $http_verb;
break;
}
}
}
}
// OPTIONS is always part of the allowed methods
$existing_verbs[] = HttpMethods::OPTIONS;
// RFC5789: PATCH verb OPTIONS response
// RFC4180: "Spaces are considered part of a field and should not be ignored."
$comma_devider = ',';
$this->header_manager->addHeader('Allow', join($comma_devider, $existing_verbs));
// CORS Headers
// Access-Control-Allow-Origin will be handled in ::handle()
$this->header_manager->addHeader('Access-Control-Allow-Methods', join($comma_devider, $existing_verbs));
$this->header_manager->addHeader('Access-Control-Max-Age', intval($this->cors_max_age));
if (count($this->cors_allowed_headers) > 0) {
$this->header_manager->addHeader('Access-Control-Allow-Headers',
join($comma_devider, $this->cors_allowed_headers));
}
$this->sendData('');
}
|
[
"protected",
"function",
"handleCorsPreflightRequest",
"(",
")",
"{",
"// Automatic CORS preflight response",
"$",
"existing_verbs",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"HttpMethods",
"::",
"getAllMethods",
"(",
")",
"as",
"$",
"http_verb",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"map",
"[",
"$",
"http_verb",
"]",
")",
")",
"{",
"$",
"urls",
"=",
"$",
"this",
"->",
"map",
"[",
"$",
"http_verb",
"]",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"urls",
")",
"as",
"$",
"url",
")",
"{",
"if",
"(",
"strstr",
"(",
"$",
"url",
",",
"'$'",
")",
")",
"{",
"$",
"matches",
"=",
"$",
"this",
"->",
"matchRequestUriWithMap",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"$",
"url",
")",
";",
"if",
"(",
"count",
"(",
"$",
"matches",
")",
">",
"0",
")",
"{",
"$",
"existing_verbs",
"[",
"]",
"=",
"$",
"http_verb",
";",
"break",
";",
"}",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"this",
"->",
"map",
"[",
"$",
"http_verb",
"]",
"[",
"$",
"this",
"->",
"getPath",
"(",
")",
"]",
")",
")",
"{",
"$",
"existing_verbs",
"[",
"]",
"=",
"$",
"http_verb",
";",
"break",
";",
"}",
"}",
"}",
"}",
"// OPTIONS is always part of the allowed methods",
"$",
"existing_verbs",
"[",
"]",
"=",
"HttpMethods",
"::",
"OPTIONS",
";",
"// RFC5789: PATCH verb OPTIONS response",
"// RFC4180: \"Spaces are considered part of a field and should not be ignored.\"",
"$",
"comma_devider",
"=",
"','",
";",
"$",
"this",
"->",
"header_manager",
"->",
"addHeader",
"(",
"'Allow'",
",",
"join",
"(",
"$",
"comma_devider",
",",
"$",
"existing_verbs",
")",
")",
";",
"// CORS Headers",
"// Access-Control-Allow-Origin will be handled in ::handle()",
"$",
"this",
"->",
"header_manager",
"->",
"addHeader",
"(",
"'Access-Control-Allow-Methods'",
",",
"join",
"(",
"$",
"comma_devider",
",",
"$",
"existing_verbs",
")",
")",
";",
"$",
"this",
"->",
"header_manager",
"->",
"addHeader",
"(",
"'Access-Control-Max-Age'",
",",
"intval",
"(",
"$",
"this",
"->",
"cors_max_age",
")",
")",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"cors_allowed_headers",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"header_manager",
"->",
"addHeader",
"(",
"'Access-Control-Allow-Headers'",
",",
"join",
"(",
"$",
"comma_devider",
",",
"$",
"this",
"->",
"cors_allowed_headers",
")",
")",
";",
"}",
"$",
"this",
"->",
"sendData",
"(",
"''",
")",
";",
"}"
] |
Handle CORS preflight requests automatically
@throws RestException
@see http://www.w3.org/TR/cors/
@see http://tools.ietf.org/html/rfc4180
@see http://tools.ietf.org/html/rfc5789
|
[
"Handle",
"CORS",
"preflight",
"requests",
"automatically"
] |
477e6a0f0b601008bf96db9767492d5b35637d0b
|
https://github.com/jk/RestServer/blob/477e6a0f0b601008bf96db9767492d5b35637d0b/src/JK/RestServer/RestServer.php#L222-L263
|
227,318
|
jk/RestServer
|
src/JK/RestServer/RestServer.php
|
RestServer.handleError
|
public function handleError($status_code, $error_message = null)
{
$method = "handle$status_code";
foreach ($this->errorClasses as $class) {
$reflection = Utilities::reflectionClassFromObjectOrClass($class);
if (isset($reflection) && $reflection->hasMethod($method)) {
$obj = is_string($class) ? new $class() : $class;
$obj->$method();
return;
}
}
$description = HttpStatusCodes::getDescription($status_code);
if (isset($error_message) && $this->mode == Mode::DEBUG) {
$message = $description . ': ' . $error_message;
} else {
$message = $description;
}
$output = array(
'error' => array(
'code' => $status_code,
'message' => $message
)
);
$this->setStatus($status_code);
$this->sendData($output);
}
|
php
|
public function handleError($status_code, $error_message = null)
{
$method = "handle$status_code";
foreach ($this->errorClasses as $class) {
$reflection = Utilities::reflectionClassFromObjectOrClass($class);
if (isset($reflection) && $reflection->hasMethod($method)) {
$obj = is_string($class) ? new $class() : $class;
$obj->$method();
return;
}
}
$description = HttpStatusCodes::getDescription($status_code);
if (isset($error_message) && $this->mode == Mode::DEBUG) {
$message = $description . ': ' . $error_message;
} else {
$message = $description;
}
$output = array(
'error' => array(
'code' => $status_code,
'message' => $message
)
);
$this->setStatus($status_code);
$this->sendData($output);
}
|
[
"public",
"function",
"handleError",
"(",
"$",
"status_code",
",",
"$",
"error_message",
"=",
"null",
")",
"{",
"$",
"method",
"=",
"\"handle$status_code\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"errorClasses",
"as",
"$",
"class",
")",
"{",
"$",
"reflection",
"=",
"Utilities",
"::",
"reflectionClassFromObjectOrClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"reflection",
")",
"&&",
"$",
"reflection",
"->",
"hasMethod",
"(",
"$",
"method",
")",
")",
"{",
"$",
"obj",
"=",
"is_string",
"(",
"$",
"class",
")",
"?",
"new",
"$",
"class",
"(",
")",
":",
"$",
"class",
";",
"$",
"obj",
"->",
"$",
"method",
"(",
")",
";",
"return",
";",
"}",
"}",
"$",
"description",
"=",
"HttpStatusCodes",
"::",
"getDescription",
"(",
"$",
"status_code",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"error_message",
")",
"&&",
"$",
"this",
"->",
"mode",
"==",
"Mode",
"::",
"DEBUG",
")",
"{",
"$",
"message",
"=",
"$",
"description",
".",
"': '",
".",
"$",
"error_message",
";",
"}",
"else",
"{",
"$",
"message",
"=",
"$",
"description",
";",
"}",
"$",
"output",
"=",
"array",
"(",
"'error'",
"=>",
"array",
"(",
"'code'",
"=>",
"$",
"status_code",
",",
"'message'",
"=>",
"$",
"message",
")",
")",
";",
"$",
"this",
"->",
"setStatus",
"(",
"$",
"status_code",
")",
";",
"$",
"this",
"->",
"sendData",
"(",
"$",
"output",
")",
";",
"}"
] |
Handles all error cases. Mostly sets a header and formats an error message to respond to the client
The more detailed error message will only be returned to the user if the server is in Mode::DEBUG mode
@param int $status_code HTTP status code
@param string $error_message Error message, you can specify a more detailed error message
@throws RestException
|
[
"Handles",
"all",
"error",
"cases",
".",
"Mostly",
"sets",
"a",
"header",
"and",
"formats",
"an",
"error",
"message",
"to",
"respond",
"to",
"the",
"client"
] |
477e6a0f0b601008bf96db9767492d5b35637d0b
|
https://github.com/jk/RestServer/blob/477e6a0f0b601008bf96db9767492d5b35637d0b/src/JK/RestServer/RestServer.php#L302-L333
|
227,319
|
jk/RestServer
|
src/JK/RestServer/RestServer.php
|
RestServer.getFormat
|
public function getFormat()
{
if ($this->format !== null) {
return $this->format;
}
$format = $this->default_format;
if (isset($_SERVER['HTTP_ACCEPT'])) {
$accept_header = Utilities::sortByPriority($_SERVER['HTTP_ACCEPT']);
foreach ($accept_header as $mime_type => $priority) {
if (Format::isMimeTypeSupported($mime_type)) {
$format = $mime_type;
break;
}
}
}
// Check for trailing dot-format syntax like /controller/action.format -> action.json
$override = '';
if (isset($_SERVER['REQUEST_URI']) && preg_match('/\.(\w+)($|\?)/i', $_SERVER['REQUEST_URI'], $matches)) {
$override = $matches[1];
}
if (Format::getMimeTypeFromFormatAbbreviation($override)) {
$format = Format::getMimeTypeFromFormatAbbreviation($override);
}
$this->format = $format;
return $format;
}
|
php
|
public function getFormat()
{
if ($this->format !== null) {
return $this->format;
}
$format = $this->default_format;
if (isset($_SERVER['HTTP_ACCEPT'])) {
$accept_header = Utilities::sortByPriority($_SERVER['HTTP_ACCEPT']);
foreach ($accept_header as $mime_type => $priority) {
if (Format::isMimeTypeSupported($mime_type)) {
$format = $mime_type;
break;
}
}
}
// Check for trailing dot-format syntax like /controller/action.format -> action.json
$override = '';
if (isset($_SERVER['REQUEST_URI']) && preg_match('/\.(\w+)($|\?)/i', $_SERVER['REQUEST_URI'], $matches)) {
$override = $matches[1];
}
if (Format::getMimeTypeFromFormatAbbreviation($override)) {
$format = Format::getMimeTypeFromFormatAbbreviation($override);
}
$this->format = $format;
return $format;
}
|
[
"public",
"function",
"getFormat",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"format",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"format",
";",
"}",
"$",
"format",
"=",
"$",
"this",
"->",
"default_format",
";",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTP_ACCEPT'",
"]",
")",
")",
"{",
"$",
"accept_header",
"=",
"Utilities",
"::",
"sortByPriority",
"(",
"$",
"_SERVER",
"[",
"'HTTP_ACCEPT'",
"]",
")",
";",
"foreach",
"(",
"$",
"accept_header",
"as",
"$",
"mime_type",
"=>",
"$",
"priority",
")",
"{",
"if",
"(",
"Format",
"::",
"isMimeTypeSupported",
"(",
"$",
"mime_type",
")",
")",
"{",
"$",
"format",
"=",
"$",
"mime_type",
";",
"break",
";",
"}",
"}",
"}",
"// Check for trailing dot-format syntax like /controller/action.format -> action.json",
"$",
"override",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
"&&",
"preg_match",
"(",
"'/\\.(\\w+)($|\\?)/i'",
",",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
",",
"$",
"matches",
")",
")",
"{",
"$",
"override",
"=",
"$",
"matches",
"[",
"1",
"]",
";",
"}",
"if",
"(",
"Format",
"::",
"getMimeTypeFromFormatAbbreviation",
"(",
"$",
"override",
")",
")",
"{",
"$",
"format",
"=",
"Format",
"::",
"getMimeTypeFromFormatAbbreviation",
"(",
"$",
"override",
")",
";",
"}",
"$",
"this",
"->",
"format",
"=",
"$",
"format",
";",
"return",
"$",
"format",
";",
"}"
] |
Determine the requested format by the API client
We have basically two ways requesting an output format
1. The client tells us the requsted format within the URL like /controller/action.format
2. The client send the Accept: header
The order is important only if the client specifies both. If so, the 1. varient (the URL dot syntax)
has precedence
@return string Client requested output format
|
[
"Determine",
"the",
"requested",
"format",
"by",
"the",
"API",
"client"
] |
477e6a0f0b601008bf96db9767492d5b35637d0b
|
https://github.com/jk/RestServer/blob/477e6a0f0b601008bf96db9767492d5b35637d0b/src/JK/RestServer/RestServer.php#L489-L521
|
227,320
|
jk/RestServer
|
src/JK/RestServer/RestServer.php
|
RestServer.setRoot
|
public function setRoot($root)
{
// do nothing if root isn't a valid prefix
if (empty($root)) {
return null;
}
// Kill slash padding and add a trailing slash afterwards
$root = trim($root, '/');
$root .= '/';
$this->root = $root;
}
|
php
|
public function setRoot($root)
{
// do nothing if root isn't a valid prefix
if (empty($root)) {
return null;
}
// Kill slash padding and add a trailing slash afterwards
$root = trim($root, '/');
$root .= '/';
$this->root = $root;
}
|
[
"public",
"function",
"setRoot",
"(",
"$",
"root",
")",
"{",
"// do nothing if root isn't a valid prefix",
"if",
"(",
"empty",
"(",
"$",
"root",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Kill slash padding and add a trailing slash afterwards",
"$",
"root",
"=",
"trim",
"(",
"$",
"root",
",",
"'/'",
")",
";",
"$",
"root",
".=",
"'/'",
";",
"$",
"this",
"->",
"root",
"=",
"$",
"root",
";",
"}"
] |
Set an URL prefix
You can set the root to achieve something like a base directory, so
you don't have to prepend that directory prefix on every addClass
class.
@param string $root URL prefix you type into your browser
@return void|null
|
[
"Set",
"an",
"URL",
"prefix"
] |
477e6a0f0b601008bf96db9767492d5b35637d0b
|
https://github.com/jk/RestServer/blob/477e6a0f0b601008bf96db9767492d5b35637d0b/src/JK/RestServer/RestServer.php#L604-L615
|
227,321
|
jk/RestServer
|
src/JK/RestServer/RestServer.php
|
RestServer.setDefaultFormat
|
public function setDefaultFormat($mime_type)
{
if (Format::isMimeTypeSupported($mime_type)) {
$this->default_format = $mime_type;
return true;
} else {
return false;
}
}
|
php
|
public function setDefaultFormat($mime_type)
{
if (Format::isMimeTypeSupported($mime_type)) {
$this->default_format = $mime_type;
return true;
} else {
return false;
}
}
|
[
"public",
"function",
"setDefaultFormat",
"(",
"$",
"mime_type",
")",
"{",
"if",
"(",
"Format",
"::",
"isMimeTypeSupported",
"(",
"$",
"mime_type",
")",
")",
"{",
"$",
"this",
"->",
"default_format",
"=",
"$",
"mime_type",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Setting a default output format.
This will be used if the client does not request any specific format.
@param string $mime_type Default format
@return bool Setting of default format was successful
|
[
"Setting",
"a",
"default",
"output",
"format",
"."
] |
477e6a0f0b601008bf96db9767492d5b35637d0b
|
https://github.com/jk/RestServer/blob/477e6a0f0b601008bf96db9767492d5b35637d0b/src/JK/RestServer/RestServer.php#L695-L703
|
227,322
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/WiFi/MacFilter.php
|
MacFilter.getAll
|
public function getAll(){
$rest = $this->getService( self::API_WIFI_MAC_FILTER);
$rest->GET();
return $rest->getResultAsArray( models\WiFi\MacFilter::class);
}
|
php
|
public function getAll(){
$rest = $this->getService( self::API_WIFI_MAC_FILTER);
$rest->GET();
return $rest->getResultAsArray( models\WiFi\MacFilter::class);
}
|
[
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_WIFI_MAC_FILTER",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResultAsArray",
"(",
"models",
"\\",
"WiFi",
"\\",
"MacFilter",
"::",
"class",
")",
";",
"}"
] |
Get all MacFilters
@return models\WiFi\MacFilter[]
|
[
"Get",
"all",
"MacFilters"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/MacFilter.php#L18-L23
|
227,323
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/WiFi/MacFilter.php
|
MacFilter.getFromId
|
public function getFromId( $MacFilterId){
$rest = $this->getService( self::API_WIFI_MAC_FILTER . $MacFilterId);
$rest->GET();
return $rest->getResult( models\WiFi\MacFilter::class);
}
|
php
|
public function getFromId( $MacFilterId){
$rest = $this->getService( self::API_WIFI_MAC_FILTER . $MacFilterId);
$rest->GET();
return $rest->getResult( models\WiFi\MacFilter::class);
}
|
[
"public",
"function",
"getFromId",
"(",
"$",
"MacFilterId",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_WIFI_MAC_FILTER",
".",
"$",
"MacFilterId",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"WiFi",
"\\",
"MacFilter",
"::",
"class",
")",
";",
"}"
] |
Get a specific MacFilter
@param $MacFilterId
@return models\WiFi\MacFilter
|
[
"Get",
"a",
"specific",
"MacFilter"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/MacFilter.php#L30-L35
|
227,324
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/WiFi/MacFilter.php
|
MacFilter.update
|
public function update( models\WiFi\MacFilter $MacFilter){
$rest = $this->getService( self::API_WIFI_MAC_FILTER . $MacFilter->getId());
$rest->PUT( $MacFilter);
return $rest->getResult( models\WiFi\MacFilter::class);
}
|
php
|
public function update( models\WiFi\MacFilter $MacFilter){
$rest = $this->getService( self::API_WIFI_MAC_FILTER . $MacFilter->getId());
$rest->PUT( $MacFilter);
return $rest->getResult( models\WiFi\MacFilter::class);
}
|
[
"public",
"function",
"update",
"(",
"models",
"\\",
"WiFi",
"\\",
"MacFilter",
"$",
"MacFilter",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_WIFI_MAC_FILTER",
".",
"$",
"MacFilter",
"->",
"getId",
"(",
")",
")",
";",
"$",
"rest",
"->",
"PUT",
"(",
"$",
"MacFilter",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"WiFi",
"\\",
"MacFilter",
"::",
"class",
")",
";",
"}"
] |
Update a MacFilter
@param \alphayax\freebox\api\v3\models\WiFi\MacFilter $MacFilter
@return \alphayax\freebox\api\v3\models\WiFi\MacFilter
|
[
"Update",
"a",
"MacFilter"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/MacFilter.php#L42-L47
|
227,325
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/WiFi/MacFilter.php
|
MacFilter.deleteFromId
|
public function deleteFromId( $MacFilterId){
$rest = $this->getService( self::API_WIFI_MAC_FILTER . $MacFilterId);
$rest->DELETE();
return $rest->getSuccess();
}
|
php
|
public function deleteFromId( $MacFilterId){
$rest = $this->getService( self::API_WIFI_MAC_FILTER . $MacFilterId);
$rest->DELETE();
return $rest->getSuccess();
}
|
[
"public",
"function",
"deleteFromId",
"(",
"$",
"MacFilterId",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_WIFI_MAC_FILTER",
".",
"$",
"MacFilterId",
")",
";",
"$",
"rest",
"->",
"DELETE",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Delete a MacFilter with the specified id
@param $MacFilterId
@return bool
|
[
"Delete",
"a",
"MacFilter",
"with",
"the",
"specified",
"id"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/MacFilter.php#L63-L68
|
227,326
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/WiFi/MacFilter.php
|
MacFilter.add
|
public function add( models\WiFi\MacFilter $MacFilter){
$rest = $this->getService( self::API_WIFI_MAC_FILTER);
$rest->POST( $MacFilter);
return $rest->getResult( models\WiFi\MacFilter::class);
}
|
php
|
public function add( models\WiFi\MacFilter $MacFilter){
$rest = $this->getService( self::API_WIFI_MAC_FILTER);
$rest->POST( $MacFilter);
return $rest->getResult( models\WiFi\MacFilter::class);
}
|
[
"public",
"function",
"add",
"(",
"models",
"\\",
"WiFi",
"\\",
"MacFilter",
"$",
"MacFilter",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_WIFI_MAC_FILTER",
")",
";",
"$",
"rest",
"->",
"POST",
"(",
"$",
"MacFilter",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"WiFi",
"\\",
"MacFilter",
"::",
"class",
")",
";",
"}"
] |
Add a new MacFilter
@param \alphayax\freebox\api\v3\models\WiFi\MacFilter $MacFilter
@return \alphayax\freebox\api\v3\models\WiFi\MacFilter
|
[
"Add",
"a",
"new",
"MacFilter"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/MacFilter.php#L75-L80
|
227,327
|
jk/RestServer
|
src/JK/RestServer/Format.php
|
Format.getMimeTypeFromFormatAbbreviation
|
public static function getMimeTypeFromFormatAbbreviation($format_abbreviation)
{
if (array_key_exists($format_abbreviation, self::$formats)) {
return self::$formats[$format_abbreviation];
} else {
return false;
}
}
|
php
|
public static function getMimeTypeFromFormatAbbreviation($format_abbreviation)
{
if (array_key_exists($format_abbreviation, self::$formats)) {
return self::$formats[$format_abbreviation];
} else {
return false;
}
}
|
[
"public",
"static",
"function",
"getMimeTypeFromFormatAbbreviation",
"(",
"$",
"format_abbreviation",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"format_abbreviation",
",",
"self",
"::",
"$",
"formats",
")",
")",
"{",
"return",
"self",
"::",
"$",
"formats",
"[",
"$",
"format_abbreviation",
"]",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Get the MIME type for a known format abbreviation
@param string $format_abbreviation Supported format abbreviation (i.e. file type extension like "json" or "xml")
@return bool|string MIME type
|
[
"Get",
"the",
"MIME",
"type",
"for",
"a",
"known",
"format",
"abbreviation"
] |
477e6a0f0b601008bf96db9767492d5b35637d0b
|
https://github.com/jk/RestServer/blob/477e6a0f0b601008bf96db9767492d5b35637d0b/src/JK/RestServer/Format.php#L54-L61
|
227,328
|
php-comp/queue
|
src/Driver/SysVQueue.php
|
SysVQueue.setQueueOptions
|
public function setQueueOptions(array $options = [], $queue = self::PRIORITY_NORM)
{
msg_set_queue($this->queues[$queue], $options);
}
|
php
|
public function setQueueOptions(array $options = [], $queue = self::PRIORITY_NORM)
{
msg_set_queue($this->queues[$queue], $options);
}
|
[
"public",
"function",
"setQueueOptions",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"queue",
"=",
"self",
"::",
"PRIORITY_NORM",
")",
"{",
"msg_set_queue",
"(",
"$",
"this",
"->",
"queues",
"[",
"$",
"queue",
"]",
",",
"$",
"options",
")",
";",
"}"
] |
Setting the queue option
@param array $options
@param int $queue
|
[
"Setting",
"the",
"queue",
"option"
] |
61eb3787cda32b469382c8430a663ea2154dc288
|
https://github.com/php-comp/queue/blob/61eb3787cda32b469382c8430a663ea2154dc288/src/Driver/SysVQueue.php#L225-L228
|
227,329
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.logOut
|
public function logOut() {
$data["Envelope"] = array(
"Body" => array(
"Logout" => ""
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
return $this->_isSuccess($result);
}
|
php
|
public function logOut() {
$data["Envelope"] = array(
"Body" => array(
"Logout" => ""
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
return $this->_isSuccess($result);
}
|
[
"public",
"function",
"logOut",
"(",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"Logout\"",
"=>",
"\"\"",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"return",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
";",
"}"
] |
Terminate the session with Silverpop.
@return bool
|
[
"Terminate",
"the",
"session",
"with",
"Silverpop",
"."
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L43-L52
|
227,330
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.getLists
|
public function getLists($listType = 2, $isPrivate = true, $folder = null) {
$data["Envelope"] = array(
"Body" => array(
"GetLists" => array(
"VISIBILITY" => ($isPrivate ? '0' : '1'),
"FOLDER_ID" => $folder,
"LIST_TYPE" => $listType,
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['LIST']))
return $result['LIST'];
else {
return array(); //?
}
} else {
throw new \Exception("GetLists Error: ".$this->_getErrorFromResponse($response));
}
}
|
php
|
public function getLists($listType = 2, $isPrivate = true, $folder = null) {
$data["Envelope"] = array(
"Body" => array(
"GetLists" => array(
"VISIBILITY" => ($isPrivate ? '0' : '1'),
"FOLDER_ID" => $folder,
"LIST_TYPE" => $listType,
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['LIST']))
return $result['LIST'];
else {
return array(); //?
}
} else {
throw new \Exception("GetLists Error: ".$this->_getErrorFromResponse($response));
}
}
|
[
"public",
"function",
"getLists",
"(",
"$",
"listType",
"=",
"2",
",",
"$",
"isPrivate",
"=",
"true",
",",
"$",
"folder",
"=",
"null",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"GetLists\"",
"=>",
"array",
"(",
"\"VISIBILITY\"",
"=>",
"(",
"$",
"isPrivate",
"?",
"'0'",
":",
"'1'",
")",
",",
"\"FOLDER_ID\"",
"=>",
"$",
"folder",
",",
"\"LIST_TYPE\"",
"=>",
"$",
"listType",
",",
")",
",",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'LIST'",
"]",
")",
")",
"return",
"$",
"result",
"[",
"'LIST'",
"]",
";",
"else",
"{",
"return",
"array",
"(",
")",
";",
"//?",
"}",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"GetLists Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}",
"}"
] |
Fetches the contents of a list
$listType can be one of:
0 - Databases
1 - Queries
2 - Both Databases and Queries
5 - Test Lists
6 - Seed Lists
13 - Suppression Lists
15 - Relational Tables
18 - Contact Lists
|
[
"Fetches",
"the",
"contents",
"of",
"a",
"list"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L69-L90
|
227,331
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.getMailingTemplates
|
public function getMailingTemplates($isPrivate = true) {
$data["Envelope"] = array(
"Body" => array(
"GetMailingTemplates" => array(
"VISIBILITY" => ($isPrivate ? '0' : '1'),
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['MAILING_TEMPLATE']))
return $result['MAILING_TEMPLATE'];
else {
return array(); //?
}
} else {
throw new \Exception("GetLists Error: ".$this->_getErrorFromResponse($response));
}
}
|
php
|
public function getMailingTemplates($isPrivate = true) {
$data["Envelope"] = array(
"Body" => array(
"GetMailingTemplates" => array(
"VISIBILITY" => ($isPrivate ? '0' : '1'),
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['MAILING_TEMPLATE']))
return $result['MAILING_TEMPLATE'];
else {
return array(); //?
}
} else {
throw new \Exception("GetLists Error: ".$this->_getErrorFromResponse($response));
}
}
|
[
"public",
"function",
"getMailingTemplates",
"(",
"$",
"isPrivate",
"=",
"true",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"GetMailingTemplates\"",
"=>",
"array",
"(",
"\"VISIBILITY\"",
"=>",
"(",
"$",
"isPrivate",
"?",
"'0'",
":",
"'1'",
")",
",",
")",
",",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'MAILING_TEMPLATE'",
"]",
")",
")",
"return",
"$",
"result",
"[",
"'MAILING_TEMPLATE'",
"]",
";",
"else",
"{",
"return",
"array",
"(",
")",
";",
"//?",
"}",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"GetLists Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}",
"}"
] |
Get mailing templates
|
[
"Get",
"mailing",
"templates"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L96-L115
|
227,332
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.getScheduledMailings
|
public function getScheduledMailings() {
$data['Envelope'] = array(
'Body' => array(
'GetSentMailingsForOrg' => array(
'SCHEDULED' => null,
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return $result;
} else {
throw new Exception("Silverpop says: ".$response["Envelope"]["Body"]["Fault"]["FaultString"]);
}
}
|
php
|
public function getScheduledMailings() {
$data['Envelope'] = array(
'Body' => array(
'GetSentMailingsForOrg' => array(
'SCHEDULED' => null,
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return $result;
} else {
throw new Exception("Silverpop says: ".$response["Envelope"]["Body"]["Fault"]["FaultString"]);
}
}
|
[
"public",
"function",
"getScheduledMailings",
"(",
")",
"{",
"$",
"data",
"[",
"'Envelope'",
"]",
"=",
"array",
"(",
"'Body'",
"=>",
"array",
"(",
"'GetSentMailingsForOrg'",
"=>",
"array",
"(",
"'SCHEDULED'",
"=>",
"null",
",",
")",
",",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"else",
"{",
"throw",
"new",
"Exception",
"(",
"\"Silverpop says: \"",
".",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"Fault\"",
"]",
"[",
"\"FaultString\"",
"]",
")",
";",
"}",
"}"
] |
Get scheduled mailings
|
[
"Get",
"scheduled",
"mailings"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L142-L157
|
227,333
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.getListMetaData
|
public function getListMetaData($databaseID) {
$data["Envelope"] = array(
"Body" => array(
"GetListMetaData" => array(
"LIST_ID" => $databaseID,
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return $result;
} else {
throw new \Exception("Silverpop says: ".$response["Envelope"]["Body"]["Fault"]["FaultString"]);
}
}
|
php
|
public function getListMetaData($databaseID) {
$data["Envelope"] = array(
"Body" => array(
"GetListMetaData" => array(
"LIST_ID" => $databaseID,
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return $result;
} else {
throw new \Exception("Silverpop says: ".$response["Envelope"]["Body"]["Fault"]["FaultString"]);
}
}
|
[
"public",
"function",
"getListMetaData",
"(",
"$",
"databaseID",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"GetListMetaData\"",
"=>",
"array",
"(",
"\"LIST_ID\"",
"=>",
"$",
"databaseID",
",",
")",
",",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Silverpop says: \"",
".",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"Fault\"",
"]",
"[",
"\"FaultString\"",
"]",
")",
";",
"}",
"}"
] |
Get the meta information for a list
|
[
"Get",
"the",
"meta",
"information",
"for",
"a",
"list"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L163-L178
|
227,334
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.doubleOptInContact
|
public function doubleOptInContact($databaseID, $email) {
$data["Envelope"] = array(
"Body" => array(
"DoubleOptInRecipient" => array(
"LIST_ID" => $databaseID,
"COLUMN" => array(
array(
'NAME' => 'EMAIL',
'VALUE' => $email,
),
),
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['RecipientId']))
return $result['RecipientId'];
else {
throw new \Exception('Recipient added but no recipient ID was returned from the server.');
}
}
throw new \Exception("DoubleOptInRecipient Error: ".$this->_getErrorFromResponse($response));
}
|
php
|
public function doubleOptInContact($databaseID, $email) {
$data["Envelope"] = array(
"Body" => array(
"DoubleOptInRecipient" => array(
"LIST_ID" => $databaseID,
"COLUMN" => array(
array(
'NAME' => 'EMAIL',
'VALUE' => $email,
),
),
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['RecipientId']))
return $result['RecipientId'];
else {
throw new \Exception('Recipient added but no recipient ID was returned from the server.');
}
}
throw new \Exception("DoubleOptInRecipient Error: ".$this->_getErrorFromResponse($response));
}
|
[
"public",
"function",
"doubleOptInContact",
"(",
"$",
"databaseID",
",",
"$",
"email",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"DoubleOptInRecipient\"",
"=>",
"array",
"(",
"\"LIST_ID\"",
"=>",
"$",
"databaseID",
",",
"\"COLUMN\"",
"=>",
"array",
"(",
"array",
"(",
"'NAME'",
"=>",
"'EMAIL'",
",",
"'VALUE'",
"=>",
"$",
"email",
",",
")",
",",
")",
",",
")",
",",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'RecipientId'",
"]",
")",
")",
"return",
"$",
"result",
"[",
"'RecipientId'",
"]",
";",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Recipient added but no recipient ID was returned from the server.'",
")",
";",
"}",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"\"DoubleOptInRecipient Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}"
] |
Double opt in a contact
@param string $databaseID
@param string $email
@throws \Exception
@throw Exception in case of error
@return int recipient ID
|
[
"Double",
"opt",
"in",
"a",
"contact"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L332-L358
|
227,335
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.updateContact
|
public function updateContact($databaseID, $oldEmail, $columns, $visitorKey = '', $syncFields = []) {
$data["Envelope"] = array(
"Body" => array(
"UpdateRecipient" => array(
"LIST_ID" => $databaseID,
"OLD_EMAIL" => $oldEmail,
"CREATED_FROM" => 1, // 1 = created manually
"VISITOR_KEY" => $visitorKey,
"COLUMN" => array(),
),
),
);
foreach ($columns as $name => $value) {
$data["Envelope"]["Body"]["UpdateRecipient"]["COLUMN"][] = array("NAME" => $name, "VALUE" => $value);
}
foreach ($syncFields as $name => $value) {
$data["Envelope"]["Body"]["UpdateRecipient"]["SYNC_FIELDS"]["SYNC_FIELD"][] = array("NAME" => $name, "VALUE" => $value);
}
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['RecipientId']))
return $result['RecipientId'];
else {
throw new \Exception('Recipient added but no recipient ID was returned from the server.');
}
}
throw new \Exception("UpdateRecipient Error: ".$this->_getErrorFromResponse($response));
}
|
php
|
public function updateContact($databaseID, $oldEmail, $columns, $visitorKey = '', $syncFields = []) {
$data["Envelope"] = array(
"Body" => array(
"UpdateRecipient" => array(
"LIST_ID" => $databaseID,
"OLD_EMAIL" => $oldEmail,
"CREATED_FROM" => 1, // 1 = created manually
"VISITOR_KEY" => $visitorKey,
"COLUMN" => array(),
),
),
);
foreach ($columns as $name => $value) {
$data["Envelope"]["Body"]["UpdateRecipient"]["COLUMN"][] = array("NAME" => $name, "VALUE" => $value);
}
foreach ($syncFields as $name => $value) {
$data["Envelope"]["Body"]["UpdateRecipient"]["SYNC_FIELDS"]["SYNC_FIELD"][] = array("NAME" => $name, "VALUE" => $value);
}
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['RecipientId']))
return $result['RecipientId'];
else {
throw new \Exception('Recipient added but no recipient ID was returned from the server.');
}
}
throw new \Exception("UpdateRecipient Error: ".$this->_getErrorFromResponse($response));
}
|
[
"public",
"function",
"updateContact",
"(",
"$",
"databaseID",
",",
"$",
"oldEmail",
",",
"$",
"columns",
",",
"$",
"visitorKey",
"=",
"''",
",",
"$",
"syncFields",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"UpdateRecipient\"",
"=>",
"array",
"(",
"\"LIST_ID\"",
"=>",
"$",
"databaseID",
",",
"\"OLD_EMAIL\"",
"=>",
"$",
"oldEmail",
",",
"\"CREATED_FROM\"",
"=>",
"1",
",",
"// 1 = created manually",
"\"VISITOR_KEY\"",
"=>",
"$",
"visitorKey",
",",
"\"COLUMN\"",
"=>",
"array",
"(",
")",
",",
")",
",",
")",
",",
")",
";",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"UpdateRecipient\"",
"]",
"[",
"\"COLUMN\"",
"]",
"[",
"]",
"=",
"array",
"(",
"\"NAME\"",
"=>",
"$",
"name",
",",
"\"VALUE\"",
"=>",
"$",
"value",
")",
";",
"}",
"foreach",
"(",
"$",
"syncFields",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"UpdateRecipient\"",
"]",
"[",
"\"SYNC_FIELDS\"",
"]",
"[",
"\"SYNC_FIELD\"",
"]",
"[",
"]",
"=",
"array",
"(",
"\"NAME\"",
"=>",
"$",
"name",
",",
"\"VALUE\"",
"=>",
"$",
"value",
")",
";",
"}",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'RecipientId'",
"]",
")",
")",
"return",
"$",
"result",
"[",
"'RecipientId'",
"]",
";",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Recipient added but no recipient ID was returned from the server.'",
")",
";",
"}",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"\"UpdateRecipient Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}"
] |
Update a contact.
@param int $databaseID
@param string $oldEmail
@param array $columns
@throws \Exception
@return int recipient ID
|
[
"Update",
"a",
"contact",
"."
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L370-L399
|
227,336
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.optOutContact
|
public function optOutContact($databaseID, $email, $columns = array()) {
$data["Envelope"] = array(
"Body" => array(
"OptOutRecipient" => array(
"LIST_ID" => $databaseID,
"EMAIL" => $email,
"COLUMN" => array(),
),
),
);
$columns['EMAIL'] = $email;
foreach ($columns as $name => $value) {
$data["Envelope"]["Body"]["OptOutRecipient"]["COLUMN"][] = array("NAME" => $name, "VALUE" => $value);
}
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return true;
}
throw new \Exception("OptOutRecipient Error: ".$this->_getErrorFromResponse($response));
}
|
php
|
public function optOutContact($databaseID, $email, $columns = array()) {
$data["Envelope"] = array(
"Body" => array(
"OptOutRecipient" => array(
"LIST_ID" => $databaseID,
"EMAIL" => $email,
"COLUMN" => array(),
),
),
);
$columns['EMAIL'] = $email;
foreach ($columns as $name => $value) {
$data["Envelope"]["Body"]["OptOutRecipient"]["COLUMN"][] = array("NAME" => $name, "VALUE" => $value);
}
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return true;
}
throw new \Exception("OptOutRecipient Error: ".$this->_getErrorFromResponse($response));
}
|
[
"public",
"function",
"optOutContact",
"(",
"$",
"databaseID",
",",
"$",
"email",
",",
"$",
"columns",
"=",
"array",
"(",
")",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"OptOutRecipient\"",
"=>",
"array",
"(",
"\"LIST_ID\"",
"=>",
"$",
"databaseID",
",",
"\"EMAIL\"",
"=>",
"$",
"email",
",",
"\"COLUMN\"",
"=>",
"array",
"(",
")",
",",
")",
",",
")",
",",
")",
";",
"$",
"columns",
"[",
"'EMAIL'",
"]",
"=",
"$",
"email",
";",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"OptOutRecipient\"",
"]",
"[",
"\"COLUMN\"",
"]",
"[",
"]",
"=",
"array",
"(",
"\"NAME\"",
"=>",
"$",
"name",
",",
"\"VALUE\"",
"=>",
"$",
"value",
")",
";",
"}",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"return",
"true",
";",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"\"OptOutRecipient Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}"
] |
Opt out a contact
@param int $databaseID
@param string $email
@param array $columns
@throws \Exception
@return boolean true on success
|
[
"Opt",
"out",
"a",
"contact"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L411-L434
|
227,337
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.createQuery
|
public function createQuery($queryName, $parentListId, $parentFolderId, $condition, $isPrivate = true) {
$data['Envelope'] = array(
'Body' => array(
'CreateQuery' => array(
'QUERY_NAME' => $queryName,
'PARENT_LIST_ID' => $parentListId,
'PARENT_FOLDER_ID' => $parentFolderId,
'VISIBILITY' => ($isPrivate ? '0' : '1'),
'CRITERIA' => array(
'TYPE' => 'editable',
'EXPRESSION' => $condition,
),
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['ListId']))
return $result['ListId'];
else {
throw new \Exception('Query created but no query ID was returned from the server.');
}
} else {
throw new \Exception("createQuery Error: ".$this->_getErrorFromResponse($response));
}
}
|
php
|
public function createQuery($queryName, $parentListId, $parentFolderId, $condition, $isPrivate = true) {
$data['Envelope'] = array(
'Body' => array(
'CreateQuery' => array(
'QUERY_NAME' => $queryName,
'PARENT_LIST_ID' => $parentListId,
'PARENT_FOLDER_ID' => $parentFolderId,
'VISIBILITY' => ($isPrivate ? '0' : '1'),
'CRITERIA' => array(
'TYPE' => 'editable',
'EXPRESSION' => $condition,
),
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['ListId']))
return $result['ListId'];
else {
throw new \Exception('Query created but no query ID was returned from the server.');
}
} else {
throw new \Exception("createQuery Error: ".$this->_getErrorFromResponse($response));
}
}
|
[
"public",
"function",
"createQuery",
"(",
"$",
"queryName",
",",
"$",
"parentListId",
",",
"$",
"parentFolderId",
",",
"$",
"condition",
",",
"$",
"isPrivate",
"=",
"true",
")",
"{",
"$",
"data",
"[",
"'Envelope'",
"]",
"=",
"array",
"(",
"'Body'",
"=>",
"array",
"(",
"'CreateQuery'",
"=>",
"array",
"(",
"'QUERY_NAME'",
"=>",
"$",
"queryName",
",",
"'PARENT_LIST_ID'",
"=>",
"$",
"parentListId",
",",
"'PARENT_FOLDER_ID'",
"=>",
"$",
"parentFolderId",
",",
"'VISIBILITY'",
"=>",
"(",
"$",
"isPrivate",
"?",
"'0'",
":",
"'1'",
")",
",",
"'CRITERIA'",
"=>",
"array",
"(",
"'TYPE'",
"=>",
"'editable'",
",",
"'EXPRESSION'",
"=>",
"$",
"condition",
",",
")",
",",
")",
",",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'ListId'",
"]",
")",
")",
"return",
"$",
"result",
"[",
"'ListId'",
"]",
";",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Query created but no query ID was returned from the server.'",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"createQuery Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}",
"}"
] |
Create a new query
Takes a list of criteria and creates a query from them
@param string $queryName The name of the new query
@param int $parentListId List that this query is derived from
@param $parentFolderId
@param $condition
@param bool $isPrivate
@throws \Exception
@internal param string $columnName Column that the expression will run against
@internal param string $operators Operator that will be used for the expression
@internal param string $values
@return int ListID of the query that was created
|
[
"Create",
"a",
"new",
"query"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L453-L481
|
227,338
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.sendMailing
|
public function sendMailing($emailID, $mailingID, $optionalKeys = array()) {
$data["Envelope"] = array(
"Body" => array(
"SendMailing" => array(
"MailingId" => $mailingID,
"RecipientEmail" => $emailID,
),
),
);
foreach ($optionalKeys as $key => $value) {
$data["Envelope"]["Body"]["SendMailing"][$key] = $value;
}
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return true;
} else {
throw new \Exception("SendEmail Error: ".$this->_getErrorFromResponse($response));
}
}
|
php
|
public function sendMailing($emailID, $mailingID, $optionalKeys = array()) {
$data["Envelope"] = array(
"Body" => array(
"SendMailing" => array(
"MailingId" => $mailingID,
"RecipientEmail" => $emailID,
),
),
);
foreach ($optionalKeys as $key => $value) {
$data["Envelope"]["Body"]["SendMailing"][$key] = $value;
}
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return true;
} else {
throw new \Exception("SendEmail Error: ".$this->_getErrorFromResponse($response));
}
}
|
[
"public",
"function",
"sendMailing",
"(",
"$",
"emailID",
",",
"$",
"mailingID",
",",
"$",
"optionalKeys",
"=",
"array",
"(",
")",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"SendMailing\"",
"=>",
"array",
"(",
"\"MailingId\"",
"=>",
"$",
"mailingID",
",",
"\"RecipientEmail\"",
"=>",
"$",
"emailID",
",",
")",
",",
")",
",",
")",
";",
"foreach",
"(",
"$",
"optionalKeys",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"SendMailing\"",
"]",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"SendEmail Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}",
"}"
] |
Send a single transactional email
Sends an email to the specified email address ($emailID) using the mailingId
of the autoresponder $mailingID. You can optionally include database keys
to match if multikey database is used (not for replacement).
## Example
$engage->sendMailing("someone@somedomain.com", 149482, array("COLUMNS" => array(
'COLUMN' => array(
array(
'Name' => 'FIELD_IN_TEMPLATE',
'Value' => "value to MATCH",
),
)
)));
@param string $emailID ID of users email, must be opted in.
@param int $mailingID ID of template upon which to base the mailing.
@param array $optionalKeys additional keys to match reciepent
@throws \Exception
@return int $mailingID
|
[
"Send",
"a",
"single",
"transactional",
"email"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L571-L592
|
227,339
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.purgeTable
|
public function purgeTable($tableName, $isPrivate = true) {
$data["Envelope"] = array(
"Body" => array(
"PurgeTable" => array(
"TABLE_NAME" => $tableName,
"TABLE_VISIBILITY" => ($isPrivate ? '0' : '1'),
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['JOB_ID']))
return $result['JOB_ID'];
else {
throw new \Exception('Purge table query created but no job ID was returned from the server.');
}
} else {
throw new \Exception("purgeTable Error: ".$this->_getErrorFromResponse($response));
}
}
|
php
|
public function purgeTable($tableName, $isPrivate = true) {
$data["Envelope"] = array(
"Body" => array(
"PurgeTable" => array(
"TABLE_NAME" => $tableName,
"TABLE_VISIBILITY" => ($isPrivate ? '0' : '1'),
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['JOB_ID']))
return $result['JOB_ID'];
else {
throw new \Exception('Purge table query created but no job ID was returned from the server.');
}
} else {
throw new \Exception("purgeTable Error: ".$this->_getErrorFromResponse($response));
}
}
|
[
"public",
"function",
"purgeTable",
"(",
"$",
"tableName",
",",
"$",
"isPrivate",
"=",
"true",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"PurgeTable\"",
"=>",
"array",
"(",
"\"TABLE_NAME\"",
"=>",
"$",
"tableName",
",",
"\"TABLE_VISIBILITY\"",
"=>",
"(",
"$",
"isPrivate",
"?",
"'0'",
":",
"'1'",
")",
",",
")",
",",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'JOB_ID'",
"]",
")",
")",
"return",
"$",
"result",
"[",
"'JOB_ID'",
"]",
";",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Purge table query created but no job ID was returned from the server.'",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"purgeTable Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}",
"}"
] |
Purge a table
Clear the contents of a table, useful before importing new content
Returns the data job id
|
[
"Purge",
"a",
"table"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L637-L661
|
227,340
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.insertUpdateRelationalTable
|
public function insertUpdateRelationalTable($tableId, $rows) {
$processedRows = array();
$attribs = array();
foreach($rows as $row) {
$columns = array();
foreach($row as $name => $value)
{
$columns['COLUMN'][] = $value;
$attribs[5]['COLUMN'][] = array('name' => $name);
}
$processedRows['ROW'][] = $columns;
}
$data["Envelope"] = array(
"Body" => array(
"InsertUpdateRelationalTable" => array(
"TABLE_ID" => $tableId,
"ROWS" => $processedRows,
),
),
);
$response = $this->_request($data, array(), $attribs);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return true;
} else {
throw new \Exception("insertUpdateRelationalTable Error: ".$this->_getErrorFromResponse($response));
}
}
|
php
|
public function insertUpdateRelationalTable($tableId, $rows) {
$processedRows = array();
$attribs = array();
foreach($rows as $row) {
$columns = array();
foreach($row as $name => $value)
{
$columns['COLUMN'][] = $value;
$attribs[5]['COLUMN'][] = array('name' => $name);
}
$processedRows['ROW'][] = $columns;
}
$data["Envelope"] = array(
"Body" => array(
"InsertUpdateRelationalTable" => array(
"TABLE_ID" => $tableId,
"ROWS" => $processedRows,
),
),
);
$response = $this->_request($data, array(), $attribs);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
return true;
} else {
throw new \Exception("insertUpdateRelationalTable Error: ".$this->_getErrorFromResponse($response));
}
}
|
[
"public",
"function",
"insertUpdateRelationalTable",
"(",
"$",
"tableId",
",",
"$",
"rows",
")",
"{",
"$",
"processedRows",
"=",
"array",
"(",
")",
";",
"$",
"attribs",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"$",
"columns",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"row",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"columns",
"[",
"'COLUMN'",
"]",
"[",
"]",
"=",
"$",
"value",
";",
"$",
"attribs",
"[",
"5",
"]",
"[",
"'COLUMN'",
"]",
"[",
"]",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"name",
")",
";",
"}",
"$",
"processedRows",
"[",
"'ROW'",
"]",
"[",
"]",
"=",
"$",
"columns",
";",
"}",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"InsertUpdateRelationalTable\"",
"=>",
"array",
"(",
"\"TABLE_ID\"",
"=>",
"$",
"tableId",
",",
"\"ROWS\"",
"=>",
"$",
"processedRows",
",",
")",
",",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
",",
"array",
"(",
")",
",",
"$",
"attribs",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"insertUpdateRelationalTable Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}",
"}"
] |
This interface inserts or updates relational data
For each Row that is passed in:
- If a row is found having the same key as the passed in row, update the record.
- If no matching row is found, insert a new row setting the column values to those passed in the request.
Only one hundred rows may be passed in a single insertUpdateRelationalTable call!
|
[
"This",
"interface",
"inserts",
"or",
"updates",
"relational",
"data"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L672-L703
|
227,341
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.exportList
|
public function exportList($listId, $exportType, $exportFormat, $exportColumns = array(), $email = null, $fileEncoding = null, $addToStoredFiles = false, $dateStart = null, $dateEnd = null, $useCreatedDate = false, $includeLeadSource = false, $listDateFormat = null)
{
$data["Envelope"] = array(
"Body" => array(
"ExportList" => array(
"LIST_ID" => $listId,
"EXPORT_TYPE" => $exportType,
"EXPORT_FORMAT" => $exportFormat
)
)
);
if ($exportColumns) {
foreach ($exportColumns as $column) {
$data["Envelope"]["Body"]["ExportList"]["EXPORT_COLUMNS"]["COLUMN"][] = $column;
}
}
if ($email) {
$data["Envelope"]["Body"]["ExportList"]["EMAIL"] = $email;
}
if ($fileEncoding) {
$data["Envelope"]["Body"]["ExportList"]["FILE_ENCODING"] = $fileEncoding;
}
if ($addToStoredFiles) {
$data["Envelope"]["Body"]["ExportList"]["ADD_TO_STORED_FILES"] = "";
}
if ($dateStart) {
$data["Envelope"]["Body"]["ExportList"]["DATE_START"] = $dateStart;
}
if ($dateEnd) {
$data["Envelope"]["Body"]["ExportList"]["DATE_END"] = $dateEnd;
}
if ($useCreatedDate) {
$data["Envelope"]["Body"]["ExportList"]["USE_CREATED_DATE"] = "";
}
if ($includeLeadSource) {
$data["Envelope"]["Body"]["ExportList"]["INCLUDE_LEAD_SOURCE"] = "";
}
if ($listDateFormat) {
$data["Envelope"]["Body"]["ExportList"]["LIST_DATE_FORMAT"] = $listDateFormat;
}
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['JOB_ID']))
return array("JOB_ID" => $result['JOB_ID'], "FILE_PATH" => $result['FILE_PATH']);
else {
throw new \Exception('Export list created but no job ID was returned from the server.');
}
} else {
throw new \Exception("exportList Error: ".$this->_getErrorFromResponse($response));
}
}
|
php
|
public function exportList($listId, $exportType, $exportFormat, $exportColumns = array(), $email = null, $fileEncoding = null, $addToStoredFiles = false, $dateStart = null, $dateEnd = null, $useCreatedDate = false, $includeLeadSource = false, $listDateFormat = null)
{
$data["Envelope"] = array(
"Body" => array(
"ExportList" => array(
"LIST_ID" => $listId,
"EXPORT_TYPE" => $exportType,
"EXPORT_FORMAT" => $exportFormat
)
)
);
if ($exportColumns) {
foreach ($exportColumns as $column) {
$data["Envelope"]["Body"]["ExportList"]["EXPORT_COLUMNS"]["COLUMN"][] = $column;
}
}
if ($email) {
$data["Envelope"]["Body"]["ExportList"]["EMAIL"] = $email;
}
if ($fileEncoding) {
$data["Envelope"]["Body"]["ExportList"]["FILE_ENCODING"] = $fileEncoding;
}
if ($addToStoredFiles) {
$data["Envelope"]["Body"]["ExportList"]["ADD_TO_STORED_FILES"] = "";
}
if ($dateStart) {
$data["Envelope"]["Body"]["ExportList"]["DATE_START"] = $dateStart;
}
if ($dateEnd) {
$data["Envelope"]["Body"]["ExportList"]["DATE_END"] = $dateEnd;
}
if ($useCreatedDate) {
$data["Envelope"]["Body"]["ExportList"]["USE_CREATED_DATE"] = "";
}
if ($includeLeadSource) {
$data["Envelope"]["Body"]["ExportList"]["INCLUDE_LEAD_SOURCE"] = "";
}
if ($listDateFormat) {
$data["Envelope"]["Body"]["ExportList"]["LIST_DATE_FORMAT"] = $listDateFormat;
}
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['JOB_ID']))
return array("JOB_ID" => $result['JOB_ID'], "FILE_PATH" => $result['FILE_PATH']);
else {
throw new \Exception('Export list created but no job ID was returned from the server.');
}
} else {
throw new \Exception("exportList Error: ".$this->_getErrorFromResponse($response));
}
}
|
[
"public",
"function",
"exportList",
"(",
"$",
"listId",
",",
"$",
"exportType",
",",
"$",
"exportFormat",
",",
"$",
"exportColumns",
"=",
"array",
"(",
")",
",",
"$",
"email",
"=",
"null",
",",
"$",
"fileEncoding",
"=",
"null",
",",
"$",
"addToStoredFiles",
"=",
"false",
",",
"$",
"dateStart",
"=",
"null",
",",
"$",
"dateEnd",
"=",
"null",
",",
"$",
"useCreatedDate",
"=",
"false",
",",
"$",
"includeLeadSource",
"=",
"false",
",",
"$",
"listDateFormat",
"=",
"null",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"ExportList\"",
"=>",
"array",
"(",
"\"LIST_ID\"",
"=>",
"$",
"listId",
",",
"\"EXPORT_TYPE\"",
"=>",
"$",
"exportType",
",",
"\"EXPORT_FORMAT\"",
"=>",
"$",
"exportFormat",
")",
")",
")",
";",
"if",
"(",
"$",
"exportColumns",
")",
"{",
"foreach",
"(",
"$",
"exportColumns",
"as",
"$",
"column",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"ExportList\"",
"]",
"[",
"\"EXPORT_COLUMNS\"",
"]",
"[",
"\"COLUMN\"",
"]",
"[",
"]",
"=",
"$",
"column",
";",
"}",
"}",
"if",
"(",
"$",
"email",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"ExportList\"",
"]",
"[",
"\"EMAIL\"",
"]",
"=",
"$",
"email",
";",
"}",
"if",
"(",
"$",
"fileEncoding",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"ExportList\"",
"]",
"[",
"\"FILE_ENCODING\"",
"]",
"=",
"$",
"fileEncoding",
";",
"}",
"if",
"(",
"$",
"addToStoredFiles",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"ExportList\"",
"]",
"[",
"\"ADD_TO_STORED_FILES\"",
"]",
"=",
"\"\"",
";",
"}",
"if",
"(",
"$",
"dateStart",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"ExportList\"",
"]",
"[",
"\"DATE_START\"",
"]",
"=",
"$",
"dateStart",
";",
"}",
"if",
"(",
"$",
"dateEnd",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"ExportList\"",
"]",
"[",
"\"DATE_END\"",
"]",
"=",
"$",
"dateEnd",
";",
"}",
"if",
"(",
"$",
"useCreatedDate",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"ExportList\"",
"]",
"[",
"\"USE_CREATED_DATE\"",
"]",
"=",
"\"\"",
";",
"}",
"if",
"(",
"$",
"includeLeadSource",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"ExportList\"",
"]",
"[",
"\"INCLUDE_LEAD_SOURCE\"",
"]",
"=",
"\"\"",
";",
"}",
"if",
"(",
"$",
"listDateFormat",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"ExportList\"",
"]",
"[",
"\"LIST_DATE_FORMAT\"",
"]",
"=",
"$",
"listDateFormat",
";",
"}",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'JOB_ID'",
"]",
")",
")",
"return",
"array",
"(",
"\"JOB_ID\"",
"=>",
"$",
"result",
"[",
"'JOB_ID'",
"]",
",",
"\"FILE_PATH\"",
"=>",
"$",
"result",
"[",
"'FILE_PATH'",
"]",
")",
";",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Export list created but no job ID was returned from the server.'",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"exportList Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}",
"}"
] |
Exports contact data from a database, query, or contact list. Engage exports the results to a CSV
file, then adds that file to the FTP account associated with the current session.
@param string $listId Unique identifier for the database, query, or contact list Engage is exporting.
@param string $exportType Specifies which contacts to export.
@param string $exportFormat Specifies the format (file type) for the exported data.
@param array $exportColumns XML node used to request specific custom database columns to export for each contact. If EXPORT_COLUMNS is not specified, all database columns will be exported.
@param null|string $email If specified, this email address receives notification when the job is complete.
@param null|string $fileEncoding Defines the encoding of the exported file.
@param bool $addToStoredFiles Use the ADD_TO_STORED_FILES parameter to write the output to the Stored Files folder within Engage.
@param null|string $dateStart Specifies the beginning boundary of information to export (relative to the last modified date). If time is included, it must be in 24-hour format.
@param null|string $dateEnd Specifies the ending boundary of information to export (relative to the last modified date). If time is included, it must be in 24-hour format.
@param bool $useCreatedDate If included, the DATE_START and DATE_END range will be relative to the contact create date rather than last modified date.
@param bool $includeLeadSource Specifies whether to include the Lead Source column in the resulting file.
@param null|string $listDateFormat Used to specify the date format of the date fields in your exported file if date format differs from "mm/dd/yyyy" (month, day, and year can be in any order you choose).
@return mixed
@throws \Exception
|
[
"Exports",
"contact",
"data",
"from",
"a",
"database",
"query",
"or",
"contact",
"list",
".",
"Engage",
"exports",
"the",
"results",
"to",
"a",
"CSV",
"file",
"then",
"adds",
"that",
"file",
"to",
"the",
"FTP",
"account",
"associated",
"with",
"the",
"current",
"session",
"."
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L794-L856
|
227,342
|
simpleweb/SilverpopPHP
|
src/Silverpop/EngagePod.php
|
EngagePod.getJobStatus
|
public function getJobStatus($jobId) {
$data["Envelope"] = array(
"Body" => array(
"GetJobStatus" => array(
"JOB_ID" => $jobId
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['JOB_STATUS']))
return $result;
else {
throw new Exception('Job status query was successful but no status was found.');
}
} else {
throw new \Exception("getJobStatus Error: ".$this->_getErrorFromResponse($response));
}
}
|
php
|
public function getJobStatus($jobId) {
$data["Envelope"] = array(
"Body" => array(
"GetJobStatus" => array(
"JOB_ID" => $jobId
),
),
);
$response = $this->_request($data);
$result = $response["Envelope"]["Body"]["RESULT"];
if ($this->_isSuccess($result)) {
if (isset($result['JOB_STATUS']))
return $result;
else {
throw new Exception('Job status query was successful but no status was found.');
}
} else {
throw new \Exception("getJobStatus Error: ".$this->_getErrorFromResponse($response));
}
}
|
[
"public",
"function",
"getJobStatus",
"(",
"$",
"jobId",
")",
"{",
"$",
"data",
"[",
"\"Envelope\"",
"]",
"=",
"array",
"(",
"\"Body\"",
"=>",
"array",
"(",
"\"GetJobStatus\"",
"=>",
"array",
"(",
"\"JOB_ID\"",
"=>",
"$",
"jobId",
")",
",",
")",
",",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"Envelope\"",
"]",
"[",
"\"Body\"",
"]",
"[",
"\"RESULT\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"'JOB_STATUS'",
"]",
")",
")",
"return",
"$",
"result",
";",
"else",
"{",
"throw",
"new",
"Exception",
"(",
"'Job status query was successful but no status was found.'",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"getJobStatus Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"response",
")",
")",
";",
"}",
"}"
] |
Get a data job status
Returns the status or throws an exception
|
[
"Get",
"a",
"data",
"job",
"status"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/EngagePod.php#L864-L887
|
227,343
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/Connection/DynDns.php
|
DynDns.getStatusFromProvider
|
protected function getStatusFromProvider( $provider){
$service = sprintf( self::API_CONNECTION_DDNS_STATUS, $provider);
$rest = $this->getService( $service);
$rest->GET();
return $rest->getResult( models\Connection\DynDns\Status::class);
}
|
php
|
protected function getStatusFromProvider( $provider){
$service = sprintf( self::API_CONNECTION_DDNS_STATUS, $provider);
$rest = $this->getService( $service);
$rest->GET();
return $rest->getResult( models\Connection\DynDns\Status::class);
}
|
[
"protected",
"function",
"getStatusFromProvider",
"(",
"$",
"provider",
")",
"{",
"$",
"service",
"=",
"sprintf",
"(",
"self",
"::",
"API_CONNECTION_DDNS_STATUS",
",",
"$",
"provider",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"$",
"service",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"Connection",
"\\",
"DynDns",
"\\",
"Status",
"::",
"class",
")",
";",
"}"
] |
Get the current DDns status by a given dynamic dns provider
@param string $provider
@return \alphayax\freebox\api\v3\models\Connection\DynDns\Status
|
[
"Get",
"the",
"current",
"DDns",
"status",
"by",
"a",
"given",
"dynamic",
"dns",
"provider"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/Connection/DynDns.php#L20-L26
|
227,344
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/Connection/DynDns.php
|
DynDns.getConfigFromProvider
|
protected function getConfigFromProvider( $provider){
$service = sprintf( self::API_CONNECTION_DDNS_CONFIG, $provider);
$rest = $this->getService( $service);
$rest->GET();
return $rest->getResult( models\Connection\DynDns\Config::class);
}
|
php
|
protected function getConfigFromProvider( $provider){
$service = sprintf( self::API_CONNECTION_DDNS_CONFIG, $provider);
$rest = $this->getService( $service);
$rest->GET();
return $rest->getResult( models\Connection\DynDns\Config::class);
}
|
[
"protected",
"function",
"getConfigFromProvider",
"(",
"$",
"provider",
")",
"{",
"$",
"service",
"=",
"sprintf",
"(",
"self",
"::",
"API_CONNECTION_DDNS_CONFIG",
",",
"$",
"provider",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"$",
"service",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"Connection",
"\\",
"DynDns",
"\\",
"Config",
"::",
"class",
")",
";",
"}"
] |
Get the current DDns config by a given dynamic dns provider
@param string $provider
@return \alphayax\freebox\api\v3\models\Connection\DynDns\Config
|
[
"Get",
"the",
"current",
"DDns",
"config",
"by",
"a",
"given",
"dynamic",
"dns",
"provider"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/Connection/DynDns.php#L33-L39
|
227,345
|
amercier/php-cli-helpers
|
src/Cli/Helpers/Script.php
|
Script.start
|
public function start($arguments = null)
{
$this->checkProperties();
global $argv;
$arguments = $arguments === null ? $argv : $arguments;
try {
$continue = $this->processParameters($arguments);
if (!$continue) {
return;
}
return $this->run($arguments);
} catch (Exception $e) {
if ($this->exceptionCatchingEnabled) {
fwrite(STDERR, $e->getMessage() . "\n");
exit(1);
} else {
throw $e;
}
}
}
|
php
|
public function start($arguments = null)
{
$this->checkProperties();
global $argv;
$arguments = $arguments === null ? $argv : $arguments;
try {
$continue = $this->processParameters($arguments);
if (!$continue) {
return;
}
return $this->run($arguments);
} catch (Exception $e) {
if ($this->exceptionCatchingEnabled) {
fwrite(STDERR, $e->getMessage() . "\n");
exit(1);
} else {
throw $e;
}
}
}
|
[
"public",
"function",
"start",
"(",
"$",
"arguments",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"checkProperties",
"(",
")",
";",
"global",
"$",
"argv",
";",
"$",
"arguments",
"=",
"$",
"arguments",
"===",
"null",
"?",
"$",
"argv",
":",
"$",
"arguments",
";",
"try",
"{",
"$",
"continue",
"=",
"$",
"this",
"->",
"processParameters",
"(",
"$",
"arguments",
")",
";",
"if",
"(",
"!",
"$",
"continue",
")",
"{",
"return",
";",
"}",
"return",
"$",
"this",
"->",
"run",
"(",
"$",
"arguments",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exceptionCatchingEnabled",
")",
"{",
"fwrite",
"(",
"STDERR",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
".",
"\"\\n\"",
")",
";",
"exit",
"(",
"1",
")",
";",
"}",
"else",
"{",
"throw",
"$",
"e",
";",
"}",
"}",
"}"
] |
Starts the program using either the script arguments, or custom ones.
@param array $arguments Arguments to pass to the script (optional).
When null, the script uses the command-line
arguments (global $argv).
@return mixed Returns whatever the program returns
|
[
"Starts",
"the",
"program",
"using",
"either",
"the",
"script",
"arguments",
"or",
"custom",
"ones",
"."
] |
5767dd441960c0ed89b64ba72fb312bf8e217739
|
https://github.com/amercier/php-cli-helpers/blob/5767dd441960c0ed89b64ba72fb312bf8e217739/src/Cli/Helpers/Script.php#L226-L249
|
227,346
|
fanout/php-gripcontrol
|
src/grippubcontrol.php
|
GripPubControl.apply_grip_config
|
public function apply_grip_config($config)
{
if (!is_array(reset($config))) {
$config = array($config);
}
foreach ($config as $entry) {
if (!array_key_exists('control_uri', $entry)) {
continue;
}
$pub = new \PubControl\PubControlClient($entry['control_uri']);
if (array_key_exists('control_iss', $entry)) {
$pub->set_auth_jwt(array('iss' => $entry['control_iss']), $entry['key']);
}
$this->clients[] = $pub;
}
}
|
php
|
public function apply_grip_config($config)
{
if (!is_array(reset($config))) {
$config = array($config);
}
foreach ($config as $entry) {
if (!array_key_exists('control_uri', $entry)) {
continue;
}
$pub = new \PubControl\PubControlClient($entry['control_uri']);
if (array_key_exists('control_iss', $entry)) {
$pub->set_auth_jwt(array('iss' => $entry['control_iss']), $entry['key']);
}
$this->clients[] = $pub;
}
}
|
[
"public",
"function",
"apply_grip_config",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"reset",
"(",
"$",
"config",
")",
")",
")",
"{",
"$",
"config",
"=",
"array",
"(",
"$",
"config",
")",
";",
"}",
"foreach",
"(",
"$",
"config",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'control_uri'",
",",
"$",
"entry",
")",
")",
"{",
"continue",
";",
"}",
"$",
"pub",
"=",
"new",
"\\",
"PubControl",
"\\",
"PubControlClient",
"(",
"$",
"entry",
"[",
"'control_uri'",
"]",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'control_iss'",
",",
"$",
"entry",
")",
")",
"{",
"$",
"pub",
"->",
"set_auth_jwt",
"(",
"array",
"(",
"'iss'",
"=>",
"$",
"entry",
"[",
"'control_iss'",
"]",
")",
",",
"$",
"entry",
"[",
"'key'",
"]",
")",
";",
"}",
"$",
"this",
"->",
"clients",
"[",
"]",
"=",
"$",
"pub",
";",
"}",
"}"
] |
a URI or a URI and JWT authentication information.
|
[
"a",
"URI",
"or",
"a",
"URI",
"and",
"JWT",
"authentication",
"information",
"."
] |
ee187ddcf8b6e4a0e88584ffc5c89cf96a47d3ff
|
https://github.com/fanout/php-gripcontrol/blob/ee187ddcf8b6e4a0e88584ffc5c89cf96a47d3ff/src/grippubcontrol.php#L36-L51
|
227,347
|
fanout/php-gripcontrol
|
src/grippubcontrol.php
|
GripPubControl.publish_http_response
|
public function publish_http_response($channel, $http_response, $id = null, $prev_id = null)
{
if (is_string($http_response)) {
$http_response = new HttpResponseFormat(null, null, null, $http_response);
}
$item = new \PubControl\Item($http_response, $id, $prev_id);
parent::publish($channel, $item);
}
|
php
|
public function publish_http_response($channel, $http_response, $id = null, $prev_id = null)
{
if (is_string($http_response)) {
$http_response = new HttpResponseFormat(null, null, null, $http_response);
}
$item = new \PubControl\Item($http_response, $id, $prev_id);
parent::publish($channel, $item);
}
|
[
"public",
"function",
"publish_http_response",
"(",
"$",
"channel",
",",
"$",
"http_response",
",",
"$",
"id",
"=",
"null",
",",
"$",
"prev_id",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"http_response",
")",
")",
"{",
"$",
"http_response",
"=",
"new",
"HttpResponseFormat",
"(",
"null",
",",
"null",
",",
"null",
",",
"$",
"http_response",
")",
";",
"}",
"$",
"item",
"=",
"new",
"\\",
"PubControl",
"\\",
"Item",
"(",
"$",
"http_response",
",",
"$",
"id",
",",
"$",
"prev_id",
")",
";",
"parent",
"::",
"publish",
"(",
"$",
"channel",
",",
"$",
"item",
")",
";",
"}"
] |
have the 'body' field set to the specified string).
|
[
"have",
"the",
"body",
"field",
"set",
"to",
"the",
"specified",
"string",
")",
"."
] |
ee187ddcf8b6e4a0e88584ffc5c89cf96a47d3ff
|
https://github.com/fanout/php-gripcontrol/blob/ee187ddcf8b6e4a0e88584ffc5c89cf96a47d3ff/src/grippubcontrol.php#L59-L66
|
227,348
|
fanout/php-gripcontrol
|
src/grippubcontrol.php
|
GripPubControl.publish_http_stream
|
public function publish_http_stream($channel, $http_stream, $id = null, $prev_id = null)
{
if (is_string($http_stream)) {
$http_stream = new HttpStreamFormat($http_stream);
}
$item = new \PubControl\Item($http_stream, $id, $prev_id);
parent::publish($channel, $item);
}
|
php
|
public function publish_http_stream($channel, $http_stream, $id = null, $prev_id = null)
{
if (is_string($http_stream)) {
$http_stream = new HttpStreamFormat($http_stream);
}
$item = new \PubControl\Item($http_stream, $id, $prev_id);
parent::publish($channel, $item);
}
|
[
"public",
"function",
"publish_http_stream",
"(",
"$",
"channel",
",",
"$",
"http_stream",
",",
"$",
"id",
"=",
"null",
",",
"$",
"prev_id",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"http_stream",
")",
")",
"{",
"$",
"http_stream",
"=",
"new",
"HttpStreamFormat",
"(",
"$",
"http_stream",
")",
";",
"}",
"$",
"item",
"=",
"new",
"\\",
"PubControl",
"\\",
"Item",
"(",
"$",
"http_stream",
",",
"$",
"id",
",",
"$",
"prev_id",
")",
";",
"parent",
"::",
"publish",
"(",
"$",
"channel",
",",
"$",
"item",
")",
";",
"}"
] |
have the 'content' field set to the specified string).
|
[
"have",
"the",
"content",
"field",
"set",
"to",
"the",
"specified",
"string",
")",
"."
] |
ee187ddcf8b6e4a0e88584ffc5c89cf96a47d3ff
|
https://github.com/fanout/php-gripcontrol/blob/ee187ddcf8b6e4a0e88584ffc5c89cf96a47d3ff/src/grippubcontrol.php#L91-L98
|
227,349
|
toplan/task-balancer
|
src/TaskBalancer/Balancer.php
|
Balancer.task
|
public static function task($name, $data = null, \Closure $ready = null)
{
$task = self::getTask($name);
if (!$task) {
if (is_callable($data)) {
$ready = $data;
$data = null;
}
$task = Task::create($name, $data, $ready);
self::$tasks[$name] = $task;
}
return $task;
}
|
php
|
public static function task($name, $data = null, \Closure $ready = null)
{
$task = self::getTask($name);
if (!$task) {
if (is_callable($data)) {
$ready = $data;
$data = null;
}
$task = Task::create($name, $data, $ready);
self::$tasks[$name] = $task;
}
return $task;
}
|
[
"public",
"static",
"function",
"task",
"(",
"$",
"name",
",",
"$",
"data",
"=",
"null",
",",
"\\",
"Closure",
"$",
"ready",
"=",
"null",
")",
"{",
"$",
"task",
"=",
"self",
"::",
"getTask",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"$",
"task",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"data",
")",
")",
"{",
"$",
"ready",
"=",
"$",
"data",
";",
"$",
"data",
"=",
"null",
";",
"}",
"$",
"task",
"=",
"Task",
"::",
"create",
"(",
"$",
"name",
",",
"$",
"data",
",",
"$",
"ready",
")",
";",
"self",
"::",
"$",
"tasks",
"[",
"$",
"name",
"]",
"=",
"$",
"task",
";",
"}",
"return",
"$",
"task",
";",
"}"
] |
create a task instance.
@param string $name
@param mixed $data
@param \Closure|null $ready
@return Task
|
[
"create",
"a",
"task",
"instance",
"."
] |
6ba16aafbf6888de0f0c53ea93dfff844b6ef27f
|
https://github.com/toplan/task-balancer/blob/6ba16aafbf6888de0f0c53ea93dfff844b6ef27f/src/TaskBalancer/Balancer.php#L26-L39
|
227,350
|
toplan/task-balancer
|
src/TaskBalancer/Balancer.php
|
Balancer.hasTask
|
public static function hasTask($name)
{
if (!self::$tasks) {
return false;
}
if (isset(self::$tasks[$name])) {
return true;
}
return false;
}
|
php
|
public static function hasTask($name)
{
if (!self::$tasks) {
return false;
}
if (isset(self::$tasks[$name])) {
return true;
}
return false;
}
|
[
"public",
"static",
"function",
"hasTask",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"tasks",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"tasks",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
whether has task.
@param string $name
@return bool
|
[
"whether",
"has",
"task",
"."
] |
6ba16aafbf6888de0f0c53ea93dfff844b6ef27f
|
https://github.com/toplan/task-balancer/blob/6ba16aafbf6888de0f0c53ea93dfff844b6ef27f/src/TaskBalancer/Balancer.php#L72-L82
|
227,351
|
toplan/task-balancer
|
src/TaskBalancer/Balancer.php
|
Balancer.destroy
|
public static function destroy($name)
{
if (is_array($name)) {
foreach ($name as $v) {
self::destroy($v);
}
} elseif (is_string($name) && self::hasTask($name)) {
unset(self::$tasks[$name]);
}
}
|
php
|
public static function destroy($name)
{
if (is_array($name)) {
foreach ($name as $v) {
self::destroy($v);
}
} elseif (is_string($name) && self::hasTask($name)) {
unset(self::$tasks[$name]);
}
}
|
[
"public",
"static",
"function",
"destroy",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"foreach",
"(",
"$",
"name",
"as",
"$",
"v",
")",
"{",
"self",
"::",
"destroy",
"(",
"$",
"v",
")",
";",
"}",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"name",
")",
"&&",
"self",
"::",
"hasTask",
"(",
"$",
"name",
")",
")",
"{",
"unset",
"(",
"self",
"::",
"$",
"tasks",
"[",
"$",
"name",
"]",
")",
";",
"}",
"}"
] |
destroy a task.
@param string|string[] $name
|
[
"destroy",
"a",
"task",
"."
] |
6ba16aafbf6888de0f0c53ea93dfff844b6ef27f
|
https://github.com/toplan/task-balancer/blob/6ba16aafbf6888de0f0c53ea93dfff844b6ef27f/src/TaskBalancer/Balancer.php#L103-L112
|
227,352
|
codecasts/aws-sdk-php
|
src/History.php
|
History.getLastReturn
|
public function getLastReturn()
{
if (!$this->entries) {
throw new \LogicException('No entries');
}
$last = end($this->entries);
if (isset($last['result'])) {
return $last['result'];
} elseif (isset($last['exception'])) {
return $last['exception'];
} else {
throw new \LogicException('No return value for last entry.');
}
}
|
php
|
public function getLastReturn()
{
if (!$this->entries) {
throw new \LogicException('No entries');
}
$last = end($this->entries);
if (isset($last['result'])) {
return $last['result'];
} elseif (isset($last['exception'])) {
return $last['exception'];
} else {
throw new \LogicException('No return value for last entry.');
}
}
|
[
"public",
"function",
"getLastReturn",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"entries",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'No entries'",
")",
";",
"}",
"$",
"last",
"=",
"end",
"(",
"$",
"this",
"->",
"entries",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"last",
"[",
"'result'",
"]",
")",
")",
"{",
"return",
"$",
"last",
"[",
"'result'",
"]",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"last",
"[",
"'exception'",
"]",
")",
")",
"{",
"return",
"$",
"last",
"[",
"'exception'",
"]",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'No return value for last entry.'",
")",
";",
"}",
"}"
] |
Get the last received result or exception.
@return ResultInterface|AwsException
@throws \LogicException if no return values have been received.
|
[
"Get",
"the",
"last",
"received",
"result",
"or",
"exception",
"."
] |
4f22b5a422c8fbebca46de12ac2422e7cb66ec70
|
https://github.com/codecasts/aws-sdk-php/blob/4f22b5a422c8fbebca46de12ac2422e7cb66ec70/src/History.php#L70-L85
|
227,353
|
codecasts/aws-sdk-php
|
src/History.php
|
History.finish
|
public function finish($ticket, $result)
{
if (!isset($this->entries[$ticket])) {
throw new \InvalidArgumentException('Invalid history ticket');
} elseif (isset($this->entries[$ticket]['result'])
|| isset($this->entries[$ticket]['exception'])
) {
throw new \LogicException('History entry is already finished');
}
if ($result instanceof \Exception) {
$this->entries[$ticket]['exception'] = $result;
} else {
$this->entries[$ticket]['result'] = $result;
}
if (count($this->entries) >= $this->maxEntries) {
$this->entries = array_slice($this->entries, -$this->maxEntries, null, true);
}
}
|
php
|
public function finish($ticket, $result)
{
if (!isset($this->entries[$ticket])) {
throw new \InvalidArgumentException('Invalid history ticket');
} elseif (isset($this->entries[$ticket]['result'])
|| isset($this->entries[$ticket]['exception'])
) {
throw new \LogicException('History entry is already finished');
}
if ($result instanceof \Exception) {
$this->entries[$ticket]['exception'] = $result;
} else {
$this->entries[$ticket]['result'] = $result;
}
if (count($this->entries) >= $this->maxEntries) {
$this->entries = array_slice($this->entries, -$this->maxEntries, null, true);
}
}
|
[
"public",
"function",
"finish",
"(",
"$",
"ticket",
",",
"$",
"result",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"entries",
"[",
"$",
"ticket",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid history ticket'",
")",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"this",
"->",
"entries",
"[",
"$",
"ticket",
"]",
"[",
"'result'",
"]",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"entries",
"[",
"$",
"ticket",
"]",
"[",
"'exception'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'History entry is already finished'",
")",
";",
"}",
"if",
"(",
"$",
"result",
"instanceof",
"\\",
"Exception",
")",
"{",
"$",
"this",
"->",
"entries",
"[",
"$",
"ticket",
"]",
"[",
"'exception'",
"]",
"=",
"$",
"result",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"entries",
"[",
"$",
"ticket",
"]",
"[",
"'result'",
"]",
"=",
"$",
"result",
";",
"}",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"entries",
")",
">=",
"$",
"this",
"->",
"maxEntries",
")",
"{",
"$",
"this",
"->",
"entries",
"=",
"array_slice",
"(",
"$",
"this",
"->",
"entries",
",",
"-",
"$",
"this",
"->",
"maxEntries",
",",
"null",
",",
"true",
")",
";",
"}",
"}"
] |
Finish adding an entry to the history container.
@param string $ticket Ticket returned from the start call.
@param mixed $result The result (an exception or AwsResult).
|
[
"Finish",
"adding",
"an",
"entry",
"to",
"the",
"history",
"container",
"."
] |
4f22b5a422c8fbebca46de12ac2422e7cb66ec70
|
https://github.com/codecasts/aws-sdk-php/blob/4f22b5a422c8fbebca46de12ac2422e7cb66ec70/src/History.php#L114-L133
|
227,354
|
jk/RestServer
|
src/JK/RestServer/DocBlockParser.php
|
DocBlockParser.getDocKeys
|
public static function getDocKeys(\ReflectionMethod $reflection_method)
{
$doc_comment_string = $reflection_method->getDocComment();
$keys_as_array = array('url');
/**
* The following RegExpr captures @annotation. It must start with an @ symbol following by a word of one or more
* charaters. Optionally followed by a space or a tab and a string. And all these annotations must end in
* a proper new line (\n, \r\n etc.) to seperate the findings.
*/
if (preg_match_all('/@(\w+)([ \t](.*?))?(?:\n|\r)+/', $doc_comment_string, $matches, PREG_SET_ORDER)) {
$keys = array();
foreach ($matches as $match) {
if (in_array($match[1], $keys_as_array)) {
$keys[$match[1]][] = $match[3];
} else {
if (!isset($match[2])) {
$keys[$match[1]] = true;
} else {
$keys[$match[1]] = $match[3];
}
}
}
return $keys;
}
return false;
}
|
php
|
public static function getDocKeys(\ReflectionMethod $reflection_method)
{
$doc_comment_string = $reflection_method->getDocComment();
$keys_as_array = array('url');
/**
* The following RegExpr captures @annotation. It must start with an @ symbol following by a word of one or more
* charaters. Optionally followed by a space or a tab and a string. And all these annotations must end in
* a proper new line (\n, \r\n etc.) to seperate the findings.
*/
if (preg_match_all('/@(\w+)([ \t](.*?))?(?:\n|\r)+/', $doc_comment_string, $matches, PREG_SET_ORDER)) {
$keys = array();
foreach ($matches as $match) {
if (in_array($match[1], $keys_as_array)) {
$keys[$match[1]][] = $match[3];
} else {
if (!isset($match[2])) {
$keys[$match[1]] = true;
} else {
$keys[$match[1]] = $match[3];
}
}
}
return $keys;
}
return false;
}
|
[
"public",
"static",
"function",
"getDocKeys",
"(",
"\\",
"ReflectionMethod",
"$",
"reflection_method",
")",
"{",
"$",
"doc_comment_string",
"=",
"$",
"reflection_method",
"->",
"getDocComment",
"(",
")",
";",
"$",
"keys_as_array",
"=",
"array",
"(",
"'url'",
")",
";",
"/**\n * The following RegExpr captures @annotation. It must start with an @ symbol following by a word of one or more\n * charaters. Optionally followed by a space or a tab and a string. And all these annotations must end in\n * a proper new line (\\n, \\r\\n etc.) to seperate the findings.\n */",
"if",
"(",
"preg_match_all",
"(",
"'/@(\\w+)([ \\t](.*?))?(?:\\n|\\r)+/'",
",",
"$",
"doc_comment_string",
",",
"$",
"matches",
",",
"PREG_SET_ORDER",
")",
")",
"{",
"$",
"keys",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"matches",
"as",
"$",
"match",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"match",
"[",
"1",
"]",
",",
"$",
"keys_as_array",
")",
")",
"{",
"$",
"keys",
"[",
"$",
"match",
"[",
"1",
"]",
"]",
"[",
"]",
"=",
"$",
"match",
"[",
"3",
"]",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"match",
"[",
"2",
"]",
")",
")",
"{",
"$",
"keys",
"[",
"$",
"match",
"[",
"1",
"]",
"]",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"keys",
"[",
"$",
"match",
"[",
"1",
"]",
"]",
"=",
"$",
"match",
"[",
"3",
"]",
";",
"}",
"}",
"}",
"return",
"$",
"keys",
";",
"}",
"return",
"false",
";",
"}"
] |
Get doc keys from a method's docblock documentation
@param \ReflectionMethod $reflection_method Reflected method
@return array|bool List of found keys, if there are none, false is returned
|
[
"Get",
"doc",
"keys",
"from",
"a",
"method",
"s",
"docblock",
"documentation"
] |
477e6a0f0b601008bf96db9767492d5b35637d0b
|
https://github.com/jk/RestServer/blob/477e6a0f0b601008bf96db9767492d5b35637d0b/src/JK/RestServer/DocBlockParser.php#L17-L45
|
227,355
|
cartalyst/alerts
|
src/Alerts.php
|
Alerts.notifier
|
public function notifier($name, $default = null)
{
return isset($this->notifiers[$name]) ? $this->notifiers[$name] : $default;
}
|
php
|
public function notifier($name, $default = null)
{
return isset($this->notifiers[$name]) ? $this->notifiers[$name] : $default;
}
|
[
"public",
"function",
"notifier",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"notifiers",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"notifiers",
"[",
"$",
"name",
"]",
":",
"$",
"default",
";",
"}"
] |
Returns the given notifier.
@param string $name
@param string $default
@return \Cartalyst\Alerts\Notifiers\NotifierInterface|null
|
[
"Returns",
"the",
"given",
"notifier",
"."
] |
00639a88ef11645aacd2756b654fec7b2796fa9a
|
https://github.com/cartalyst/alerts/blob/00639a88ef11645aacd2756b654fec7b2796fa9a/src/Alerts.php#L111-L114
|
227,356
|
cartalyst/alerts
|
src/Alerts.php
|
Alerts.get
|
public function get()
{
// Retrieve all alerts if no filters are assigned
if ( ! $this->filters) {
return $this->getAllAlerts();
}
$filteredAlerts = $this->filteredAlerts;
// Clear filters and filtered alerts
$this->filters = [];
$this->filteredAlerts = [];
return $filteredAlerts;
}
|
php
|
public function get()
{
// Retrieve all alerts if no filters are assigned
if ( ! $this->filters) {
return $this->getAllAlerts();
}
$filteredAlerts = $this->filteredAlerts;
// Clear filters and filtered alerts
$this->filters = [];
$this->filteredAlerts = [];
return $filteredAlerts;
}
|
[
"public",
"function",
"get",
"(",
")",
"{",
"// Retrieve all alerts if no filters are assigned",
"if",
"(",
"!",
"$",
"this",
"->",
"filters",
")",
"{",
"return",
"$",
"this",
"->",
"getAllAlerts",
"(",
")",
";",
"}",
"$",
"filteredAlerts",
"=",
"$",
"this",
"->",
"filteredAlerts",
";",
"// Clear filters and filtered alerts",
"$",
"this",
"->",
"filters",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"filteredAlerts",
"=",
"[",
"]",
";",
"return",
"$",
"filteredAlerts",
";",
"}"
] |
Returns the alerts with the applied filters.
@return array
|
[
"Returns",
"the",
"alerts",
"with",
"the",
"applied",
"filters",
"."
] |
00639a88ef11645aacd2756b654fec7b2796fa9a
|
https://github.com/cartalyst/alerts/blob/00639a88ef11645aacd2756b654fec7b2796fa9a/src/Alerts.php#L121-L135
|
227,357
|
cartalyst/alerts
|
src/Alerts.php
|
Alerts.getAllAlerts
|
protected function getAllAlerts(array $alerts = [])
{
foreach ($this->notifiers as $notifier) {
$alerts = array_merge_recursive($alerts, $notifier->get());
}
return $alerts;
}
|
php
|
protected function getAllAlerts(array $alerts = [])
{
foreach ($this->notifiers as $notifier) {
$alerts = array_merge_recursive($alerts, $notifier->get());
}
return $alerts;
}
|
[
"protected",
"function",
"getAllAlerts",
"(",
"array",
"$",
"alerts",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"notifiers",
"as",
"$",
"notifier",
")",
"{",
"$",
"alerts",
"=",
"array_merge_recursive",
"(",
"$",
"alerts",
",",
"$",
"notifier",
"->",
"get",
"(",
")",
")",
";",
"}",
"return",
"$",
"alerts",
";",
"}"
] |
Returns all the alerts.
@param array $alerts
@return array
|
[
"Returns",
"all",
"the",
"alerts",
"."
] |
00639a88ef11645aacd2756b654fec7b2796fa9a
|
https://github.com/cartalyst/alerts/blob/00639a88ef11645aacd2756b654fec7b2796fa9a/src/Alerts.php#L265-L272
|
227,358
|
simpleweb/SilverpopPHP
|
src/Silverpop/Transact.php
|
Transact.submit
|
public function submit($campaingID, $recipient, $transactionID = null, $showAllSendDetail = true, $sendAsBatch = false) {
$data["XTMAILING"] = array(
"CAMPAIGN_ID" => $campaingID,
"SHOW_ALL_SEND_DETAIL" => ($showAllSendDetail ? "true" : "false"),
"SEND_AS_BATCH" => ($sendAsBatch ? "true" : "false"),
"NO_RETRY_ON_FAILURE" => "true",
"RECIPIENT" => $recipient
);
if($transactionID !== null) {
$data["XTMAILING"]["TRANSACTION_ID"] = $transactionID;
}
$response = $this->_request($data);
$result = $response["XTMAILING_RESPONSE"];
if ($this->_isSuccess($result) && $result['EMAILS_SENT'] != 0) {
return $result['RECIPIENT_DETAIL'];
}
throw new \Exception("Silverpop\\Transact::submit Error: ".$this->_getErrorFromResponse($result));
}
|
php
|
public function submit($campaingID, $recipient, $transactionID = null, $showAllSendDetail = true, $sendAsBatch = false) {
$data["XTMAILING"] = array(
"CAMPAIGN_ID" => $campaingID,
"SHOW_ALL_SEND_DETAIL" => ($showAllSendDetail ? "true" : "false"),
"SEND_AS_BATCH" => ($sendAsBatch ? "true" : "false"),
"NO_RETRY_ON_FAILURE" => "true",
"RECIPIENT" => $recipient
);
if($transactionID !== null) {
$data["XTMAILING"]["TRANSACTION_ID"] = $transactionID;
}
$response = $this->_request($data);
$result = $response["XTMAILING_RESPONSE"];
if ($this->_isSuccess($result) && $result['EMAILS_SENT'] != 0) {
return $result['RECIPIENT_DETAIL'];
}
throw new \Exception("Silverpop\\Transact::submit Error: ".$this->_getErrorFromResponse($result));
}
|
[
"public",
"function",
"submit",
"(",
"$",
"campaingID",
",",
"$",
"recipient",
",",
"$",
"transactionID",
"=",
"null",
",",
"$",
"showAllSendDetail",
"=",
"true",
",",
"$",
"sendAsBatch",
"=",
"false",
")",
"{",
"$",
"data",
"[",
"\"XTMAILING\"",
"]",
"=",
"array",
"(",
"\"CAMPAIGN_ID\"",
"=>",
"$",
"campaingID",
",",
"\"SHOW_ALL_SEND_DETAIL\"",
"=>",
"(",
"$",
"showAllSendDetail",
"?",
"\"true\"",
":",
"\"false\"",
")",
",",
"\"SEND_AS_BATCH\"",
"=>",
"(",
"$",
"sendAsBatch",
"?",
"\"true\"",
":",
"\"false\"",
")",
",",
"\"NO_RETRY_ON_FAILURE\"",
"=>",
"\"true\"",
",",
"\"RECIPIENT\"",
"=>",
"$",
"recipient",
")",
";",
"if",
"(",
"$",
"transactionID",
"!==",
"null",
")",
"{",
"$",
"data",
"[",
"\"XTMAILING\"",
"]",
"[",
"\"TRANSACTION_ID\"",
"]",
"=",
"$",
"transactionID",
";",
"}",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"$",
"data",
")",
";",
"$",
"result",
"=",
"$",
"response",
"[",
"\"XTMAILING_RESPONSE\"",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_isSuccess",
"(",
"$",
"result",
")",
"&&",
"$",
"result",
"[",
"'EMAILS_SENT'",
"]",
"!=",
"0",
")",
"{",
"return",
"$",
"result",
"[",
"'RECIPIENT_DETAIL'",
"]",
";",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Silverpop\\\\Transact::submit Error: \"",
".",
"$",
"this",
"->",
"_getErrorFromResponse",
"(",
"$",
"result",
")",
")",
";",
"}"
] |
Submit transaction email
Sends an email to the specified recipient ($recipient)
## Example
$engage->sendEmail(123, array(
'EMAIL' => 'som@email.tld',
'BODY_TYPE' => 'HTML',
'PERSONALIZATION' => array(
array(
'TAG_NAME' => 'SomeParam',
'VALUE' => 'SomeValue'
),
array(
'TAG_NAME' => 'SomeParam',
'VALUE' => 'SomeValue'
)
)
));
@param int $campaingID ID of capaing upon which to base the mailing.
@param array $recipient An array of $key => $value, where $key can be one of EMAIL, BODY_TYPE, PERSONALIZATION
@param int $transactionID ID of transaction.
@param bool $showAllSendDetail
@param bool $sendAsBatch
@throws \Exception
@return array RECIPIENT_DETAIL
|
[
"Submit",
"transaction",
"email"
] |
9b10e3cd45db470ac418342d87bcec14cabe3e08
|
https://github.com/simpleweb/SilverpopPHP/blob/9b10e3cd45db470ac418342d87bcec14cabe3e08/src/Silverpop/Transact.php#L60-L82
|
227,359
|
codecasts/aws-sdk-php
|
src/MultiRegionClient.php
|
MultiRegionClient.getCommand
|
public function getCommand($name, array $args = [])
{
list($region, $args) = $this->getRegionFromArgs($args);
return $this->getClientFromPool($region)->getCommand($name, $args);
}
|
php
|
public function getCommand($name, array $args = [])
{
list($region, $args) = $this->getRegionFromArgs($args);
return $this->getClientFromPool($region)->getCommand($name, $args);
}
|
[
"public",
"function",
"getCommand",
"(",
"$",
"name",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"list",
"(",
"$",
"region",
",",
"$",
"args",
")",
"=",
"$",
"this",
"->",
"getRegionFromArgs",
"(",
"$",
"args",
")",
";",
"return",
"$",
"this",
"->",
"getClientFromPool",
"(",
"$",
"region",
")",
"->",
"getCommand",
"(",
"$",
"name",
",",
"$",
"args",
")",
";",
"}"
] |
Create a command for an operation name.
Special keys may be set on the command to control how it behaves,
including:
- @http: Associative array of transfer specific options to apply to the
request that is serialized for this command. Available keys include
"proxy", "verify", "timeout", "connect_timeout", "debug", "delay", and
"headers".
- @region: The region to which the command should be sent.
@param string $name Name of the operation to use in the command
@param array $args Arguments to pass to the command
@return CommandInterface
@throws \InvalidArgumentException if no command can be found by name
|
[
"Create",
"a",
"command",
"for",
"an",
"operation",
"name",
"."
] |
4f22b5a422c8fbebca46de12ac2422e7cb66ec70
|
https://github.com/codecasts/aws-sdk-php/blob/4f22b5a422c8fbebca46de12ac2422e7cb66ec70/src/MultiRegionClient.php#L144-L149
|
227,360
|
alphayax/freebox_api_php
|
freebox/api/v3/services/download/Tracker.php
|
Tracker.update
|
public function update( $downloadTaskId, $announceUrl, models\Download\Tracker $Tracker) {
$service = sprintf( self::API_DOWNLOAD_TRACKER_ITEM, $downloadTaskId, $announceUrl);
$rest = $this->getService( $service);
$rest->PUT( $Tracker);
return $rest->getSuccess();
}
|
php
|
public function update( $downloadTaskId, $announceUrl, models\Download\Tracker $Tracker) {
$service = sprintf( self::API_DOWNLOAD_TRACKER_ITEM, $downloadTaskId, $announceUrl);
$rest = $this->getService( $service);
$rest->PUT( $Tracker);
return $rest->getSuccess();
}
|
[
"public",
"function",
"update",
"(",
"$",
"downloadTaskId",
",",
"$",
"announceUrl",
",",
"models",
"\\",
"Download",
"\\",
"Tracker",
"$",
"Tracker",
")",
"{",
"$",
"service",
"=",
"sprintf",
"(",
"self",
"::",
"API_DOWNLOAD_TRACKER_ITEM",
",",
"$",
"downloadTaskId",
",",
"$",
"announceUrl",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"$",
"service",
")",
";",
"$",
"rest",
"->",
"PUT",
"(",
"$",
"Tracker",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Update a tracker
Attempting to call this method on a download other than bittorent will fail
@param int $downloadTaskId
@param string $announceUrl
@param models\Download\Tracker $Tracker
@return bool
|
[
"Update",
"a",
"tracker",
"Attempting",
"to",
"call",
"this",
"method",
"on",
"a",
"download",
"other",
"than",
"bittorent",
"will",
"fail"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/download/Tracker.php#L70-L76
|
227,361
|
E96/yii2-sentry
|
src/Target.php
|
Target.filterMessages
|
public static function filterMessages($messages, $levels = 0, $categories = [], $except = [])
{
$messages = parent::filterMessages($messages, $levels, $categories, $except);
foreach ($messages as $i => $message) {
$type = explode(':', $message[2]);
// shutdown function not working in yii2 yet: https://github.com/yiisoft/yii2/issues/6637
// allow fatal errors exceptions in log messages
if (is_array($type) &&
sizeof($type) == 2 &&
$type[0] == 'yii\base\ErrorException' &&
ErrorException::isFatalError(['type' => $type[1]])
) {
continue;
}
if (strpos($message[0], 'exception \'') === 0) {
unset($messages[$i]);
}
}
return $messages;
}
|
php
|
public static function filterMessages($messages, $levels = 0, $categories = [], $except = [])
{
$messages = parent::filterMessages($messages, $levels, $categories, $except);
foreach ($messages as $i => $message) {
$type = explode(':', $message[2]);
// shutdown function not working in yii2 yet: https://github.com/yiisoft/yii2/issues/6637
// allow fatal errors exceptions in log messages
if (is_array($type) &&
sizeof($type) == 2 &&
$type[0] == 'yii\base\ErrorException' &&
ErrorException::isFatalError(['type' => $type[1]])
) {
continue;
}
if (strpos($message[0], 'exception \'') === 0) {
unset($messages[$i]);
}
}
return $messages;
}
|
[
"public",
"static",
"function",
"filterMessages",
"(",
"$",
"messages",
",",
"$",
"levels",
"=",
"0",
",",
"$",
"categories",
"=",
"[",
"]",
",",
"$",
"except",
"=",
"[",
"]",
")",
"{",
"$",
"messages",
"=",
"parent",
"::",
"filterMessages",
"(",
"$",
"messages",
",",
"$",
"levels",
",",
"$",
"categories",
",",
"$",
"except",
")",
";",
"foreach",
"(",
"$",
"messages",
"as",
"$",
"i",
"=>",
"$",
"message",
")",
"{",
"$",
"type",
"=",
"explode",
"(",
"':'",
",",
"$",
"message",
"[",
"2",
"]",
")",
";",
"// shutdown function not working in yii2 yet: https://github.com/yiisoft/yii2/issues/6637",
"// allow fatal errors exceptions in log messages",
"if",
"(",
"is_array",
"(",
"$",
"type",
")",
"&&",
"sizeof",
"(",
"$",
"type",
")",
"==",
"2",
"&&",
"$",
"type",
"[",
"0",
"]",
"==",
"'yii\\base\\ErrorException'",
"&&",
"ErrorException",
"::",
"isFatalError",
"(",
"[",
"'type'",
"=>",
"$",
"type",
"[",
"1",
"]",
"]",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"message",
"[",
"0",
"]",
",",
"'exception \\''",
")",
"===",
"0",
")",
"{",
"unset",
"(",
"$",
"messages",
"[",
"$",
"i",
"]",
")",
";",
"}",
"}",
"return",
"$",
"messages",
";",
"}"
] |
Filter all exceptions. They logged via ErrorHandler
@inheritdoc
|
[
"Filter",
"all",
"exceptions",
".",
"They",
"logged",
"via",
"ErrorHandler"
] |
d1910816a9b872b043aeab02579c913d0a12e1c5
|
https://github.com/E96/yii2-sentry/blob/d1910816a9b872b043aeab02579c913d0a12e1c5/src/Target.php#L43-L63
|
227,362
|
mervick/yii2-mthaml
|
src/TwigViewRenderer.php
|
TwigViewRenderer.init
|
public function init()
{
parent::init();
$this->options['cache'] = Yii::getAlias($this->cachePath);
$haml = new MtHaml\Environment('twig', $this->options, $this->getFilters());
$fs = new \Twig_Loader_Filesystem([
dirname(Yii::$app->getView()->getViewFile()),
Yii::$app->getViewPath(),
]);
$loader = new MtHaml\Support\Twig\Loader($haml, $fs);
$this->parser = new \Twig_Environment($loader, [
'cache' => Yii::getAlias($this->cachePath),
]);
$this->parser->addExtension(new MtHaml\Support\Twig\Extension($haml));
if (!empty($this->extensions)) {
foreach ($this->extensions as $name) {
$this->parser->addExtension($this->getExtension($name));
}
}
}
|
php
|
public function init()
{
parent::init();
$this->options['cache'] = Yii::getAlias($this->cachePath);
$haml = new MtHaml\Environment('twig', $this->options, $this->getFilters());
$fs = new \Twig_Loader_Filesystem([
dirname(Yii::$app->getView()->getViewFile()),
Yii::$app->getViewPath(),
]);
$loader = new MtHaml\Support\Twig\Loader($haml, $fs);
$this->parser = new \Twig_Environment($loader, [
'cache' => Yii::getAlias($this->cachePath),
]);
$this->parser->addExtension(new MtHaml\Support\Twig\Extension($haml));
if (!empty($this->extensions)) {
foreach ($this->extensions as $name) {
$this->parser->addExtension($this->getExtension($name));
}
}
}
|
[
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"$",
"this",
"->",
"options",
"[",
"'cache'",
"]",
"=",
"Yii",
"::",
"getAlias",
"(",
"$",
"this",
"->",
"cachePath",
")",
";",
"$",
"haml",
"=",
"new",
"MtHaml",
"\\",
"Environment",
"(",
"'twig'",
",",
"$",
"this",
"->",
"options",
",",
"$",
"this",
"->",
"getFilters",
"(",
")",
")",
";",
"$",
"fs",
"=",
"new",
"\\",
"Twig_Loader_Filesystem",
"(",
"[",
"dirname",
"(",
"Yii",
"::",
"$",
"app",
"->",
"getView",
"(",
")",
"->",
"getViewFile",
"(",
")",
")",
",",
"Yii",
"::",
"$",
"app",
"->",
"getViewPath",
"(",
")",
",",
"]",
")",
";",
"$",
"loader",
"=",
"new",
"MtHaml",
"\\",
"Support",
"\\",
"Twig",
"\\",
"Loader",
"(",
"$",
"haml",
",",
"$",
"fs",
")",
";",
"$",
"this",
"->",
"parser",
"=",
"new",
"\\",
"Twig_Environment",
"(",
"$",
"loader",
",",
"[",
"'cache'",
"=>",
"Yii",
"::",
"getAlias",
"(",
"$",
"this",
"->",
"cachePath",
")",
",",
"]",
")",
";",
"$",
"this",
"->",
"parser",
"->",
"addExtension",
"(",
"new",
"MtHaml",
"\\",
"Support",
"\\",
"Twig",
"\\",
"Extension",
"(",
"$",
"haml",
")",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"extensions",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"extensions",
"as",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"parser",
"->",
"addExtension",
"(",
"$",
"this",
"->",
"getExtension",
"(",
"$",
"name",
")",
")",
";",
"}",
"}",
"}"
] |
Init a parser
|
[
"Init",
"a",
"parser"
] |
5c7d930679ca58e42fde4062b6d08be7b0a9cfc1
|
https://github.com/mervick/yii2-mthaml/blob/5c7d930679ca58e42fde4062b6d08be7b0a9cfc1/src/TwigViewRenderer.php#L43-L63
|
227,363
|
mervick/yii2-mthaml
|
src/TwigViewRenderer.php
|
TwigViewRenderer.getExtension
|
private function getExtension($name)
{
if (class_exists('Twig_Extensions_Extension_' . $name)) {
$name = 'Twig_Extensions_Extension_' . $name;
}
elseif (class_exists('Twig_Extensions_Extension_' . ucfirst(strtolower($name)))) {
$name = 'Twig_Extensions_Extension_' . ucfirst(strtolower($name));
}
elseif (!class_exists($name)) {
throw new InvalidConfigException('Twig extension "' . $name . '" not declared.');
}
return new $name();
}
|
php
|
private function getExtension($name)
{
if (class_exists('Twig_Extensions_Extension_' . $name)) {
$name = 'Twig_Extensions_Extension_' . $name;
}
elseif (class_exists('Twig_Extensions_Extension_' . ucfirst(strtolower($name)))) {
$name = 'Twig_Extensions_Extension_' . ucfirst(strtolower($name));
}
elseif (!class_exists($name)) {
throw new InvalidConfigException('Twig extension "' . $name . '" not declared.');
}
return new $name();
}
|
[
"private",
"function",
"getExtension",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'Twig_Extensions_Extension_'",
".",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"'Twig_Extensions_Extension_'",
".",
"$",
"name",
";",
"}",
"elseif",
"(",
"class_exists",
"(",
"'Twig_Extensions_Extension_'",
".",
"ucfirst",
"(",
"strtolower",
"(",
"$",
"name",
")",
")",
")",
")",
"{",
"$",
"name",
"=",
"'Twig_Extensions_Extension_'",
".",
"ucfirst",
"(",
"strtolower",
"(",
"$",
"name",
")",
")",
";",
"}",
"elseif",
"(",
"!",
"class_exists",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidConfigException",
"(",
"'Twig extension \"'",
".",
"$",
"name",
".",
"'\" not declared.'",
")",
";",
"}",
"return",
"new",
"$",
"name",
"(",
")",
";",
"}"
] |
Get twig extension
@throws InvalidConfigException
@param string $name extension name
@return mixed extension instance
|
[
"Get",
"twig",
"extension"
] |
5c7d930679ca58e42fde4062b6d08be7b0a9cfc1
|
https://github.com/mervick/yii2-mthaml/blob/5c7d930679ca58e42fde4062b6d08be7b0a9cfc1/src/TwigViewRenderer.php#L71-L83
|
227,364
|
alphayax/freebox_api_php
|
freebox/api/v4/services/download/Feed.php
|
Feed.downloadFeedItem
|
public function downloadFeedItem(models\Download\Feed\DownloadFeedItem $DownloadFeedItem)
{
$service = sprintf(self::API_DOWNLOAD_FEEDS_ITEMS_ITEM_DOWNLOAD, $DownloadFeedItem->getFeedId(), $DownloadFeedItem->getId());
$rest = $this->callService('POST', $service, $DownloadFeedItem);
return $rest->getSuccess();
}
|
php
|
public function downloadFeedItem(models\Download\Feed\DownloadFeedItem $DownloadFeedItem)
{
$service = sprintf(self::API_DOWNLOAD_FEEDS_ITEMS_ITEM_DOWNLOAD, $DownloadFeedItem->getFeedId(), $DownloadFeedItem->getId());
$rest = $this->callService('POST', $service, $DownloadFeedItem);
return $rest->getSuccess();
}
|
[
"public",
"function",
"downloadFeedItem",
"(",
"models",
"\\",
"Download",
"\\",
"Feed",
"\\",
"DownloadFeedItem",
"$",
"DownloadFeedItem",
")",
"{",
"$",
"service",
"=",
"sprintf",
"(",
"self",
"::",
"API_DOWNLOAD_FEEDS_ITEMS_ITEM_DOWNLOAD",
",",
"$",
"DownloadFeedItem",
"->",
"getFeedId",
"(",
")",
",",
"$",
"DownloadFeedItem",
"->",
"getId",
"(",
")",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"callService",
"(",
"'POST'",
",",
"$",
"service",
",",
"$",
"DownloadFeedItem",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Download the specified feed item
@param models\Download\Feed\DownloadFeedItem $DownloadFeedItem
@return bool
@throws \GuzzleHttp\Exception\GuzzleException
@throws \alphayax\freebox\Exception\FreeboxApiException
|
[
"Download",
"the",
"specified",
"feed",
"item"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v4/services/download/Feed.php#L165-L171
|
227,365
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/VPN/Server/Config.php
|
Config.getConfigurationFromId
|
public function getConfigurationFromId( $vpnId){
$service = sprintf( self::API_VPN_SERVER_CONFIG, $vpnId);
$rest = $this->getService( $service);
$rest->GET();
return $rest->getResult( models\VPN\Server\Config\ServerConfig::class);
}
|
php
|
public function getConfigurationFromId( $vpnId){
$service = sprintf( self::API_VPN_SERVER_CONFIG, $vpnId);
$rest = $this->getService( $service);
$rest->GET();
return $rest->getResult( models\VPN\Server\Config\ServerConfig::class);
}
|
[
"public",
"function",
"getConfigurationFromId",
"(",
"$",
"vpnId",
")",
"{",
"$",
"service",
"=",
"sprintf",
"(",
"self",
"::",
"API_VPN_SERVER_CONFIG",
",",
"$",
"vpnId",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"$",
"service",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"VPN",
"\\",
"Server",
"\\",
"Config",
"\\",
"ServerConfig",
"::",
"class",
")",
";",
"}"
] |
Get a VPN config
@param string $vpnId (eg: openvpn_routed)
@return models\VPN\Server\Config\ServerConfig
|
[
"Get",
"a",
"VPN",
"config"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/Config.php#L19-L25
|
227,366
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/VPN/Server/Config.php
|
Config.setConfiguration
|
public function setConfiguration( models\VPN\Server\Config\ServerConfig $serverConfig){
$service = sprintf( self::API_VPN_SERVER_CONFIG, $serverConfig->getId());
$rest = $this->getService( $service);
$rest->PUT( $serverConfig);
return $rest->getResult( models\VPN\Server\Config\ServerConfig::class);
}
|
php
|
public function setConfiguration( models\VPN\Server\Config\ServerConfig $serverConfig){
$service = sprintf( self::API_VPN_SERVER_CONFIG, $serverConfig->getId());
$rest = $this->getService( $service);
$rest->PUT( $serverConfig);
return $rest->getResult( models\VPN\Server\Config\ServerConfig::class);
}
|
[
"public",
"function",
"setConfiguration",
"(",
"models",
"\\",
"VPN",
"\\",
"Server",
"\\",
"Config",
"\\",
"ServerConfig",
"$",
"serverConfig",
")",
"{",
"$",
"service",
"=",
"sprintf",
"(",
"self",
"::",
"API_VPN_SERVER_CONFIG",
",",
"$",
"serverConfig",
"->",
"getId",
"(",
")",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"$",
"service",
")",
";",
"$",
"rest",
"->",
"PUT",
"(",
"$",
"serverConfig",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"VPN",
"\\",
"Server",
"\\",
"Config",
"\\",
"ServerConfig",
"::",
"class",
")",
";",
"}"
] |
Update the VPN configuration
@param models\VPN\Server\Config\ServerConfig $serverConfig
@return models\VPN\Server\Config\ServerConfig
|
[
"Update",
"the",
"VPN",
"configuration"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Server/Config.php#L32-L38
|
227,367
|
brucepc/sum-up
|
src/Customer/PaymentInstrument/PaymentInstrument.php
|
PaymentInstrument.setCard
|
public function setCard(?array $data): PaymentInstrumentInterface
{
$this->setLast4Digits($data['last_4_digits']);
$this->setCardType($data['type']);
return $this;
}
|
php
|
public function setCard(?array $data): PaymentInstrumentInterface
{
$this->setLast4Digits($data['last_4_digits']);
$this->setCardType($data['type']);
return $this;
}
|
[
"public",
"function",
"setCard",
"(",
"?",
"array",
"$",
"data",
")",
":",
"PaymentInstrumentInterface",
"{",
"$",
"this",
"->",
"setLast4Digits",
"(",
"$",
"data",
"[",
"'last_4_digits'",
"]",
")",
";",
"$",
"this",
"->",
"setCardType",
"(",
"$",
"data",
"[",
"'type'",
"]",
")",
";",
"return",
"$",
"this",
";",
"}"
] |
Set PaymentInstrument array
@see http://docs.sumup.com/rest-api/checkouts-api/#customers-payment-instruments-post
@param array $data
@return PaymentInstrumentInterface
|
[
"Set",
"PaymentInstrument",
"array"
] |
4b9b046b6c629000b74dc762a96cb24208dc758e
|
https://github.com/brucepc/sum-up/blob/4b9b046b6c629000b74dc762a96cb24208dc758e/src/Customer/PaymentInstrument/PaymentInstrument.php#L63-L69
|
227,368
|
alphayax/freebox_api_php
|
freebox/utils/Application.php
|
Application.openSession
|
public function openSession(){
$Login = new services\login\Session( $this);
$Login->askLoginStatus();
$Login->createSession();
$this->permissions = $Login->getPermissions();
$this->session_token = $Login->getSessionToken();
}
|
php
|
public function openSession(){
$Login = new services\login\Session( $this);
$Login->askLoginStatus();
$Login->createSession();
$this->permissions = $Login->getPermissions();
$this->session_token = $Login->getSessionToken();
}
|
[
"public",
"function",
"openSession",
"(",
")",
"{",
"$",
"Login",
"=",
"new",
"services",
"\\",
"login",
"\\",
"Session",
"(",
"$",
"this",
")",
";",
"$",
"Login",
"->",
"askLoginStatus",
"(",
")",
";",
"$",
"Login",
"->",
"createSession",
"(",
")",
";",
"$",
"this",
"->",
"permissions",
"=",
"$",
"Login",
"->",
"getPermissions",
"(",
")",
";",
"$",
"this",
"->",
"session_token",
"=",
"$",
"Login",
"->",
"getSessionToken",
"(",
")",
";",
"}"
] |
Open a new session and save the session token
@throws \Exception
|
[
"Open",
"a",
"new",
"session",
"and",
"save",
"the",
"session",
"token"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/utils/Application.php#L86-L93
|
227,369
|
cartalyst/alerts
|
src/Laravel/AlertsServiceProvider.php
|
AlertsServiceProvider.registerAlerts
|
protected function registerAlerts()
{
$this->app->singleton('alerts', function($app) {
$config = $this->app['config']->get('cartalyst.alerts');
$alerts = $this->app->make('Cartalyst\Alerts\Alerts');
$viewNotifier = new Notifier('view', $config['classes']);
$flashNotifier = new FlashNotifier('flash', $config['classes'], $this->app['Cartalyst\Alerts\Storage\StorageInterface']);
$alerts->addNotifier($viewNotifier);
$alerts->addNotifier($flashNotifier);
$alerts->setDefaultNotifier($config['default']);
return $alerts;
});
}
|
php
|
protected function registerAlerts()
{
$this->app->singleton('alerts', function($app) {
$config = $this->app['config']->get('cartalyst.alerts');
$alerts = $this->app->make('Cartalyst\Alerts\Alerts');
$viewNotifier = new Notifier('view', $config['classes']);
$flashNotifier = new FlashNotifier('flash', $config['classes'], $this->app['Cartalyst\Alerts\Storage\StorageInterface']);
$alerts->addNotifier($viewNotifier);
$alerts->addNotifier($flashNotifier);
$alerts->setDefaultNotifier($config['default']);
return $alerts;
});
}
|
[
"protected",
"function",
"registerAlerts",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'alerts'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'cartalyst.alerts'",
")",
";",
"$",
"alerts",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"'Cartalyst\\Alerts\\Alerts'",
")",
";",
"$",
"viewNotifier",
"=",
"new",
"Notifier",
"(",
"'view'",
",",
"$",
"config",
"[",
"'classes'",
"]",
")",
";",
"$",
"flashNotifier",
"=",
"new",
"FlashNotifier",
"(",
"'flash'",
",",
"$",
"config",
"[",
"'classes'",
"]",
",",
"$",
"this",
"->",
"app",
"[",
"'Cartalyst\\Alerts\\Storage\\StorageInterface'",
"]",
")",
";",
"$",
"alerts",
"->",
"addNotifier",
"(",
"$",
"viewNotifier",
")",
";",
"$",
"alerts",
"->",
"addNotifier",
"(",
"$",
"flashNotifier",
")",
";",
"$",
"alerts",
"->",
"setDefaultNotifier",
"(",
"$",
"config",
"[",
"'default'",
"]",
")",
";",
"return",
"$",
"alerts",
";",
"}",
")",
";",
"}"
] |
Register alerts.
@return void
|
[
"Register",
"alerts",
"."
] |
00639a88ef11645aacd2756b654fec7b2796fa9a
|
https://github.com/cartalyst/alerts/blob/00639a88ef11645aacd2756b654fec7b2796fa9a/src/Laravel/AlertsServiceProvider.php#L78-L95
|
227,370
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/WiFi/Config.php
|
Config.getConfiguration
|
public function getConfiguration(){
$rest = $this->getService( self::API_WIFI_CONFIG);
$rest->GET();
return $rest->getResult( models\WiFi\GlobalConfig::class);
}
|
php
|
public function getConfiguration(){
$rest = $this->getService( self::API_WIFI_CONFIG);
$rest->GET();
return $rest->getResult( models\WiFi\GlobalConfig::class);
}
|
[
"public",
"function",
"getConfiguration",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_WIFI_CONFIG",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"WiFi",
"\\",
"GlobalConfig",
"::",
"class",
")",
";",
"}"
] |
Get the global wifi configuration
@return models\WiFi\GlobalConfig
|
[
"Get",
"the",
"global",
"wifi",
"configuration"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/Config.php#L19-L24
|
227,371
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/WiFi/Config.php
|
Config.setConfiguration
|
public function setConfiguration( models\WiFi\GlobalConfig $globalConfig){
$rest = $this->getService( self::API_WIFI_CONFIG);
$rest->PUT( $globalConfig);
return $rest->getResult( models\WiFi\GlobalConfig::class);
}
|
php
|
public function setConfiguration( models\WiFi\GlobalConfig $globalConfig){
$rest = $this->getService( self::API_WIFI_CONFIG);
$rest->PUT( $globalConfig);
return $rest->getResult( models\WiFi\GlobalConfig::class);
}
|
[
"public",
"function",
"setConfiguration",
"(",
"models",
"\\",
"WiFi",
"\\",
"GlobalConfig",
"$",
"globalConfig",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_WIFI_CONFIG",
")",
";",
"$",
"rest",
"->",
"PUT",
"(",
"$",
"globalConfig",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"WiFi",
"\\",
"GlobalConfig",
"::",
"class",
")",
";",
"}"
] |
Update the global wifi configuration
@param models\WiFi\GlobalConfig $globalConfig
@return models\WiFi\GlobalConfig
|
[
"Update",
"the",
"global",
"wifi",
"configuration"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/Config.php#L31-L36
|
227,372
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/WiFi/Config.php
|
Config.resetConfiguration
|
public function resetConfiguration(){
$rest = $this->getService( self::API_WIFI_CONFIG_RESET);
$rest->POST();
return $rest->getSuccess();
}
|
php
|
public function resetConfiguration(){
$rest = $this->getService( self::API_WIFI_CONFIG_RESET);
$rest->POST();
return $rest->getSuccess();
}
|
[
"public",
"function",
"resetConfiguration",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_WIFI_CONFIG_RESET",
")",
";",
"$",
"rest",
"->",
"POST",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Reset Wifi to default configuration
@return bool
|
[
"Reset",
"Wifi",
"to",
"default",
"configuration"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/WiFi/Config.php#L42-L47
|
227,373
|
alphayax/freebox_api_php
|
freebox/api/v3/services/Storage/Partition.php
|
Partition.getAll
|
public function getAll(){
$rest = $this->getService( self::API_STORAGE_PARTITION);
$rest->GET();
return $rest->getResultAsArray( models\Storage\DiskPartition::class);
}
|
php
|
public function getAll(){
$rest = $this->getService( self::API_STORAGE_PARTITION);
$rest->GET();
return $rest->getResultAsArray( models\Storage\DiskPartition::class);
}
|
[
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_STORAGE_PARTITION",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResultAsArray",
"(",
"models",
"\\",
"Storage",
"\\",
"DiskPartition",
"::",
"class",
")",
";",
"}"
] |
Get the list of partitions
@throws \Exception
@return models\Storage\DiskPartition[]
|
[
"Get",
"the",
"list",
"of",
"partitions"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Storage/Partition.php#L21-L26
|
227,374
|
alphayax/freebox_api_php
|
freebox/api/v3/services/Storage/Partition.php
|
Partition.getFromId
|
public function getFromId( $diskId){
$rest = $this->getService( self::API_STORAGE_PARTITION . $diskId);
$rest->GET();
return $rest->getResult( models\Storage\DiskPartition::class);
}
|
php
|
public function getFromId( $diskId){
$rest = $this->getService( self::API_STORAGE_PARTITION . $diskId);
$rest->GET();
return $rest->getResult( models\Storage\DiskPartition::class);
}
|
[
"public",
"function",
"getFromId",
"(",
"$",
"diskId",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_STORAGE_PARTITION",
".",
"$",
"diskId",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"Storage",
"\\",
"DiskPartition",
"::",
"class",
")",
";",
"}"
] |
Get a given partition info
@param $diskId
@return \alphayax\freebox\api\v3\models\Storage\DiskPartition
|
[
"Get",
"a",
"given",
"partition",
"info"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Storage/Partition.php#L33-L38
|
227,375
|
jc21/clitable
|
src/jc21/CliTableManipulator.php
|
CliTableManipulator.manipulate
|
public function manipulate($value, $row = array(), $fieldName = '') {
$type = $this->type;
if ($type && is_callable(array($this, $type))) {
return $this->$type($value, $row, $fieldName);
} else {
error_log('Invalid Data Manipulator type: "' . $type . '"');
return $value . ' (Invalid Type: "' . $type . '")';
}
}
|
php
|
public function manipulate($value, $row = array(), $fieldName = '') {
$type = $this->type;
if ($type && is_callable(array($this, $type))) {
return $this->$type($value, $row, $fieldName);
} else {
error_log('Invalid Data Manipulator type: "' . $type . '"');
return $value . ' (Invalid Type: "' . $type . '")';
}
}
|
[
"public",
"function",
"manipulate",
"(",
"$",
"value",
",",
"$",
"row",
"=",
"array",
"(",
")",
",",
"$",
"fieldName",
"=",
"''",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"type",
";",
"if",
"(",
"$",
"type",
"&&",
"is_callable",
"(",
"array",
"(",
"$",
"this",
",",
"$",
"type",
")",
")",
")",
"{",
"return",
"$",
"this",
"->",
"$",
"type",
"(",
"$",
"value",
",",
"$",
"row",
",",
"$",
"fieldName",
")",
";",
"}",
"else",
"{",
"error_log",
"(",
"'Invalid Data Manipulator type: \"'",
".",
"$",
"type",
".",
"'\"'",
")",
";",
"return",
"$",
"value",
".",
"' (Invalid Type: \"'",
".",
"$",
"type",
".",
"'\")'",
";",
"}",
"}"
] |
manipulate
This is used by the Table class to manipulate the data passed in and returns the formatted data.
@access public
@param mixed $value
@param array $row
@param string $fieldName
@return string
|
[
"manipulate",
"This",
"is",
"used",
"by",
"the",
"Table",
"class",
"to",
"manipulate",
"the",
"data",
"passed",
"in",
"and",
"returns",
"the",
"formatted",
"data",
"."
] |
a9ff1fcdff131d25e90a9ae839a5805f6963b3da
|
https://github.com/jc21/clitable/blob/a9ff1fcdff131d25e90a9ae839a5805f6963b3da/src/jc21/CliTableManipulator.php#L48-L56
|
227,376
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/VPN/Client/Config.php
|
Config.getAll
|
public function getAll(){
$rest = $this->getService( self::API_VPN_CLIENT_CONFIG);
$rest->GET();
return $rest->getResultAsArray( models\VPN\Client\Config\ClientConfig::class);
}
|
php
|
public function getAll(){
$rest = $this->getService( self::API_VPN_CLIENT_CONFIG);
$rest->GET();
return $rest->getResultAsArray( models\VPN\Client\Config\ClientConfig::class);
}
|
[
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_VPN_CLIENT_CONFIG",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResultAsArray",
"(",
"models",
"\\",
"VPN",
"\\",
"Client",
"\\",
"Config",
"\\",
"ClientConfig",
"::",
"class",
")",
";",
"}"
] |
Get VPN Client configuration list
@return models\VPN\Client\Config\ClientConfig[]
|
[
"Get",
"VPN",
"Client",
"configuration",
"list"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/VPN/Client/Config.php#L18-L23
|
227,377
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/NetworkShare/Afp.php
|
Afp.getConfiguration
|
public function getConfiguration(){
$rest = $this->getService( self::API_NETWORK_SHARE_AFP);
$rest->GET();
return $rest->getResult( models\NetworkShare\AfpConfig::class);
}
|
php
|
public function getConfiguration(){
$rest = $this->getService( self::API_NETWORK_SHARE_AFP);
$rest->GET();
return $rest->getResult( models\NetworkShare\AfpConfig::class);
}
|
[
"public",
"function",
"getConfiguration",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_NETWORK_SHARE_AFP",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"NetworkShare",
"\\",
"AfpConfig",
"::",
"class",
")",
";",
"}"
] |
Get the current Afp configuration
@return \alphayax\freebox\api\v3\models\NetworkShare\AfpConfig
|
[
"Get",
"the",
"current",
"Afp",
"configuration"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/NetworkShare/Afp.php#L18-L23
|
227,378
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/NetworkShare/Afp.php
|
Afp.setConfiguration
|
public function setConfiguration( models\NetworkShare\AfpConfig $afpConfig){
$rest = $this->getService( self::API_NETWORK_SHARE_AFP);
$rest->PUT( $afpConfig);
return $rest->getResult( models\NetworkShare\AfpConfig::class);
}
|
php
|
public function setConfiguration( models\NetworkShare\AfpConfig $afpConfig){
$rest = $this->getService( self::API_NETWORK_SHARE_AFP);
$rest->PUT( $afpConfig);
return $rest->getResult( models\NetworkShare\AfpConfig::class);
}
|
[
"public",
"function",
"setConfiguration",
"(",
"models",
"\\",
"NetworkShare",
"\\",
"AfpConfig",
"$",
"afpConfig",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_NETWORK_SHARE_AFP",
")",
";",
"$",
"rest",
"->",
"PUT",
"(",
"$",
"afpConfig",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"NetworkShare",
"\\",
"AfpConfig",
"::",
"class",
")",
";",
"}"
] |
Update the Afp configuration
@param \alphayax\freebox\api\v3\models\NetworkShare\AfpConfig $afpConfig
@return \alphayax\freebox\api\v3\models\NetworkShare\AfpConfig
|
[
"Update",
"the",
"Afp",
"configuration"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/NetworkShare/Afp.php#L30-L35
|
227,379
|
alphayax/freebox_api_php
|
freebox/utils/ServiceAuth.php
|
ServiceAuth.getService
|
protected function getService( $service){
$rest = new utils\rest\RestAuth( $this->application->getFreeboxApiHost() . $service);
$rest->setSessionToken( $this->application->getSessionToken());
return $rest;
}
|
php
|
protected function getService( $service){
$rest = new utils\rest\RestAuth( $this->application->getFreeboxApiHost() . $service);
$rest->setSessionToken( $this->application->getSessionToken());
return $rest;
}
|
[
"protected",
"function",
"getService",
"(",
"$",
"service",
")",
"{",
"$",
"rest",
"=",
"new",
"utils",
"\\",
"rest",
"\\",
"RestAuth",
"(",
"$",
"this",
"->",
"application",
"->",
"getFreeboxApiHost",
"(",
")",
".",
"$",
"service",
")",
";",
"$",
"rest",
"->",
"setSessionToken",
"(",
"$",
"this",
"->",
"application",
"->",
"getSessionToken",
"(",
")",
")",
";",
"return",
"$",
"rest",
";",
"}"
] |
Return a Rest object with the session token of the application
@param string $service
@return \alphayax\freebox\utils\rest\RestAuth
@deprecated Use callService instead
|
[
"Return",
"a",
"Rest",
"object",
"with",
"the",
"session",
"token",
"of",
"the",
"application"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/utils/ServiceAuth.php#L17-L21
|
227,380
|
alphayax/freebox_api_php
|
freebox/api/v3/services/Call/CallEntry.php
|
CallEntry.getAll
|
public function getAll(){
$rest = $this->getService( self::API_CALL_LOG);
$rest->GET();
return $rest->getResultAsArray( models\Call\CallEntry::class);
}
|
php
|
public function getAll(){
$rest = $this->getService( self::API_CALL_LOG);
$rest->GET();
return $rest->getResultAsArray( models\Call\CallEntry::class);
}
|
[
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_CALL_LOG",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResultAsArray",
"(",
"models",
"\\",
"Call",
"\\",
"CallEntry",
"::",
"class",
")",
";",
"}"
] |
List every calls
@throws \Exception
@return models\Call\CallEntry[]
|
[
"List",
"every",
"calls"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Call/CallEntry.php#L20-L25
|
227,381
|
alphayax/freebox_api_php
|
freebox/api/v3/services/Call/CallEntry.php
|
CallEntry.getFromId
|
public function getFromId( $CallId){
$rest = $this->getService( self::API_CALL_LOG . $CallId);
$rest->GET();
return $rest->getResult( models\Call\CallEntry::class);
}
|
php
|
public function getFromId( $CallId){
$rest = $this->getService( self::API_CALL_LOG . $CallId);
$rest->GET();
return $rest->getResult( models\Call\CallEntry::class);
}
|
[
"public",
"function",
"getFromId",
"(",
"$",
"CallId",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_CALL_LOG",
".",
"$",
"CallId",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"Call",
"\\",
"CallEntry",
"::",
"class",
")",
";",
"}"
] |
Access a given call entry
@param int $CallId
@return models\Call\CallEntry[]
|
[
"Access",
"a",
"given",
"call",
"entry"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Call/CallEntry.php#L32-L37
|
227,382
|
alphayax/freebox_api_php
|
freebox/api/v3/services/Call/CallEntry.php
|
CallEntry.deleteFromId
|
public function deleteFromId( $CallId){
$rest = $this->getService( self::API_CALL_LOG . $CallId);
$rest->DELETE();
return $rest->getSuccess();
}
|
php
|
public function deleteFromId( $CallId){
$rest = $this->getService( self::API_CALL_LOG . $CallId);
$rest->DELETE();
return $rest->getSuccess();
}
|
[
"public",
"function",
"deleteFromId",
"(",
"$",
"CallId",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_CALL_LOG",
".",
"$",
"CallId",
")",
";",
"$",
"rest",
"->",
"DELETE",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Delete a call entry
@param int $CallId
@return bool
|
[
"Delete",
"a",
"call",
"entry"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Call/CallEntry.php#L53-L58
|
227,383
|
alphayax/freebox_api_php
|
freebox/api/v3/services/Call/CallEntry.php
|
CallEntry.update
|
public function update( models\Call\CallEntry $CallEntry){
$rest = $this->getService( self::API_CALL_LOG . $CallEntry->getId());
$rest->PUT( $CallEntry);
return $rest->getResult( models\Call\CallEntry::class);
}
|
php
|
public function update( models\Call\CallEntry $CallEntry){
$rest = $this->getService( self::API_CALL_LOG . $CallEntry->getId());
$rest->PUT( $CallEntry);
return $rest->getResult( models\Call\CallEntry::class);
}
|
[
"public",
"function",
"update",
"(",
"models",
"\\",
"Call",
"\\",
"CallEntry",
"$",
"CallEntry",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_CALL_LOG",
".",
"$",
"CallEntry",
"->",
"getId",
"(",
")",
")",
";",
"$",
"rest",
"->",
"PUT",
"(",
"$",
"CallEntry",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"Call",
"\\",
"CallEntry",
"::",
"class",
")",
";",
"}"
] |
Update a given call entry
@param models\Call\CallEntry $CallEntry
@return models\Call\CallEntry
|
[
"Update",
"a",
"given",
"call",
"entry"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Call/CallEntry.php#L65-L70
|
227,384
|
alphayax/freebox_api_php
|
freebox/api/v4/services/download/Download.php
|
Download.getPiecesFromId
|
public function getPiecesFromId($taskId)
{
$Service = sprintf(self::API_DOWNLOAD_PIECES, $taskId);
$rest = $this->callService('GET', $Service);
return $rest->getResult();
}
|
php
|
public function getPiecesFromId($taskId)
{
$Service = sprintf(self::API_DOWNLOAD_PIECES, $taskId);
$rest = $this->callService('GET', $Service);
return $rest->getResult();
}
|
[
"public",
"function",
"getPiecesFromId",
"(",
"$",
"taskId",
")",
"{",
"$",
"Service",
"=",
"sprintf",
"(",
"self",
"::",
"API_DOWNLOAD_PIECES",
",",
"$",
"taskId",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"callService",
"(",
"'GET'",
",",
"$",
"Service",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
")",
";",
"}"
] |
Get the pieces status a given download
Each Torrent is split in ‘pieces’ of fixed size.
The Download Piece Api allow tracking the download state of each pieces of a Torrent
The result value is a string, with each character representing a piece status. Piece status can be:
X piece is complete
piece is currently downloading
. piece is wanted but not downloading yet
piece is not wanted and will not be downloaded
/ piece is downloading with high priority as it is needed for file preview
U piece is scheduled with high priority as it is needed for file preview
@param $taskId
@return mixed
@throws \GuzzleHttp\Exception\GuzzleException
|
[
"Get",
"the",
"pieces",
"status",
"a",
"given",
"download"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v4/services/download/Download.php#L283-L289
|
227,385
|
alphayax/freebox_api_php
|
freebox/api/v3/services/FileSystem/FileUpload.php
|
FileUpload.createAuthorization
|
public function createAuthorization( $dirName, $FileName){
$rest = $this->getService( self::API_UPLOAD);
$rest->POST([
'dirname' => base64_encode( $dirName),
'upload_name' => $FileName,
]);
return (int) $rest->getResult()['id'];
}
|
php
|
public function createAuthorization( $dirName, $FileName){
$rest = $this->getService( self::API_UPLOAD);
$rest->POST([
'dirname' => base64_encode( $dirName),
'upload_name' => $FileName,
]);
return (int) $rest->getResult()['id'];
}
|
[
"public",
"function",
"createAuthorization",
"(",
"$",
"dirName",
",",
"$",
"FileName",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_UPLOAD",
")",
";",
"$",
"rest",
"->",
"POST",
"(",
"[",
"'dirname'",
"=>",
"base64_encode",
"(",
"$",
"dirName",
")",
",",
"'upload_name'",
"=>",
"$",
"FileName",
",",
"]",
")",
";",
"return",
"(",
"int",
")",
"$",
"rest",
"->",
"getResult",
"(",
")",
"[",
"'id'",
"]",
";",
"}"
] |
Create a file upload authorization
@param string $dirName
@param string $FileName
@return int The new upload authorization id
|
[
"Create",
"a",
"file",
"upload",
"authorization"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/FileSystem/FileUpload.php#L24-L32
|
227,386
|
alphayax/freebox_api_php
|
freebox/api/v3/services/FileSystem/FileUpload.php
|
FileUpload.uploadFile
|
public function uploadFile( $FileUploadTaskId, $fileToUpload_afi){
$Service = sprintf( self::API_UPLOAD_SEND, $FileUploadTaskId);
$rest = $this->getService( $Service);
$rest->setContentType_MultipartFormData();
$rest->POST([
basename( $fileToUpload_afi) => new \CurlFile( $fileToUpload_afi),
]);
return $rest->getSuccess();
}
|
php
|
public function uploadFile( $FileUploadTaskId, $fileToUpload_afi){
$Service = sprintf( self::API_UPLOAD_SEND, $FileUploadTaskId);
$rest = $this->getService( $Service);
$rest->setContentType_MultipartFormData();
$rest->POST([
basename( $fileToUpload_afi) => new \CurlFile( $fileToUpload_afi),
]);
return $rest->getSuccess();
}
|
[
"public",
"function",
"uploadFile",
"(",
"$",
"FileUploadTaskId",
",",
"$",
"fileToUpload_afi",
")",
"{",
"$",
"Service",
"=",
"sprintf",
"(",
"self",
"::",
"API_UPLOAD_SEND",
",",
"$",
"FileUploadTaskId",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"$",
"Service",
")",
";",
"$",
"rest",
"->",
"setContentType_MultipartFormData",
"(",
")",
";",
"$",
"rest",
"->",
"POST",
"(",
"[",
"basename",
"(",
"$",
"fileToUpload_afi",
")",
"=>",
"new",
"\\",
"CurlFile",
"(",
"$",
"fileToUpload_afi",
")",
",",
"]",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Send the content of the FileUpload task
@param int $FileUploadTaskId
@param string $fileToUpload_afi
@return bool
|
[
"Send",
"the",
"content",
"of",
"the",
"FileUpload",
"task"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/FileSystem/FileUpload.php#L40-L49
|
227,387
|
alphayax/freebox_api_php
|
freebox/api/v3/services/FileSystem/FileUpload.php
|
FileUpload.cleanTerminated
|
public function cleanTerminated(){
$rest = $this->getService( self::API_UPLOAD_CLEAN);
$rest->DELETE();
return $rest->getSuccess();
}
|
php
|
public function cleanTerminated(){
$rest = $this->getService( self::API_UPLOAD_CLEAN);
$rest->DELETE();
return $rest->getSuccess();
}
|
[
"public",
"function",
"cleanTerminated",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_UPLOAD_CLEAN",
")",
";",
"$",
"rest",
"->",
"DELETE",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Deletes all the FileUpload not in_progress
@return bool
@deprecated use v4 service
|
[
"Deletes",
"all",
"the",
"FileUpload",
"not",
"in_progress"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/FileSystem/FileUpload.php#L109-L114
|
227,388
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/System.php
|
System.reboot
|
public function reboot(){
$rest = $this->getService( self::API_SYSTEM_REBOOT);
$rest->POST();
return $rest->getSuccess();
}
|
php
|
public function reboot(){
$rest = $this->getService( self::API_SYSTEM_REBOOT);
$rest->POST();
return $rest->getSuccess();
}
|
[
"public",
"function",
"reboot",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_SYSTEM_REBOOT",
")",
";",
"$",
"rest",
"->",
"POST",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getSuccess",
"(",
")",
";",
"}"
] |
Reboot the Freebox
@return bool
|
[
"Reboot",
"the",
"Freebox"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/System.php#L32-L37
|
227,389
|
alphayax/freebox_api_php
|
freebox/api/v3/services/RRD/Fetch.php
|
Fetch.getStats
|
public function getStats( $db, $date_start = null, $date_end = null, $precision = null, array $fields = []){
$QueryParameters = $this->buildQuery( $db, $date_start, $date_end, $precision, $fields);
$rest = $this->getService( self::API_RDD);
$rest->GET( $QueryParameters);
return $rest->getResult();
}
|
php
|
public function getStats( $db, $date_start = null, $date_end = null, $precision = null, array $fields = []){
$QueryParameters = $this->buildQuery( $db, $date_start, $date_end, $precision, $fields);
$rest = $this->getService( self::API_RDD);
$rest->GET( $QueryParameters);
return $rest->getResult();
}
|
[
"public",
"function",
"getStats",
"(",
"$",
"db",
",",
"$",
"date_start",
"=",
"null",
",",
"$",
"date_end",
"=",
"null",
",",
"$",
"precision",
"=",
"null",
",",
"array",
"$",
"fields",
"=",
"[",
"]",
")",
"{",
"$",
"QueryParameters",
"=",
"$",
"this",
"->",
"buildQuery",
"(",
"$",
"db",
",",
"$",
"date_start",
",",
"$",
"date_end",
",",
"$",
"precision",
",",
"$",
"fields",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_RDD",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
"$",
"QueryParameters",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
")",
";",
"}"
] |
Return Freebox information & statistics
@param string $db
Name of the rrd database to read
@see alphayax\freebox\api\v3\symbols\RRD\Db
@param int $date_start
The requested start timestamp of the stats to get
NOTE: this can be adjusted to fit the best available resolution
@param int $date_end
The requested end timestamp of the stats to get
NOTE: this can be adjusted to fit the best available resolution
@param int $precision
By default all values are cast to int, if you need floating point precision you can provide a precision factor that will be applied to all values before being returned.
For instance if you want 2 digit precision you should use a precision of 100, and divide the obtained results by 100.
@param array $fields
If you are only interested in getting some fields you can provide the list of fields you want to get.
@see alphayax\freebox\api\v3\symbols\RRD\Fields\Net
@see alphayax\freebox\api\v3\symbols\RRD\Fields\Temp
@see alphayax\freebox\api\v3\symbols\RRD\Fields\Dsl
@see alphayax\freebox\api\v3\symbols\RRD\Fields\FbxSwitch
@return array
|
[
"Return",
"Freebox",
"information",
"&",
"statistics"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/RRD/Fetch.php#L35-L41
|
227,390
|
alphayax/freebox_api_php
|
freebox/api/v3/services/Call/Contact/ContactUrl.php
|
ContactUrl.create
|
public function create( models\Call\ContactUrl $ContactUrl){
$rest = $this->getService( self::API_URL);
$rest->POST( $ContactUrl);
return $rest->getResult( models\Call\ContactUrl::class);
}
|
php
|
public function create( models\Call\ContactUrl $ContactUrl){
$rest = $this->getService( self::API_URL);
$rest->POST( $ContactUrl);
return $rest->getResult( models\Call\ContactUrl::class);
}
|
[
"public",
"function",
"create",
"(",
"models",
"\\",
"Call",
"\\",
"ContactUrl",
"$",
"ContactUrl",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_URL",
")",
";",
"$",
"rest",
"->",
"POST",
"(",
"$",
"ContactUrl",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"Call",
"\\",
"ContactUrl",
"::",
"class",
")",
";",
"}"
] |
Add a new contact url
@param models\Call\ContactUrl $ContactUrl
@return models\Call\ContactUrl
|
[
"Add",
"a",
"new",
"contact",
"url"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Call/Contact/ContactUrl.php#L32-L37
|
227,391
|
alphayax/freebox_api_php
|
freebox/api/v3/services/Call/Contact/ContactUrl.php
|
ContactUrl.update
|
public function update( models\Call\ContactUrl $ContactUrl){
$rest = $this->getService( self::API_URL . $ContactUrl->getId());
$rest->PUT( $ContactUrl);
return $rest->getResult( models\Call\ContactUrl::class);
}
|
php
|
public function update( models\Call\ContactUrl $ContactUrl){
$rest = $this->getService( self::API_URL . $ContactUrl->getId());
$rest->PUT( $ContactUrl);
return $rest->getResult( models\Call\ContactUrl::class);
}
|
[
"public",
"function",
"update",
"(",
"models",
"\\",
"Call",
"\\",
"ContactUrl",
"$",
"ContactUrl",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_URL",
".",
"$",
"ContactUrl",
"->",
"getId",
"(",
")",
")",
";",
"$",
"rest",
"->",
"PUT",
"(",
"$",
"ContactUrl",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"Call",
"\\",
"ContactUrl",
"::",
"class",
")",
";",
"}"
] |
Update a contact url
@param models\Call\ContactUrl $ContactUrl
@return models\Call\ContactUrl
|
[
"Update",
"a",
"contact",
"url"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/Call/Contact/ContactUrl.php#L65-L70
|
227,392
|
alphayax/freebox_api_php
|
freebox/utils/Model.php
|
Model.initProperty
|
protected function initProperty( $propertyName, $propertyClass){
if( property_exists( static::class, $propertyName) && ! empty( $this->$propertyName)){
$this->$propertyName = new $propertyClass( $this->$propertyName);
}
}
|
php
|
protected function initProperty( $propertyName, $propertyClass){
if( property_exists( static::class, $propertyName) && ! empty( $this->$propertyName)){
$this->$propertyName = new $propertyClass( $this->$propertyName);
}
}
|
[
"protected",
"function",
"initProperty",
"(",
"$",
"propertyName",
",",
"$",
"propertyClass",
")",
"{",
"if",
"(",
"property_exists",
"(",
"static",
"::",
"class",
",",
"$",
"propertyName",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"$",
"propertyName",
")",
")",
"{",
"$",
"this",
"->",
"$",
"propertyName",
"=",
"new",
"$",
"propertyClass",
"(",
"$",
"this",
"->",
"$",
"propertyName",
")",
";",
"}",
"}"
] |
Convert a property into a given class
@param string $propertyName
@param string $propertyClass
|
[
"Convert",
"a",
"property",
"into",
"a",
"given",
"class"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/utils/Model.php#L27-L31
|
227,393
|
alphayax/freebox_api_php
|
freebox/utils/Model.php
|
Model.initPropertyArray
|
protected function initPropertyArray( $propertyName, $propertyClass){
if( property_exists( static::class, $propertyName) && is_array( $this->$propertyName)){
$newProperty = [];
foreach( $this->$propertyName as $PropertyItem){
if( is_array( $PropertyItem)){
$newProperty[] = new $propertyClass( $PropertyItem);
}
}
$this->$propertyName = $newProperty;
}
}
|
php
|
protected function initPropertyArray( $propertyName, $propertyClass){
if( property_exists( static::class, $propertyName) && is_array( $this->$propertyName)){
$newProperty = [];
foreach( $this->$propertyName as $PropertyItem){
if( is_array( $PropertyItem)){
$newProperty[] = new $propertyClass( $PropertyItem);
}
}
$this->$propertyName = $newProperty;
}
}
|
[
"protected",
"function",
"initPropertyArray",
"(",
"$",
"propertyName",
",",
"$",
"propertyClass",
")",
"{",
"if",
"(",
"property_exists",
"(",
"static",
"::",
"class",
",",
"$",
"propertyName",
")",
"&&",
"is_array",
"(",
"$",
"this",
"->",
"$",
"propertyName",
")",
")",
"{",
"$",
"newProperty",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"$",
"propertyName",
"as",
"$",
"PropertyItem",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"PropertyItem",
")",
")",
"{",
"$",
"newProperty",
"[",
"]",
"=",
"new",
"$",
"propertyClass",
"(",
"$",
"PropertyItem",
")",
";",
"}",
"}",
"$",
"this",
"->",
"$",
"propertyName",
"=",
"$",
"newProperty",
";",
"}",
"}"
] |
Convert a property into an array of the given class
@param string $propertyName
@param string $propertyClass
|
[
"Convert",
"a",
"property",
"into",
"an",
"array",
"of",
"the",
"given",
"class"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/utils/Model.php#L38-L48
|
227,394
|
alphayax/freebox_api_php
|
freebox/utils/Model.php
|
Model.toArray
|
public function toArray(){
$ModelArray = [];
foreach( get_object_vars( $this) as $propertyName => $propertyValue){
if( is_subclass_of( $propertyValue, Model::class)){
/** @var $propertyValue Model */
$ModelArray[$propertyName] = $propertyValue->toArray();
} else {
$ModelArray[$propertyName] = $propertyValue;
}
}
return $ModelArray;
}
|
php
|
public function toArray(){
$ModelArray = [];
foreach( get_object_vars( $this) as $propertyName => $propertyValue){
if( is_subclass_of( $propertyValue, Model::class)){
/** @var $propertyValue Model */
$ModelArray[$propertyName] = $propertyValue->toArray();
} else {
$ModelArray[$propertyName] = $propertyValue;
}
}
return $ModelArray;
}
|
[
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"ModelArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"propertyName",
"=>",
"$",
"propertyValue",
")",
"{",
"if",
"(",
"is_subclass_of",
"(",
"$",
"propertyValue",
",",
"Model",
"::",
"class",
")",
")",
"{",
"/** @var $propertyValue Model */",
"$",
"ModelArray",
"[",
"$",
"propertyName",
"]",
"=",
"$",
"propertyValue",
"->",
"toArray",
"(",
")",
";",
"}",
"else",
"{",
"$",
"ModelArray",
"[",
"$",
"propertyName",
"]",
"=",
"$",
"propertyValue",
";",
"}",
"}",
"return",
"$",
"ModelArray",
";",
"}"
] |
Return an array representation of the model properties
@return array
|
[
"Return",
"an",
"array",
"representation",
"of",
"the",
"model",
"properties"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/utils/Model.php#L54-L65
|
227,395
|
minkphp/MinkSahiDriver
|
src/SahiDriver.php
|
SahiDriver.selectRadioOption
|
private function selectRadioOption($xpath, $value)
{
$name = $this->getAttribute($xpath, 'name');
if (null !== $name) {
$name = json_encode($name);
$function = <<<JS
(function(){
for (var i = 0; i < document.forms.length; i++) {
if (document.forms[i].elements[{$name}]) {
var form = document.forms[i];
var elements = form.elements[{$name}];
for (var f = 0; f < elements.length; f++) {
var item = elements[f];
if ("{$value}" == item.value) {
item.checked = true;
var event;
if (document.createEvent) {
event = document.createEvent("HTMLEvents");
event.initEvent("change", true, true);
} else {
event = document.createEventObject();
event.eventType = "change";
}
event.eventName = "change";
if (document.createEvent) {
item.dispatchEvent(event);
} else {
item.fireEvent("on" + event.eventType, event);
}
}
}
}
}
})()
JS;
$this->executeScript($function);
}
}
|
php
|
private function selectRadioOption($xpath, $value)
{
$name = $this->getAttribute($xpath, 'name');
if (null !== $name) {
$name = json_encode($name);
$function = <<<JS
(function(){
for (var i = 0; i < document.forms.length; i++) {
if (document.forms[i].elements[{$name}]) {
var form = document.forms[i];
var elements = form.elements[{$name}];
for (var f = 0; f < elements.length; f++) {
var item = elements[f];
if ("{$value}" == item.value) {
item.checked = true;
var event;
if (document.createEvent) {
event = document.createEvent("HTMLEvents");
event.initEvent("change", true, true);
} else {
event = document.createEventObject();
event.eventType = "change";
}
event.eventName = "change";
if (document.createEvent) {
item.dispatchEvent(event);
} else {
item.fireEvent("on" + event.eventType, event);
}
}
}
}
}
})()
JS;
$this->executeScript($function);
}
}
|
[
"private",
"function",
"selectRadioOption",
"(",
"$",
"xpath",
",",
"$",
"value",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"$",
"xpath",
",",
"'name'",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"json_encode",
"(",
"$",
"name",
")",
";",
"$",
"function",
"=",
" <<<JS\n(function(){\n for (var i = 0; i < document.forms.length; i++) {\n if (document.forms[i].elements[{$name}]) {\n var form = document.forms[i];\n var elements = form.elements[{$name}];\n for (var f = 0; f < elements.length; f++) {\n var item = elements[f];\n if (\"{$value}\" == item.value) {\n item.checked = true;\n\n var event;\n if (document.createEvent) {\n event = document.createEvent(\"HTMLEvents\");\n event.initEvent(\"change\", true, true);\n } else {\n event = document.createEventObject();\n event.eventType = \"change\";\n }\n\n event.eventName = \"change\";\n\n if (document.createEvent) {\n item.dispatchEvent(event);\n } else {\n item.fireEvent(\"on\" + event.eventType, event);\n }\n }\n }\n }\n }\n})()\nJS",
";",
"$",
"this",
"->",
"executeScript",
"(",
"$",
"function",
")",
";",
"}",
"}"
] |
Selects specific radio option.
@param string $xpath xpath to one of the radio buttons
@param string $value value to be set
|
[
"Selects",
"specific",
"radio",
"option",
"."
] |
8636f8d33409641d6913a45359083654bc7391e4
|
https://github.com/minkphp/MinkSahiDriver/blob/8636f8d33409641d6913a45359083654bc7391e4/src/SahiDriver.php#L558-L600
|
227,396
|
codecasts/aws-sdk-php
|
src/S3/ObjectCopier.php
|
ObjectCopier.promise
|
public function promise()
{
return \GuzzleHttp\Promise\coroutine(function () {
$objectStats = (yield $this->client->executeAsync(
$this->client->getCommand('HeadObject', $this->source)
));
if ($objectStats['ContentLength'] > $this->options['mup_threshold']) {
$mup = new MultipartCopy(
$this->client,
$this->getSourcePath(),
['source_metadata' => $objectStats, 'acl' => $this->acl]
+ $this->destination
+ $this->options
);
yield $mup->promise();
} else {
$defaults = [
'ACL' => $this->acl,
'MetadataDirective' => 'COPY',
'CopySource' => $this->getSourcePath(),
];
$params = array_diff_key($this->options, self::$defaults)
+ $this->destination + $defaults + $this->options['params'];
yield $this->client->executeAsync(
$this->client->getCommand('CopyObject', $params)
);
}
});
}
|
php
|
public function promise()
{
return \GuzzleHttp\Promise\coroutine(function () {
$objectStats = (yield $this->client->executeAsync(
$this->client->getCommand('HeadObject', $this->source)
));
if ($objectStats['ContentLength'] > $this->options['mup_threshold']) {
$mup = new MultipartCopy(
$this->client,
$this->getSourcePath(),
['source_metadata' => $objectStats, 'acl' => $this->acl]
+ $this->destination
+ $this->options
);
yield $mup->promise();
} else {
$defaults = [
'ACL' => $this->acl,
'MetadataDirective' => 'COPY',
'CopySource' => $this->getSourcePath(),
];
$params = array_diff_key($this->options, self::$defaults)
+ $this->destination + $defaults + $this->options['params'];
yield $this->client->executeAsync(
$this->client->getCommand('CopyObject', $params)
);
}
});
}
|
[
"public",
"function",
"promise",
"(",
")",
"{",
"return",
"\\",
"GuzzleHttp",
"\\",
"Promise",
"\\",
"coroutine",
"(",
"function",
"(",
")",
"{",
"$",
"objectStats",
"=",
"(",
"yield",
"$",
"this",
"->",
"client",
"->",
"executeAsync",
"(",
"$",
"this",
"->",
"client",
"->",
"getCommand",
"(",
"'HeadObject'",
",",
"$",
"this",
"->",
"source",
")",
")",
")",
";",
"if",
"(",
"$",
"objectStats",
"[",
"'ContentLength'",
"]",
">",
"$",
"this",
"->",
"options",
"[",
"'mup_threshold'",
"]",
")",
"{",
"$",
"mup",
"=",
"new",
"MultipartCopy",
"(",
"$",
"this",
"->",
"client",
",",
"$",
"this",
"->",
"getSourcePath",
"(",
")",
",",
"[",
"'source_metadata'",
"=>",
"$",
"objectStats",
",",
"'acl'",
"=>",
"$",
"this",
"->",
"acl",
"]",
"+",
"$",
"this",
"->",
"destination",
"+",
"$",
"this",
"->",
"options",
")",
";",
"yield",
"$",
"mup",
"->",
"promise",
"(",
")",
";",
"}",
"else",
"{",
"$",
"defaults",
"=",
"[",
"'ACL'",
"=>",
"$",
"this",
"->",
"acl",
",",
"'MetadataDirective'",
"=>",
"'COPY'",
",",
"'CopySource'",
"=>",
"$",
"this",
"->",
"getSourcePath",
"(",
")",
",",
"]",
";",
"$",
"params",
"=",
"array_diff_key",
"(",
"$",
"this",
"->",
"options",
",",
"self",
"::",
"$",
"defaults",
")",
"+",
"$",
"this",
"->",
"destination",
"+",
"$",
"defaults",
"+",
"$",
"this",
"->",
"options",
"[",
"'params'",
"]",
";",
"yield",
"$",
"this",
"->",
"client",
"->",
"executeAsync",
"(",
"$",
"this",
"->",
"client",
"->",
"getCommand",
"(",
"'CopyObject'",
",",
"$",
"params",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Perform the configured copy asynchronously. Returns a promise that is
fulfilled with the result of the CompleteMultipartUpload or CopyObject
operation or rejected with an exception.
@return \GuzzleHttp\Promise\Promise
|
[
"Perform",
"the",
"configured",
"copy",
"asynchronously",
".",
"Returns",
"a",
"promise",
"that",
"is",
"fulfilled",
"with",
"the",
"result",
"of",
"the",
"CompleteMultipartUpload",
"or",
"CopyObject",
"operation",
"or",
"rejected",
"with",
"an",
"exception",
"."
] |
4f22b5a422c8fbebca46de12ac2422e7cb66ec70
|
https://github.com/codecasts/aws-sdk-php/blob/4f22b5a422c8fbebca46de12ac2422e7cb66ec70/src/S3/ObjectCopier.php#L76-L108
|
227,397
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/NetworkShare/Samba.php
|
Samba.getConfiguration
|
public function getConfiguration(){
$rest = $this->getService( self::API_NETWORK_SHARE_SAMBA);
$rest->GET();
return $rest->getResult( models\NetworkShare\SambaConfig::class);
}
|
php
|
public function getConfiguration(){
$rest = $this->getService( self::API_NETWORK_SHARE_SAMBA);
$rest->GET();
return $rest->getResult( models\NetworkShare\SambaConfig::class);
}
|
[
"public",
"function",
"getConfiguration",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_NETWORK_SHARE_SAMBA",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"NetworkShare",
"\\",
"SambaConfig",
"::",
"class",
")",
";",
"}"
] |
Get the current Samba configuration
@return \alphayax\freebox\api\v3\models\NetworkShare\SambaConfig
|
[
"Get",
"the",
"current",
"Samba",
"configuration"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/NetworkShare/Samba.php#L18-L23
|
227,398
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/NetworkShare/Samba.php
|
Samba.setConfiguration
|
public function setConfiguration( models\NetworkShare\SambaConfig $sambaConfig){
$rest = $this->getService( self::API_NETWORK_SHARE_SAMBA);
$rest->PUT( $sambaConfig);
return $rest->getResult( models\NetworkShare\SambaConfig::class);
}
|
php
|
public function setConfiguration( models\NetworkShare\SambaConfig $sambaConfig){
$rest = $this->getService( self::API_NETWORK_SHARE_SAMBA);
$rest->PUT( $sambaConfig);
return $rest->getResult( models\NetworkShare\SambaConfig::class);
}
|
[
"public",
"function",
"setConfiguration",
"(",
"models",
"\\",
"NetworkShare",
"\\",
"SambaConfig",
"$",
"sambaConfig",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_NETWORK_SHARE_SAMBA",
")",
";",
"$",
"rest",
"->",
"PUT",
"(",
"$",
"sambaConfig",
")",
";",
"return",
"$",
"rest",
"->",
"getResult",
"(",
"models",
"\\",
"NetworkShare",
"\\",
"SambaConfig",
"::",
"class",
")",
";",
"}"
] |
Update the Samba configuration
@param \alphayax\freebox\api\v3\models\NetworkShare\SambaConfig $sambaConfig
@return \alphayax\freebox\api\v3\models\NetworkShare\SambaConfig
|
[
"Update",
"the",
"Samba",
"configuration"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/NetworkShare/Samba.php#L30-L35
|
227,399
|
alphayax/freebox_api_php
|
freebox/api/v3/services/config/NAT/IncomingPort.php
|
IncomingPort.getAll
|
public function getAll(){
$rest = $this->getService( self::API_NAT_INCOMING);
$rest->GET();
return $rest->getResultAsArray( models\NAT\IncomingPortConfig::class);
}
|
php
|
public function getAll(){
$rest = $this->getService( self::API_NAT_INCOMING);
$rest->GET();
return $rest->getResultAsArray( models\NAT\IncomingPortConfig::class);
}
|
[
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"rest",
"=",
"$",
"this",
"->",
"getService",
"(",
"self",
"::",
"API_NAT_INCOMING",
")",
";",
"$",
"rest",
"->",
"GET",
"(",
")",
";",
"return",
"$",
"rest",
"->",
"getResultAsArray",
"(",
"models",
"\\",
"NAT",
"\\",
"IncomingPortConfig",
"::",
"class",
")",
";",
"}"
] |
Getting the list of incoming ports
@throws \Exception
@return models\NAT\IncomingPortConfig[]
|
[
"Getting",
"the",
"list",
"of",
"incoming",
"ports"
] |
6b90f932fca9d74053dc0af9664881664a29cefb
|
https://github.com/alphayax/freebox_api_php/blob/6b90f932fca9d74053dc0af9664881664a29cefb/freebox/api/v3/services/config/NAT/IncomingPort.php#L20-L25
|
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.