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
235,000
makinacorpus/drupal-ucms
ucms_label/src/LabelManager.php
LabelManager.deleteLabel
public function deleteLabel(\stdClass $label) { // Prevents to delete a label which has children. if ($this->hasChildren($label)) { throw new \LogicException("Can't delete a label which has children."); } return taxonomy_term_delete($label->tid); }
php
public function deleteLabel(\stdClass $label) { // Prevents to delete a label which has children. if ($this->hasChildren($label)) { throw new \LogicException("Can't delete a label which has children."); } return taxonomy_term_delete($label->tid); }
[ "public", "function", "deleteLabel", "(", "\\", "stdClass", "$", "label", ")", "{", "// Prevents to delete a label which has children.", "if", "(", "$", "this", "->", "hasChildren", "(", "$", "label", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", ...
Delete the label. @return integer Constant SAVED_DELETED if no exception occurs. @throws \LogicException @see taxonomy_term_delete().
[ "Delete", "the", "label", "." ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_label/src/LabelManager.php#L203-L210
235,001
makinacorpus/drupal-ucms
ucms_label/src/LabelManager.php
LabelManager.canEditLabel
public function canEditLabel(\stdClass $label, AccountInterface $account = null) { if ($account === null) { global $user; $account = $user; } return ($label->is_locked == 0) ? user_access(LabelAccess::PERM_EDIT_NON_LOCKED, $account) : user_access(LabelAccess::PERM_EDIT_LOCKED, $account); }
php
public function canEditLabel(\stdClass $label, AccountInterface $account = null) { if ($account === null) { global $user; $account = $user; } return ($label->is_locked == 0) ? user_access(LabelAccess::PERM_EDIT_NON_LOCKED, $account) : user_access(LabelAccess::PERM_EDIT_LOCKED, $account); }
[ "public", "function", "canEditLabel", "(", "\\", "stdClass", "$", "label", ",", "AccountInterface", "$", "account", "=", "null", ")", "{", "if", "(", "$", "account", "===", "null", ")", "{", "global", "$", "user", ";", "$", "account", "=", "$", "user",...
Is the user allowed to edit the given label? @param stdClass $label @param AccountInterface $account @return boolean
[ "Is", "the", "user", "allowed", "to", "edit", "the", "given", "label?" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_label/src/LabelManager.php#L220-L230
235,002
makinacorpus/drupal-ucms
ucms_label/src/LabelManager.php
LabelManager.canEditLockedLabels
public function canEditLockedLabels(AccountInterface $account = null) { if ($account === null) { global $user; $account = $user; } return user_access(LabelAccess::PERM_EDIT_LOCKED, $account); }
php
public function canEditLockedLabels(AccountInterface $account = null) { if ($account === null) { global $user; $account = $user; } return user_access(LabelAccess::PERM_EDIT_LOCKED, $account); }
[ "public", "function", "canEditLockedLabels", "(", "AccountInterface", "$", "account", "=", "null", ")", "{", "if", "(", "$", "account", "===", "null", ")", "{", "global", "$", "user", ";", "$", "account", "=", "$", "user", ";", "}", "return", "user_acces...
Is the user allowed to edit locked labels? @param AccountInterface $account @return boolean
[ "Is", "the", "user", "allowed", "to", "edit", "locked", "labels?" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_label/src/LabelManager.php#L259-L267
235,003
makinacorpus/drupal-ucms
ucms_label/src/LabelManager.php
LabelManager.canEditNonLockedLabels
public function canEditNonLockedLabels(AccountInterface $account = null) { if ($account === null) { global $user; $account = $user; } return user_access(LabelAccess::PERM_EDIT_NON_LOCKED, $account); }
php
public function canEditNonLockedLabels(AccountInterface $account = null) { if ($account === null) { global $user; $account = $user; } return user_access(LabelAccess::PERM_EDIT_NON_LOCKED, $account); }
[ "public", "function", "canEditNonLockedLabels", "(", "AccountInterface", "$", "account", "=", "null", ")", "{", "if", "(", "$", "account", "===", "null", ")", "{", "global", "$", "user", ";", "$", "account", "=", "$", "user", ";", "}", "return", "user_ac...
Is the user allowed to edit non locked labels? @param AccountInterface $account @return boolean
[ "Is", "the", "user", "allowed", "to", "edit", "non", "locked", "labels?" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_label/src/LabelManager.php#L276-L284
235,004
makinacorpus/drupal-ucms
ucms_search/src/Aggs/TermFacet.php
TermFacet.getFormattedChoices
public function getFormattedChoices() { $ret = []; $loaded = []; // Populate the raw formatted array with just values as values foreach (array_keys($this->choices) as $value) { $ret[$value] = $value; } // First start with arbitrarily set choices map if ($this->choicesMap) { $loaded = array_intersect_key($this->choicesMap, $ret); } // Execute the user given callback if ($this->choicesCallback) { $callbackLoaded = call_user_func( $this->choicesCallback, // Exclude already loaded items to leave the choices map // having precedence over the callback array_diff_key($ret, $loaded) ); // We are forced to proceed to a two step merge (using foreach) // else array_merge() as well as the + operator would terribly // fail merging integer keys if ($callbackLoaded) { foreach ($callbackLoaded as $value => $title) { $loaded[$value] = $title; } } } // Append the count for each value foreach ($this->choices as $value => $count) { $append = ' <span class="badge">' . $count . '</span>'; if (isset($loaded[$value])) { $ret[$value] = $loaded[$value] . $append; } elseif(!$this->exclusiveMode) { $ret[$value] .= $append; } else { unset($ret[$value]); } } return $ret; }
php
public function getFormattedChoices() { $ret = []; $loaded = []; // Populate the raw formatted array with just values as values foreach (array_keys($this->choices) as $value) { $ret[$value] = $value; } // First start with arbitrarily set choices map if ($this->choicesMap) { $loaded = array_intersect_key($this->choicesMap, $ret); } // Execute the user given callback if ($this->choicesCallback) { $callbackLoaded = call_user_func( $this->choicesCallback, // Exclude already loaded items to leave the choices map // having precedence over the callback array_diff_key($ret, $loaded) ); // We are forced to proceed to a two step merge (using foreach) // else array_merge() as well as the + operator would terribly // fail merging integer keys if ($callbackLoaded) { foreach ($callbackLoaded as $value => $title) { $loaded[$value] = $title; } } } // Append the count for each value foreach ($this->choices as $value => $count) { $append = ' <span class="badge">' . $count . '</span>'; if (isset($loaded[$value])) { $ret[$value] = $loaded[$value] . $append; } elseif(!$this->exclusiveMode) { $ret[$value] .= $append; } else { unset($ret[$value]); } } return $ret; }
[ "public", "function", "getFormattedChoices", "(", ")", "{", "$", "ret", "=", "[", "]", ";", "$", "loaded", "=", "[", "]", ";", "// Populate the raw formatted array with just values as values", "foreach", "(", "array_keys", "(", "$", "this", "->", "choices", ")",...
Get formatter list of choices after query @return string[]
[ "Get", "formatter", "list", "of", "choices", "after", "query" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/Aggs/TermFacet.php#L151-L200
235,005
PHPixie/HTTP
src/PHPixie/HTTP/Context/Cookies/Update.php
Update.asHeader
public function asHeader() { $header = urlencode($this->name).'='.urlencode((string) $this->value); if($this->domain !== null) { $header.= '; domain='.$this->domain; } if($this->path !== null) { $header.= '; path='.$this->path; } if($this->expires !== null) { $header.= '; expires=' . gmdate('D, d-M-Y H:i:s e', $this->expires); } if($this->secure) { $header.= '; secure'; } if($this->httpOnly) { $header.= '; HttpOnly'; } return $header; }
php
public function asHeader() { $header = urlencode($this->name).'='.urlencode((string) $this->value); if($this->domain !== null) { $header.= '; domain='.$this->domain; } if($this->path !== null) { $header.= '; path='.$this->path; } if($this->expires !== null) { $header.= '; expires=' . gmdate('D, d-M-Y H:i:s e', $this->expires); } if($this->secure) { $header.= '; secure'; } if($this->httpOnly) { $header.= '; HttpOnly'; } return $header; }
[ "public", "function", "asHeader", "(", ")", "{", "$", "header", "=", "urlencode", "(", "$", "this", "->", "name", ")", ".", "'='", ".", "urlencode", "(", "(", "string", ")", "$", "this", "->", "value", ")", ";", "if", "(", "$", "this", "->", "dom...
Get header representation @return string
[ "Get", "header", "representation" ]
581c0df452fd07ca4ea0b3e24e8ddee8dddc2912
https://github.com/PHPixie/HTTP/blob/581c0df452fd07ca4ea0b3e24e8ddee8dddc2912/src/PHPixie/HTTP/Context/Cookies/Update.php#L141-L166
235,006
NicolasMahe/Laravel-SlackOutput
src/Library/Stats.php
Stats.getClasses
protected function getClasses() { $classes = config('slack-output.stats.classes'); //force classes to have the right format $sanitized_classes = [ ]; foreach ($classes as $classes_name => $constraints) { //check constraints are supplied, if not, correct //the classes name with the right value if (is_int($classes_name)) { $classes_name = $constraints; $constraints = [ ]; } $sanitized_classes[$classes_name] = $constraints; } return $sanitized_classes; }
php
protected function getClasses() { $classes = config('slack-output.stats.classes'); //force classes to have the right format $sanitized_classes = [ ]; foreach ($classes as $classes_name => $constraints) { //check constraints are supplied, if not, correct //the classes name with the right value if (is_int($classes_name)) { $classes_name = $constraints; $constraints = [ ]; } $sanitized_classes[$classes_name] = $constraints; } return $sanitized_classes; }
[ "protected", "function", "getClasses", "(", ")", "{", "$", "classes", "=", "config", "(", "'slack-output.stats.classes'", ")", ";", "//force classes to have the right format", "$", "sanitized_classes", "=", "[", "]", ";", "foreach", "(", "$", "classes", "as", "$",...
Get the classes and sanitized them @return array
[ "Get", "the", "classes", "and", "sanitized", "them" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Library/Stats.php#L37-L55
235,007
NicolasMahe/Laravel-SlackOutput
src/Library/Stats.php
Stats.calculateStats
public function calculateStats() { $classes = $this->getClasses(); $dates = $this->getDates(); //explore all class to stated foreach ($classes as $objectClass => $constraints) { //prepare useful data $stats_fields = [ ]; $objectName = last(explode('\\', $objectClass)); //explore each date to count from foreach ($dates as $dateName => $date) { //create the sql request $sql = $objectClass::where('created_at', '>=', $date->toDateTimeString()); //taking into account the constraint foreach ($constraints as $constraintName => $constraintValue) { $sql = $sql->where($constraintName, $constraintValue); } //count ! $count = $sql->count(); //set count $stats_fields[] = [ "since" => $dateName, "value" => $count ]; } //add to stats array $this->stats[] = [ 'name' => $objectName, 'values' => $stats_fields ]; } }
php
public function calculateStats() { $classes = $this->getClasses(); $dates = $this->getDates(); //explore all class to stated foreach ($classes as $objectClass => $constraints) { //prepare useful data $stats_fields = [ ]; $objectName = last(explode('\\', $objectClass)); //explore each date to count from foreach ($dates as $dateName => $date) { //create the sql request $sql = $objectClass::where('created_at', '>=', $date->toDateTimeString()); //taking into account the constraint foreach ($constraints as $constraintName => $constraintValue) { $sql = $sql->where($constraintName, $constraintValue); } //count ! $count = $sql->count(); //set count $stats_fields[] = [ "since" => $dateName, "value" => $count ]; } //add to stats array $this->stats[] = [ 'name' => $objectName, 'values' => $stats_fields ]; } }
[ "public", "function", "calculateStats", "(", ")", "{", "$", "classes", "=", "$", "this", "->", "getClasses", "(", ")", ";", "$", "dates", "=", "$", "this", "->", "getDates", "(", ")", ";", "//explore all class to stated", "foreach", "(", "$", "classes", ...
Do the stats!
[ "Do", "the", "stats!" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Library/Stats.php#L72-L110
235,008
NicolasMahe/Laravel-SlackOutput
src/Library/Stats.php
Stats.prepareSlackAttachment
protected function prepareSlackAttachment() { $attachments = [ ]; foreach ($this->stats as $stats) { $name = $stats['name']; $fields = [ ]; foreach ($stats['values'] as $stat) { $count = $stat['value']; $since = $stat['since']; $fields[] = [ "title" => "Since " . $since, "value" => $count, "short" => true ]; } $attachments[] = [ 'color' => 'grey', "title" => "New " . $name . "s", "fields" => $fields ]; } return $attachments; }
php
protected function prepareSlackAttachment() { $attachments = [ ]; foreach ($this->stats as $stats) { $name = $stats['name']; $fields = [ ]; foreach ($stats['values'] as $stat) { $count = $stat['value']; $since = $stat['since']; $fields[] = [ "title" => "Since " . $since, "value" => $count, "short" => true ]; } $attachments[] = [ 'color' => 'grey', "title" => "New " . $name . "s", "fields" => $fields ]; } return $attachments; }
[ "protected", "function", "prepareSlackAttachment", "(", ")", "{", "$", "attachments", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "stats", "as", "$", "stats", ")", "{", "$", "name", "=", "$", "stats", "[", "'name'", "]", ";", "$", "fields"...
Transform the stats array to a slack attachment
[ "Transform", "the", "stats", "array", "to", "a", "slack", "attachment" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Library/Stats.php#L116-L144
235,009
NicolasMahe/Laravel-SlackOutput
src/Library/Stats.php
Stats.sendToSlack
public function sendToSlack($channel) { $attachments = $this->prepareSlackAttachment(); Artisan::call('slack:post', [ 'to' => $channel, 'attach' => $attachments, 'message' => "Stats of the " . Carbon::now()->toFormattedDateString() ]); }
php
public function sendToSlack($channel) { $attachments = $this->prepareSlackAttachment(); Artisan::call('slack:post', [ 'to' => $channel, 'attach' => $attachments, 'message' => "Stats of the " . Carbon::now()->toFormattedDateString() ]); }
[ "public", "function", "sendToSlack", "(", "$", "channel", ")", "{", "$", "attachments", "=", "$", "this", "->", "prepareSlackAttachment", "(", ")", ";", "Artisan", "::", "call", "(", "'slack:post'", ",", "[", "'to'", "=>", "$", "channel", ",", "'attach'", ...
Send the stats to output @param $channel
[ "Send", "the", "stats", "to", "output" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Library/Stats.php#L152-L161
235,010
PHPixie/HTTP
src/PHPixie/HTTP.php
HTTP.request
public function request($serverRequest = null) { if ($serverRequest === null) { $serverRequest = $this->sapiServerRequest(); } return $this->builder->request($serverRequest); }
php
public function request($serverRequest = null) { if ($serverRequest === null) { $serverRequest = $this->sapiServerRequest(); } return $this->builder->request($serverRequest); }
[ "public", "function", "request", "(", "$", "serverRequest", "=", "null", ")", "{", "if", "(", "$", "serverRequest", "===", "null", ")", "{", "$", "serverRequest", "=", "$", "this", "->", "sapiServerRequest", "(", ")", ";", "}", "return", "$", "this", "...
Create PHPixie request from server request. If the server request is not specified it will be created from globals @param Request\ServerRequest $serverRequest @return HTTP\Request
[ "Create", "PHPixie", "request", "from", "server", "request", "." ]
581c0df452fd07ca4ea0b3e24e8ddee8dddc2912
https://github.com/PHPixie/HTTP/blob/581c0df452fd07ca4ea0b3e24e8ddee8dddc2912/src/PHPixie/HTTP.php#L43-L49
235,011
PHPixie/HTTP
src/PHPixie/HTTP.php
HTTP.output
public function output($response, $context = null) { $this->builder->output()->response($response, $context); }
php
public function output($response, $context = null) { $this->builder->output()->response($response, $context); }
[ "public", "function", "output", "(", "$", "response", ",", "$", "context", "=", "null", ")", "{", "$", "this", "->", "builder", "->", "output", "(", ")", "->", "response", "(", "$", "response", ",", "$", "context", ")", ";", "}" ]
Output a HTTP response @param HTTP\Responses\Response $response @param HTTP\Context $context Optional HTTP context to use (e.g. for cookie data) @return void
[ "Output", "a", "HTTP", "response" ]
581c0df452fd07ca4ea0b3e24e8ddee8dddc2912
https://github.com/PHPixie/HTTP/blob/581c0df452fd07ca4ea0b3e24e8ddee8dddc2912/src/PHPixie/HTTP.php#L57-L60
235,012
PHPixie/HTTP
src/PHPixie/HTTP.php
HTTP.context
public function context($request, $session = null) { $serverRequest = $request->serverRequest(); $cookieArray = $serverRequest->getCookieParams(); $cookies = $this->builder->cookies($cookieArray); if ($session === null) { $session = $this->builder->sapiSession(); } return $this->builder->context($request, $cookies, $session); }
php
public function context($request, $session = null) { $serverRequest = $request->serverRequest(); $cookieArray = $serverRequest->getCookieParams(); $cookies = $this->builder->cookies($cookieArray); if ($session === null) { $session = $this->builder->sapiSession(); } return $this->builder->context($request, $cookies, $session); }
[ "public", "function", "context", "(", "$", "request", ",", "$", "session", "=", "null", ")", "{", "$", "serverRequest", "=", "$", "request", "->", "serverRequest", "(", ")", ";", "$", "cookieArray", "=", "$", "serverRequest", "->", "getCookieParams", "(", ...
Create a context from a HTTP request @param HTTP\Request $request @param HTTP\Context\Session $session Optional session container, if not specified the default PHP session storage is used @return HTTP\Context
[ "Create", "a", "context", "from", "a", "HTTP", "request" ]
581c0df452fd07ca4ea0b3e24e8ddee8dddc2912
https://github.com/PHPixie/HTTP/blob/581c0df452fd07ca4ea0b3e24e8ddee8dddc2912/src/PHPixie/HTTP.php#L79-L89
235,013
aimeos/ai-admin-extadm
controller/extjs/src/Controller/ExtJS/Base.php
Base.checkFileUpload
protected function checkFileUpload( $filename, $errcode ) { switch( $errcode ) { case UPLOAD_ERR_OK: break; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: throw new \Aimeos\Controller\ExtJS\Exception( 'The uploaded file exceeds the max. allowed filesize' ); case UPLOAD_ERR_PARTIAL: throw new \Aimeos\Controller\ExtJS\Exception( 'The uploaded file was only partially uploaded' ); case UPLOAD_ERR_NO_FILE: throw new \Aimeos\Controller\ExtJS\Exception( 'No file was uploaded' ); case UPLOAD_ERR_NO_TMP_DIR: throw new \Aimeos\Controller\ExtJS\Exception( 'Temporary folder is missing' ); case UPLOAD_ERR_CANT_WRITE: throw new \Aimeos\Controller\ExtJS\Exception( 'Failed to write file to disk' ); case UPLOAD_ERR_EXTENSION: throw new \Aimeos\Controller\ExtJS\Exception( 'File upload stopped by extension' ); default: throw new \Aimeos\Controller\ExtJS\Exception( 'Unknown upload error' ); } if( is_uploaded_file( $filename ) === false ) { throw new \Aimeos\Controller\ExtJS\Exception( 'File was not uploaded' ); } }
php
protected function checkFileUpload( $filename, $errcode ) { switch( $errcode ) { case UPLOAD_ERR_OK: break; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: throw new \Aimeos\Controller\ExtJS\Exception( 'The uploaded file exceeds the max. allowed filesize' ); case UPLOAD_ERR_PARTIAL: throw new \Aimeos\Controller\ExtJS\Exception( 'The uploaded file was only partially uploaded' ); case UPLOAD_ERR_NO_FILE: throw new \Aimeos\Controller\ExtJS\Exception( 'No file was uploaded' ); case UPLOAD_ERR_NO_TMP_DIR: throw new \Aimeos\Controller\ExtJS\Exception( 'Temporary folder is missing' ); case UPLOAD_ERR_CANT_WRITE: throw new \Aimeos\Controller\ExtJS\Exception( 'Failed to write file to disk' ); case UPLOAD_ERR_EXTENSION: throw new \Aimeos\Controller\ExtJS\Exception( 'File upload stopped by extension' ); default: throw new \Aimeos\Controller\ExtJS\Exception( 'Unknown upload error' ); } if( is_uploaded_file( $filename ) === false ) { throw new \Aimeos\Controller\ExtJS\Exception( 'File was not uploaded' ); } }
[ "protected", "function", "checkFileUpload", "(", "$", "filename", ",", "$", "errcode", ")", "{", "switch", "(", "$", "errcode", ")", "{", "case", "UPLOAD_ERR_OK", ":", "break", ";", "case", "UPLOAD_ERR_INI_SIZE", ":", "case", "UPLOAD_ERR_FORM_SIZE", ":", "thro...
Checks if the uploaded file is valid. @param string $filename Name of the uploaded file in the file system of the server @param integer $errcode Status code of the uploaded file @throws \Aimeos\Controller\ExtJS\Exception If file upload is invalid
[ "Checks", "if", "the", "uploaded", "file", "is", "valid", "." ]
594ee7cec90fd63a4773c05c93f353e66d9b3408
https://github.com/aimeos/ai-admin-extadm/blob/594ee7cec90fd63a4773c05c93f353e66d9b3408/controller/extjs/src/Controller/ExtJS/Base.php#L265-L291
235,014
aimeos/ai-admin-extadm
controller/extjs/src/Controller/ExtJS/Base.php
Base.getItems
protected function getItems( array $ids, $prefix ) { $search = $this->getManager()->createSearch(); $search->setConditions( $search->compare( '==', $prefix . '.id', $ids ) ); $search->setSlice( 0, count( $ids ) ); $items = $this->toArray( $this->getManager()->searchItems( $search ) ); return array( 'items' => ( count( $ids ) === 1 ? reset( $items ) : $items ), 'success' => true, ); }
php
protected function getItems( array $ids, $prefix ) { $search = $this->getManager()->createSearch(); $search->setConditions( $search->compare( '==', $prefix . '.id', $ids ) ); $search->setSlice( 0, count( $ids ) ); $items = $this->toArray( $this->getManager()->searchItems( $search ) ); return array( 'items' => ( count( $ids ) === 1 ? reset( $items ) : $items ), 'success' => true, ); }
[ "protected", "function", "getItems", "(", "array", "$", "ids", ",", "$", "prefix", ")", "{", "$", "search", "=", "$", "this", "->", "getManager", "(", ")", "->", "createSearch", "(", ")", ";", "$", "search", "->", "setConditions", "(", "$", "search", ...
Returns the items for the given domain and IDs @param array $ids List of domain item IDs @param string $prefix Search key prefix @return array Associative array including items and status for ExtJS
[ "Returns", "the", "items", "for", "the", "given", "domain", "and", "IDs" ]
594ee7cec90fd63a4773c05c93f353e66d9b3408
https://github.com/aimeos/ai-admin-extadm/blob/594ee7cec90fd63a4773c05c93f353e66d9b3408/controller/extjs/src/Controller/ExtJS/Base.php#L369-L380
235,015
aimeos/ai-admin-extadm
controller/extjs/src/Controller/ExtJS/Base.php
Base.toArray
protected function toArray( array $list ) { $result = []; foreach( $list as $item ) { $result[] = (object) $item->toArray( true ); } return $result; }
php
protected function toArray( array $list ) { $result = []; foreach( $list as $item ) { $result[] = (object) $item->toArray( true ); } return $result; }
[ "protected", "function", "toArray", "(", "array", "$", "list", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "list", "as", "$", "item", ")", "{", "$", "result", "[", "]", "=", "(", "object", ")", "$", "item", "->", "toArray", ...
Converts the given list of objects to a list of \stdClass objects @param array $list List of item objects @return array List of \stdClass objects containing the properties of the item objects
[ "Converts", "the", "given", "list", "of", "objects", "to", "a", "list", "of", "\\", "stdClass", "objects" ]
594ee7cec90fd63a4773c05c93f353e66d9b3408
https://github.com/aimeos/ai-admin-extadm/blob/594ee7cec90fd63a4773c05c93f353e66d9b3408/controller/extjs/src/Controller/ExtJS/Base.php#L512-L521
235,016
platformsh/console-form
src/Form.php
Form.addField
public function addField(Field $field, $key = null) { $this->fields[$key] = $field; return $this; }
php
public function addField(Field $field, $key = null) { $this->fields[$key] = $field; return $this; }
[ "public", "function", "addField", "(", "Field", "$", "field", ",", "$", "key", "=", "null", ")", "{", "$", "this", "->", "fields", "[", "$", "key", "]", "=", "$", "field", ";", "return", "$", "this", ";", "}" ]
Add a field to the form. @param Field $field @param string $key @return $this
[ "Add", "a", "field", "to", "the", "form", "." ]
5263fe8c6c976e10f4495c9e00c92cc2d410a673
https://github.com/platformsh/console-form/blob/5263fe8c6c976e10f4495c9e00c92cc2d410a673/src/Form.php#L27-L32
235,017
platformsh/console-form
src/Form.php
Form.getField
public function getField($key) { if (!isset($this->fields[$key])) { return false; } return $this->fields[$key]; }
php
public function getField($key) { if (!isset($this->fields[$key])) { return false; } return $this->fields[$key]; }
[ "public", "function", "getField", "(", "$", "key", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "fields", "[", "$", "key", "]", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "fields", "[", "$", "key", "]...
Get a single form field. @param string $key @return Field|false
[ "Get", "a", "single", "form", "field", "." ]
5263fe8c6c976e10f4495c9e00c92cc2d410a673
https://github.com/platformsh/console-form/blob/5263fe8c6c976e10f4495c9e00c92cc2d410a673/src/Form.php#L41-L48
235,018
platformsh/console-form
src/Form.php
Form.fromArray
public static function fromArray(array $fields) { $form = new static(); foreach ($fields as $key => $field) { $form->addField($field, $key); } return $form; }
php
public static function fromArray(array $fields) { $form = new static(); foreach ($fields as $key => $field) { $form->addField($field, $key); } return $form; }
[ "public", "static", "function", "fromArray", "(", "array", "$", "fields", ")", "{", "$", "form", "=", "new", "static", "(", ")", ";", "foreach", "(", "$", "fields", "as", "$", "key", "=>", "$", "field", ")", "{", "$", "form", "->", "addField", "(",...
Create a form from an array of fields. @param Field[] $fields @return static
[ "Create", "a", "form", "from", "an", "array", "of", "fields", "." ]
5263fe8c6c976e10f4495c9e00c92cc2d410a673
https://github.com/platformsh/console-form/blob/5263fe8c6c976e10f4495c9e00c92cc2d410a673/src/Form.php#L57-L65
235,019
platformsh/console-form
src/Form.php
Form.configureInputDefinition
public function configureInputDefinition(InputDefinition $definition) { foreach ($this->fields as $field) { if ($field->includeAsOption()) { $definition->addOption($field->getAsOption()); } } }
php
public function configureInputDefinition(InputDefinition $definition) { foreach ($this->fields as $field) { if ($field->includeAsOption()) { $definition->addOption($field->getAsOption()); } } }
[ "public", "function", "configureInputDefinition", "(", "InputDefinition", "$", "definition", ")", "{", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", ")", "{", "if", "(", "$", "field", "->", "includeAsOption", "(", ")", ")", "{", "$", "...
Add options to a Symfony Console input definition. @param InputDefinition $definition
[ "Add", "options", "to", "a", "Symfony", "Console", "input", "definition", "." ]
5263fe8c6c976e10f4495c9e00c92cc2d410a673
https://github.com/platformsh/console-form/blob/5263fe8c6c976e10f4495c9e00c92cc2d410a673/src/Form.php#L72-L79
235,020
platformsh/console-form
src/Form.php
Form.resolveOptions
public function resolveOptions(InputInterface $input, OutputInterface $output, QuestionHelper $helper) { $values = []; $stdErr = $output instanceof ConsoleOutput ? $output->getErrorOutput() : $output; foreach ($this->fields as $key => $field) { $field->onChange($values); if (!$this->includeField($field, $values)) { continue; } // Get the value from the command-line options. $value = $field->getValueFromInput($input, false); if ($value !== null) { $field->validate($value); } elseif ($input->isInteractive()) { // Get the value interactively. $value = $helper->ask($input, $stdErr, $field->getAsQuestion()); $stdErr->writeln(''); } elseif ($field->isRequired()) { throw new MissingValueException('--' . $field->getOptionName() . ' is required'); } self::setNestedArrayValue( $values, $field->getValueKeys() ?: [$key], $field->getFinalValue($value), true ); } return $values; }
php
public function resolveOptions(InputInterface $input, OutputInterface $output, QuestionHelper $helper) { $values = []; $stdErr = $output instanceof ConsoleOutput ? $output->getErrorOutput() : $output; foreach ($this->fields as $key => $field) { $field->onChange($values); if (!$this->includeField($field, $values)) { continue; } // Get the value from the command-line options. $value = $field->getValueFromInput($input, false); if ($value !== null) { $field->validate($value); } elseif ($input->isInteractive()) { // Get the value interactively. $value = $helper->ask($input, $stdErr, $field->getAsQuestion()); $stdErr->writeln(''); } elseif ($field->isRequired()) { throw new MissingValueException('--' . $field->getOptionName() . ' is required'); } self::setNestedArrayValue( $values, $field->getValueKeys() ?: [$key], $field->getFinalValue($value), true ); } return $values; }
[ "public", "function", "resolveOptions", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "QuestionHelper", "$", "helper", ")", "{", "$", "values", "=", "[", "]", ";", "$", "stdErr", "=", "$", "output", "instanceof", "ConsoleOu...
Validate specified options, and ask questions for any missing values. Values can come from three sources at the moment: - command-line input - defaults - interactive questions @param InputInterface $input @param OutputInterface $output @param QuestionHelper $helper @throws InvalidValueException if any of the input was invalid. @return array An array of normalized field values. The array keys match those provided as the second argument to self::addField().
[ "Validate", "specified", "options", "and", "ask", "questions", "for", "any", "missing", "values", "." ]
5263fe8c6c976e10f4495c9e00c92cc2d410a673
https://github.com/platformsh/console-form/blob/5263fe8c6c976e10f4495c9e00c92cc2d410a673/src/Form.php#L109-L141
235,021
platformsh/console-form
src/Form.php
Form.includeField
public function includeField(Field $field, array $previousValues) { foreach ($field->getConditions() as $previousField => $condition) { $previousFieldObject = $this->getField($previousField); if ($previousFieldObject === false || !isset($previousValues[$previousField]) || !$previousFieldObject->matchesCondition($previousValues[$previousField], $condition)) { return false; } } return true; }
php
public function includeField(Field $field, array $previousValues) { foreach ($field->getConditions() as $previousField => $condition) { $previousFieldObject = $this->getField($previousField); if ($previousFieldObject === false || !isset($previousValues[$previousField]) || !$previousFieldObject->matchesCondition($previousValues[$previousField], $condition)) { return false; } } return true; }
[ "public", "function", "includeField", "(", "Field", "$", "field", ",", "array", "$", "previousValues", ")", "{", "foreach", "(", "$", "field", "->", "getConditions", "(", ")", "as", "$", "previousField", "=>", "$", "condition", ")", "{", "$", "previousFiel...
Determine whether the field should be included. @param Field $field @param array $previousValues @return bool
[ "Determine", "whether", "the", "field", "should", "be", "included", "." ]
5263fe8c6c976e10f4495c9e00c92cc2d410a673
https://github.com/platformsh/console-form/blob/5263fe8c6c976e10f4495c9e00c92cc2d410a673/src/Form.php#L151-L163
235,022
makinacorpus/drupal-ucms
ucms_group/src/Controller/DashboardController.php
DashboardController.viewAction
public function viewAction(Group $group) { $table = $this->createAdminTable('ucms_group'); $table ->addHeader($this->t("Information"), 'basic') ->addRow($this->t("Title"), $group->getTitle()) ->addRow($this->t("Identifier"), $group->getId()) ; $this->addArbitraryAttributesToTable($table, $group->getAttributes()); return $table->render(); }
php
public function viewAction(Group $group) { $table = $this->createAdminTable('ucms_group'); $table ->addHeader($this->t("Information"), 'basic') ->addRow($this->t("Title"), $group->getTitle()) ->addRow($this->t("Identifier"), $group->getId()) ; $this->addArbitraryAttributesToTable($table, $group->getAttributes()); return $table->render(); }
[ "public", "function", "viewAction", "(", "Group", "$", "group", ")", "{", "$", "table", "=", "$", "this", "->", "createAdminTable", "(", "'ucms_group'", ")", ";", "$", "table", "->", "addHeader", "(", "$", "this", "->", "t", "(", "\"Information\"", ")", ...
Group details action
[ "Group", "details", "action" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_group/src/Controller/DashboardController.php#L71-L84
235,023
makinacorpus/drupal-ucms
ucms_group/src/Controller/DashboardController.php
DashboardController.memberListAction
public function memberListAction(Request $request, Group $group) { return $this->renderPage('ucms_group.list_members', $request, [ 'base_query' => [ 'group' => $group->getId(), ] ]); }
php
public function memberListAction(Request $request, Group $group) { return $this->renderPage('ucms_group.list_members', $request, [ 'base_query' => [ 'group' => $group->getId(), ] ]); }
[ "public", "function", "memberListAction", "(", "Request", "$", "request", ",", "Group", "$", "group", ")", "{", "return", "$", "this", "->", "renderPage", "(", "'ucms_group.list_members'", ",", "$", "request", ",", "[", "'base_query'", "=>", "[", "'group'", ...
View members action
[ "View", "members", "action" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_group/src/Controller/DashboardController.php#L89-L96
235,024
makinacorpus/drupal-ucms
ucms_group/src/Controller/DashboardController.php
DashboardController.siteAttachAction
public function siteAttachAction(Site $site) { if (!$this->isGranted(Access::PERM_GROUP_MANAGE_ALL)) { throw $this->createAccessDeniedException(); } return \Drupal::formBuilder()->getForm(SiteGroupAttach::class, $site); }
php
public function siteAttachAction(Site $site) { if (!$this->isGranted(Access::PERM_GROUP_MANAGE_ALL)) { throw $this->createAccessDeniedException(); } return \Drupal::formBuilder()->getForm(SiteGroupAttach::class, $site); }
[ "public", "function", "siteAttachAction", "(", "Site", "$", "site", ")", "{", "if", "(", "!", "$", "this", "->", "isGranted", "(", "Access", "::", "PERM_GROUP_MANAGE_ALL", ")", ")", "{", "throw", "$", "this", "->", "createAccessDeniedException", "(", ")", ...
Add site action
[ "Add", "site", "action" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_group/src/Controller/DashboardController.php#L117-L124
235,025
makinacorpus/drupal-ucms
ucms_group/src/Controller/DashboardController.php
DashboardController.siteListAction
public function siteListAction(Request $request, Group $group) { return $this->renderPage('ucms_group.list_by_site', $request, [ 'base_query' => [ 'group' => $group->getId(), ] ]); }
php
public function siteListAction(Request $request, Group $group) { return $this->renderPage('ucms_group.list_by_site', $request, [ 'base_query' => [ 'group' => $group->getId(), ] ]); }
[ "public", "function", "siteListAction", "(", "Request", "$", "request", ",", "Group", "$", "group", ")", "{", "return", "$", "this", "->", "renderPage", "(", "'ucms_group.list_by_site'", ",", "$", "request", ",", "[", "'base_query'", "=>", "[", "'group'", "=...
Site list action for group
[ "Site", "list", "action", "for", "group" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_group/src/Controller/DashboardController.php#L129-L136
235,026
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.ping
protected function ping() { // obfuscate data relevant for authentication $config = $this->config->toArray(); $config['customer_number'] = ShopgateLogger::OBFUSCATION_STRING; $config['shop_number'] = ShopgateLogger::OBFUSCATION_STRING; $config['apikey'] = ShopgateLogger::OBFUSCATION_STRING; $config['oauth_access_token'] = ShopgateLogger::OBFUSCATION_STRING; // prepare response data array $this->responseData['pong'] = 'OK'; $this->responseData['configuration'] = $config; $this->responseData['plugin_info'] = $this->plugin->createPluginInfo(); $this->responseData['permissions'] = $this->getPermissions(); $this->responseData['php_version'] = phpversion(); $this->responseData['php_config'] = $this->getPhpSettings(); $this->responseData['php_curl'] = function_exists('curl_version') ? curl_version() : 'No PHP-CURL installed'; $this->responseData['php_extensions'] = get_loaded_extensions(); $this->responseData['shopgate_library_version'] = SHOPGATE_LIBRARY_VERSION; $this->responseData['plugin_version'] = defined( 'SHOPGATE_PLUGIN_VERSION' ) ? SHOPGATE_PLUGIN_VERSION : 'UNKNOWN'; $this->responseData['shop_info'] = $this->plugin->createShopInfo(); // set data and return response if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } }
php
protected function ping() { // obfuscate data relevant for authentication $config = $this->config->toArray(); $config['customer_number'] = ShopgateLogger::OBFUSCATION_STRING; $config['shop_number'] = ShopgateLogger::OBFUSCATION_STRING; $config['apikey'] = ShopgateLogger::OBFUSCATION_STRING; $config['oauth_access_token'] = ShopgateLogger::OBFUSCATION_STRING; // prepare response data array $this->responseData['pong'] = 'OK'; $this->responseData['configuration'] = $config; $this->responseData['plugin_info'] = $this->plugin->createPluginInfo(); $this->responseData['permissions'] = $this->getPermissions(); $this->responseData['php_version'] = phpversion(); $this->responseData['php_config'] = $this->getPhpSettings(); $this->responseData['php_curl'] = function_exists('curl_version') ? curl_version() : 'No PHP-CURL installed'; $this->responseData['php_extensions'] = get_loaded_extensions(); $this->responseData['shopgate_library_version'] = SHOPGATE_LIBRARY_VERSION; $this->responseData['plugin_version'] = defined( 'SHOPGATE_PLUGIN_VERSION' ) ? SHOPGATE_PLUGIN_VERSION : 'UNKNOWN'; $this->responseData['shop_info'] = $this->plugin->createShopInfo(); // set data and return response if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } }
[ "protected", "function", "ping", "(", ")", "{", "// obfuscate data relevant for authentication", "$", "config", "=", "$", "this", "->", "config", "->", "toArray", "(", ")", ";", "$", "config", "[", "'customer_number'", "]", "=", "ShopgateLogger", "::", "OBFUSCAT...
Represents the "ping" action. @see http://wiki.shopgate.com/Shopgate_Plugin_API_ping
[ "Represents", "the", "ping", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L295-L327
235,027
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.getDebugInfo
protected function getDebugInfo() { // prepare response data array $this->responseData = $this->plugin->getDebugInfo(); // set data and return response if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } }
php
protected function getDebugInfo() { // prepare response data array $this->responseData = $this->plugin->getDebugInfo(); // set data and return response if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } }
[ "protected", "function", "getDebugInfo", "(", ")", "{", "// prepare response data array", "$", "this", "->", "responseData", "=", "$", "this", "->", "plugin", "->", "getDebugInfo", "(", ")", ";", "// set data and return response", "if", "(", "empty", "(", "$", "...
Represents the "debug" action. @see http://wiki.shopgate.com/Shopgate_Plugin_API_ping
[ "Represents", "the", "debug", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L334-L343
235,028
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.cron
protected function cron() { if (empty($this->params['jobs']) || !is_array($this->params['jobs'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_CRON_NO_JOBS); } $unknownJobs = $this->getUnknownCronJobs($this->params['jobs']); if (!empty($unknownJobs)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_CRON_UNSUPPORTED_JOB, implode(', ', $unknownJobs), true ); } // time tracking $starttime = microtime(true); // references $message = ''; $errorcount = 0; // execute the jobs foreach ($this->params['jobs'] as $job) { if (empty($job['job_params'])) { $job['job_params'] = array(); } try { $jobErrorcount = 0; // job execution $this->plugin->cron($job['job_name'], $job['job_params'], $message, $jobErrorcount); // check error count if ($jobErrorcount > 0) { $message .= "{$jobErrorcount} errors occured while executing cron job '{$job['job_name']}'\n"; $errorcount += $jobErrorcount; } } catch (Exception $e) { $errorcount++; $message .= 'Job aborted: "' . $e->getMessage() . '"'; } } // time tracking $endtime = microtime(true); $runtime = $endtime - $starttime; $runtime = round($runtime, 4); // prepare response $responses = array(); $responses['message'] = $message; $responses['execution_error_count'] = $errorcount; $responses['execution_time'] = $runtime; if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $this->responseData = $responses; }
php
protected function cron() { if (empty($this->params['jobs']) || !is_array($this->params['jobs'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_CRON_NO_JOBS); } $unknownJobs = $this->getUnknownCronJobs($this->params['jobs']); if (!empty($unknownJobs)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_CRON_UNSUPPORTED_JOB, implode(', ', $unknownJobs), true ); } // time tracking $starttime = microtime(true); // references $message = ''; $errorcount = 0; // execute the jobs foreach ($this->params['jobs'] as $job) { if (empty($job['job_params'])) { $job['job_params'] = array(); } try { $jobErrorcount = 0; // job execution $this->plugin->cron($job['job_name'], $job['job_params'], $message, $jobErrorcount); // check error count if ($jobErrorcount > 0) { $message .= "{$jobErrorcount} errors occured while executing cron job '{$job['job_name']}'\n"; $errorcount += $jobErrorcount; } } catch (Exception $e) { $errorcount++; $message .= 'Job aborted: "' . $e->getMessage() . '"'; } } // time tracking $endtime = microtime(true); $runtime = $endtime - $starttime; $runtime = round($runtime, 4); // prepare response $responses = array(); $responses['message'] = $message; $responses['execution_error_count'] = $errorcount; $responses['execution_time'] = $runtime; if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $this->responseData = $responses; }
[ "protected", "function", "cron", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "params", "[", "'jobs'", "]", ")", "||", "!", "is_array", "(", "$", "this", "->", "params", "[", "'jobs'", "]", ")", ")", "{", "throw", "new", "ShopgateLibr...
Represents the "cron" action. @throws ShopgateLibraryException
[ "Represents", "the", "cron", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L350-L410
235,029
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.addOrder
protected function addOrder() { if (!isset($this->params['order_number'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_ORDER_NUMBER); } /** @var ShopgateOrder[] $orders */ $orders = $this->merchantApi->getOrders( array( 'order_numbers[0]' => $this->params['order_number'], 'with_items' => 1, ) )->getData(); if (empty($orders)) { throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, '"orders" not set or empty. Response: ' . var_export($orders, true) ); } if (count($orders) > 1) { throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, 'more than one order in response. Response: ' . var_export($orders, true) ); } if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $orderData = $this->plugin->addOrder($orders[0]); if (is_array($orderData)) { $this->responseData = $orderData; } else { $this->responseData['external_order_id'] = $orderData; $this->responseData['external_order_number'] = null; } }
php
protected function addOrder() { if (!isset($this->params['order_number'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_ORDER_NUMBER); } /** @var ShopgateOrder[] $orders */ $orders = $this->merchantApi->getOrders( array( 'order_numbers[0]' => $this->params['order_number'], 'with_items' => 1, ) )->getData(); if (empty($orders)) { throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, '"orders" not set or empty. Response: ' . var_export($orders, true) ); } if (count($orders) > 1) { throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, 'more than one order in response. Response: ' . var_export($orders, true) ); } if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $orderData = $this->plugin->addOrder($orders[0]); if (is_array($orderData)) { $this->responseData = $orderData; } else { $this->responseData['external_order_id'] = $orderData; $this->responseData['external_order_number'] = null; } }
[ "protected", "function", "addOrder", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "params", "[", "'order_number'", "]", ")", ")", "{", "throw", "new", "ShopgateLibraryException", "(", "ShopgateLibraryException", "::", "PLUGIN_API_NO_ORDER_NUMB...
Represents the "add_order" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_add_order
[ "Represents", "the", "add_order", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L442-L478
235,030
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.updateOrder
protected function updateOrder() { if (!isset($this->params['order_number'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_ORDER_NUMBER); } /** @var ShopgateOrder[] $orders */ $orders = $this->merchantApi->getOrders( array( 'order_numbers[0]' => $this->params['order_number'], 'with_items' => 1, ) )->getData(); if (empty($orders)) { throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, '"order" not set or empty. Response: ' . var_export($orders, true) ); } if (count($orders) > 1) { throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, 'more than one order in response. Response: ' . var_export($orders, true) ); } $payment = 0; $shipping = 0; if (isset($this->params['payment'])) { $payment = (int)$this->params['payment']; } if (isset($this->params['shipping'])) { $shipping = (int)$this->params['shipping']; } $orders[0]->setUpdatePayment($payment); $orders[0]->setUpdateShipping($shipping); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $orderData = $this->plugin->updateOrder($orders[0]); if (is_array($orderData)) { $this->responseData = $orderData; } else { $this->responseData['external_order_id'] = $orderData; $this->responseData['external_order_number'] = null; } }
php
protected function updateOrder() { if (!isset($this->params['order_number'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_ORDER_NUMBER); } /** @var ShopgateOrder[] $orders */ $orders = $this->merchantApi->getOrders( array( 'order_numbers[0]' => $this->params['order_number'], 'with_items' => 1, ) )->getData(); if (empty($orders)) { throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, '"order" not set or empty. Response: ' . var_export($orders, true) ); } if (count($orders) > 1) { throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, 'more than one order in response. Response: ' . var_export($orders, true) ); } $payment = 0; $shipping = 0; if (isset($this->params['payment'])) { $payment = (int)$this->params['payment']; } if (isset($this->params['shipping'])) { $shipping = (int)$this->params['shipping']; } $orders[0]->setUpdatePayment($payment); $orders[0]->setUpdateShipping($shipping); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $orderData = $this->plugin->updateOrder($orders[0]); if (is_array($orderData)) { $this->responseData = $orderData; } else { $this->responseData['external_order_id'] = $orderData; $this->responseData['external_order_number'] = null; } }
[ "protected", "function", "updateOrder", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "params", "[", "'order_number'", "]", ")", ")", "{", "throw", "new", "ShopgateLibraryException", "(", "ShopgateLibraryException", "::", "PLUGIN_API_NO_ORDER_N...
Represents the "update_order" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_update_order
[ "Represents", "the", "update_order", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L486-L537
235,031
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.redeemCoupons
protected function redeemCoupons() { if (!isset($this->params['cart'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_CART); } if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $cart = new ShopgateCart($this->params['cart']); $couponData = $this->plugin->redeemCoupons($cart); if (!is_array($couponData)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, 'Plugin Response: ' . var_export($couponData, true) ); } // Workaround: // $couponData was specified to be a ShopgateExternalCoupon[]. // Now supports the same format as checkCart(), i.e. array('external_coupons' => ShopgateExternalCoupon[]). if (!empty($couponData['external_coupons']) && is_array($couponData['external_coupons'])) { $couponData = $couponData['external_coupons']; } $responseData = array("external_coupons" => array()); foreach ($couponData as $coupon) { if (!is_object($coupon) || !($coupon instanceof ShopgateExternalCoupon)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, 'Plugin Response: ' . var_export($coupon, true) ); } $coupon = $coupon->toArray(); unset($coupon["order_index"]); $responseData["external_coupons"][] = $coupon; } $this->responseData = $responseData; }
php
protected function redeemCoupons() { if (!isset($this->params['cart'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_CART); } if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $cart = new ShopgateCart($this->params['cart']); $couponData = $this->plugin->redeemCoupons($cart); if (!is_array($couponData)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, 'Plugin Response: ' . var_export($couponData, true) ); } // Workaround: // $couponData was specified to be a ShopgateExternalCoupon[]. // Now supports the same format as checkCart(), i.e. array('external_coupons' => ShopgateExternalCoupon[]). if (!empty($couponData['external_coupons']) && is_array($couponData['external_coupons'])) { $couponData = $couponData['external_coupons']; } $responseData = array("external_coupons" => array()); foreach ($couponData as $coupon) { if (!is_object($coupon) || !($coupon instanceof ShopgateExternalCoupon)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, 'Plugin Response: ' . var_export($coupon, true) ); } $coupon = $coupon->toArray(); unset($coupon["order_index"]); $responseData["external_coupons"][] = $coupon; } $this->responseData = $responseData; }
[ "protected", "function", "redeemCoupons", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "params", "[", "'cart'", "]", ")", ")", "{", "throw", "new", "ShopgateLibraryException", "(", "ShopgateLibraryException", "::", "PLUGIN_API_NO_CART", ")",...
Represents the "redeem_coupons" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_redeem_coupons
[ "Represents", "the", "redeem_coupons", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L545-L588
235,032
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.checkStock
protected function checkStock() { if (!isset($this->params['items'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_ITEMS); } if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $cart = new ShopgateCart(); $cart->setItems($this->params['items']); $items = $this->plugin->checkStock($cart); $responseData = array(); if (!is_array($items)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, '$cartData Is type of : ' . is_object($items) ? get_class($items) : gettype($items) ); } $cartItems = array(); if (!empty($items)) { foreach ($items as $cartItem) { /** @var ShopgateCartItem $cartItem */ if (!is_object($cartItem) || !($cartItem instanceof ShopgateCartItem)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, '$cartItem Is type of : ' . is_object($cartItem) ? get_class($cartItem) : gettype($cartItem) ); } $item = $cartItem->toArray(); $notNeededArrayKeys = array('qty_buyable', 'unit_amount', 'unit_amount_with_tax'); foreach ($notNeededArrayKeys as $key) { if (array_key_exists($key, $item)) { unset($item[$key]); } } $cartItems[] = $item; } } $responseData["items"] = $cartItems; $this->responseData = $responseData; }
php
protected function checkStock() { if (!isset($this->params['items'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_ITEMS); } if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $cart = new ShopgateCart(); $cart->setItems($this->params['items']); $items = $this->plugin->checkStock($cart); $responseData = array(); if (!is_array($items)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, '$cartData Is type of : ' . is_object($items) ? get_class($items) : gettype($items) ); } $cartItems = array(); if (!empty($items)) { foreach ($items as $cartItem) { /** @var ShopgateCartItem $cartItem */ if (!is_object($cartItem) || !($cartItem instanceof ShopgateCartItem)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, '$cartItem Is type of : ' . is_object($cartItem) ? get_class($cartItem) : gettype($cartItem) ); } $item = $cartItem->toArray(); $notNeededArrayKeys = array('qty_buyable', 'unit_amount', 'unit_amount_with_tax'); foreach ($notNeededArrayKeys as $key) { if (array_key_exists($key, $item)) { unset($item[$key]); } } $cartItems[] = $item; } } $responseData["items"] = $cartItems; $this->responseData = $responseData; }
[ "protected", "function", "checkStock", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "params", "[", "'items'", "]", ")", ")", "{", "throw", "new", "ShopgateLibraryException", "(", "ShopgateLibraryException", "::", "PLUGIN_API_NO_ITEMS", ")", ...
Represents the "check_stock" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_check_stock
[ "Represents", "the", "check_stock", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L735-L786
235,033
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.getSettings
protected function getSettings() { $this->responseData = $this->plugin->getSettings(); // set data and return response if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } }
php
protected function getSettings() { $this->responseData = $this->plugin->getSettings(); // set data and return response if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } }
[ "protected", "function", "getSettings", "(", ")", "{", "$", "this", "->", "responseData", "=", "$", "this", "->", "plugin", "->", "getSettings", "(", ")", ";", "// set data and return response", "if", "(", "empty", "(", "$", "this", "->", "response", ")", ...
Represents the "get_settings" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_settings
[ "Represents", "the", "get_settings", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L794-L802
235,034
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.setSettings
protected function setSettings() { if (empty($this->params['shopgate_settings']) || !is_array($this->params['shopgate_settings'])) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_NO_SHOPGATE_SETTINGS, 'Request: ' . var_export($this->params, true) ); } // settings that may never be changed: $shopgateSettingsBlacklist = array( 'shop_number', 'customer_number', 'apikey', 'plugin_name', 'export_folder_path', 'log_folder_path', 'cache_folder_path', 'items_csv_filename', 'categories_csv_filename', 'reviews_csv_filename', 'access_log_filename', 'error_log_filename', 'request_log_filename', 'debug_log_filename', 'redirect_keyword_cache_filename', 'redirect_skip_keyword_cache_filename', ); // filter the new settings $shopgateSettingsNew = array(); $shopgateSettingsOld = $this->config->toArray(); foreach ($this->params['shopgate_settings'] as $setting) { if (!isset($setting['name'])) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_NO_SHOPGATE_SETTINGS, 'Wrong format: ' . var_export($setting, true) ); } if (in_array($setting['name'], $shopgateSettingsBlacklist)) { continue; } if (!in_array($setting['name'], array_keys($shopgateSettingsOld))) { continue; } $shopgateSettingsNew[$setting['name']] = isset($setting['value']) ? $setting['value'] : null; } $this->config->load($shopgateSettingsNew); $this->config->save(array_keys($shopgateSettingsNew), true); $diff = array(); foreach ($shopgateSettingsNew as $setting => $value) { $diff[] = array('name' => $setting, 'old' => $shopgateSettingsOld[$setting], 'new' => $value); } // set data and return response if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $this->responseData['shopgate_settings'] = $diff; }
php
protected function setSettings() { if (empty($this->params['shopgate_settings']) || !is_array($this->params['shopgate_settings'])) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_NO_SHOPGATE_SETTINGS, 'Request: ' . var_export($this->params, true) ); } // settings that may never be changed: $shopgateSettingsBlacklist = array( 'shop_number', 'customer_number', 'apikey', 'plugin_name', 'export_folder_path', 'log_folder_path', 'cache_folder_path', 'items_csv_filename', 'categories_csv_filename', 'reviews_csv_filename', 'access_log_filename', 'error_log_filename', 'request_log_filename', 'debug_log_filename', 'redirect_keyword_cache_filename', 'redirect_skip_keyword_cache_filename', ); // filter the new settings $shopgateSettingsNew = array(); $shopgateSettingsOld = $this->config->toArray(); foreach ($this->params['shopgate_settings'] as $setting) { if (!isset($setting['name'])) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_NO_SHOPGATE_SETTINGS, 'Wrong format: ' . var_export($setting, true) ); } if (in_array($setting['name'], $shopgateSettingsBlacklist)) { continue; } if (!in_array($setting['name'], array_keys($shopgateSettingsOld))) { continue; } $shopgateSettingsNew[$setting['name']] = isset($setting['value']) ? $setting['value'] : null; } $this->config->load($shopgateSettingsNew); $this->config->save(array_keys($shopgateSettingsNew), true); $diff = array(); foreach ($shopgateSettingsNew as $setting => $value) { $diff[] = array('name' => $setting, 'old' => $shopgateSettingsOld[$setting], 'new' => $value); } // set data and return response if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $this->responseData['shopgate_settings'] = $diff; }
[ "protected", "function", "setSettings", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "params", "[", "'shopgate_settings'", "]", ")", "||", "!", "is_array", "(", "$", "this", "->", "params", "[", "'shopgate_settings'", "]", ")", ")", "{", ...
Represents the "set_settings" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_set_settings
[ "Represents", "the", "set_settings", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L810-L875
235,035
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.getCustomer
protected function getCustomer() { if (!isset($this->params['user'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_USER); } if (!isset($this->params['pass'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_PASS); } $customer = $this->plugin->getCustomer($this->params['user'], $this->params['pass']); if (!is_object($customer) || !($customer instanceof ShopgateCustomer)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, 'Plugin Response: ' . var_export($customer, true) ); } foreach ($customer->getCustomerGroups() as $customerGroup) { /** @var ShopgateCustomerGroup $customerGroup */ if (!is_object($customerGroup) || !($customerGroup instanceof ShopgateCustomerGroup)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, '$customerGroup is of type: ' . is_object($customerGroup) ? get_class($customerGroup) : gettype($customerGroup) ); } } $customerData = $customer->toArray(); $addressList = $customerData['addresses']; unset($customerData['addresses']); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $this->responseData["user_data"] = $customerData; $this->responseData["addresses"] = $addressList; }
php
protected function getCustomer() { if (!isset($this->params['user'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_USER); } if (!isset($this->params['pass'])) { throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_PASS); } $customer = $this->plugin->getCustomer($this->params['user'], $this->params['pass']); if (!is_object($customer) || !($customer instanceof ShopgateCustomer)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, 'Plugin Response: ' . var_export($customer, true) ); } foreach ($customer->getCustomerGroups() as $customerGroup) { /** @var ShopgateCustomerGroup $customerGroup */ if (!is_object($customerGroup) || !($customerGroup instanceof ShopgateCustomerGroup)) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT, '$customerGroup is of type: ' . is_object($customerGroup) ? get_class($customerGroup) : gettype($customerGroup) ); } } $customerData = $customer->toArray(); $addressList = $customerData['addresses']; unset($customerData['addresses']); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id); } $this->responseData["user_data"] = $customerData; $this->responseData["addresses"] = $addressList; }
[ "protected", "function", "getCustomer", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "params", "[", "'user'", "]", ")", ")", "{", "throw", "new", "ShopgateLibraryException", "(", "ShopgateLibraryException", "::", "PLUGIN_API_NO_USER", ")", ...
Represents the "get_customer" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_customer
[ "Represents", "the", "get_customer", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L990-L1029
235,036
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.getMediaCsv
protected function getMediaCsv() { if (isset($this->params['limit']) && isset($this->params['offset'])) { $this->plugin->setExportLimit((int)$this->params['limit']); $this->plugin->setExportOffset((int)$this->params['offset']); $this->plugin->setSplittedExport(true); } // generate / update items csv file if requested $this->plugin->startGetMediaCsv(); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextCsvExport($this->trace_id); } $this->responseData = $this->config->getMediaCsvPath(); }
php
protected function getMediaCsv() { if (isset($this->params['limit']) && isset($this->params['offset'])) { $this->plugin->setExportLimit((int)$this->params['limit']); $this->plugin->setExportOffset((int)$this->params['offset']); $this->plugin->setSplittedExport(true); } // generate / update items csv file if requested $this->plugin->startGetMediaCsv(); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextCsvExport($this->trace_id); } $this->responseData = $this->config->getMediaCsvPath(); }
[ "protected", "function", "getMediaCsv", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "params", "[", "'limit'", "]", ")", "&&", "isset", "(", "$", "this", "->", "params", "[", "'offset'", "]", ")", ")", "{", "$", "this", "->", "plugin"...
Represents the "get_media_csv" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_media_csv
[ "Represents", "the", "get_media_csv", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L1099-L1114
235,037
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.getItemsCsv
protected function getItemsCsv() { if (isset($this->params['limit']) && isset($this->params['offset'])) { $this->plugin->setExportLimit((int)$this->params['limit']); $this->plugin->setExportOffset((int)$this->params['offset']); $this->plugin->setSplittedExport(true); } // generate / update items csv file if requested $this->plugin->startGetItemsCsv(); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextCsvExport($this->trace_id); } $this->responseData = $this->config->getItemsCsvPath(); }
php
protected function getItemsCsv() { if (isset($this->params['limit']) && isset($this->params['offset'])) { $this->plugin->setExportLimit((int)$this->params['limit']); $this->plugin->setExportOffset((int)$this->params['offset']); $this->plugin->setSplittedExport(true); } // generate / update items csv file if requested $this->plugin->startGetItemsCsv(); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextCsvExport($this->trace_id); } $this->responseData = $this->config->getItemsCsvPath(); }
[ "protected", "function", "getItemsCsv", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "params", "[", "'limit'", "]", ")", "&&", "isset", "(", "$", "this", "->", "params", "[", "'offset'", "]", ")", ")", "{", "$", "this", "->", "plugin"...
Represents the "get_items_csv" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_items_csv
[ "Represents", "the", "get_items_csv", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L1122-L1137
235,038
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.getItems
protected function getItems() { $limit = isset($this->params['limit']) ? (int)$this->params['limit'] : null; $offset = isset($this->params['offset']) ? (int)$this->params['offset'] : null; $uids = isset($this->params['uids']) ? (array)$this->params['uids'] : array(); $responseType = isset($this->params['response_type']) ? $this->params['response_type'] : false; $supportedResponseTypes = $this->config->getSupportedResponseTypes(); if (!empty($responseType) && !in_array($responseType, $supportedResponseTypes['get_items'])) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_UNSUPPORTED_RESPONSE_TYPE, 'Requested type: "' . $responseType . '"' ); } $this->plugin->startGetItems($limit, $offset, $uids, $responseType); switch ($responseType) { default: case 'xml': $response = new ShopgatePluginApiResponseAppXmlExport($this->trace_id); $responseData = $this->config->getItemsXmlPath(); break; case 'json': $response = new ShopgatePluginApiResponseAppJsonExport($this->trace_id); $responseData = $this->config->getItemsJsonPath(); break; } if (empty($this->response)) { $this->response = $response; } $this->responseData = $responseData; }
php
protected function getItems() { $limit = isset($this->params['limit']) ? (int)$this->params['limit'] : null; $offset = isset($this->params['offset']) ? (int)$this->params['offset'] : null; $uids = isset($this->params['uids']) ? (array)$this->params['uids'] : array(); $responseType = isset($this->params['response_type']) ? $this->params['response_type'] : false; $supportedResponseTypes = $this->config->getSupportedResponseTypes(); if (!empty($responseType) && !in_array($responseType, $supportedResponseTypes['get_items'])) { throw new ShopgateLibraryException( ShopgateLibraryException::PLUGIN_API_UNSUPPORTED_RESPONSE_TYPE, 'Requested type: "' . $responseType . '"' ); } $this->plugin->startGetItems($limit, $offset, $uids, $responseType); switch ($responseType) { default: case 'xml': $response = new ShopgatePluginApiResponseAppXmlExport($this->trace_id); $responseData = $this->config->getItemsXmlPath(); break; case 'json': $response = new ShopgatePluginApiResponseAppJsonExport($this->trace_id); $responseData = $this->config->getItemsJsonPath(); break; } if (empty($this->response)) { $this->response = $response; } $this->responseData = $responseData; }
[ "protected", "function", "getItems", "(", ")", "{", "$", "limit", "=", "isset", "(", "$", "this", "->", "params", "[", "'limit'", "]", ")", "?", "(", "int", ")", "$", "this", "->", "params", "[", "'limit'", "]", ":", "null", ";", "$", "offset", "...
Represents the "get_items" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_items
[ "Represents", "the", "get_items", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L1145-L1188
235,039
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.getCategoriesCsv
protected function getCategoriesCsv() { if (isset($this->params['limit']) && isset($this->params['offset'])) { $this->plugin->setExportLimit((int)$this->params['limit']); $this->plugin->setExportOffset((int)$this->params['offset']); $this->plugin->setSplittedExport(true); } // generate / update categories csv file $this->plugin->startGetCategoriesCsv(); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextCsvExport($this->trace_id); } $this->responseData = $this->config->getCategoriesCsvPath(); }
php
protected function getCategoriesCsv() { if (isset($this->params['limit']) && isset($this->params['offset'])) { $this->plugin->setExportLimit((int)$this->params['limit']); $this->plugin->setExportOffset((int)$this->params['offset']); $this->plugin->setSplittedExport(true); } // generate / update categories csv file $this->plugin->startGetCategoriesCsv(); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextCsvExport($this->trace_id); } $this->responseData = $this->config->getCategoriesCsvPath(); }
[ "protected", "function", "getCategoriesCsv", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "params", "[", "'limit'", "]", ")", "&&", "isset", "(", "$", "this", "->", "params", "[", "'offset'", "]", ")", ")", "{", "$", "this", "->", "pl...
Represents the "get_categories_csv" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_categories_csv
[ "Represents", "the", "get_categories_csv", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L1247-L1262
235,040
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.getReviewsCsv
protected function getReviewsCsv() { if (isset($this->params['limit']) && isset($this->params['offset'])) { $this->plugin->setExportLimit((int)$this->params['limit']); $this->plugin->setExportOffset((int)$this->params['offset']); $this->plugin->setSplittedExport(true); } // generate / update reviews csv file $this->plugin->startGetReviewsCsv(); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextCsvExport($this->trace_id); } $this->responseData = $this->config->getReviewsCsvPath(); }
php
protected function getReviewsCsv() { if (isset($this->params['limit']) && isset($this->params['offset'])) { $this->plugin->setExportLimit((int)$this->params['limit']); $this->plugin->setExportOffset((int)$this->params['offset']); $this->plugin->setSplittedExport(true); } // generate / update reviews csv file $this->plugin->startGetReviewsCsv(); if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextCsvExport($this->trace_id); } $this->responseData = $this->config->getReviewsCsvPath(); }
[ "protected", "function", "getReviewsCsv", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "params", "[", "'limit'", "]", ")", "&&", "isset", "(", "$", "this", "->", "params", "[", "'offset'", "]", ")", ")", "{", "$", "this", "->", "plugi...
Represents the "get_reviews_csv" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_reviews_csv
[ "Represents", "the", "get_reviews_csv", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L1270-L1285
235,041
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi.getLogFile
protected function getLogFile() { // disable debug log for this action $logger = ShopgateLogger::getInstance(); $logger->disableDebug(); $logger->keepDebugLog(true); $type = (empty($this->params['log_type'])) ? ShopgateLogger::LOGTYPE_ERROR : $this->params['log_type']; $lines = (!isset($this->params['lines'])) ? null : $this->params['lines']; $log = $logger->tail($type, $lines); // return the requested log file content and end the script if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextPlain($this->trace_id); } $this->responseData = $log; }
php
protected function getLogFile() { // disable debug log for this action $logger = ShopgateLogger::getInstance(); $logger->disableDebug(); $logger->keepDebugLog(true); $type = (empty($this->params['log_type'])) ? ShopgateLogger::LOGTYPE_ERROR : $this->params['log_type']; $lines = (!isset($this->params['lines'])) ? null : $this->params['lines']; $log = $logger->tail($type, $lines); // return the requested log file content and end the script if (empty($this->response)) { $this->response = new ShopgatePluginApiResponseTextPlain($this->trace_id); } $this->responseData = $log; }
[ "protected", "function", "getLogFile", "(", ")", "{", "// disable debug log for this action", "$", "logger", "=", "ShopgateLogger", "::", "getInstance", "(", ")", ";", "$", "logger", "->", "disableDebug", "(", ")", ";", "$", "logger", "->", "keepDebugLog", "(", ...
Represents the "get_log_file" action. @throws ShopgateLibraryException @see http://wiki.shopgate.com/Shopgate_Plugin_API_get_log_file
[ "Represents", "the", "get_log_file", "action", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L1344-L1365
235,042
shopgate/cart-integration-sdk
src/apis.php
ShopgatePluginApi._getFileMeta
private function _getFileMeta($file, $parentLevel = 0) { $meta = array('file' => $file); if ($meta['exist'] = (bool)file_exists($file)) { $meta['writeable'] = (bool)is_writable($file); $uid = fileowner($file); if (function_exists('posix_getpwuid')) { $uinfo = posix_getpwuid($uid); $uid = $uinfo['name']; } $gid = filegroup($file); if (function_exists('posix_getgrgid')) { $ginfo = posix_getgrgid($gid); $gid = $ginfo['name']; } $meta['owner'] = $uid; $meta['group'] = $gid; $meta['permission'] = substr(sprintf('%o', fileperms($file)), -4); $meta['last_modification_time'] = date('d.m.Y H:i:s', filemtime($file)); if (is_file($file)) { $meta['filesize'] = round(filesize($file) / (1024 * 1024), 4) . ' MB'; } } elseif ($parentLevel > 0) { $fInfo = pathinfo($file); if (file_exists($fInfo['dirname'])) { $meta['parent_dir'] = $this->_getFileMeta($fInfo['dirname'], --$parentLevel); } } return $meta; }
php
private function _getFileMeta($file, $parentLevel = 0) { $meta = array('file' => $file); if ($meta['exist'] = (bool)file_exists($file)) { $meta['writeable'] = (bool)is_writable($file); $uid = fileowner($file); if (function_exists('posix_getpwuid')) { $uinfo = posix_getpwuid($uid); $uid = $uinfo['name']; } $gid = filegroup($file); if (function_exists('posix_getgrgid')) { $ginfo = posix_getgrgid($gid); $gid = $ginfo['name']; } $meta['owner'] = $uid; $meta['group'] = $gid; $meta['permission'] = substr(sprintf('%o', fileperms($file)), -4); $meta['last_modification_time'] = date('d.m.Y H:i:s', filemtime($file)); if (is_file($file)) { $meta['filesize'] = round(filesize($file) / (1024 * 1024), 4) . ' MB'; } } elseif ($parentLevel > 0) { $fInfo = pathinfo($file); if (file_exists($fInfo['dirname'])) { $meta['parent_dir'] = $this->_getFileMeta($fInfo['dirname'], --$parentLevel); } } return $meta; }
[ "private", "function", "_getFileMeta", "(", "$", "file", ",", "$", "parentLevel", "=", "0", ")", "{", "$", "meta", "=", "array", "(", "'file'", "=>", "$", "file", ")", ";", "if", "(", "$", "meta", "[", "'exist'", "]", "=", "(", "bool", ")", "file...
get meta data for given file. if file doesn't exists, move up to parent directory @param string $file (max numbers of parent directory lookups) @param int $parentLevel @return array with file meta data
[ "get", "meta", "data", "for", "given", "file", ".", "if", "file", "doesn", "t", "exists", "move", "up", "to", "parent", "directory" ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L1642-L1677
235,043
shopgate/cart-integration-sdk
src/apis.php
ShopgateMerchantApi.getCurlOptArray
protected function getCurlOptArray($override = array()) { $opt = array(); $opt[CURLOPT_HEADER] = false; $opt[CURLOPT_USERAGENT] = 'ShopgatePlugin/' . (defined( 'SHOPGATE_PLUGIN_VERSION' ) ? SHOPGATE_PLUGIN_VERSION : 'called outside plugin'); $opt[CURLOPT_RETURNTRANSFER] = true; $opt[CURLOPT_SSL_VERIFYPEER] = true; // *always* verify peers, otherwise MITM attacks are trivial // Use value of CURL_SSLVERSION_TLSv1_2 for CURLOPT_SSLVERSION, because it is not available before PHP 5.5.19 / 5.6.3 // Actual usage of TLS 1.2 (which is required by PCI DSS) depends on PHP cURL extension and underlying SSL lib $opt[CURLOPT_SSLVERSION] = 6; $opt[CURLOPT_HTTPHEADER] = array( 'X-Shopgate-Library-Version: ' . SHOPGATE_LIBRARY_VERSION, 'X-Shopgate-Plugin-Version: ' . (defined( 'SHOPGATE_PLUGIN_VERSION' ) ? SHOPGATE_PLUGIN_VERSION : 'called outside plugin'), ); $opt[CURLOPT_HTTPHEADER] = !empty($opt[CURLOPT_HTTPHEADER]) ? ($this->authService->getAuthHttpHeaders() + $opt[CURLOPT_HTTPHEADER]) : $this->authService->getAuthHttpHeaders(); $opt[CURLOPT_TIMEOUT] = 30; // Default timeout 30sec $opt[CURLOPT_POST] = true; return ($override + $opt); }
php
protected function getCurlOptArray($override = array()) { $opt = array(); $opt[CURLOPT_HEADER] = false; $opt[CURLOPT_USERAGENT] = 'ShopgatePlugin/' . (defined( 'SHOPGATE_PLUGIN_VERSION' ) ? SHOPGATE_PLUGIN_VERSION : 'called outside plugin'); $opt[CURLOPT_RETURNTRANSFER] = true; $opt[CURLOPT_SSL_VERIFYPEER] = true; // *always* verify peers, otherwise MITM attacks are trivial // Use value of CURL_SSLVERSION_TLSv1_2 for CURLOPT_SSLVERSION, because it is not available before PHP 5.5.19 / 5.6.3 // Actual usage of TLS 1.2 (which is required by PCI DSS) depends on PHP cURL extension and underlying SSL lib $opt[CURLOPT_SSLVERSION] = 6; $opt[CURLOPT_HTTPHEADER] = array( 'X-Shopgate-Library-Version: ' . SHOPGATE_LIBRARY_VERSION, 'X-Shopgate-Plugin-Version: ' . (defined( 'SHOPGATE_PLUGIN_VERSION' ) ? SHOPGATE_PLUGIN_VERSION : 'called outside plugin'), ); $opt[CURLOPT_HTTPHEADER] = !empty($opt[CURLOPT_HTTPHEADER]) ? ($this->authService->getAuthHttpHeaders() + $opt[CURLOPT_HTTPHEADER]) : $this->authService->getAuthHttpHeaders(); $opt[CURLOPT_TIMEOUT] = 30; // Default timeout 30sec $opt[CURLOPT_POST] = true; return ($override + $opt); }
[ "protected", "function", "getCurlOptArray", "(", "$", "override", "=", "array", "(", ")", ")", "{", "$", "opt", "=", "array", "(", ")", ";", "$", "opt", "[", "CURLOPT_HEADER", "]", "=", "false", ";", "$", "opt", "[", "CURLOPT_USERAGENT", "]", "=", "'...
Returns an array of curl-options for requests @param mixed[] $override cURL options to override for this request. @return mixed[] The default cURL options for a Shopgate Merchant API request merged with the options in $override.
[ "Returns", "an", "array", "of", "curl", "-", "options", "for", "requests" ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L1743-L1773
235,044
shopgate/cart-integration-sdk
src/apis.php
ShopgateMerchantApi.sendRequest
protected function sendRequest($parameters = array(), $curlOptOverride = array()) { if (!empty($this->shopNumber)) { $parameters['shop_number'] = $this->shopNumber; } $parameters = !empty($parameters) ? array_merge($this->authService->getAuthPostParams(), $parameters) : $this->authService->getAuthPostParams(); $parameters['trace_id'] = 'spa-' . uniqid(); $this->log( 'Sending request to "' . $this->apiUrl . '": ' . ShopgateLogger::getInstance()->cleanParamsForLog( $parameters ), ShopgateLogger::LOGTYPE_REQUEST ); // init new auth session and generate cURL options $this->authService->startNewSession(); $curlOpt = $this->getCurlOptArray($curlOptOverride); // init cURL connection and send the request $curl = curl_init($this->apiUrl); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($parameters)); curl_setopt_array($curl, $curlOpt); $response = curl_exec($curl); curl_close($curl); // check the result if (!$response) { // exception without logging - this might cause spamming your logs and we will know when our API is offline anyways throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_NO_CONNECTION, null, false, false ); } $decodedResponse = $this->jsonDecode($response, true); if (empty($decodedResponse)) { // exception without logging - this might cause spamming your logs and we will know when our API is offline anyways throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, 'Response: ' . $response, true, false ); } $responseObject = new ShopgateMerchantApiResponse($decodedResponse); if ($decodedResponse['error'] != 0) { throw new ShopgateMerchantApiException( $decodedResponse['error'], $decodedResponse['error_text'], $responseObject ); } return $responseObject; }
php
protected function sendRequest($parameters = array(), $curlOptOverride = array()) { if (!empty($this->shopNumber)) { $parameters['shop_number'] = $this->shopNumber; } $parameters = !empty($parameters) ? array_merge($this->authService->getAuthPostParams(), $parameters) : $this->authService->getAuthPostParams(); $parameters['trace_id'] = 'spa-' . uniqid(); $this->log( 'Sending request to "' . $this->apiUrl . '": ' . ShopgateLogger::getInstance()->cleanParamsForLog( $parameters ), ShopgateLogger::LOGTYPE_REQUEST ); // init new auth session and generate cURL options $this->authService->startNewSession(); $curlOpt = $this->getCurlOptArray($curlOptOverride); // init cURL connection and send the request $curl = curl_init($this->apiUrl); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($parameters)); curl_setopt_array($curl, $curlOpt); $response = curl_exec($curl); curl_close($curl); // check the result if (!$response) { // exception without logging - this might cause spamming your logs and we will know when our API is offline anyways throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_NO_CONNECTION, null, false, false ); } $decodedResponse = $this->jsonDecode($response, true); if (empty($decodedResponse)) { // exception without logging - this might cause spamming your logs and we will know when our API is offline anyways throw new ShopgateLibraryException( ShopgateLibraryException::MERCHANT_API_INVALID_RESPONSE, 'Response: ' . $response, true, false ); } $responseObject = new ShopgateMerchantApiResponse($decodedResponse); if ($decodedResponse['error'] != 0) { throw new ShopgateMerchantApiException( $decodedResponse['error'], $decodedResponse['error_text'], $responseObject ); } return $responseObject; }
[ "protected", "function", "sendRequest", "(", "$", "parameters", "=", "array", "(", ")", ",", "$", "curlOptOverride", "=", "array", "(", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "shopNumber", ")", ")", "{", "$", "parameters", "[...
Prepares the request and sends it to the configured Shopgate Merchant API. @param mixed[] $parameters The parameters to send. @param mixed[] $curlOptOverride cURL options to override for this request. @throws ShopgateLibraryException in case the connection can't be established, the response is invalid or an error occured. @throws ShopgateMerchantApiException @return ShopgateMerchantApiResponse The response object.
[ "Prepares", "the", "request", "and", "sends", "it", "to", "the", "configured", "Shopgate", "Merchant", "API", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L1787-L1849
235,045
shopgate/cart-integration-sdk
src/apis.php
ShopgateAuthenticationServiceShopgate.buildCustomAuthToken
protected function buildCustomAuthToken($prefix, $customerNumber, $timestamp, $apiKey) { if (empty($customerNumber) || empty($apiKey)) { throw new ShopgateLibraryException( ShopgateLibraryException::CONFIG_INVALID_VALUE, 'Shopgate customer number or API key not set.', true, false ); } return sha1("{$prefix}-{$customerNumber}-{$timestamp}-{$apiKey}"); }
php
protected function buildCustomAuthToken($prefix, $customerNumber, $timestamp, $apiKey) { if (empty($customerNumber) || empty($apiKey)) { throw new ShopgateLibraryException( ShopgateLibraryException::CONFIG_INVALID_VALUE, 'Shopgate customer number or API key not set.', true, false ); } return sha1("{$prefix}-{$customerNumber}-{$timestamp}-{$apiKey}"); }
[ "protected", "function", "buildCustomAuthToken", "(", "$", "prefix", ",", "$", "customerNumber", ",", "$", "timestamp", ",", "$", "apiKey", ")", "{", "if", "(", "empty", "(", "$", "customerNumber", ")", "||", "empty", "(", "$", "apiKey", ")", ")", "{", ...
Generates the auth token with the given parameters. @param string $prefix @param string $customerNumber @param int $timestamp @param string $apiKey @throws ShopgateLibraryException when no customer number or API key is set @return string The SHA-1 hash Auth Token for Shopgate's Authentication
[ "Generates", "the", "auth", "token", "with", "the", "given", "parameters", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/apis.php#L2319-L2331
235,046
makinacorpus/drupal-ucms
ucms_label/src/EventDispatcher/NodeEventSubscriber.php
NodeEventSubscriber.addLabelChannels
protected function addLabelChannels(ResourceEvent $event) { $nodeId = $event->getResourceIdList()[0]; $node = $this->entityManager->getStorage('node')->load($nodeId); $items = field_get_items('node', $node, 'labels'); if ($items) { foreach ($items as $item) { $event->addResourceChanId('label', $item['tid']); } } }
php
protected function addLabelChannels(ResourceEvent $event) { $nodeId = $event->getResourceIdList()[0]; $node = $this->entityManager->getStorage('node')->load($nodeId); $items = field_get_items('node', $node, 'labels'); if ($items) { foreach ($items as $item) { $event->addResourceChanId('label', $item['tid']); } } }
[ "protected", "function", "addLabelChannels", "(", "ResourceEvent", "$", "event", ")", "{", "$", "nodeId", "=", "$", "event", "->", "getResourceIdList", "(", ")", "[", "0", "]", ";", "$", "node", "=", "$", "this", "->", "entityManager", "->", "getStorage", ...
Adds specific channels of the node's labels to the event. @param ResourceEvent $event
[ "Adds", "specific", "channels", "of", "the", "node", "s", "labels", "to", "the", "event", "." ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_label/src/EventDispatcher/NodeEventSubscriber.php#L108-L119
235,047
pomirleanu/gif-create
src/GifCreate.php
GifCreate.create
public function create($frames, $durations = 10, $loop = null) { if (count($frames) < 2) { throw new \Exception(sprintf($this->errors[ 'ERR06' ])); } // Update loop value if passed in. $this->mergeConfigIfSet('loop', $loop); // Check if $frames is a dir; get all files in ascending order if yes (else die): if (! is_array($frames)) { if (is_dir($frames)) { $this->frames_dir = $frames; if ($frames = scandir($this->frames_dir)) { $frames = array_filter($frames, function ($dir) { return $dir[ 0 ] != "."; }); array_walk($frames, function (&$dir) { $dir = $this->frames_dir.DIRECTORY_SEPARATOR."$dir"; }); } } if (! is_array($frames)) { throw new \Exception(sprintf($this->errors[ 'ERR05' ], $this->frames_dir)); } } assert(is_array($frames)); if (sizeof($frames) < 2) { throw new \Exception($this->errors[ 'ERR00' ]); } return $this->buildFrameSources($frames, $durations); }
php
public function create($frames, $durations = 10, $loop = null) { if (count($frames) < 2) { throw new \Exception(sprintf($this->errors[ 'ERR06' ])); } // Update loop value if passed in. $this->mergeConfigIfSet('loop', $loop); // Check if $frames is a dir; get all files in ascending order if yes (else die): if (! is_array($frames)) { if (is_dir($frames)) { $this->frames_dir = $frames; if ($frames = scandir($this->frames_dir)) { $frames = array_filter($frames, function ($dir) { return $dir[ 0 ] != "."; }); array_walk($frames, function (&$dir) { $dir = $this->frames_dir.DIRECTORY_SEPARATOR."$dir"; }); } } if (! is_array($frames)) { throw new \Exception(sprintf($this->errors[ 'ERR05' ], $this->frames_dir)); } } assert(is_array($frames)); if (sizeof($frames) < 2) { throw new \Exception($this->errors[ 'ERR00' ]); } return $this->buildFrameSources($frames, $durations); }
[ "public", "function", "create", "(", "$", "frames", ",", "$", "durations", "=", "10", ",", "$", "loop", "=", "null", ")", "{", "if", "(", "count", "(", "$", "frames", ")", "<", "2", ")", "{", "throw", "new", "\\", "Exception", "(", "sprintf", "("...
Creates a gif from the given array images sources @param $frames @param int $durations @param null $loop @return \Pomirleanu\GifCreate\GifCreate @throws \Exception
[ "Creates", "a", "gif", "from", "the", "given", "array", "images", "sources" ]
84a840fb53285b8531d2d6e020434f6c501bf5bc
https://github.com/pomirleanu/gif-create/blob/84a840fb53285b8531d2d6e020434f6c501bf5bc/src/GifCreate.php#L115-L149
235,048
pomirleanu/gif-create
src/GifCreate.php
GifCreate.gifAddHeader
protected function gifAddHeader() { $cmap = 0; if (ord($this->sources[ 0 ]{10}) & 0x80) { $cmap = 3 * (2 << (ord($this->sources[ 0 ]{10}) & 0x07)); $this->gif .= substr($this->sources[ 0 ], 6, 7); $this->gif .= substr($this->sources[ 0 ], 13, $cmap); $this->gif .= "!\377\13NETSCAPE2.0\3\1".$this->word2bin($this->config[ 'loop' ])."\0"; } }
php
protected function gifAddHeader() { $cmap = 0; if (ord($this->sources[ 0 ]{10}) & 0x80) { $cmap = 3 * (2 << (ord($this->sources[ 0 ]{10}) & 0x07)); $this->gif .= substr($this->sources[ 0 ], 6, 7); $this->gif .= substr($this->sources[ 0 ], 13, $cmap); $this->gif .= "!\377\13NETSCAPE2.0\3\1".$this->word2bin($this->config[ 'loop' ])."\0"; } }
[ "protected", "function", "gifAddHeader", "(", ")", "{", "$", "cmap", "=", "0", ";", "if", "(", "ord", "(", "$", "this", "->", "sources", "[", "0", "]", "{", "10", "}", ")", "&", "0x80", ")", "{", "$", "cmap", "=", "3", "*", "(", "2", "<<", ...
Add the header gif string in its source
[ "Add", "the", "header", "gif", "string", "in", "its", "source" ]
84a840fb53285b8531d2d6e020434f6c501bf5bc
https://github.com/pomirleanu/gif-create/blob/84a840fb53285b8531d2d6e020434f6c501bf5bc/src/GifCreate.php#L260-L270
235,049
pomirleanu/gif-create
src/GifCreate.php
GifCreate.gifBlockCompare
private function gifBlockCompare($globalBlock, $localBlock, $length) { for ($i = 0; $i < $length; $i++) { if ($globalBlock [ 3 * $i + 0 ] != $localBlock [ 3 * $i + 0 ] || $globalBlock [ 3 * $i + 1 ] != $localBlock [ 3 * $i + 1 ] || $globalBlock [ 3 * $i + 2 ] != $localBlock [ 3 * $i + 2 ]) { return 0; } } return 1; }
php
private function gifBlockCompare($globalBlock, $localBlock, $length) { for ($i = 0; $i < $length; $i++) { if ($globalBlock [ 3 * $i + 0 ] != $localBlock [ 3 * $i + 0 ] || $globalBlock [ 3 * $i + 1 ] != $localBlock [ 3 * $i + 1 ] || $globalBlock [ 3 * $i + 2 ] != $localBlock [ 3 * $i + 2 ]) { return 0; } } return 1; }
[ "private", "function", "gifBlockCompare", "(", "$", "globalBlock", ",", "$", "localBlock", ",", "$", "length", ")", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "length", ";", "$", "i", "++", ")", "{", "if", "(", "$", "globalBloc...
Compare two block and return the version @param string $globalBlock @param string $localBlock @param integer $length @return integer
[ "Compare", "two", "block", "and", "return", "the", "version" ]
84a840fb53285b8531d2d6e020434f6c501bf5bc
https://github.com/pomirleanu/gif-create/blob/84a840fb53285b8531d2d6e020434f6c501bf5bc/src/GifCreate.php#L381-L392
235,050
shopgate/cart-integration-sdk
src/redirect.php
ShopgateMobileRedirect.getMobileUrl
protected function getMobileUrl() { if (!empty($this->cname)) { return $this->cname; } elseif (!empty($this->alias)) { return 'http://' . $this->alias . $this->getShopgateUrl(); } }
php
protected function getMobileUrl() { if (!empty($this->cname)) { return $this->cname; } elseif (!empty($this->alias)) { return 'http://' . $this->alias . $this->getShopgateUrl(); } }
[ "protected", "function", "getMobileUrl", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "cname", ")", ")", "{", "return", "$", "this", "->", "cname", ";", "}", "elseif", "(", "!", "empty", "(", "$", "this", "->", "alias", ")", ")...
Generates the root mobile Url for the redirect
[ "Generates", "the", "root", "mobile", "Url", "for", "the", "redirect" ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/redirect.php#L600-L607
235,051
shopgate/cart-integration-sdk
src/redirect.php
ShopgateMobileRedirect.loadKeywordsFromFile
protected function loadKeywordsFromFile($file) { $defaultReturn = array( 'timestamp' => 0, 'keywords' => array(), ); $cacheFile = @fopen($file, 'a+'); if (empty($cacheFile)) { // exception without logging throw new ShopgateLibraryException( ShopgateLibraryException::FILE_READ_WRITE_ERROR, 'Could not read file "' . $file . '".', false, false ); } $keywordsFromFile = explode("\n", @fread($cacheFile, filesize($file))); @fclose($cacheFile); return (empty($keywordsFromFile)) ? $defaultReturn : array( 'timestamp' => (int)array_shift($keywordsFromFile), // strip timestamp in first line 'keywords' => $keywordsFromFile, ); }
php
protected function loadKeywordsFromFile($file) { $defaultReturn = array( 'timestamp' => 0, 'keywords' => array(), ); $cacheFile = @fopen($file, 'a+'); if (empty($cacheFile)) { // exception without logging throw new ShopgateLibraryException( ShopgateLibraryException::FILE_READ_WRITE_ERROR, 'Could not read file "' . $file . '".', false, false ); } $keywordsFromFile = explode("\n", @fread($cacheFile, filesize($file))); @fclose($cacheFile); return (empty($keywordsFromFile)) ? $defaultReturn : array( 'timestamp' => (int)array_shift($keywordsFromFile), // strip timestamp in first line 'keywords' => $keywordsFromFile, ); }
[ "protected", "function", "loadKeywordsFromFile", "(", "$", "file", ")", "{", "$", "defaultReturn", "=", "array", "(", "'timestamp'", "=>", "0", ",", "'keywords'", "=>", "array", "(", ")", ",", ")", ";", "$", "cacheFile", "=", "@", "fopen", "(", "$", "f...
Reads redirect keywords from file. @param string $file The file to read the keywords from. @return array<'timestamp' => int, 'keywords' => string[]) An array with the 'timestamp' of the last update and the list of 'keywords'. @throws ShopgateLibraryException in case the file cannot be opened.
[ "Reads", "redirect", "keywords", "from", "file", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/redirect.php#L722-L747
235,052
shopgate/cart-integration-sdk
src/redirect.php
ShopgateMobileRedirect.processQueryString
protected function processQueryString($url) { $queryDataKeys = array_intersect($this->config->getRedirectableGetParams(), array_keys($_GET)); $queryData = array_intersect_key($_GET, array_flip($queryDataKeys)); $connector = preg_match('/\?/', $url) ? "&" : "?"; return count($queryData) ? $connector . http_build_query($queryData) : ""; }
php
protected function processQueryString($url) { $queryDataKeys = array_intersect($this->config->getRedirectableGetParams(), array_keys($_GET)); $queryData = array_intersect_key($_GET, array_flip($queryDataKeys)); $connector = preg_match('/\?/', $url) ? "&" : "?"; return count($queryData) ? $connector . http_build_query($queryData) : ""; }
[ "protected", "function", "processQueryString", "(", "$", "url", ")", "{", "$", "queryDataKeys", "=", "array_intersect", "(", "$", "this", "->", "config", "->", "getRedirectableGetParams", "(", ")", ",", "array_keys", "(", "$", "_GET", ")", ")", ";", "$", "...
Passes allowed get params to the url as querystring @param string $url @return string $url
[ "Passes", "allowed", "get", "params", "to", "the", "url", "as", "querystring" ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/redirect.php#L766-L778
235,053
NicolasMahe/Laravel-SlackOutput
src/Command/SlackPost.php
SlackPost.initClient
protected function initClient() { //get slack config $slack_config = config('slack-output'); if (empty( $slack_config["endpoint"] )) { throw new Exception("The endpoint url is not set in the config"); } //init client $this->client = new Client($slack_config["endpoint"], [ "username" => $slack_config["username"], "icon" => $slack_config["icon"] ]); }
php
protected function initClient() { //get slack config $slack_config = config('slack-output'); if (empty( $slack_config["endpoint"] )) { throw new Exception("The endpoint url is not set in the config"); } //init client $this->client = new Client($slack_config["endpoint"], [ "username" => $slack_config["username"], "icon" => $slack_config["icon"] ]); }
[ "protected", "function", "initClient", "(", ")", "{", "//get slack config", "$", "slack_config", "=", "config", "(", "'slack-output'", ")", ";", "if", "(", "empty", "(", "$", "slack_config", "[", "\"endpoint\"", "]", ")", ")", "{", "throw", "new", "Exception...
Init the slack client @return Client @throws Exception
[ "Init", "the", "slack", "client" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Command/SlackPost.php#L74-L88
235,054
NicolasMahe/Laravel-SlackOutput
src/Command/SlackPost.php
SlackPost.addAttachment
protected function addAttachment($attach) { if (is_array($attach)) { if ($this->is_assoc($attach)) { $attach = [ $attach ]; } foreach ($attach as $attachElement) { $this->client = $this->client->attach($attachElement); } } }
php
protected function addAttachment($attach) { if (is_array($attach)) { if ($this->is_assoc($attach)) { $attach = [ $attach ]; } foreach ($attach as $attachElement) { $this->client = $this->client->attach($attachElement); } } }
[ "protected", "function", "addAttachment", "(", "$", "attach", ")", "{", "if", "(", "is_array", "(", "$", "attach", ")", ")", "{", "if", "(", "$", "this", "->", "is_assoc", "(", "$", "attach", ")", ")", "{", "$", "attach", "=", "[", "$", "attach", ...
Add the attachments @param $attach
[ "Add", "the", "attachments" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Command/SlackPost.php#L96-L107
235,055
NicolasMahe/Laravel-SlackOutput
src/Command/SlackPost.php
SlackPost.addTo
protected function addTo($to) { if ( ! empty( $to )) { $this->client = $this->client->to($to); } }
php
protected function addTo($to) { if ( ! empty( $to )) { $this->client = $this->client->to($to); } }
[ "protected", "function", "addTo", "(", "$", "to", ")", "{", "if", "(", "!", "empty", "(", "$", "to", ")", ")", "{", "$", "this", "->", "client", "=", "$", "this", "->", "client", "->", "to", "(", "$", "to", ")", ";", "}", "}" ]
Add the receiver @param $to
[ "Add", "the", "receiver" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Command/SlackPost.php#L115-L120
235,056
ondrs/upload-manager
src/ondrs/UploadManager/Storages/S3Storage.php
S3Storage.buildPattern
private static function buildPattern($masks) { $pattern = array(); $masks = is_array($masks) ? $masks : [$masks]; foreach ($masks as $mask) { $mask = rtrim(strtr($mask, '\\', '/'), '/'); $prefix = ''; if ($mask === '') { continue; } elseif ($mask === '*') { return NULL; } elseif ($mask[0] === '/') { // absolute fixing $mask = ltrim($mask, '/'); $prefix = '(?<=^/)'; } $pattern[] = $prefix . strtr(preg_quote($mask, '#'), array('\*\*' => '.*', '\*' => '[^/]*', '\?' => '[^/]', '\[\!' => '[^', '\[' => '[', '\]' => ']', '\-' => '-')); } return $pattern ? '#/(' . implode('|', $pattern) . ')\z#i' : NULL; }
php
private static function buildPattern($masks) { $pattern = array(); $masks = is_array($masks) ? $masks : [$masks]; foreach ($masks as $mask) { $mask = rtrim(strtr($mask, '\\', '/'), '/'); $prefix = ''; if ($mask === '') { continue; } elseif ($mask === '*') { return NULL; } elseif ($mask[0] === '/') { // absolute fixing $mask = ltrim($mask, '/'); $prefix = '(?<=^/)'; } $pattern[] = $prefix . strtr(preg_quote($mask, '#'), array('\*\*' => '.*', '\*' => '[^/]*', '\?' => '[^/]', '\[\!' => '[^', '\[' => '[', '\]' => ']', '\-' => '-')); } return $pattern ? '#/(' . implode('|', $pattern) . ')\z#i' : NULL; }
[ "private", "static", "function", "buildPattern", "(", "$", "masks", ")", "{", "$", "pattern", "=", "array", "(", ")", ";", "$", "masks", "=", "is_array", "(", "$", "masks", ")", "?", "$", "masks", ":", "[", "$", "masks", "]", ";", "foreach", "(", ...
Converts Finder pattern to regular expression. @param array @return string
[ "Converts", "Finder", "pattern", "to", "regular", "expression", "." ]
81538fe956b4f173fd9b1d0d371c2f1563b1ea99
https://github.com/ondrs/upload-manager/blob/81538fe956b4f173fd9b1d0d371c2f1563b1ea99/src/ondrs/UploadManager/Storages/S3Storage.php#L150-L172
235,057
makinacorpus/drupal-ucms
ucms_site/src/Twig/Extension/SiteExtension.php
SiteExtension.renderState
public function renderState($state) { $list = SiteState::getList(); if (isset($list[$state])) { return $this->t($list[$state]); } return $this->t("Unknown"); }
php
public function renderState($state) { $list = SiteState::getList(); if (isset($list[$state])) { return $this->t($list[$state]); } return $this->t("Unknown"); }
[ "public", "function", "renderState", "(", "$", "state", ")", "{", "$", "list", "=", "SiteState", "::", "getList", "(", ")", ";", "if", "(", "isset", "(", "$", "list", "[", "$", "state", "]", ")", ")", "{", "return", "$", "this", "->", "t", "(", ...
Render state human readable label @param int $state @return string
[ "Render", "state", "human", "readable", "label" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/Twig/Extension/SiteExtension.php#L58-L67
235,058
makinacorpus/drupal-ucms
ucms_site/src/Twig/Extension/SiteExtension.php
SiteExtension.renderSiteUrl
public function renderSiteUrl($site, $path = null, array $options = [], $ignoreSso = false, $dropDestination = true) { return $this->siteManager->getUrlGenerator()->generateUrl($site, $path, $options, $ignoreSso, $dropDestination); }
php
public function renderSiteUrl($site, $path = null, array $options = [], $ignoreSso = false, $dropDestination = true) { return $this->siteManager->getUrlGenerator()->generateUrl($site, $path, $options, $ignoreSso, $dropDestination); }
[ "public", "function", "renderSiteUrl", "(", "$", "site", ",", "$", "path", "=", "null", ",", "array", "$", "options", "=", "[", "]", ",", "$", "ignoreSso", "=", "false", ",", "$", "dropDestination", "=", "true", ")", "{", "return", "$", "this", "->",...
Render site link @param int|Site $site Site identifier, if site is null @param string $path Drupal path to hit in site @param mixed[] $options Link options, see url() @return string
[ "Render", "site", "link" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/Twig/Extension/SiteExtension.php#L105-L108
235,059
shopgate/cart-integration-sdk
src/models/catalog/Relation.php
Shopgate_Model_Catalog_Relation.addValue
public function addValue($value) { $values = $this->getValues(); array_push($values, $value); $this->setValues($values); }
php
public function addValue($value) { $values = $this->getValues(); array_push($values, $value); $this->setValues($values); }
[ "public", "function", "addValue", "(", "$", "value", ")", "{", "$", "values", "=", "$", "this", "->", "getValues", "(", ")", ";", "array_push", "(", "$", "values", ",", "$", "value", ")", ";", "$", "this", "->", "setValues", "(", "$", "values", ")"...
add new value @param int $value
[ "add", "new", "value" ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/models/catalog/Relation.php#L90-L95
235,060
aimeos/ai-admin-extadm
controller/extjs/src/Controller/ExtJS/Factory.php
Factory.clear
static public function clear( $id = null, $path = null ) { if( $id !== null ) { if( $path !== null ) { self::$controllers[$id][$path] = null; } else { self::$controllers[$id] = []; } return; } self::$controllers = []; }
php
static public function clear( $id = null, $path = null ) { if( $id !== null ) { if( $path !== null ) { self::$controllers[$id][$path] = null; } else { self::$controllers[$id] = []; } return; } self::$controllers = []; }
[ "static", "public", "function", "clear", "(", "$", "id", "=", "null", ",", "$", "path", "=", "null", ")", "{", "if", "(", "$", "id", "!==", "null", ")", "{", "if", "(", "$", "path", "!==", "null", ")", "{", "self", "::", "$", "controllers", "["...
Removes the controller objects from the cache. If neither a context ID nor a path is given, the complete cache will be pruned. @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface) @param string $path Path describing the controller to clear, e.g. "product/lists/type"
[ "Removes", "the", "controller", "objects", "from", "the", "cache", "." ]
594ee7cec90fd63a4773c05c93f353e66d9b3408
https://github.com/aimeos/ai-admin-extadm/blob/594ee7cec90fd63a4773c05c93f353e66d9b3408/controller/extjs/src/Controller/ExtJS/Factory.php#L35-L49
235,061
runcmf/runbb
src/RunBB/Core/Hooks.php
Hooks.fireDB
public function fireDB($name) { $args = func_get_args(); array_shift($args); if (!isset($this->hooks[$name])) { //$this->hooks[$name] = array(array()); return $args[0]; } if (!empty($this->hooks[$name])) { // Sort by priority, low to high, if there's more than one priority if (count($this->hooks[$name]) > 1) { ksort($this->hooks[$name]); } $output = []; foreach ($this->hooks[$name] as $priority) { if (!empty($priority)) { foreach ($priority as $callable) { $output[] = call_user_func_array($callable, $args); } } } return $output[0]; } }
php
public function fireDB($name) { $args = func_get_args(); array_shift($args); if (!isset($this->hooks[$name])) { //$this->hooks[$name] = array(array()); return $args[0]; } if (!empty($this->hooks[$name])) { // Sort by priority, low to high, if there's more than one priority if (count($this->hooks[$name]) > 1) { ksort($this->hooks[$name]); } $output = []; foreach ($this->hooks[$name] as $priority) { if (!empty($priority)) { foreach ($priority as $callable) { $output[] = call_user_func_array($callable, $args); } } } return $output[0]; } }
[ "public", "function", "fireDB", "(", "$", "name", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "array_shift", "(", "$", "args", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "hooks", "[", "$", "name", "]", ")", ")", ...
Invoke hook for DB @param string $name The hook name @param mixed ... Argument(s) for hooked functions, can specify multiple arguments @return mixed
[ "Invoke", "hook", "for", "DB" ]
d4f4098bcece48b78ea2d1ae5eeead7ac9a8b463
https://github.com/runcmf/runbb/blob/d4f4098bcece48b78ea2d1ae5eeead7ac9a8b463/src/RunBB/Core/Hooks.php#L110-L137
235,062
aimeos/ai-admin-extadm
controller/extjs/src/Controller/ExtJS/Locale/Site/Standard.php
Standard.saveItems
public function saveItems( \stdClass $params ) { $this->checkParams( $params, array( 'items' ) ); $ids = []; $manager = $this->getManager(); $items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items ); foreach( $items as $entry ) { $item = $manager->createItem(); $item->fromArray( (array) $this->transformValues( $entry ) ); $item = $manager->saveItem( $item ); $ids[] = $item->getId(); } return $this->getItems( $ids, $this->getPrefix() ); }
php
public function saveItems( \stdClass $params ) { $this->checkParams( $params, array( 'items' ) ); $ids = []; $manager = $this->getManager(); $items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items ); foreach( $items as $entry ) { $item = $manager->createItem(); $item->fromArray( (array) $this->transformValues( $entry ) ); $item = $manager->saveItem( $item ); $ids[] = $item->getId(); } return $this->getItems( $ids, $this->getPrefix() ); }
[ "public", "function", "saveItems", "(", "\\", "stdClass", "$", "params", ")", "{", "$", "this", "->", "checkParams", "(", "$", "params", ",", "array", "(", "'items'", ")", ")", ";", "$", "ids", "=", "[", "]", ";", "$", "manager", "=", "$", "this", ...
Creates a new site item or updates an existing one or a list thereof. @param \stdClass $params Associative array containing the product properties
[ "Creates", "a", "new", "site", "item", "or", "updates", "an", "existing", "one", "or", "a", "list", "thereof", "." ]
594ee7cec90fd63a4773c05c93f353e66d9b3408
https://github.com/aimeos/ai-admin-extadm/blob/594ee7cec90fd63a4773c05c93f353e66d9b3408/controller/extjs/src/Controller/ExtJS/Locale/Site/Standard.php#L63-L80
235,063
platformsh/console-form
src/Field/OptionsField.php
OptionsField.isNumeric
private function isNumeric() { foreach (array_keys($this->options) as $key) { if (!is_int($key)) { return false; } } return true; }
php
private function isNumeric() { foreach (array_keys($this->options) as $key) { if (!is_int($key)) { return false; } } return true; }
[ "private", "function", "isNumeric", "(", ")", "{", "foreach", "(", "array_keys", "(", "$", "this", "->", "options", ")", "as", "$", "key", ")", "{", "if", "(", "!", "is_int", "(", "$", "key", ")", ")", "{", "return", "false", ";", "}", "}", "retu...
Check if this is numeric, rather than associative. @return bool
[ "Check", "if", "this", "is", "numeric", "rather", "than", "associative", "." ]
5263fe8c6c976e10f4495c9e00c92cc2d410a673
https://github.com/platformsh/console-form/blob/5263fe8c6c976e10f4495c9e00c92cc2d410a673/src/Field/OptionsField.php#L145-L154
235,064
shopgate/cart-integration-sdk
src/helper/logging/strategy/DefaultLogging.php
Shopgate_Helper_Logging_Strategy_DefaultLogging.setLogFilePaths
public function setLogFilePaths($accessLogPath, $requestLogPath, $errorLogPath, $debugLogPath) { if (!empty($accessLogPath)) { $this->logFiles[self::LOGTYPE_ACCESS]['path'] = $accessLogPath; } if (!empty($requestLogPath)) { $this->logFiles[self::LOGTYPE_REQUEST]['path'] = $requestLogPath; } if (!empty($errorLogPath)) { $this->logFiles[self::LOGTYPE_ERROR]['path'] = $errorLogPath; } if (!empty($debugLogPath)) { $this->logFiles[self::LOGTYPE_DEBUG]['path'] = $debugLogPath; } }
php
public function setLogFilePaths($accessLogPath, $requestLogPath, $errorLogPath, $debugLogPath) { if (!empty($accessLogPath)) { $this->logFiles[self::LOGTYPE_ACCESS]['path'] = $accessLogPath; } if (!empty($requestLogPath)) { $this->logFiles[self::LOGTYPE_REQUEST]['path'] = $requestLogPath; } if (!empty($errorLogPath)) { $this->logFiles[self::LOGTYPE_ERROR]['path'] = $errorLogPath; } if (!empty($debugLogPath)) { $this->logFiles[self::LOGTYPE_DEBUG]['path'] = $debugLogPath; } }
[ "public", "function", "setLogFilePaths", "(", "$", "accessLogPath", ",", "$", "requestLogPath", ",", "$", "errorLogPath", ",", "$", "debugLogPath", ")", "{", "if", "(", "!", "empty", "(", "$", "accessLogPath", ")", ")", "{", "$", "this", "->", "logFiles", ...
Sets the paths to the log files. @param string $accessLogPath @param string $requestLogPath @param string $errorLogPath @param string $debugLogPath
[ "Sets", "the", "paths", "to", "the", "log", "files", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/helper/logging/strategy/DefaultLogging.php#L196-L213
235,065
shopgate/cart-integration-sdk
src/helper/logging/strategy/DefaultLogging.php
Shopgate_Helper_Logging_Strategy_DefaultLogging.openLogFileHandle
protected function openLogFileHandle($type) { // don't open file handle if already open if (!empty($this->logFiles[$type]['handle'])) { return true; } // set the file handle $this->logFiles[$type]['handle'] = @fopen($this->logFiles[$type]['path'], $this->logFiles[$type]['mode']); // if log files are not writeable continue silently to the next handle // TODO: This seems a bit too silent... How could we get notice of the error? if ($this->logFiles[$type]['handle'] === false) { return false; } return true; }
php
protected function openLogFileHandle($type) { // don't open file handle if already open if (!empty($this->logFiles[$type]['handle'])) { return true; } // set the file handle $this->logFiles[$type]['handle'] = @fopen($this->logFiles[$type]['path'], $this->logFiles[$type]['mode']); // if log files are not writeable continue silently to the next handle // TODO: This seems a bit too silent... How could we get notice of the error? if ($this->logFiles[$type]['handle'] === false) { return false; } return true; }
[ "protected", "function", "openLogFileHandle", "(", "$", "type", ")", "{", "// don't open file handle if already open", "if", "(", "!", "empty", "(", "$", "this", "->", "logFiles", "[", "$", "type", "]", "[", "'handle'", "]", ")", ")", "{", "return", "true", ...
Opens log file handles for the requested log type if necessary. Already opened file handles will not be opened again. @param string $type The log type, that would be one of the self::LOGTYPE_* constants. @return bool true if opening succeeds or the handle is already open; false on error.
[ "Opens", "log", "file", "handles", "for", "the", "requested", "log", "type", "if", "necessary", "." ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/helper/logging/strategy/DefaultLogging.php#L224-L241
235,066
runcmf/runbb
src/RunBB/Middleware/Csrf.php
Csrf.generateNewToken
public function generateNewToken(ServerRequestInterface $request) { $pair = $this->generateToken(); $request = $request->withAttribute($this->prefix . '_name', $pair[$this->prefix . '_name']) ->withAttribute($this->prefix . '_value', $pair[$this->prefix . '_value']); View::setPageInfo([ $this->prefix . '_name' => $pair[$this->prefix . '_name'], $this->prefix . '_value' => $pair[$this->prefix . '_value'] ]); return $request; }
php
public function generateNewToken(ServerRequestInterface $request) { $pair = $this->generateToken(); $request = $request->withAttribute($this->prefix . '_name', $pair[$this->prefix . '_name']) ->withAttribute($this->prefix . '_value', $pair[$this->prefix . '_value']); View::setPageInfo([ $this->prefix . '_name' => $pair[$this->prefix . '_name'], $this->prefix . '_value' => $pair[$this->prefix . '_value'] ]); return $request; }
[ "public", "function", "generateNewToken", "(", "ServerRequestInterface", "$", "request", ")", "{", "$", "pair", "=", "$", "this", "->", "generateToken", "(", ")", ";", "$", "request", "=", "$", "request", "->", "withAttribute", "(", "$", "this", "->", "pre...
Generates a new CSRF token and attaches it to the Request Object @param ServerRequestInterface $request PSR7 response object. @return ServerRequestInterface PSR7 response object.
[ "Generates", "a", "new", "CSRF", "token", "and", "attaches", "it", "to", "the", "Request", "Object" ]
d4f4098bcece48b78ea2d1ae5eeead7ac9a8b463
https://github.com/runcmf/runbb/blob/d4f4098bcece48b78ea2d1ae5eeead7ac9a8b463/src/RunBB/Middleware/Csrf.php#L191-L205
235,067
layerhq/layer-identity-token-php
src/Layer/LayerIdentityTokenProvider.php
LayerIdentityTokenProvider._checkLayerConfig
private function _checkLayerConfig() { $errorString = array(); if ($this->_providerID == '') { array_push($errorString, 'LAYER_PROVIDER_ID'); } if ($this->_keyID == '') { array_push($errorString, 'LAYER_PRIVATE_KEY_ID'); } if ($this->_privateKey == '') { array_push($errorString, 'LAYER_PRIVATE_KEY'); } if (count($errorString) > 0) { $joined = implode(',', $errorString); trigger_error("$joined not configured. See README.md", E_USER_ERROR); } }
php
private function _checkLayerConfig() { $errorString = array(); if ($this->_providerID == '') { array_push($errorString, 'LAYER_PROVIDER_ID'); } if ($this->_keyID == '') { array_push($errorString, 'LAYER_PRIVATE_KEY_ID'); } if ($this->_privateKey == '') { array_push($errorString, 'LAYER_PRIVATE_KEY'); } if (count($errorString) > 0) { $joined = implode(',', $errorString); trigger_error("$joined not configured. See README.md", E_USER_ERROR); } }
[ "private", "function", "_checkLayerConfig", "(", ")", "{", "$", "errorString", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "_providerID", "==", "''", ")", "{", "array_push", "(", "$", "errorString", ",", "'LAYER_PROVIDER_ID'", ")", ";", "}...
Checks if all the proper config has been prvided.
[ "Checks", "if", "all", "the", "proper", "config", "has", "been", "prvided", "." ]
0bad3f751f1c9a7b6582f902fcd425281f5501ae
https://github.com/layerhq/layer-identity-token-php/blob/0bad3f751f1c9a7b6582f902fcd425281f5501ae/src/Layer/LayerIdentityTokenProvider.php#L78-L97
235,068
makinacorpus/drupal-ucms
ucms_contrib/src/NodeAccess/NodeAccessEventSubscriber.php
NodeAccessEventSubscriber.onNodeAccess
public function onNodeAccess(NodeAccessEvent $event) { $node = $event->getNode(); $account = $event->getAccount(); $op = $event->getOperation(); $access = $this->siteManager->getAccess(); if ('create' === $op) { // Drupal gave a wrong input, this may happen if (!is_string($node) && !$node instanceof NodeInterface) { return $this->deny(); } $type = is_string($node) ? $node : $node->bundle(); // Locked types if (in_array($type, $this->typeHandler->getLockedTypes()) && !$account->hasPermission(Access::PERM_CONTENT_GOD)) { return $event->deny(); } if ($this->siteManager->hasContext()) { $site = $this->siteManager->getContext(); // Contributor can only create editorial content if ($access->userIsContributor($account, $site) && in_array($type, $this->typeHandler->getEditorialTypes())) { return $event->allow(); } // Webmasters can create anything if ($access->userIsWebmaster($account, $site) && in_array($type, $this->typeHandler->getAllTypes())) { return $event->allow(); } } else { // All user that may manage global content or manage group // content may create content outside of a site context, as // long as content is editorial (text and media) $canManage = $account->hasPermission(Access::PERM_CONTENT_MANAGE_GLOBAL) || $account->hasPermission(Access::PERM_CONTENT_MANAGE_CORPORATE) ; if ($canManage && in_array($type, $this->typeHandler->getEditorialTypes())) { return $event->allow(); } } } else if (Permission::DELETE === $op) { // Locked types if (in_array($node->bundle(), $this->typeHandler->getLockedTypes()) && !$account->hasPermission(Access::PERM_CONTENT_GOD)) { return $event->deny(); } } return $event->ignore(); }
php
public function onNodeAccess(NodeAccessEvent $event) { $node = $event->getNode(); $account = $event->getAccount(); $op = $event->getOperation(); $access = $this->siteManager->getAccess(); if ('create' === $op) { // Drupal gave a wrong input, this may happen if (!is_string($node) && !$node instanceof NodeInterface) { return $this->deny(); } $type = is_string($node) ? $node : $node->bundle(); // Locked types if (in_array($type, $this->typeHandler->getLockedTypes()) && !$account->hasPermission(Access::PERM_CONTENT_GOD)) { return $event->deny(); } if ($this->siteManager->hasContext()) { $site = $this->siteManager->getContext(); // Contributor can only create editorial content if ($access->userIsContributor($account, $site) && in_array($type, $this->typeHandler->getEditorialTypes())) { return $event->allow(); } // Webmasters can create anything if ($access->userIsWebmaster($account, $site) && in_array($type, $this->typeHandler->getAllTypes())) { return $event->allow(); } } else { // All user that may manage global content or manage group // content may create content outside of a site context, as // long as content is editorial (text and media) $canManage = $account->hasPermission(Access::PERM_CONTENT_MANAGE_GLOBAL) || $account->hasPermission(Access::PERM_CONTENT_MANAGE_CORPORATE) ; if ($canManage && in_array($type, $this->typeHandler->getEditorialTypes())) { return $event->allow(); } } } else if (Permission::DELETE === $op) { // Locked types if (in_array($node->bundle(), $this->typeHandler->getLockedTypes()) && !$account->hasPermission(Access::PERM_CONTENT_GOD)) { return $event->deny(); } } return $event->ignore(); }
[ "public", "function", "onNodeAccess", "(", "NodeAccessEvent", "$", "event", ")", "{", "$", "node", "=", "$", "event", "->", "getNode", "(", ")", ";", "$", "account", "=", "$", "event", "->", "getAccount", "(", ")", ";", "$", "op", "=", "$", "event", ...
Checks node access for content creation
[ "Checks", "node", "access", "for", "content", "creation" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_contrib/src/NodeAccess/NodeAccessEventSubscriber.php#L54-L108
235,069
makinacorpus/drupal-ucms
ucms_search/src/Lucene/RangeQuery.php
RangeQuery.setRange
public function setRange($start, $stop) { $this->start = $start; $this->stop = $stop; return $this; }
php
public function setRange($start, $stop) { $this->start = $start; $this->stop = $stop; return $this; }
[ "public", "function", "setRange", "(", "$", "start", ",", "$", "stop", ")", "{", "$", "this", "->", "start", "=", "$", "start", ";", "$", "this", "->", "stop", "=", "$", "stop", ";", "return", "$", "this", ";", "}" ]
Construct a range statement If you build the object with both $start and $stop set to NULL, this statement won't been built at all in the final query. We can, but we won't send [* TO *] useless range. @param null|mixed $start @param null|mixed $stop @return RangeQuery
[ "Construct", "a", "range", "statement" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/Lucene/RangeQuery.php#L53-L59
235,070
makinacorpus/drupal-ucms
ucms_search/src/Lucene/RangeQuery.php
RangeQuery.escapeElement
protected function escapeElement($value) { if (empty($value)) { $element = '*'; } else { $element = $this->renderElement($value); } return self::escapeToken($element); }
php
protected function escapeElement($value) { if (empty($value)) { $element = '*'; } else { $element = $this->renderElement($value); } return self::escapeToken($element); }
[ "protected", "function", "escapeElement", "(", "$", "value", ")", "{", "if", "(", "empty", "(", "$", "value", ")", ")", "{", "$", "element", "=", "'*'", ";", "}", "else", "{", "$", "element", "=", "$", "this", "->", "renderElement", "(", "$", "valu...
Render range element Overriding classes must implement this function in order to escape values Replace the element by '*' wildcard if empty @param string $value @return string
[ "Render", "range", "element" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/Lucene/RangeQuery.php#L86-L95
235,071
h4cc/StackLogger
src/Logger/ContainerBuilder.php
ContainerBuilder.process
public function process(Pimple $container, array $options) { $container['logger'] = $container->share( function () { return new NullLogger(); } ); $container['log_level'] = LogLevel::INFO; $container['log_sub_request'] = false; foreach ($options as $name => $value) { $container[$name] = $value; } return $container; }
php
public function process(Pimple $container, array $options) { $container['logger'] = $container->share( function () { return new NullLogger(); } ); $container['log_level'] = LogLevel::INFO; $container['log_sub_request'] = false; foreach ($options as $name => $value) { $container[$name] = $value; } return $container; }
[ "public", "function", "process", "(", "Pimple", "$", "container", ",", "array", "$", "options", ")", "{", "$", "container", "[", "'logger'", "]", "=", "$", "container", "->", "share", "(", "function", "(", ")", "{", "return", "new", "NullLogger", "(", ...
Adds services and parameters to given container. ALso applies given options. @param Pimple $container @param array $options @return Pimple
[ "Adds", "services", "and", "parameters", "to", "given", "container", ".", "ALso", "applies", "given", "options", "." ]
1bdbb3e7d157aa9069ace90267c249f43dc02b77
https://github.com/h4cc/StackLogger/blob/1bdbb3e7d157aa9069ace90267c249f43dc02b77/src/Logger/ContainerBuilder.php#L30-L47
235,072
umpirsky/list-generator
src/Umpirsky/ListGenerator/Exporter/HtmlExporter.php
HtmlExporter.exportHtml
protected function exportHtml(\DOMElement $element) { $body = $this->getDocument()->createElement('body'); $body->appendChild($element); $html = $this->getDocument()->getElementsByTagName('html')->item(0); $html->appendChild($this->getHead()); $html->appendChild($body); $html = $this->getDocument()->saveHTML(); $this->reset(); return $html; }
php
protected function exportHtml(\DOMElement $element) { $body = $this->getDocument()->createElement('body'); $body->appendChild($element); $html = $this->getDocument()->getElementsByTagName('html')->item(0); $html->appendChild($this->getHead()); $html->appendChild($body); $html = $this->getDocument()->saveHTML(); $this->reset(); return $html; }
[ "protected", "function", "exportHtml", "(", "\\", "DOMElement", "$", "element", ")", "{", "$", "body", "=", "$", "this", "->", "getDocument", "(", ")", "->", "createElement", "(", "'body'", ")", ";", "$", "body", "->", "appendChild", "(", "$", "element",...
Wraps DOM element to document and exports it as HTML string. @param \DOMElement $element @return string
[ "Wraps", "DOM", "element", "to", "document", "and", "exports", "it", "as", "HTML", "string", "." ]
103182faf6e48611901263a49e7a9ba33e7515b8
https://github.com/umpirsky/list-generator/blob/103182faf6e48611901263a49e7a9ba33e7515b8/src/Umpirsky/ListGenerator/Exporter/HtmlExporter.php#L25-L37
235,073
umpirsky/list-generator
src/Umpirsky/ListGenerator/Exporter/HtmlExporter.php
HtmlExporter.getDocument
protected function getDocument() { if (null === $this->document) { $this->document = \DOMImplementation::createDocument( 'http://www.w3.org/1999/xhtml', 'html', \DOMImplementation::createDocumentType( 'html', '-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd' ) ); } return $this->document; }
php
protected function getDocument() { if (null === $this->document) { $this->document = \DOMImplementation::createDocument( 'http://www.w3.org/1999/xhtml', 'html', \DOMImplementation::createDocumentType( 'html', '-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd' ) ); } return $this->document; }
[ "protected", "function", "getDocument", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "document", ")", "{", "$", "this", "->", "document", "=", "\\", "DOMImplementation", "::", "createDocument", "(", "'http://www.w3.org/1999/xhtml'", ",", "'html'...
Creates HTML document. @return \DOMDocument
[ "Creates", "HTML", "document", "." ]
103182faf6e48611901263a49e7a9ba33e7515b8
https://github.com/umpirsky/list-generator/blob/103182faf6e48611901263a49e7a9ba33e7515b8/src/Umpirsky/ListGenerator/Exporter/HtmlExporter.php#L44-L59
235,074
umpirsky/list-generator
src/Umpirsky/ListGenerator/Exporter/HtmlExporter.php
HtmlExporter.getHead
protected function getHead() { $head = $this->getDocument()->createElement('head'); $metahttp = $this->getDocument()->createElement('meta'); $metahttp->setAttribute('http-equiv', 'Content-Type'); $metahttp->setAttribute('content', 'text/html; charset=utf-8'); $head->appendChild($metahttp); $head->appendChild($this->getDocument()->createElement('title', 'Generated List')); foreach ($this->getStylesheets() as $href) { $stylesheet = $this->getDocument()->createElement('link'); $stylesheet->setAttribute('href', $href); $stylesheet->setAttribute('rel', 'stylesheet'); $stylesheet->setAttribute('type', 'text/css'); $head->appendChild($stylesheet); } return $head; }
php
protected function getHead() { $head = $this->getDocument()->createElement('head'); $metahttp = $this->getDocument()->createElement('meta'); $metahttp->setAttribute('http-equiv', 'Content-Type'); $metahttp->setAttribute('content', 'text/html; charset=utf-8'); $head->appendChild($metahttp); $head->appendChild($this->getDocument()->createElement('title', 'Generated List')); foreach ($this->getStylesheets() as $href) { $stylesheet = $this->getDocument()->createElement('link'); $stylesheet->setAttribute('href', $href); $stylesheet->setAttribute('rel', 'stylesheet'); $stylesheet->setAttribute('type', 'text/css'); $head->appendChild($stylesheet); } return $head; }
[ "protected", "function", "getHead", "(", ")", "{", "$", "head", "=", "$", "this", "->", "getDocument", "(", ")", "->", "createElement", "(", "'head'", ")", ";", "$", "metahttp", "=", "$", "this", "->", "getDocument", "(", ")", "->", "createElement", "(...
Creates HTML head. @return \DOMElement
[ "Creates", "HTML", "head", "." ]
103182faf6e48611901263a49e7a9ba33e7515b8
https://github.com/umpirsky/list-generator/blob/103182faf6e48611901263a49e7a9ba33e7515b8/src/Umpirsky/ListGenerator/Exporter/HtmlExporter.php#L95-L113
235,075
makinacorpus/drupal-ucms
ucms_tree/src/EventDispatcher/SiteEventSubscriber.php
SiteEventSubscriber.onSiteClone
public function onSiteClone(SiteCloneEvent $event) { $source = $event->getTemplateSite(); $target = $event->getSite(); $this->ensureSiteMenus($source); $this->ensureSiteMenus($target); if ($this->treeManager && $this->allowedMenus) { foreach (array_keys($this->allowedMenus) as $prefix) { $sourceName = $prefix . '-' . $source->getId(); $targetName = $prefix . '-' . $target->getId(); $this->treeManager->cloneMenuIn($sourceName, $targetName); } } }
php
public function onSiteClone(SiteCloneEvent $event) { $source = $event->getTemplateSite(); $target = $event->getSite(); $this->ensureSiteMenus($source); $this->ensureSiteMenus($target); if ($this->treeManager && $this->allowedMenus) { foreach (array_keys($this->allowedMenus) as $prefix) { $sourceName = $prefix . '-' . $source->getId(); $targetName = $prefix . '-' . $target->getId(); $this->treeManager->cloneMenuIn($sourceName, $targetName); } } }
[ "public", "function", "onSiteClone", "(", "SiteCloneEvent", "$", "event", ")", "{", "$", "source", "=", "$", "event", "->", "getTemplateSite", "(", ")", ";", "$", "target", "=", "$", "event", "->", "getSite", "(", ")", ";", "$", "this", "->", "ensureSi...
On site cloning. @param SiteCloneEvent $event
[ "On", "site", "cloning", "." ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_tree/src/EventDispatcher/SiteEventSubscriber.php#L115-L132
235,076
makinacorpus/drupal-ucms
ucms_tree/src/EventDispatcher/SiteEventSubscriber.php
SiteEventSubscriber.ensureSiteMenus
private function ensureSiteMenus(Site $site) { $ret = []; if ($this->treeManager && $this->allowedMenus) { $storage = $this->treeManager->getMenuStorage(); foreach ($this->allowedMenus as $prefix => $title) { $name = $prefix.'-'.$site->getId(); if (!$storage->exists($name)) { $ret[$name] = $storage->create($name, ['title' => $this->t($title), 'site_id' => $site->getId()]); } } } return $ret; }
php
private function ensureSiteMenus(Site $site) { $ret = []; if ($this->treeManager && $this->allowedMenus) { $storage = $this->treeManager->getMenuStorage(); foreach ($this->allowedMenus as $prefix => $title) { $name = $prefix.'-'.$site->getId(); if (!$storage->exists($name)) { $ret[$name] = $storage->create($name, ['title' => $this->t($title), 'site_id' => $site->getId()]); } } } return $ret; }
[ "private", "function", "ensureSiteMenus", "(", "Site", "$", "site", ")", "{", "$", "ret", "=", "[", "]", ";", "if", "(", "$", "this", "->", "treeManager", "&&", "$", "this", "->", "allowedMenus", ")", "{", "$", "storage", "=", "$", "this", "->", "t...
Create missing menus for site @param Site $site @return string[][] Newly created menus
[ "Create", "missing", "menus", "for", "site" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_tree/src/EventDispatcher/SiteEventSubscriber.php#L142-L160
235,077
accompli/accompli
src/Deployment/Connection/ConnectionManager.php
ConnectionManager.onCreateConnection
public function onCreateConnection(HostEvent $event) { $connectionAdapter = $this->getConnectionAdapter($event->getHost()); if ($connectionAdapter instanceof ConnectionAdapterInterface) { $event->getHost()->setConnection($connectionAdapter); } }
php
public function onCreateConnection(HostEvent $event) { $connectionAdapter = $this->getConnectionAdapter($event->getHost()); if ($connectionAdapter instanceof ConnectionAdapterInterface) { $event->getHost()->setConnection($connectionAdapter); } }
[ "public", "function", "onCreateConnection", "(", "HostEvent", "$", "event", ")", "{", "$", "connectionAdapter", "=", "$", "this", "->", "getConnectionAdapter", "(", "$", "event", "->", "getHost", "(", ")", ")", ";", "if", "(", "$", "connectionAdapter", "inst...
Sets a connection adapter on a Host when an 'accompli.create_connection' event is dispatched. @param HostEvent $event
[ "Sets", "a", "connection", "adapter", "on", "a", "Host", "when", "an", "accompli", ".", "create_connection", "event", "is", "dispatched", "." ]
618f28377448d8caa90d63bfa5865a3ee15e49e7
https://github.com/accompli/accompli/blob/618f28377448d8caa90d63bfa5865a3ee15e49e7/src/Deployment/Connection/ConnectionManager.php#L64-L70
235,078
accompli/accompli
src/EventDispatcher/Subscriber/GenerateReportSubscriber.php
GenerateReportSubscriber.onInstallCommandCompletedOutputReport
public function onInstallCommandCompletedOutputReport() { $report = new InstallReport($this->eventDataCollector, $this->dataCollectors); $report->generate($this->logger); }
php
public function onInstallCommandCompletedOutputReport() { $report = new InstallReport($this->eventDataCollector, $this->dataCollectors); $report->generate($this->logger); }
[ "public", "function", "onInstallCommandCompletedOutputReport", "(", ")", "{", "$", "report", "=", "new", "InstallReport", "(", "$", "this", "->", "eventDataCollector", ",", "$", "this", "->", "dataCollectors", ")", ";", "$", "report", "->", "generate", "(", "$...
Generates an installation report.
[ "Generates", "an", "installation", "report", "." ]
618f28377448d8caa90d63bfa5865a3ee15e49e7
https://github.com/accompli/accompli/blob/618f28377448d8caa90d63bfa5865a3ee15e49e7/src/EventDispatcher/Subscriber/GenerateReportSubscriber.php#L73-L77
235,079
accompli/accompli
src/EventDispatcher/Subscriber/GenerateReportSubscriber.php
GenerateReportSubscriber.onDeployCommandCompletedOutputReport
public function onDeployCommandCompletedOutputReport() { $report = new DeployReport($this->eventDataCollector, $this->dataCollectors); $report->generate($this->logger); }
php
public function onDeployCommandCompletedOutputReport() { $report = new DeployReport($this->eventDataCollector, $this->dataCollectors); $report->generate($this->logger); }
[ "public", "function", "onDeployCommandCompletedOutputReport", "(", ")", "{", "$", "report", "=", "new", "DeployReport", "(", "$", "this", "->", "eventDataCollector", ",", "$", "this", "->", "dataCollectors", ")", ";", "$", "report", "->", "generate", "(", "$",...
Generates a deployment report.
[ "Generates", "a", "deployment", "report", "." ]
618f28377448d8caa90d63bfa5865a3ee15e49e7
https://github.com/accompli/accompli/blob/618f28377448d8caa90d63bfa5865a3ee15e49e7/src/EventDispatcher/Subscriber/GenerateReportSubscriber.php#L82-L86
235,080
shopgate/cart-integration-sdk
src/models/catalog/Price.php
Shopgate_Model_Catalog_Price.addTierPriceGroup
public function addTierPriceGroup(Shopgate_Model_Catalog_TierPrice $tierPrice) { $tierPrices = $this->getTierPricesGroup(); array_push($tierPrices, $tierPrice); $this->setTierPricesGroup($tierPrices); }
php
public function addTierPriceGroup(Shopgate_Model_Catalog_TierPrice $tierPrice) { $tierPrices = $this->getTierPricesGroup(); array_push($tierPrices, $tierPrice); $this->setTierPricesGroup($tierPrices); }
[ "public", "function", "addTierPriceGroup", "(", "Shopgate_Model_Catalog_TierPrice", "$", "tierPrice", ")", "{", "$", "tierPrices", "=", "$", "this", "->", "getTierPricesGroup", "(", ")", ";", "array_push", "(", "$", "tierPrices", ",", "$", "tierPrice", ")", ";",...
add tier price @param Shopgate_Model_Catalog_TierPrice $tierPrice
[ "add", "tier", "price" ]
cf12ecf8bdb8f4c407209000002fd00261e53b06
https://github.com/shopgate/cart-integration-sdk/blob/cf12ecf8bdb8f4c407209000002fd00261e53b06/src/models/catalog/Price.php#L121-L126
235,081
makinacorpus/drupal-ucms
ucms_user/src/EventDispatcher/UserEventSubscriber.php
UserEventSubscriber.onSiteWebmasterCreate
public function onSiteWebmasterCreate(SiteEvent $event) { /* @var UserInterface $user */ $user = $this->entityManager->getStorage('user')->load($event->getArgument('webmaster_id')); if ($user->status == 0) { $this->tokenManager->sendTokenMail($user, 'ucms_user', 'new-account-disabled'); } else { $this->tokenManager->sendTokenMail($user, 'ucms_user', 'new-account-enabled'); } }
php
public function onSiteWebmasterCreate(SiteEvent $event) { /* @var UserInterface $user */ $user = $this->entityManager->getStorage('user')->load($event->getArgument('webmaster_id')); if ($user->status == 0) { $this->tokenManager->sendTokenMail($user, 'ucms_user', 'new-account-disabled'); } else { $this->tokenManager->sendTokenMail($user, 'ucms_user', 'new-account-enabled'); } }
[ "public", "function", "onSiteWebmasterCreate", "(", "SiteEvent", "$", "event", ")", "{", "/* @var UserInterface $user */", "$", "user", "=", "$", "this", "->", "entityManager", "->", "getStorage", "(", "'user'", ")", "->", "load", "(", "$", "event", "->", "get...
Act on webmaster or contributor creation. @param SiteEvent $event
[ "Act", "on", "webmaster", "or", "contributor", "creation", "." ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_user/src/EventDispatcher/UserEventSubscriber.php#L54-L64
235,082
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.loadGroupsFrom
public function loadGroupsFrom(array $items = [], $withAccess = false) { $idList = []; foreach ($items as $item) { if (is_numeric($item)) { $groupId = (int)$item; } else if ($item instanceof GroupMember) { $groupId = $item->getGroupId(); } else if ($item instanceof GroupSite) { $groupId = $item->getGroupId(); } else { throw new \InvalidArgumentException(sprintf("given input is nor an integer nor a %s nor %s instance", GroupMember::class, GroupSite::class)); } // Avoid duplicates $idList[$groupId] = $groupId; } if (!$idList) { return []; } return $this->loadAll($idList, $withAccess); }
php
public function loadGroupsFrom(array $items = [], $withAccess = false) { $idList = []; foreach ($items as $item) { if (is_numeric($item)) { $groupId = (int)$item; } else if ($item instanceof GroupMember) { $groupId = $item->getGroupId(); } else if ($item instanceof GroupSite) { $groupId = $item->getGroupId(); } else { throw new \InvalidArgumentException(sprintf("given input is nor an integer nor a %s nor %s instance", GroupMember::class, GroupSite::class)); } // Avoid duplicates $idList[$groupId] = $groupId; } if (!$idList) { return []; } return $this->loadAll($idList, $withAccess); }
[ "public", "function", "loadGroupsFrom", "(", "array", "$", "items", "=", "[", "]", ",", "$", "withAccess", "=", "false", ")", "{", "$", "idList", "=", "[", "]", ";", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "if", "(", "is_numeric"...
Load groups from @param int[]|GroupSite|GroupMember[] $items @param bool $withAccess @return Group[]
[ "Load", "groups", "from" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L50-L73
235,083
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.findOne
public function findOne($id) { $group = $this ->database ->query( "SELECT * FROM {ucms_group} WHERE id = :id LIMIT 1 OFFSET 0", [':id' => $id] ) ->fetchObject(Group::class) ; if (!$group) { throw new \InvalidArgumentException("Group does not exists"); } return $group; }
php
public function findOne($id) { $group = $this ->database ->query( "SELECT * FROM {ucms_group} WHERE id = :id LIMIT 1 OFFSET 0", [':id' => $id] ) ->fetchObject(Group::class) ; if (!$group) { throw new \InvalidArgumentException("Group does not exists"); } return $group; }
[ "public", "function", "findOne", "(", "$", "id", ")", "{", "$", "group", "=", "$", "this", "->", "database", "->", "query", "(", "\"SELECT * FROM {ucms_group} WHERE id = :id LIMIT 1 OFFSET 0\"", ",", "[", "':id'", "=>", "$", "id", "]", ")", "->", "fetchObject"...
Load group by identifier @param int $id @return Group @throws \InvalidArgumentException
[ "Load", "group", "by", "identifier" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L84-L100
235,084
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.loadAll
public function loadAll($idList = [], $withAccess = true) { $ret = []; if (empty($idList)) { return $ret; } $q = $this ->database ->select('ucms_group', 'g') ; if ($withAccess) { $q->addTag('ucms_group_access'); } $groups = $q ->fields('g') ->condition('g.id', $idList) ->execute() ->fetchAll(\PDO::FETCH_CLASS, Group::class) ; // Ensure order is the same // FIXME: find a better way $sort = []; foreach ($groups as $group) { $sort[$group->getId()] = $group; } foreach ($idList as $id) { if (isset($sort[$id])) { $ret[$id] = $sort[$id]; } } return $ret; }
php
public function loadAll($idList = [], $withAccess = true) { $ret = []; if (empty($idList)) { return $ret; } $q = $this ->database ->select('ucms_group', 'g') ; if ($withAccess) { $q->addTag('ucms_group_access'); } $groups = $q ->fields('g') ->condition('g.id', $idList) ->execute() ->fetchAll(\PDO::FETCH_CLASS, Group::class) ; // Ensure order is the same // FIXME: find a better way $sort = []; foreach ($groups as $group) { $sort[$group->getId()] = $group; } foreach ($idList as $id) { if (isset($sort[$id])) { $ret[$id] = $sort[$id]; } } return $ret; }
[ "public", "function", "loadAll", "(", "$", "idList", "=", "[", "]", ",", "$", "withAccess", "=", "true", ")", "{", "$", "ret", "=", "[", "]", ";", "if", "(", "empty", "(", "$", "idList", ")", ")", "{", "return", "$", "ret", ";", "}", "$", "q"...
Load all groups from the given identifiers @param array $idList @param string $withAccess @return Group[]
[ "Load", "all", "groups", "from", "the", "given", "identifiers" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L110-L147
235,085
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.save
public function save(Group $group, array $fields = null, $userId = null) { $eligible = [ 'title', 'is_ghost', 'is_meta', 'ts_created', 'ts_changed', 'attributes', ]; if (null === $fields) { $fields = $eligible; } else { $fields = array_intersect($eligible, $fields); } $values = []; foreach ($fields as $field) { switch ($field) { case 'attributes': $attributes = $group->getAttributes(); if (empty($attributes)) { $values[$field] = null; } else { $values[$field] = serialize($attributes); } break; case 'is_ghost': $values['is_ghost'] = (int)$group->isGhost(); break; case 'is_meta': $values['is_meta'] = (int)$group->isMeta(); break; default: $values[$field] = $group->{$field}; // @todo uses __get() fixme } } $values['ts_changed'] = $group->touch()->format('Y-m-d H:i:s'); if ($group->getId()) { $this->dispatch($group, 'preSave', [], $userId); $this ->database ->merge('ucms_group') ->key(['id' => $group->getId()]) ->fields($values) ->execute() ; $this->dispatch($group, 'save', [], $userId); } else { $this->dispatch($group, 'preCreate', [], $userId); $values['ts_created'] = $values['ts_changed']; $id = $this ->database ->insert('ucms_group') ->fields($values) ->execute() ; $group->setId($id); $this->dispatch($group, 'create', [], $userId); } }
php
public function save(Group $group, array $fields = null, $userId = null) { $eligible = [ 'title', 'is_ghost', 'is_meta', 'ts_created', 'ts_changed', 'attributes', ]; if (null === $fields) { $fields = $eligible; } else { $fields = array_intersect($eligible, $fields); } $values = []; foreach ($fields as $field) { switch ($field) { case 'attributes': $attributes = $group->getAttributes(); if (empty($attributes)) { $values[$field] = null; } else { $values[$field] = serialize($attributes); } break; case 'is_ghost': $values['is_ghost'] = (int)$group->isGhost(); break; case 'is_meta': $values['is_meta'] = (int)$group->isMeta(); break; default: $values[$field] = $group->{$field}; // @todo uses __get() fixme } } $values['ts_changed'] = $group->touch()->format('Y-m-d H:i:s'); if ($group->getId()) { $this->dispatch($group, 'preSave', [], $userId); $this ->database ->merge('ucms_group') ->key(['id' => $group->getId()]) ->fields($values) ->execute() ; $this->dispatch($group, 'save', [], $userId); } else { $this->dispatch($group, 'preCreate', [], $userId); $values['ts_created'] = $values['ts_changed']; $id = $this ->database ->insert('ucms_group') ->fields($values) ->execute() ; $group->setId($id); $this->dispatch($group, 'create', [], $userId); } }
[ "public", "function", "save", "(", "Group", "$", "group", ",", "array", "$", "fields", "=", "null", ",", "$", "userId", "=", "null", ")", "{", "$", "eligible", "=", "[", "'title'", ",", "'is_ghost'", ",", "'is_meta'", ",", "'ts_created'", ",", "'ts_cha...
Save given group If the given group has no identifier, its identifier will be set @param Group $group @param array $fields If set, update only the given fields @param int $userId Who did this!
[ "Save", "given", "group" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L160-L233
235,086
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.delete
public function delete(Group $group, $userId = null) { $this->dispatch($group, 'preDelete', [], $userId); $this->database->delete('ucms_group')->condition('id', $group->getId())->execute(); $this->dispatch($group, 'delete', [], $userId); }
php
public function delete(Group $group, $userId = null) { $this->dispatch($group, 'preDelete', [], $userId); $this->database->delete('ucms_group')->condition('id', $group->getId())->execute(); $this->dispatch($group, 'delete', [], $userId); }
[ "public", "function", "delete", "(", "Group", "$", "group", ",", "$", "userId", "=", "null", ")", "{", "$", "this", "->", "dispatch", "(", "$", "group", ",", "'preDelete'", ",", "[", "]", ",", "$", "userId", ")", ";", "$", "this", "->", "database",...
Delete the given group @param Group $group @param int $userId Who did this!
[ "Delete", "the", "given", "group" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L242-L249
235,087
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.getSiteGroup
public function getSiteGroup(Site $site) { $groupId = $site->getGroupId(); if ($groupId) { return $this->findOne($groupId); } }
php
public function getSiteGroup(Site $site) { $groupId = $site->getGroupId(); if ($groupId) { return $this->findOne($groupId); } }
[ "public", "function", "getSiteGroup", "(", "Site", "$", "site", ")", "{", "$", "groupId", "=", "$", "site", "->", "getGroupId", "(", ")", ";", "if", "(", "$", "groupId", ")", "{", "return", "$", "this", "->", "findOne", "(", "$", "groupId", ")", ";...
Get site groups @param Site $site @return Group
[ "Get", "site", "groups" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L284-L291
235,088
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.addSite
public function addSite($groupId, $siteId, $allowChange = false) { $ret = false; $currentGroupId = (int)$this ->database ->query( "SELECT group_id FROM {ucms_site} WHERE id = :site", [':site' => $siteId] ) ->fetchField() ; if (!$allowChange && $currentGroupId && $currentGroupId !== (int)$groupId) { throw new GroupMoveDisallowedException("site group change is not allowed"); } if ($currentGroupId !== (int)$groupId) { $this ->database ->query( "UPDATE {ucms_site} SET group_id = :group WHERE id = :site", [':site' => $siteId, ':group' => $groupId] ) ; $ret = true; } $this->touch($groupId); // @todo dispatch event return $ret; }
php
public function addSite($groupId, $siteId, $allowChange = false) { $ret = false; $currentGroupId = (int)$this ->database ->query( "SELECT group_id FROM {ucms_site} WHERE id = :site", [':site' => $siteId] ) ->fetchField() ; if (!$allowChange && $currentGroupId && $currentGroupId !== (int)$groupId) { throw new GroupMoveDisallowedException("site group change is not allowed"); } if ($currentGroupId !== (int)$groupId) { $this ->database ->query( "UPDATE {ucms_site} SET group_id = :group WHERE id = :site", [':site' => $siteId, ':group' => $groupId] ) ; $ret = true; } $this->touch($groupId); // @todo dispatch event return $ret; }
[ "public", "function", "addSite", "(", "$", "groupId", ",", "$", "siteId", ",", "$", "allowChange", "=", "false", ")", "{", "$", "ret", "=", "false", ";", "$", "currentGroupId", "=", "(", "int", ")", "$", "this", "->", "database", "->", "query", "(", ...
Add site to group @param int $groupId @param int $siteId @param boolean $allowChange If set to false and site does already belong to a group, throw an exception @return bool True if user was really added, false if site is already in group
[ "Add", "site", "to", "group" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L305-L339
235,089
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.removeSite
public function removeSite($groupId, $siteId) { $currentGroupId = (int)$this ->database ->query( "SELECT group_id FROM {ucms_site} WHERE id = :site", [':site' => $siteId] ) ->fetchField() ; if ($currentGroupId !== (int)$groupId) { throw new GroupMoveDisallowedException(sprintf("%s site is not in group %s", $siteId, $groupId)); } $this ->database ->query( "UPDATE {ucms_site} SET group_id = NULL WHERE id = :site", [':site' => $siteId] ) ; // @todo dispatch event $this->touch($groupId); }
php
public function removeSite($groupId, $siteId) { $currentGroupId = (int)$this ->database ->query( "SELECT group_id FROM {ucms_site} WHERE id = :site", [':site' => $siteId] ) ->fetchField() ; if ($currentGroupId !== (int)$groupId) { throw new GroupMoveDisallowedException(sprintf("%s site is not in group %s", $siteId, $groupId)); } $this ->database ->query( "UPDATE {ucms_site} SET group_id = NULL WHERE id = :site", [':site' => $siteId] ) ; // @todo dispatch event $this->touch($groupId); }
[ "public", "function", "removeSite", "(", "$", "groupId", ",", "$", "siteId", ")", "{", "$", "currentGroupId", "=", "(", "int", ")", "$", "this", "->", "database", "->", "query", "(", "\"SELECT group_id FROM {ucms_site} WHERE id = :site\"", ",", "[", "':site'", ...
Remote site from group @param int $groupId @param int $siteId
[ "Remote", "site", "from", "group" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L347-L373
235,090
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.userIsMember
public function userIsMember(AccountInterface $account, Group $group) { // @todo fix this, cache that return (bool)$this ->database ->query( "SELECT 1 FROM {ucms_group_access} WHERE group_id = :group AND user_id = :user", [':group' => $group->getId(), ':user' => $account->id()] ) ->fetchField() ; }
php
public function userIsMember(AccountInterface $account, Group $group) { // @todo fix this, cache that return (bool)$this ->database ->query( "SELECT 1 FROM {ucms_group_access} WHERE group_id = :group AND user_id = :user", [':group' => $group->getId(), ':user' => $account->id()] ) ->fetchField() ; }
[ "public", "function", "userIsMember", "(", "AccountInterface", "$", "account", ",", "Group", "$", "group", ")", "{", "// @todo fix this, cache that", "return", "(", "bool", ")", "$", "this", "->", "database", "->", "query", "(", "\"SELECT 1 FROM {ucms_group_access} ...
Is user member of the given group @param AccountInterface $account @param Group $group @return bool
[ "Is", "user", "member", "of", "the", "given", "group" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L383-L394
235,091
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.addMember
public function addMember($groupId, $userId) { $exists = (bool)$this ->database ->query( "SELECT 1 FROM {ucms_group_access} WHERE group_id = :group AND user_id = :user", [':group' => $groupId, ':user' => $userId] ) ->fetchField() ; if ($exists) { return false; } $this ->database ->merge('ucms_group_access') ->key([ 'group_id' => $groupId, 'user_id' => $userId, ]) ->execute() ; // @todo dispatch event $this->touch($groupId); $this->resetCache(); return true; }
php
public function addMember($groupId, $userId) { $exists = (bool)$this ->database ->query( "SELECT 1 FROM {ucms_group_access} WHERE group_id = :group AND user_id = :user", [':group' => $groupId, ':user' => $userId] ) ->fetchField() ; if ($exists) { return false; } $this ->database ->merge('ucms_group_access') ->key([ 'group_id' => $groupId, 'user_id' => $userId, ]) ->execute() ; // @todo dispatch event $this->touch($groupId); $this->resetCache(); return true; }
[ "public", "function", "addMember", "(", "$", "groupId", ",", "$", "userId", ")", "{", "$", "exists", "=", "(", "bool", ")", "$", "this", "->", "database", "->", "query", "(", "\"SELECT 1 FROM {ucms_group_access} WHERE group_id = :group AND user_id = :user\"", ",", ...
Add member to group @param int $groupId @param int $userId @return bool True if user was really added, false if user is already a member
[ "Add", "member", "to", "group" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L450-L482
235,092
makinacorpus/drupal-ucms
ucms_site/src/GroupManager.php
GroupManager.removeMember
public function removeMember($groupId, $userId) { $this ->database ->delete('ucms_group_access') ->condition('group_id', $groupId) ->condition('user_id', $userId) ->execute() ; // @todo dispatch event $this->touch($groupId); $this->resetCache(); }
php
public function removeMember($groupId, $userId) { $this ->database ->delete('ucms_group_access') ->condition('group_id', $groupId) ->condition('user_id', $userId) ->execute() ; // @todo dispatch event $this->touch($groupId); $this->resetCache(); }
[ "public", "function", "removeMember", "(", "$", "groupId", ",", "$", "userId", ")", "{", "$", "this", "->", "database", "->", "delete", "(", "'ucms_group_access'", ")", "->", "condition", "(", "'group_id'", ",", "$", "groupId", ")", "->", "condition", "(",...
Remove member from group If association does not exists, this will silently do nothing @param int $groupId @param int $userId
[ "Remove", "member", "from", "group" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/GroupManager.php#L492-L507
235,093
potsky/microsoft-translator-php-sdk
src/MicrosoftTranslator/Auth.php
Auth.getAccessToken
public function getAccessToken($force_new = false) { if ($this->guard->hasAccessToken()) { $access_token = $this->guard->getAccessToken(); return $access_token; } return $this->generateAndStoreNewAccessToken(); }
php
public function getAccessToken($force_new = false) { if ($this->guard->hasAccessToken()) { $access_token = $this->guard->getAccessToken(); return $access_token; } return $this->generateAndStoreNewAccessToken(); }
[ "public", "function", "getAccessToken", "(", "$", "force_new", "=", "false", ")", "{", "if", "(", "$", "this", "->", "guard", "->", "hasAccessToken", "(", ")", ")", "{", "$", "access_token", "=", "$", "this", "->", "guard", "->", "getAccessToken", "(", ...
Get an access token If available, the stored access token will be used If not available or if $force_new is true, a new one will be generated @param bool|false $force_new @return array|string @throws \MicrosoftTranslator\Exception
[ "Get", "an", "access", "token" ]
102f2411be5abb0e57a73c475f8e9e185a9f4859
https://github.com/potsky/microsoft-translator-php-sdk/blob/102f2411be5abb0e57a73c475f8e9e185a9f4859/src/MicrosoftTranslator/Auth.php#L107-L116
235,094
makinacorpus/drupal-ucms
ucms_site/src/EventDispatcher/AllowListEvent.php
AllowListEvent.remove
public function remove($item) { foreach ($this->currentList as $index => $candidate) { if ($candidate === $item) { unset($this->currentList[$index]); } } }
php
public function remove($item) { foreach ($this->currentList as $index => $candidate) { if ($candidate === $item) { unset($this->currentList[$index]); } } }
[ "public", "function", "remove", "(", "$", "item", ")", "{", "foreach", "(", "$", "this", "->", "currentList", "as", "$", "index", "=>", "$", "candidate", ")", "{", "if", "(", "$", "candidate", "===", "$", "item", ")", "{", "unset", "(", "$", "this"...
Remove item from list @param string $item
[ "Remove", "item", "from", "list" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/EventDispatcher/AllowListEvent.php#L56-L63
235,095
makinacorpus/drupal-ucms
ucms_site/src/EventDispatcher/AllowListEvent.php
AllowListEvent.add
public function add($item) { // Disallow items outside of original boundaries if (!in_array($item, $this->originalList)) { return; } if (!in_array($item, $this->currentList)) { $this->currentList[] = $item; } }
php
public function add($item) { // Disallow items outside of original boundaries if (!in_array($item, $this->originalList)) { return; } if (!in_array($item, $this->currentList)) { $this->currentList[] = $item; } }
[ "public", "function", "add", "(", "$", "item", ")", "{", "// Disallow items outside of original boundaries", "if", "(", "!", "in_array", "(", "$", "item", ",", "$", "this", "->", "originalList", ")", ")", "{", "return", ";", "}", "if", "(", "!", "in_array"...
Add item into list @param string $item
[ "Add", "item", "into", "list" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/EventDispatcher/AllowListEvent.php#L70-L79
235,096
PHPixie/HTTP
src/PHPixie/HTTP/Output.php
Output.response
public function response($response, $context = null) { $responseMessage = $response->asResponseMessage($context); $this->responseMessage($responseMessage); }
php
public function response($response, $context = null) { $responseMessage = $response->asResponseMessage($context); $this->responseMessage($responseMessage); }
[ "public", "function", "response", "(", "$", "response", ",", "$", "context", "=", "null", ")", "{", "$", "responseMessage", "=", "$", "response", "->", "asResponseMessage", "(", "$", "context", ")", ";", "$", "this", "->", "responseMessage", "(", "$", "r...
Output a HTTP response with optional context @param Responses\Response $response @param Context $context @return void
[ "Output", "a", "HTTP", "response", "with", "optional", "context" ]
581c0df452fd07ca4ea0b3e24e8ddee8dddc2912
https://github.com/PHPixie/HTTP/blob/581c0df452fd07ca4ea0b3e24e8ddee8dddc2912/src/PHPixie/HTTP/Output.php#L17-L21
235,097
PHPixie/HTTP
src/PHPixie/HTTP/Output.php
Output.responseMessage
public function responseMessage($responseMessage) { $this->statusHeader( $responseMessage->getStatusCode(), $responseMessage->getReasonPhrase(), $responseMessage->getProtocolVersion() ); $this->headers($responseMessage->getHeaders()); $this->body($responseMessage->getBody()); }
php
public function responseMessage($responseMessage) { $this->statusHeader( $responseMessage->getStatusCode(), $responseMessage->getReasonPhrase(), $responseMessage->getProtocolVersion() ); $this->headers($responseMessage->getHeaders()); $this->body($responseMessage->getBody()); }
[ "public", "function", "responseMessage", "(", "$", "responseMessage", ")", "{", "$", "this", "->", "statusHeader", "(", "$", "responseMessage", "->", "getStatusCode", "(", ")", ",", "$", "responseMessage", "->", "getReasonPhrase", "(", ")", ",", "$", "response...
Output a PSR 7 response message @param Messages\Message\Response $responseMessage
[ "Output", "a", "PSR", "7", "response", "message" ]
581c0df452fd07ca4ea0b3e24e8ddee8dddc2912
https://github.com/PHPixie/HTTP/blob/581c0df452fd07ca4ea0b3e24e8ddee8dddc2912/src/PHPixie/HTTP/Output.php#L27-L37
235,098
potsky/microsoft-translator-php-sdk
src/MicrosoftTranslator/Client.php
Client.translate
public function translate($text, $to, $from = null, $contentType = 'text/plain', $category = 'general') { $query_parameters = [ 'text' => $text, 'to' => $to, 'contentType' => $contentType, 'category' => $category, ]; if (! is_null($from)) { $query_parameters['from'] = $from; } return $this->get('/Translate', [], $query_parameters); }
php
public function translate($text, $to, $from = null, $contentType = 'text/plain', $category = 'general') { $query_parameters = [ 'text' => $text, 'to' => $to, 'contentType' => $contentType, 'category' => $category, ]; if (! is_null($from)) { $query_parameters['from'] = $from; } return $this->get('/Translate', [], $query_parameters); }
[ "public", "function", "translate", "(", "$", "text", ",", "$", "to", ",", "$", "from", "=", "null", ",", "$", "contentType", "=", "'text/plain'", ",", "$", "category", "=", "'general'", ")", "{", "$", "query_parameters", "=", "[", "'text'", "=>", "$", ...
Translates a text string from one language to another. @param string $text Required. A string representing the text to translate. The size of the text must not exceed 10000 characters. @param string $to Required. A string representing the language code to translate the text into. @param string|null $from Optional. A string representing the language code of the translation text. @param string $contentType Optional. The format of the text being translated. The supported formats are "text/plain" and "text/html". Any HTML needs to be well-formed. @param string $category Optional. A string containing the category (domain) of the translation. Defaults to "general". The language codes are available at https://msdn.microsoft.com/en-us/library/hh456380.aspx The API endpoint documentation is available at https://msdn.microsoft.com/en-us/library/ff512421.aspx @return \MicrosoftTranslator\Response @throws \MicrosoftTranslator\Exception
[ "Translates", "a", "text", "string", "from", "one", "language", "to", "another", "." ]
102f2411be5abb0e57a73c475f8e9e185a9f4859
https://github.com/potsky/microsoft-translator-php-sdk/blob/102f2411be5abb0e57a73c475f8e9e185a9f4859/src/MicrosoftTranslator/Client.php#L162-L176
235,099
potsky/microsoft-translator-php-sdk
src/MicrosoftTranslator/Client.php
Client.TransformText
public function TransformText($text, $from, $category = 'general') { $query_parameters = [ 'sentence' => $text, 'language' => $from, 'category' => $category, ]; return $this->get('/TransformText', [], $query_parameters, true, 'http://api.microsofttranslator.com/V3/json/'); }
php
public function TransformText($text, $from, $category = 'general') { $query_parameters = [ 'sentence' => $text, 'language' => $from, 'category' => $category, ]; return $this->get('/TransformText', [], $query_parameters, true, 'http://api.microsofttranslator.com/V3/json/'); }
[ "public", "function", "TransformText", "(", "$", "text", ",", "$", "from", ",", "$", "category", "=", "'general'", ")", "{", "$", "query_parameters", "=", "[", "'sentence'", "=>", "$", "text", ",", "'language'", "=>", "$", "from", ",", "'category'", "=>"...
The TransformText method is a text normalization function for social media, which returns a normalized form of the input. The method can be used as a preprocessing step in Machine Translation or other applications, which expect clean input text than is typically found in social media or user-generated content. The function currently works only with English input. @param string $text Required. A string representing the text to translate. The size of the text must not exceed 10000 characters. @param string $from Required. A string representing the language code. This parameter supports only English with "en" as the language name. @param string|null $category Optional. A string containing the category or domain of the translation. This parameter supports only the default option general. The language codes are available at https://msdn.microsoft.com/en-us/library/hh456380.aspx The API endpoint documentation is available at https://msdn.microsoft.com/en-us/library/dn876735.aspx @return \MicrosoftTranslator\Response @throws \MicrosoftTranslator\Exception
[ "The", "TransformText", "method", "is", "a", "text", "normalization", "function", "for", "social", "media", "which", "returns", "a", "normalized", "form", "of", "the", "input", ".", "The", "method", "can", "be", "used", "as", "a", "preprocessing", "step", "i...
102f2411be5abb0e57a73c475f8e9e185a9f4859
https://github.com/potsky/microsoft-translator-php-sdk/blob/102f2411be5abb0e57a73c475f8e9e185a9f4859/src/MicrosoftTranslator/Client.php#L222-L231