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
partition
stringclasses
1 value
kenarkose/Tracker
src/Cruncher.php
Cruncher.determineLocaleAndQuery
protected function determineLocaleAndQuery($locale, $query) { if (is_null($query)) { $modelName = $this->getViewModelName(); $query = with(new $modelName)->newQuery(); } if ($locale) { $query->where('locale', $locale); } return $query; }
php
protected function determineLocaleAndQuery($locale, $query) { if (is_null($query)) { $modelName = $this->getViewModelName(); $query = with(new $modelName)->newQuery(); } if ($locale) { $query->where('locale', $locale); } return $query; }
[ "protected", "function", "determineLocaleAndQuery", "(", "$", "locale", ",", "$", "query", ")", "{", "if", "(", "is_null", "(", "$", "query", ")", ")", "{", "$", "modelName", "=", "$", "this", "->", "getViewModelName", "(", ")", ";", "$", "query", "=",...
Determines the query and locale @param $locale @param $query @return mixed
[ "Determines", "the", "query", "and", "locale" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Cruncher.php#L352-L367
train
ArgentCrusade/selectel-cloud-storage
src/Traits/MetaData.php
MetaData.extractMetaData
protected function extractMetaData(ResponseInterface $response) { $headers = $this->findMetaHeaders($response); if (!count($headers)) { return []; } $metaData = []; foreach ($headers as $header) { $metaData[$header] = $response->getHeaderLine($header); } return $metaData; }
php
protected function extractMetaData(ResponseInterface $response) { $headers = $this->findMetaHeaders($response); if (!count($headers)) { return []; } $metaData = []; foreach ($headers as $header) { $metaData[$header] = $response->getHeaderLine($header); } return $metaData; }
[ "protected", "function", "extractMetaData", "(", "ResponseInterface", "$", "response", ")", "{", "$", "headers", "=", "$", "this", "->", "findMetaHeaders", "(", "$", "response", ")", ";", "if", "(", "!", "count", "(", "$", "headers", ")", ")", "{", "retu...
Extracts meta data from Object's response headers. @param \Psr\Http\Message\ResponseInterface $response @return array
[ "Extracts", "meta", "data", "from", "Object", "s", "response", "headers", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/Traits/MetaData.php#L49-L64
train
ArgentCrusade/selectel-cloud-storage
src/Traits/MetaData.php
MetaData.findMetaHeaders
protected function findMetaHeaders(ResponseInterface $response) { $headerNames = array_keys($response->getHeaders()); $metaType = $this->objectMetaType(); return array_filter($headerNames, function ($header) use ($metaType) { return strpos($header, 'X-'.$metaType.'-Meta') !== false; }); }
php
protected function findMetaHeaders(ResponseInterface $response) { $headerNames = array_keys($response->getHeaders()); $metaType = $this->objectMetaType(); return array_filter($headerNames, function ($header) use ($metaType) { return strpos($header, 'X-'.$metaType.'-Meta') !== false; }); }
[ "protected", "function", "findMetaHeaders", "(", "ResponseInterface", "$", "response", ")", "{", "$", "headerNames", "=", "array_keys", "(", "$", "response", "->", "getHeaders", "(", ")", ")", ";", "$", "metaType", "=", "$", "this", "->", "objectMetaType", "...
Filters meta headers from response. @param \Psr\Http\Message\ResponseInterface $response @return array
[ "Filters", "meta", "headers", "from", "response", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/Traits/MetaData.php#L73-L81
train
ArgentCrusade/selectel-cloud-storage
src/Traits/MetaData.php
MetaData.hasMeta
public function hasMeta($name) { $meta = $this->objectData('meta', []); return isset($meta[$this->sanitizeMetaName($name)]); }
php
public function hasMeta($name) { $meta = $this->objectData('meta', []); return isset($meta[$this->sanitizeMetaName($name)]); }
[ "public", "function", "hasMeta", "(", "$", "name", ")", "{", "$", "meta", "=", "$", "this", "->", "objectData", "(", "'meta'", ",", "[", "]", ")", ";", "return", "isset", "(", "$", "meta", "[", "$", "this", "->", "sanitizeMetaName", "(", "$", "name...
Checks if given meta data exists. @param string $name Meta name @return bool
[ "Checks", "if", "given", "meta", "data", "exists", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/Traits/MetaData.php#L104-L109
train
ArgentCrusade/selectel-cloud-storage
src/Traits/MetaData.php
MetaData.getMeta
public function getMeta($name) { if (!$this->hasMeta($name)) { throw new InvalidArgumentException('Meta data with name "'.$name.'" does not exists.'); } $meta = $this->objectData('meta', []); return $meta[$this->sanitizeMetaName($name)]; }
php
public function getMeta($name) { if (!$this->hasMeta($name)) { throw new InvalidArgumentException('Meta data with name "'.$name.'" does not exists.'); } $meta = $this->objectData('meta', []); return $meta[$this->sanitizeMetaName($name)]; }
[ "public", "function", "getMeta", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "hasMeta", "(", "$", "name", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Meta data with name \"'", ".", "$", "name", ".", "'\" does not ex...
Returns meta data. @param string $name Meta name @throws \InvalidArgumentException @return mixed
[ "Returns", "meta", "data", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/Traits/MetaData.php#L120-L129
train
ArgentCrusade/selectel-cloud-storage
src/Traits/MetaData.php
MetaData.setMeta
public function setMeta(array $meta) { $headers = []; $metaType = $this->objectMetaType(); // We will replace any 'X-{Object}-Meta-' prefixes in meta name // and prepend final header names with same prefix so API will // receive sanitized headers and won't produce any errors. foreach ($meta as $name => $value) { $key = str_replace('X-'.$metaType.'-Meta-', '', $name); $headers['X-'.$metaType.'-Meta-'.$key] = $value; } $response = $this->apiClient()->request('POST', $this->absolutePath(), ['headers' => $headers]); if ($response->getStatusCode() !== 202) { throw new ApiRequestFailedException('Unable to update container meta data.', $response->getStatusCode()); } return true; }
php
public function setMeta(array $meta) { $headers = []; $metaType = $this->objectMetaType(); // We will replace any 'X-{Object}-Meta-' prefixes in meta name // and prepend final header names with same prefix so API will // receive sanitized headers and won't produce any errors. foreach ($meta as $name => $value) { $key = str_replace('X-'.$metaType.'-Meta-', '', $name); $headers['X-'.$metaType.'-Meta-'.$key] = $value; } $response = $this->apiClient()->request('POST', $this->absolutePath(), ['headers' => $headers]); if ($response->getStatusCode() !== 202) { throw new ApiRequestFailedException('Unable to update container meta data.', $response->getStatusCode()); } return true; }
[ "public", "function", "setMeta", "(", "array", "$", "meta", ")", "{", "$", "headers", "=", "[", "]", ";", "$", "metaType", "=", "$", "this", "->", "objectMetaType", "(", ")", ";", "// We will replace any 'X-{Object}-Meta-' prefixes in meta name", "// and prepend f...
Updates object meta data. @param array $meta Array of meta data (without "X-{Object}-Meta" prefixes). @throws \ArgentCrusade\Selectel\CloudStorage\Exceptions\ApiRequestFailedException @return bool
[ "Updates", "object", "meta", "data", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/Traits/MetaData.php#L140-L161
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/SubscriptionEntity.php
SubscriptionEntity.getContext
public function getContext($options = []) { $url = $this->getBaseURI(); if (count($options) > 0) { $prefix = ($this->_type) ? "&" : "?"; $url .= $prefix . urldecode(http_build_query($options)); } return $this->_orion->get($url); }
php
public function getContext($options = []) { $url = $this->getBaseURI(); if (count($options) > 0) { $prefix = ($this->_type) ? "&" : "?"; $url .= $prefix . urldecode(http_build_query($options)); } return $this->_orion->get($url); }
[ "public", "function", "getContext", "(", "$", "options", "=", "[", "]", ")", "{", "$", "url", "=", "$", "this", "->", "getBaseURI", "(", ")", ";", "if", "(", "count", "(", "$", "options", ")", ">", "0", ")", "{", "$", "prefix", "=", "(", "$", ...
Executes OPERATIONS IN THE NGSIv2 RC 2016.05 @param array $options Array of options compatible to operation described in https://docs.google.com/spreadsheets/d/1f4m624nmO3jRjNalGE11lFLQixnfCENMV6dc54wUCCg/edit#gid=50130961 @return \Orion\Context\Context
[ "Executes", "OPERATIONS", "IN", "THE", "NGSIv2", "RC", "2016", ".", "05" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/SubscriptionEntity.php#L44-L53
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/SubscriptionEntity.php
SubscriptionEntity.update
public function update($subscription){ if(!isset($this->_id) || null == $this->_id){ throw new \Exception("You must especify an Id to perform subscription updates"); } if($subscription instanceof SubscriptionFactory){ $context = new ContextFactory((array) $subscription->get()); }elseif(is_array($subscription) || is_object($subscription)){ $context = new ContextFactory((array)$subscription); } return $this->_orion->patch($this->getBaseURI(), $context); }
php
public function update($subscription){ if(!isset($this->_id) || null == $this->_id){ throw new \Exception("You must especify an Id to perform subscription updates"); } if($subscription instanceof SubscriptionFactory){ $context = new ContextFactory((array) $subscription->get()); }elseif(is_array($subscription) || is_object($subscription)){ $context = new ContextFactory((array)$subscription); } return $this->_orion->patch($this->getBaseURI(), $context); }
[ "public", "function", "update", "(", "$", "subscription", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_id", ")", "||", "null", "==", "$", "this", "->", "_id", ")", "{", "throw", "new", "\\", "Exception", "(", "\"You must especify an Id ...
Update a subscription, you can pass a simple array chain in subscription know format or you can send a instance of SubscriptionFactory @param \Orion\Context\SubscriptionFactory|array $subscription @return type @throws \Exception
[ "Update", "a", "subscription", "you", "can", "pass", "a", "simple", "array", "chain", "in", "subscription", "know", "format", "or", "you", "can", "send", "a", "instance", "of", "SubscriptionFactory" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/SubscriptionEntity.php#L93-L103
train
rotassator/omnipay-payway-restapi
src/Helper/Uuid.php
Uuid.create
public static function create() { // use COM helper if available if (function_exists('com_create_guid')) { return com_create_guid(); } // generate UUID mt_srand((double) microtime() * 10000); // optional for php 4.2.0 and up. $charid = strtoupper(md5(uniqid(rand(), true))); $uuid = join('-', array( substr($charid, 0, 8), substr($charid, 8, 4), substr($charid, 12, 4), substr($charid, 16, 4), substr($charid, 20, 12), )); return $uuid; }
php
public static function create() { // use COM helper if available if (function_exists('com_create_guid')) { return com_create_guid(); } // generate UUID mt_srand((double) microtime() * 10000); // optional for php 4.2.0 and up. $charid = strtoupper(md5(uniqid(rand(), true))); $uuid = join('-', array( substr($charid, 0, 8), substr($charid, 8, 4), substr($charid, 12, 4), substr($charid, 16, 4), substr($charid, 20, 12), )); return $uuid; }
[ "public", "static", "function", "create", "(", ")", "{", "// use COM helper if available", "if", "(", "function_exists", "(", "'com_create_guid'", ")", ")", "{", "return", "com_create_guid", "(", ")", ";", "}", "// generate UUID", "mt_srand", "(", "(", "double", ...
Create UUID v4 string Inspiration from GUI: the guid generator @see http://guid.us/GUID/PHP @return string UUID v4 as string
[ "Create", "UUID", "v4", "string" ]
4241c1fd0d52a663839d5b65858d6ddf2af2670f
https://github.com/rotassator/omnipay-payway-restapi/blob/4241c1fd0d52a663839d5b65858d6ddf2af2670f/src/Helper/Uuid.php#L19-L38
train
webeweb/jquery-datatables-bundle
Helper/DataTablesWrapperHelper.php
DataTablesWrapperHelper.getLanguageURL
public static function getLanguageURL($language) { // Initialize the directory. $dir = ObjectHelper::getDirectory(JQueryDataTablesBundle::class); $dir .= "/Resources/public/datatables-i18n/%language%.json"; // Initialize the URI. $uri = "/bundles/jquerydatatables/datatables-i18n/%language%.json"; // Initialize the URL. $url = StringHelper::replace($uri, ["%language%"], [$language]); // Initialize and check the filename. $file = StringHelper::replace($dir, ["%language%"], [$language]); if (false === file_exists($file)) { throw new FileNotFoundException(null, 500, null, $url); } return $url; }
php
public static function getLanguageURL($language) { // Initialize the directory. $dir = ObjectHelper::getDirectory(JQueryDataTablesBundle::class); $dir .= "/Resources/public/datatables-i18n/%language%.json"; // Initialize the URI. $uri = "/bundles/jquerydatatables/datatables-i18n/%language%.json"; // Initialize the URL. $url = StringHelper::replace($uri, ["%language%"], [$language]); // Initialize and check the filename. $file = StringHelper::replace($dir, ["%language%"], [$language]); if (false === file_exists($file)) { throw new FileNotFoundException(null, 500, null, $url); } return $url; }
[ "public", "static", "function", "getLanguageURL", "(", "$", "language", ")", "{", "// Initialize the directory.", "$", "dir", "=", "ObjectHelper", "::", "getDirectory", "(", "JQueryDataTablesBundle", "::", "class", ")", ";", "$", "dir", ".=", "\"/Resources/public/da...
Get a language URL. @param string $language The language. @return string Returns the language URL. @throws FileNotFoundException Throws a file not found exception if the language file does not exist.
[ "Get", "a", "language", "URL", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Helper/DataTablesWrapperHelper.php#L36-L55
train
webeweb/jquery-datatables-bundle
Helper/DataTablesWrapperHelper.php
DataTablesWrapperHelper.getOptions
public static function getOptions(DataTablesWrapperInterface $dtWrapper) { $output = []; if (null !== $dtWrapper->getOptions()) { $output = $dtWrapper->getOptions()->getOptions(); } $output["ajax"] = []; $output["ajax"]["type"] = $dtWrapper->getMethod(); $output["ajax"]["url"] = $dtWrapper->getUrl(); $output["columns"] = []; $output["order"] = $dtWrapper->getOrder(); $output["processing"] = $dtWrapper->getProcessing(); $output["serverSide"] = $dtWrapper->getServerSide(); foreach ($dtWrapper->getColumns() as $current) { $output["columns"][] = DataTablesNormalizer::normalizeColumn($current); } return $output; }
php
public static function getOptions(DataTablesWrapperInterface $dtWrapper) { $output = []; if (null !== $dtWrapper->getOptions()) { $output = $dtWrapper->getOptions()->getOptions(); } $output["ajax"] = []; $output["ajax"]["type"] = $dtWrapper->getMethod(); $output["ajax"]["url"] = $dtWrapper->getUrl(); $output["columns"] = []; $output["order"] = $dtWrapper->getOrder(); $output["processing"] = $dtWrapper->getProcessing(); $output["serverSide"] = $dtWrapper->getServerSide(); foreach ($dtWrapper->getColumns() as $current) { $output["columns"][] = DataTablesNormalizer::normalizeColumn($current); } return $output; }
[ "public", "static", "function", "getOptions", "(", "DataTablesWrapperInterface", "$", "dtWrapper", ")", "{", "$", "output", "=", "[", "]", ";", "if", "(", "null", "!==", "$", "dtWrapper", "->", "getOptions", "(", ")", ")", "{", "$", "output", "=", "$", ...
Get the options. @param DataTablesWrapperInterface $dtWrapper The wrapper. @return array Returns the options.
[ "Get", "the", "options", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Helper/DataTablesWrapperHelper.php#L73-L94
train
ArgentCrusade/selectel-cloud-storage
src/File.php
File.fileData
protected function fileData($key, $default = null) { $this->guardDeletedFile(); return isset($this->data[$key]) ? $this->data[$key] : $default; }
php
protected function fileData($key, $default = null) { $this->guardDeletedFile(); return isset($this->data[$key]) ? $this->data[$key] : $default; }
[ "protected", "function", "fileData", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "$", "this", "->", "guardDeletedFile", "(", ")", ";", "return", "isset", "(", "$", "this", "->", "data", "[", "$", "key", "]", ")", "?", "$", "this", ...
Returns specific file data. @param string $key @param mixed $default = null @throws \LogicException @return mixed|null
[ "Returns", "specific", "file", "data", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/File.php#L63-L68
train
ArgentCrusade/selectel-cloud-storage
src/File.php
File.absolutePath
protected function absolutePath($path = '') { if (!$path) { $path = $this->path(); } return '/'.$this->container().($path ? '/'.ltrim($path, '/') : ''); }
php
protected function absolutePath($path = '') { if (!$path) { $path = $this->path(); } return '/'.$this->container().($path ? '/'.ltrim($path, '/') : ''); }
[ "protected", "function", "absolutePath", "(", "$", "path", "=", "''", ")", "{", "if", "(", "!", "$", "path", ")", "{", "$", "path", "=", "$", "this", "->", "path", "(", ")", ";", "}", "return", "'/'", ".", "$", "this", "->", "container", "(", "...
Absolute path to file from storage root. @param string $path = '' Relative file path. @return string
[ "Absolute", "path", "to", "file", "from", "storage", "root", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/File.php#L77-L84
train
ArgentCrusade/selectel-cloud-storage
src/File.php
File.read
public function read() { $response = $this->api->request('GET', $this->absolutePath()); return (string) $response->getBody(); }
php
public function read() { $response = $this->api->request('GET', $this->absolutePath()); return (string) $response->getBody(); }
[ "public", "function", "read", "(", ")", "{", "$", "response", "=", "$", "this", "->", "api", "->", "request", "(", "'GET'", ",", "$", "this", "->", "absolutePath", "(", ")", ")", ";", "return", "(", "string", ")", "$", "response", "->", "getBody", ...
Reads file contents. @return string
[ "Reads", "file", "contents", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/File.php#L203-L208
train
ArgentCrusade/selectel-cloud-storage
src/File.php
File.readStream
public function readStream($psr7Stream = false) { $response = $this->api->request('GET', $this->absolutePath()); if ($psr7Stream) { return $response->getBody(); } return StreamWrapper::getResource($response->getBody()); }
php
public function readStream($psr7Stream = false) { $response = $this->api->request('GET', $this->absolutePath()); if ($psr7Stream) { return $response->getBody(); } return StreamWrapper::getResource($response->getBody()); }
[ "public", "function", "readStream", "(", "$", "psr7Stream", "=", "false", ")", "{", "$", "response", "=", "$", "this", "->", "api", "->", "request", "(", "'GET'", ",", "$", "this", "->", "absolutePath", "(", ")", ")", ";", "if", "(", "$", "psr7Stream...
Reads file contents as stream. @param bool $psr7Stream = false @return resource|\Psr\Http\Message\StreamInterface
[ "Reads", "file", "contents", "as", "stream", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/File.php#L217-L226
train
ArgentCrusade/selectel-cloud-storage
src/File.php
File.rename
public function rename($name) { $this->guardDeletedFile(); // If there is any slash character in new name, Selectel // will create new virtual directory and copy file to // this new one. Such behaviour may be unexpected. if (count(explode('/', $name)) > 1) { throw new InvalidArgumentException('File name can not contain "/" character.'); } $destination = $this->directory().'/'.$name; $response = $this->api->request('PUT', $this->absolutePath($destination), [ 'headers' => [ 'X-Copy-From' => $this->absolutePath(), 'Content-Length' => 0, ], ]); if ($response->getStatusCode() !== 201) { throw new ApiRequestFailedException( 'Unable to rename file from "'.$this->name().'" to "'.$name.'" (path: "'.$this->directory().'").', $response->getStatusCode() ); } // Since Selectel Storage does not provide such method as "rename", // we need to delete original file after copying. Also, "deleted" // flag needs to be reverted because file was actually renamed. $this->delete(); $this->deleted = false; return $this->data['name'] = $destination; }
php
public function rename($name) { $this->guardDeletedFile(); // If there is any slash character in new name, Selectel // will create new virtual directory and copy file to // this new one. Such behaviour may be unexpected. if (count(explode('/', $name)) > 1) { throw new InvalidArgumentException('File name can not contain "/" character.'); } $destination = $this->directory().'/'.$name; $response = $this->api->request('PUT', $this->absolutePath($destination), [ 'headers' => [ 'X-Copy-From' => $this->absolutePath(), 'Content-Length' => 0, ], ]); if ($response->getStatusCode() !== 201) { throw new ApiRequestFailedException( 'Unable to rename file from "'.$this->name().'" to "'.$name.'" (path: "'.$this->directory().'").', $response->getStatusCode() ); } // Since Selectel Storage does not provide such method as "rename", // we need to delete original file after copying. Also, "deleted" // flag needs to be reverted because file was actually renamed. $this->delete(); $this->deleted = false; return $this->data['name'] = $destination; }
[ "public", "function", "rename", "(", "$", "name", ")", "{", "$", "this", "->", "guardDeletedFile", "(", ")", ";", "// If there is any slash character in new name, Selectel", "// will create new virtual directory and copy file to", "// this new one. Such behaviour may be unexpected....
Rename file. New file name must be provided without path. @param string $name @throws \LogicException @throws \InvalidArgumentException @throws \ArgentCrusade\Selectel\CloudStorage\Exceptions\ApiRequestFailedException @return string
[ "Rename", "file", ".", "New", "file", "name", "must", "be", "provided", "without", "path", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/File.php#L239-L275
train
ArgentCrusade/selectel-cloud-storage
src/File.php
File.copy
public function copy($destination, $destinationContainer = null) { $this->guardDeletedFile(); if (is_null($destinationContainer)) { $destinationContainer = $this->container(); } $fullDestination = '/'.$destinationContainer.'/'.ltrim($destination, '/'); $response = $this->api->request('COPY', $this->absolutePath(), [ 'headers' => [ 'Destination' => $fullDestination, ], ]); if ($response->getStatusCode() !== 201) { throw new ApiRequestFailedException( 'Unable to copy file from "'.$this->path().'" to "'.$destination.'".', $response->getStatusCode() ); } return $fullDestination; }
php
public function copy($destination, $destinationContainer = null) { $this->guardDeletedFile(); if (is_null($destinationContainer)) { $destinationContainer = $this->container(); } $fullDestination = '/'.$destinationContainer.'/'.ltrim($destination, '/'); $response = $this->api->request('COPY', $this->absolutePath(), [ 'headers' => [ 'Destination' => $fullDestination, ], ]); if ($response->getStatusCode() !== 201) { throw new ApiRequestFailedException( 'Unable to copy file from "'.$this->path().'" to "'.$destination.'".', $response->getStatusCode() ); } return $fullDestination; }
[ "public", "function", "copy", "(", "$", "destination", ",", "$", "destinationContainer", "=", "null", ")", "{", "$", "this", "->", "guardDeletedFile", "(", ")", ";", "if", "(", "is_null", "(", "$", "destinationContainer", ")", ")", "{", "$", "destinationCo...
Copy file to given destination. @param string $destination @param string $destinationContainer = null @throws \LogicException @return string
[ "Copy", "file", "to", "given", "destination", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/File.php#L287-L311
train
ArgentCrusade/selectel-cloud-storage
src/File.php
File.delete
public function delete() { $this->guardDeletedFile(); $response = $this->api->request('DELETE', $this->absolutePath()); if ($response->getStatusCode() !== 204) { throw new ApiRequestFailedException('Unable to delete file "'.$this->path().'".', $response->getStatusCode()); } // Set deleted flag to true, so any other calls to // this File will result in throwing exception. $this->deleted = true; return true; }
php
public function delete() { $this->guardDeletedFile(); $response = $this->api->request('DELETE', $this->absolutePath()); if ($response->getStatusCode() !== 204) { throw new ApiRequestFailedException('Unable to delete file "'.$this->path().'".', $response->getStatusCode()); } // Set deleted flag to true, so any other calls to // this File will result in throwing exception. $this->deleted = true; return true; }
[ "public", "function", "delete", "(", ")", "{", "$", "this", "->", "guardDeletedFile", "(", ")", ";", "$", "response", "=", "$", "this", "->", "api", "->", "request", "(", "'DELETE'", ",", "$", "this", "->", "absolutePath", "(", ")", ")", ";", "if", ...
Deletes file. @throws \LogicException @throws \ArgentCrusade\Selectel\CloudStorage\Exceptions\ApiRequestFailedException
[ "Deletes", "file", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/File.php#L319-L335
train
ArgentCrusade/selectel-cloud-storage
src/File.php
File.jsonSerialize
public function jsonSerialize() { return [ 'name' => $this->name(), 'path' => $this->path(), 'directory' => $this->directory(), 'container' => $this->container(), 'size' => $this->size(), 'content_type' => $this->contentType(), 'last_modified' => $this->lastModifiedAt(), 'etag' => $this->etag(), ]; }
php
public function jsonSerialize() { return [ 'name' => $this->name(), 'path' => $this->path(), 'directory' => $this->directory(), 'container' => $this->container(), 'size' => $this->size(), 'content_type' => $this->contentType(), 'last_modified' => $this->lastModifiedAt(), 'etag' => $this->etag(), ]; }
[ "public", "function", "jsonSerialize", "(", ")", "{", "return", "[", "'name'", "=>", "$", "this", "->", "name", "(", ")", ",", "'path'", "=>", "$", "this", "->", "path", "(", ")", ",", "'directory'", "=>", "$", "this", "->", "directory", "(", ")", ...
JSON representation of file. @return array
[ "JSON", "representation", "of", "file", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/File.php#L342-L354
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/GiroCheckout_SDK_Notify.php
GiroCheckout_SDK_Notify.getResponseParam
public function getResponseParam($param) { if (isset($this->notifyParams[$param])) { return $this->notifyParams[$param]; } return NULL; }
php
public function getResponseParam($param) { if (isset($this->notifyParams[$param])) { return $this->notifyParams[$param]; } return NULL; }
[ "public", "function", "getResponseParam", "(", "$", "param", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "notifyParams", "[", "$", "param", "]", ")", ")", "{", "return", "$", "this", "->", "notifyParams", "[", "$", "param", "]", ";", "}", ...
returns the data from the given parameter @param String $param response parameter key @return String data of the given response key
[ "returns", "the", "data", "from", "the", "given", "parameter" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Notify.php#L94-L99
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/GiroCheckout_SDK_Notify.php
GiroCheckout_SDK_Notify.parseNotification
public function parseNotification($params) { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationInput($params); } if (!is_array($params) || empty($params)) { throw new GiroCheckout_SDK_Exception_helper('no data given'); } try { $this->notifyParams = $this->requestMethod->checkNotification($params); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationParams($this->notifyParams); } if (!$this->checkHash()) { throw new GiroCheckout_SDK_Exception_helper('hash mismatch'); } } catch (\Exception $e) { throw new GiroCheckout_SDK_Exception_helper('Failure: ' . $e->getMessage() . "\n"); } return TRUE; }
php
public function parseNotification($params) { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationInput($params); } if (!is_array($params) || empty($params)) { throw new GiroCheckout_SDK_Exception_helper('no data given'); } try { $this->notifyParams = $this->requestMethod->checkNotification($params); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationParams($this->notifyParams); } if (!$this->checkHash()) { throw new GiroCheckout_SDK_Exception_helper('hash mismatch'); } } catch (\Exception $e) { throw new GiroCheckout_SDK_Exception_helper('Failure: ' . $e->getMessage() . "\n"); } return TRUE; }
[ "public", "function", "parseNotification", "(", "$", "params", ")", "{", "$", "Config", "=", "GiroCheckout_SDK_Config", "::", "getInstance", "(", ")", ";", "if", "(", "$", "Config", "->", "getConfig", "(", "'DEBUG_MODE'", ")", ")", "{", "GiroCheckout_SDK_Debug...
parses the given notification array @param mixed[] $params pas the $_GET array or validated input @return boolean if no error occurred @throws GiroCheckout_SDK_Exception_helper if an error occurs
[ "parses", "the", "given", "notification", "array" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Notify.php#L132-L158
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/GiroCheckout_SDK_Notify.php
GiroCheckout_SDK_Notify.checkHash
public function checkHash() { $string = ''; $hashFieldName = $this->requestMethod->getNotifyHashName(); foreach ($this->notifyParams as $k => $v) { if ($k !== $hashFieldName) { $string .= $v; } } if ($this->notifyParams[$hashFieldName] === hash_hmac('md5', $string, $this->secret)) { return TRUE; } return FALSE; }
php
public function checkHash() { $string = ''; $hashFieldName = $this->requestMethod->getNotifyHashName(); foreach ($this->notifyParams as $k => $v) { if ($k !== $hashFieldName) { $string .= $v; } } if ($this->notifyParams[$hashFieldName] === hash_hmac('md5', $string, $this->secret)) { return TRUE; } return FALSE; }
[ "public", "function", "checkHash", "(", ")", "{", "$", "string", "=", "''", ";", "$", "hashFieldName", "=", "$", "this", "->", "requestMethod", "->", "getNotifyHashName", "(", ")", ";", "foreach", "(", "$", "this", "->", "notifyParams", "as", "$", "k", ...
validates the submitted hash by comparing to a self generated Hash @return boolean true if hash test passed
[ "validates", "the", "submitted", "hash", "by", "comparing", "to", "a", "self", "generated", "Hash" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Notify.php#L165-L180
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/GiroCheckout_SDK_Notify.php
GiroCheckout_SDK_Notify.avsSuccessful
public function avsSuccessful() { if ($this->requestMethod->getAVSSuccessfulCode() != NULL) { return $this->requestMethod->getAVSSuccessfulCode() == $this->notifyParams['gcResultAVS']; } return FALSE; }
php
public function avsSuccessful() { if ($this->requestMethod->getAVSSuccessfulCode() != NULL) { return $this->requestMethod->getAVSSuccessfulCode() == $this->notifyParams['gcResultAVS']; } return FALSE; }
[ "public", "function", "avsSuccessful", "(", ")", "{", "if", "(", "$", "this", "->", "requestMethod", "->", "getAVSSuccessfulCode", "(", ")", "!=", "NULL", ")", "{", "return", "$", "this", "->", "requestMethod", "->", "getAVSSuccessfulCode", "(", ")", "==", ...
returns true if the age verification was successful @return boolean result of age verification
[ "returns", "true", "if", "the", "age", "verification", "was", "successful" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Notify.php#L200-L206
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/GiroCheckout_SDK_Notify.php
GiroCheckout_SDK_Notify.sendOkStatus
public function sendOkStatus() { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationOutput('sendOkStatus'); } header('HTTP/1.1 200 OK'); }
php
public function sendOkStatus() { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationOutput('sendOkStatus'); } header('HTTP/1.1 200 OK'); }
[ "public", "function", "sendOkStatus", "(", ")", "{", "$", "Config", "=", "GiroCheckout_SDK_Config", "::", "getInstance", "(", ")", ";", "if", "(", "$", "Config", "->", "getConfig", "(", "'DEBUG_MODE'", ")", ")", "{", "GiroCheckout_SDK_Debug_helper", "::", "get...
sends header with 200 OK status
[ "sends", "header", "with", "200", "OK", "status" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Notify.php#L211-L219
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/GiroCheckout_SDK_Notify.php
GiroCheckout_SDK_Notify.sendBadRequestStatus
public function sendBadRequestStatus() { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationOutput('sendBadRequestStatus'); } header('HTTP/1.1 400 Bad Request'); }
php
public function sendBadRequestStatus() { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationOutput('sendBadRequestStatus'); } header('HTTP/1.1 400 Bad Request'); }
[ "public", "function", "sendBadRequestStatus", "(", ")", "{", "$", "Config", "=", "GiroCheckout_SDK_Config", "::", "getInstance", "(", ")", ";", "if", "(", "$", "Config", "->", "getConfig", "(", "'DEBUG_MODE'", ")", ")", "{", "GiroCheckout_SDK_Debug_helper", "::"...
sends header with 400 Bad Request status
[ "sends", "header", "with", "400", "Bad", "Request", "status" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Notify.php#L224-L232
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/GiroCheckout_SDK_Notify.php
GiroCheckout_SDK_Notify.sendServiceUnavailableStatus
public function sendServiceUnavailableStatus() { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationOutput('sendServiceUnavailableStatus'); } header('HTTP/1.1 503 Service Unavailable'); }
php
public function sendServiceUnavailableStatus() { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationOutput('sendServiceUnavailableStatus'); } header('HTTP/1.1 503 Service Unavailable'); }
[ "public", "function", "sendServiceUnavailableStatus", "(", ")", "{", "$", "Config", "=", "GiroCheckout_SDK_Config", "::", "getInstance", "(", ")", ";", "if", "(", "$", "Config", "->", "getConfig", "(", "'DEBUG_MODE'", ")", ")", "{", "GiroCheckout_SDK_Debug_helper"...
sends header with 503 Service Unavailable status
[ "sends", "header", "with", "503", "Service", "Unavailable", "status" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Notify.php#L237-L245
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/GiroCheckout_SDK_Notify.php
GiroCheckout_SDK_Notify.sendOtherStatus
public function sendOtherStatus() { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationOutput('sendOtherStatus'); } header('HTTP/1.1 404 Not Found'); }
php
public function sendOtherStatus() { $Config = GiroCheckout_SDK_Config::getInstance(); if ($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationOutput('sendOtherStatus'); } header('HTTP/1.1 404 Not Found'); }
[ "public", "function", "sendOtherStatus", "(", ")", "{", "$", "Config", "=", "GiroCheckout_SDK_Config", "::", "getInstance", "(", ")", ";", "if", "(", "$", "Config", "->", "getConfig", "(", "'DEBUG_MODE'", ")", ")", "{", "GiroCheckout_SDK_Debug_helper", "::", "...
sends header with 404 Not Found status
[ "sends", "header", "with", "404", "Not", "Found", "status" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Notify.php#L250-L258
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/GiroCheckout_SDK_Notify.php
GiroCheckout_SDK_Notify.getNotifyResponseStringJson
public function getNotifyResponseStringJson() { $response['Result'] = $this->notifyResponse['Result']; $response['ErrorMessage'] = $this->notifyResponse['ErrorMessage']; $response['OrderId'] = $this->notifyResponse['OrderId']; $response['CustomerId'] = $this->notifyResponse['CustomerId']; $response['MailSent'] = $this->notifyResponse['MailSent']; $response['Timestamp'] = time(); return json_encode($this->notifyResponse); }
php
public function getNotifyResponseStringJson() { $response['Result'] = $this->notifyResponse['Result']; $response['ErrorMessage'] = $this->notifyResponse['ErrorMessage']; $response['OrderId'] = $this->notifyResponse['OrderId']; $response['CustomerId'] = $this->notifyResponse['CustomerId']; $response['MailSent'] = $this->notifyResponse['MailSent']; $response['Timestamp'] = time(); return json_encode($this->notifyResponse); }
[ "public", "function", "getNotifyResponseStringJson", "(", ")", "{", "$", "response", "[", "'Result'", "]", "=", "$", "this", "->", "notifyResponse", "[", "'Result'", "]", ";", "$", "response", "[", "'ErrorMessage'", "]", "=", "$", "this", "->", "notifyRespon...
returns a JSON string to be printed to the notification output @return String JSON string
[ "returns", "a", "JSON", "string", "to", "be", "printed", "to", "the", "notification", "output" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Notify.php#L294-L303
train
oliverklee/ext-oelib
Classes/FrontEndLoginManager.php
Tx_Oelib_FrontEndLoginManager.getLoggedInUser
public function getLoggedInUser($mapperName = \Tx_Oelib_Mapper_FrontEndUser::class) { if ($mapperName === '') { throw new \InvalidArgumentException('$mapperName must not be empty.', 1331488730); } if (!$this->isLoggedIn()) { return null; } if ($this->loggedInUser !== null) { $user = $this->loggedInUser; } else { /** @var \Tx_Oelib_Mapper_FrontEndUser $mapper */ $mapper = \Tx_Oelib_MapperRegistry::get($mapperName); /** @var \Tx_Oelib_Model_FrontEndUser $user */ $user = $mapper->find($this->getFrontEndController()->fe_user->user['uid']); } return $user; }
php
public function getLoggedInUser($mapperName = \Tx_Oelib_Mapper_FrontEndUser::class) { if ($mapperName === '') { throw new \InvalidArgumentException('$mapperName must not be empty.', 1331488730); } if (!$this->isLoggedIn()) { return null; } if ($this->loggedInUser !== null) { $user = $this->loggedInUser; } else { /** @var \Tx_Oelib_Mapper_FrontEndUser $mapper */ $mapper = \Tx_Oelib_MapperRegistry::get($mapperName); /** @var \Tx_Oelib_Model_FrontEndUser $user */ $user = $mapper->find($this->getFrontEndController()->fe_user->user['uid']); } return $user; }
[ "public", "function", "getLoggedInUser", "(", "$", "mapperName", "=", "\\", "Tx_Oelib_Mapper_FrontEndUser", "::", "class", ")", "{", "if", "(", "$", "mapperName", "===", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'$mapperName must not ...
Gets the currently logged-in front-end user. @param string $mapperName the name of the mapper to use for getting the front-end user model, must not be empty @return \Tx_Oelib_Model_FrontEndUser the logged-in front-end user, will be NULL if no user is logged in or if there is no front end
[ "Gets", "the", "currently", "logged", "-", "in", "front", "-", "end", "user", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/FrontEndLoginManager.php#L80-L99
train
wp-jungle/baobab
src/Baobab/Configuration/Initializer/AbstractInitializer.php
AbstractInitializer.getSettingOrThrow
public function getSettingOrThrow($key) { if ( !isset($this->data[$key])) { throw new UnknownSettingException($this->id, $key); } return $this->data[$key]; }
php
public function getSettingOrThrow($key) { if ( !isset($this->data[$key])) { throw new UnknownSettingException($this->id, $key); } return $this->data[$key]; }
[ "public", "function", "getSettingOrThrow", "(", "$", "key", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "data", "[", "$", "key", "]", ")", ")", "{", "throw", "new", "UnknownSettingException", "(", "$", "this", "->", "id", ",", "$", "...
Get the value of a setting in the initializer configuration. If that setting is not found, an exception will be thrown. @param string $key The key of the setting we are interested about @return mixed The setting value
[ "Get", "the", "value", "of", "a", "setting", "in", "the", "initializer", "configuration", ".", "If", "that", "setting", "is", "not", "found", "an", "exception", "will", "be", "thrown", "." ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Configuration/Initializer/AbstractInitializer.php#L50-L58
train
wp-jungle/baobab
src/Baobab/Configuration/Initializer/AbstractInitializer.php
AbstractInitializer.getSetting
public function getSetting($key, $defaultValue) { if ( !isset($this->data[$key])) { return $defaultValue; } return $this->data[$key]; }
php
public function getSetting($key, $defaultValue) { if ( !isset($this->data[$key])) { return $defaultValue; } return $this->data[$key]; }
[ "public", "function", "getSetting", "(", "$", "key", ",", "$", "defaultValue", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "data", "[", "$", "key", "]", ")", ")", "{", "return", "$", "defaultValue", ";", "}", "return", "$", "this", ...
Get the value of a setting in the initializer configuration. If that setting is not found, return the provided default value. @param string $key The key of the setting we are interested about @param mixed $defaultValue The default value to return if not found @return mixed The setting value or the default value
[ "Get", "the", "value", "of", "a", "setting", "in", "the", "initializer", "configuration", ".", "If", "that", "setting", "is", "not", "found", "return", "the", "provided", "default", "value", "." ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Configuration/Initializer/AbstractInitializer.php#L69-L77
train
oliverklee/ext-oelib
Classes/TemplateHelper.php
Tx_Oelib_TemplateHelper.init
public function init($configuration = null) { if ($this->isInitialized) { return; } // Calls the base class's constructor manually as this isn't done automatically. parent::__construct(); $this->initializeConfiguration($configuration); $this->ensureContentObject(); if ($this->extKey !== '') { $this->pi_setPiVarDefaults(); $this->pi_loadLL(); $this->initializeConfigurationCheck(); } $this->isInitialized = true; }
php
public function init($configuration = null) { if ($this->isInitialized) { return; } // Calls the base class's constructor manually as this isn't done automatically. parent::__construct(); $this->initializeConfiguration($configuration); $this->ensureContentObject(); if ($this->extKey !== '') { $this->pi_setPiVarDefaults(); $this->pi_loadLL(); $this->initializeConfigurationCheck(); } $this->isInitialized = true; }
[ "public", "function", "init", "(", "$", "configuration", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isInitialized", ")", "{", "return", ";", "}", "// Calls the base class's constructor manually as this isn't done automatically.", "parent", "::", "__construc...
Initializes the FE plugin stuff and reads the configuration. It is harmless if this function gets called multiple times as it recognizes this and ignores all calls but the first one. This is merely a convenience function. If the parameter is omitted, the configuration for plugin.tx_[extkey] is used instead, e.g. plugin.tx_seminars. @param array|null $configuration TypoScript configuration for the plugin, set to null to load the configuration from a BE page @return void
[ "Initializes", "the", "FE", "plugin", "stuff", "and", "reads", "the", "configuration", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateHelper.php#L74-L93
train
oliverklee/ext-oelib
Classes/TemplateHelper.php
Tx_Oelib_TemplateHelper.getConfValue
private function getConfValue( $fieldName, $sheet = 'sDEF', $isFileName = false, $ignoreFlexform = false ) { $flexformsValue = ''; if (!$ignoreFlexform) { $flexformsValue = $this->pi_getFFvalue( $this->cObj->data['pi_flexform'], $fieldName, $sheet ); } if ($isFileName && $flexformsValue !== null && $flexformsValue !== '') { $flexformsValue = $this->addPathToFileName($flexformsValue); } $confValue = isset($this->conf[$fieldName]) ? $this->conf[$fieldName] : ''; return $flexformsValue ?: $confValue; }
php
private function getConfValue( $fieldName, $sheet = 'sDEF', $isFileName = false, $ignoreFlexform = false ) { $flexformsValue = ''; if (!$ignoreFlexform) { $flexformsValue = $this->pi_getFFvalue( $this->cObj->data['pi_flexform'], $fieldName, $sheet ); } if ($isFileName && $flexformsValue !== null && $flexformsValue !== '') { $flexformsValue = $this->addPathToFileName($flexformsValue); } $confValue = isset($this->conf[$fieldName]) ? $this->conf[$fieldName] : ''; return $flexformsValue ?: $confValue; }
[ "private", "function", "getConfValue", "(", "$", "fieldName", ",", "$", "sheet", "=", "'sDEF'", ",", "$", "isFileName", "=", "false", ",", "$", "ignoreFlexform", "=", "false", ")", "{", "$", "flexformsValue", "=", "''", ";", "if", "(", "!", "$", "ignor...
Gets a value from flexforms or TS setup. The priority lies on flexforms; if nothing is found there, the value from TS setup is returned. If there is no field with that name in TS setup, an empty string is returned. @param string $fieldName field name to extract @param string $sheet sheet pointer, eg. "sDEF" @param bool $isFileName whether this is a filename, which has to be combined with a path @param bool $ignoreFlexform whether to ignore the flexform values and just get the settings from TypoScript, may be empty @return string the value of the corresponding flexforms or TS setup entry (may be empty)
[ "Gets", "a", "value", "from", "flexforms", "or", "TS", "setup", ".", "The", "priority", "lies", "on", "flexforms", ";", "if", "nothing", "is", "found", "there", "the", "value", "from", "TS", "setup", "is", "returned", ".", "If", "there", "is", "no", "f...
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateHelper.php#L275-L297
train
oliverklee/ext-oelib
Classes/TemplateHelper.php
Tx_Oelib_TemplateHelper.addPathToFileName
private function addPathToFileName($fileName, $path = '') { if (empty($path)) { $path = 'uploads/tx_' . $this->extKey . '/'; } return $path . $fileName; }
php
private function addPathToFileName($fileName, $path = '') { if (empty($path)) { $path = 'uploads/tx_' . $this->extKey . '/'; } return $path . $fileName; }
[ "private", "function", "addPathToFileName", "(", "$", "fileName", ",", "$", "path", "=", "''", ")", "{", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "$", "path", "=", "'uploads/tx_'", ".", "$", "this", "->", "extKey", ".", "'/'", ";", "}",...
Adds a path in front of the file name. This is used for files that are selected in the Flexform of the front end plugin. If no path is provided, the default (uploads/[extension_name]/) is used as path. An example (default, with no path provided): If the file is named 'template.tmpl', the output will be 'uploads/[extension_name]/template.tmpl'. The '[extension_name]' will be replaced by the name of the calling extension. @param string $fileName the file name @param string $path the path to the file (without filename), must contain a slash at the end, may contain a slash at the beginning (if not relative) @return string the complete path including file name
[ "Adds", "a", "path", "in", "front", "of", "the", "file", "name", ".", "This", "is", "used", "for", "files", "that", "are", "selected", "in", "the", "Flexform", "of", "the", "front", "end", "plugin", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateHelper.php#L320-L327
train
oliverklee/ext-oelib
Classes/TemplateHelper.php
Tx_Oelib_TemplateHelper.getConfValueString
public function getConfValueString( $fieldName, $sheet = 'sDEF', $isFileName = false, $ignoreFlexform = false ) { return trim( $this->getConfValue( $fieldName, $sheet, $isFileName, $ignoreFlexform ) ); }
php
public function getConfValueString( $fieldName, $sheet = 'sDEF', $isFileName = false, $ignoreFlexform = false ) { return trim( $this->getConfValue( $fieldName, $sheet, $isFileName, $ignoreFlexform ) ); }
[ "public", "function", "getConfValueString", "(", "$", "fieldName", ",", "$", "sheet", "=", "'sDEF'", ",", "$", "isFileName", "=", "false", ",", "$", "ignoreFlexform", "=", "false", ")", "{", "return", "trim", "(", "$", "this", "->", "getConfValue", "(", ...
Gets a trimmed string value from flexforms or TS setup. The priority lies on flexforms; if nothing is found there, the value from TS setup is returned. If there is no field with that name in TS setup, an empty string is returned. @param string $fieldName field name to extract @param string $sheet sheet pointer, eg. "sDEF" @param bool $isFileName whether this is a filename, which has to be combined with a path @param bool $ignoreFlexform whether to ignore the flexform values and just get the settings from TypoScript, may be empty @return string the trimmed value of the corresponding flexforms or TS setup entry (may be empty)
[ "Gets", "a", "trimmed", "string", "value", "from", "flexforms", "or", "TS", "setup", ".", "The", "priority", "lies", "on", "flexforms", ";", "if", "nothing", "is", "found", "there", "the", "value", "from", "TS", "setup", "is", "returned", ".", "If", "the...
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateHelper.php#L344-L358
train
oliverklee/ext-oelib
Classes/TemplateHelper.php
Tx_Oelib_TemplateHelper.hasConfValueString
public function hasConfValueString( $fieldName, $sheet = 'sDEF', $ignoreFlexform = false ) { return $this->getConfValueString( $fieldName, $sheet, false, $ignoreFlexform ) !== ''; }
php
public function hasConfValueString( $fieldName, $sheet = 'sDEF', $ignoreFlexform = false ) { return $this->getConfValueString( $fieldName, $sheet, false, $ignoreFlexform ) !== ''; }
[ "public", "function", "hasConfValueString", "(", "$", "fieldName", ",", "$", "sheet", "=", "'sDEF'", ",", "$", "ignoreFlexform", "=", "false", ")", "{", "return", "$", "this", "->", "getConfValueString", "(", "$", "fieldName", ",", "$", "sheet", ",", "fals...
Checks whether a string value from flexforms or TS setup is set. The priority lies on flexforms; if nothing is found there, the value from TS setup is checked. If there is no field with that name in TS setup, FALSE is returned. @param string $fieldName field name to extract @param string $sheet sheet pointer, eg. "sDEF" @param bool $ignoreFlexform whether to ignore the flexform values and just get the settings from TypoScript, may be empty @return bool whether there is a non-empty value in the corresponding flexforms or TS setup entry
[ "Checks", "whether", "a", "string", "value", "from", "flexforms", "or", "TS", "setup", "is", "set", ".", "The", "priority", "lies", "on", "flexforms", ";", "if", "nothing", "is", "found", "there", "the", "value", "from", "TS", "setup", "is", "checked", "...
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateHelper.php#L374-L385
train
oliverklee/ext-oelib
Classes/TemplateHelper.php
Tx_Oelib_TemplateHelper.setCachedConfigurationValue
public static function setCachedConfigurationValue($key, $value) { $pageUid = \Tx_Oelib_PageFinder::getInstance()->getPageUid(); if (!isset(self::$cachedConfigurations[$pageUid])) { self::$cachedConfigurations[$pageUid] = []; } self::$cachedConfigurations[$pageUid][$key] = $value; }
php
public static function setCachedConfigurationValue($key, $value) { $pageUid = \Tx_Oelib_PageFinder::getInstance()->getPageUid(); if (!isset(self::$cachedConfigurations[$pageUid])) { self::$cachedConfigurations[$pageUid] = []; } self::$cachedConfigurations[$pageUid][$key] = $value; }
[ "public", "static", "function", "setCachedConfigurationValue", "(", "$", "key", ",", "$", "value", ")", "{", "$", "pageUid", "=", "\\", "Tx_Oelib_PageFinder", "::", "getInstance", "(", ")", "->", "getPageUid", "(", ")", ";", "if", "(", "!", "isset", "(", ...
Sets a cached configuration value that will be used when a new instance is created. This function is intended to be used for testing purposes only. @param string $key key of the configuration property to set, must not be empty @param mixed $value value of the configuration property, may be empty or zero @return void
[ "Sets", "a", "cached", "configuration", "value", "that", "will", "be", "used", "when", "a", "new", "instance", "is", "created", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateHelper.php#L471-L480
train
oliverklee/ext-oelib
Classes/TemplateHelper.php
Tx_Oelib_TemplateHelper.setLabels
public function setLabels() { $template = $this->getTemplate(); try { $labels = $template->getLabelMarkerNames(); } catch (Exception $exception) { $labels = []; } foreach ($labels as $label) { $template->setMarker($label, $this->translate($label)); } }
php
public function setLabels() { $template = $this->getTemplate(); try { $labels = $template->getLabelMarkerNames(); } catch (Exception $exception) { $labels = []; } foreach ($labels as $label) { $template->setMarker($label, $this->translate($label)); } }
[ "public", "function", "setLabels", "(", ")", "{", "$", "template", "=", "$", "this", "->", "getTemplate", "(", ")", ";", "try", "{", "$", "labels", "=", "$", "template", "->", "getLabelMarkerNames", "(", ")", ";", "}", "catch", "(", "Exception", "$", ...
Writes all localized labels for the current template into their corresponding template markers. For this, the label markers in the template must be prefixed with "LABEL_" (e.g. "###LABEL_FOO###"), and the corresponding localization entry must have the same key, but lowercased and without the ### (e.g. "label_foo"). @return void
[ "Writes", "all", "localized", "labels", "for", "the", "current", "template", "into", "their", "corresponding", "template", "markers", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateHelper.php#L1041-L1053
train
oliverklee/ext-oelib
Classes/TemplateHelper.php
Tx_Oelib_TemplateHelper.ensureIntegerArrayValues
protected function ensureIntegerArrayValues(array $keys) { if (empty($keys)) { return; } foreach ($keys as $key) { if (!isset($this->piVars[$key]) || !is_array($this->piVars[$key]) ) { continue; } foreach ($this->piVars[$key] as $innerKey => $value) { $integerValue = (int)$value; if ($integerValue === 0) { unset($this->piVars[$key][$innerKey]); } else { $this->piVars[$key][$innerKey] = $integerValue; } } } }
php
protected function ensureIntegerArrayValues(array $keys) { if (empty($keys)) { return; } foreach ($keys as $key) { if (!isset($this->piVars[$key]) || !is_array($this->piVars[$key]) ) { continue; } foreach ($this->piVars[$key] as $innerKey => $value) { $integerValue = (int)$value; if ($integerValue === 0) { unset($this->piVars[$key][$innerKey]); } else { $this->piVars[$key][$innerKey] = $integerValue; } } } }
[ "protected", "function", "ensureIntegerArrayValues", "(", "array", "$", "keys", ")", "{", "if", "(", "empty", "(", "$", "keys", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "if", "(", "!", "isset", "("...
Ensures that all values in the given array are cast to ints and removes empty or invalid values. @param string[] $keys the keys of the piVars to check, may be empty @return void
[ "Ensures", "that", "all", "values", "in", "the", "given", "array", "are", "cast", "to", "ints", "and", "removes", "empty", "or", "invalid", "values", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateHelper.php#L1127-L1150
train
oliverklee/ext-oelib
Classes/TemplateHelper.php
Tx_Oelib_TemplateHelper.getListViewConfigurationValue
private function getListViewConfigurationValue($fieldName) { if (empty($fieldName)) { throw new \InvalidArgumentException('$fieldName must not be empty.', 1331489528); } if (!isset($this->conf['listView.']) || !isset($this->conf['listView.'][$fieldName]) ) { return ''; } return $this->conf['listView.'][$fieldName]; }
php
private function getListViewConfigurationValue($fieldName) { if (empty($fieldName)) { throw new \InvalidArgumentException('$fieldName must not be empty.', 1331489528); } if (!isset($this->conf['listView.']) || !isset($this->conf['listView.'][$fieldName]) ) { return ''; } return $this->conf['listView.'][$fieldName]; }
[ "private", "function", "getListViewConfigurationValue", "(", "$", "fieldName", ")", "{", "if", "(", "empty", "(", "$", "fieldName", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'$fieldName must not be empty.'", ",", "1331489528", ")", ";"...
Extracts a value within listView. @param string $fieldName TS setup field name to extract (within listView.), must not be empty @return string the contents of that field within listView., may be empty
[ "Extracts", "a", "value", "within", "listView", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateHelper.php#L1159-L1172
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/helper/GiroCheckout_SDK_Hash_helper.php
GiroCheckout_SDK_Hash_helper.getHMACMD5Hash
public static function getHMACMD5Hash($password, $data) { $dataString = implode('', $data); return self::getHMACMD5HashString($password, $dataString); }
php
public static function getHMACMD5Hash($password, $data) { $dataString = implode('', $data); return self::getHMACMD5HashString($password, $dataString); }
[ "public", "static", "function", "getHMACMD5Hash", "(", "$", "password", ",", "$", "data", ")", "{", "$", "dataString", "=", "implode", "(", "''", ",", "$", "data", ")", ";", "return", "self", "::", "getHMACMD5HashString", "(", "$", "password", ",", "$", ...
Returns a HMAC Hash with md5 encryption by using a secret and an array @param String password @param mixed[] data to hash @return String generated hash
[ "Returns", "a", "HMAC", "Hash", "with", "md5", "encryption", "by", "using", "a", "secret", "and", "an", "array" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Hash_helper.php#L22-L26
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/helper/GiroCheckout_SDK_Hash_helper.php
GiroCheckout_SDK_Hash_helper.getHMACMD5HashString
public static function getHMACMD5HashString($password, $data) { if (function_exists('hash_hmac')) { return hash_hmac('MD5', $data, $password); } else { return self::hmacFallbackMD5($data, $password); } }
php
public static function getHMACMD5HashString($password, $data) { if (function_exists('hash_hmac')) { return hash_hmac('MD5', $data, $password); } else { return self::hmacFallbackMD5($data, $password); } }
[ "public", "static", "function", "getHMACMD5HashString", "(", "$", "password", ",", "$", "data", ")", "{", "if", "(", "function_exists", "(", "'hash_hmac'", ")", ")", "{", "return", "hash_hmac", "(", "'MD5'", ",", "$", "data", ",", "$", "password", ")", "...
Returns a HMAC Hash with md5 encryption by using a secret and a string @param String password @param String data to hash @return String generated hash
[ "Returns", "a", "HMAC", "Hash", "with", "md5", "encryption", "by", "using", "a", "secret", "and", "a", "string" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Hash_helper.php#L35-L42
train
mocdk/MOC.Varnish
Classes/Service/ContentCacheFlusherService.php
ContentCacheFlusherService.generateCacheTags
protected function generateCacheTags($node) { $this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".'; if (empty($this->workspacesToFlush[$node->getWorkspace()->getName()])) { $this->resolveWorkspaceChain($node->getWorkspace()); } if (!array_key_exists($node->getWorkspace()->getName(), $this->workspacesToFlush)) { return; } $nodeIdentifier = $node->getIdentifier(); foreach ($this->workspacesToFlush[$node->getWorkspace()->getName()] as $workspaceName => $workspaceHash) { $this->generateCacheTagsForNodeIdentifier($workspaceHash .'_'. $nodeIdentifier); $this->generateCacheTagsForNodeType($node->getNodeType()->getName(), $nodeIdentifier, $workspaceHash); $nodeInWorkspace = $node; while ($nodeInWorkspace->getDepth() > 1) { $nodeInWorkspace = $nodeInWorkspace->getParent(); // Workaround for issue #56566 in Neos.ContentRepository if ($nodeInWorkspace === null) { break; } $tagName = 'DescendantOf_' . $workspaceHash . '_' . $nodeInWorkspace->getIdentifier(); $this->tagsToFlush[$tagName] = sprintf('which were tagged with "%s" because node "%s" has changed.', $tagName, $node->getPath()); } } if ($node instanceof NodeInterface && $node->getContext() instanceof ContentContext) { /** @var Site $site */ $site = $node->getContext()->getCurrentSite(); if ($site->hasActiveDomains()) { $domains = $site->getActiveDomains()->map(function (Domain $domain) { return $domain->getHostname(); })->toArray(); $this->domainsToFlush = array_unique(array_merge($this->domainsToFlush, $domains)); } } }
php
protected function generateCacheTags($node) { $this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".'; if (empty($this->workspacesToFlush[$node->getWorkspace()->getName()])) { $this->resolveWorkspaceChain($node->getWorkspace()); } if (!array_key_exists($node->getWorkspace()->getName(), $this->workspacesToFlush)) { return; } $nodeIdentifier = $node->getIdentifier(); foreach ($this->workspacesToFlush[$node->getWorkspace()->getName()] as $workspaceName => $workspaceHash) { $this->generateCacheTagsForNodeIdentifier($workspaceHash .'_'. $nodeIdentifier); $this->generateCacheTagsForNodeType($node->getNodeType()->getName(), $nodeIdentifier, $workspaceHash); $nodeInWorkspace = $node; while ($nodeInWorkspace->getDepth() > 1) { $nodeInWorkspace = $nodeInWorkspace->getParent(); // Workaround for issue #56566 in Neos.ContentRepository if ($nodeInWorkspace === null) { break; } $tagName = 'DescendantOf_' . $workspaceHash . '_' . $nodeInWorkspace->getIdentifier(); $this->tagsToFlush[$tagName] = sprintf('which were tagged with "%s" because node "%s" has changed.', $tagName, $node->getPath()); } } if ($node instanceof NodeInterface && $node->getContext() instanceof ContentContext) { /** @var Site $site */ $site = $node->getContext()->getCurrentSite(); if ($site->hasActiveDomains()) { $domains = $site->getActiveDomains()->map(function (Domain $domain) { return $domain->getHostname(); })->toArray(); $this->domainsToFlush = array_unique(array_merge($this->domainsToFlush, $domains)); } } }
[ "protected", "function", "generateCacheTags", "(", "$", "node", ")", "{", "$", "this", "->", "tagsToFlush", "[", "ContentCache", "::", "TAG_EVERYTHING", "]", "=", "'which were tagged with \"Everything\".'", ";", "if", "(", "empty", "(", "$", "this", "->", "works...
Generates cache tags to be flushed for a node which is flushed on shutdown. Code duplicated from Neos' ContentCacheFlusher class @param NodeInterface|NodeData $node The node which has changed in some way @return void @throws \Neos\ContentRepository\Exception\NodeTypeNotFoundException
[ "Generates", "cache", "tags", "to", "be", "flushed", "for", "a", "node", "which", "is", "flushed", "on", "shutdown", "." ]
f7f4cec4ceb0ce03ca259e896d8f75a645272759
https://github.com/mocdk/MOC.Varnish/blob/f7f4cec4ceb0ce03ca259e896d8f75a645272759/Classes/Service/ContentCacheFlusherService.php#L88-L124
train
oliverklee/ext-oelib
Classes/Template.php
Tx_Oelib_Template.getMarker
public function getMarker($markerName) { $unifiedMarkerName = $this->createMarkerName($markerName); if (!isset($this->markers[$unifiedMarkerName])) { return ''; } return $this->markers[$unifiedMarkerName]; }
php
public function getMarker($markerName) { $unifiedMarkerName = $this->createMarkerName($markerName); if (!isset($this->markers[$unifiedMarkerName])) { return ''; } return $this->markers[$unifiedMarkerName]; }
[ "public", "function", "getMarker", "(", "$", "markerName", ")", "{", "$", "unifiedMarkerName", "=", "$", "this", "->", "createMarkerName", "(", "$", "markerName", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "markers", "[", "$", "unifiedMar...
Gets a marker's content. @param string $markerName the marker's name without the ### signs, case-insensitive, will get uppercased, must not be empty @return string the marker's content or an empty string if the marker has not been set before
[ "Gets", "a", "marker", "s", "content", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Template.php#L236-L244
train
oliverklee/ext-oelib
Classes/Template.php
Tx_Oelib_Template.isSubpartVisible
public function isSubpartVisible($subpartName) { if ($subpartName === '') { return false; } return isset($this->subparts[$subpartName]) && !isset($this->subpartsToHide[$subpartName]); }
php
public function isSubpartVisible($subpartName) { if ($subpartName === '') { return false; } return isset($this->subparts[$subpartName]) && !isset($this->subpartsToHide[$subpartName]); }
[ "public", "function", "isSubpartVisible", "(", "$", "subpartName", ")", "{", "if", "(", "$", "subpartName", "===", "''", ")", "{", "return", "false", ";", "}", "return", "isset", "(", "$", "this", "->", "subparts", "[", "$", "subpartName", "]", ")", "&...
Checks whether a subpart is visible. Note: If the subpart to check does not exist, this function will return FALSE. @param string $subpartName name of the subpart to check (without the ###), must not be empty @return bool TRUE if the subpart is visible, FALSE otherwise
[ "Checks", "whether", "a", "subpart", "is", "visible", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Template.php#L335-L343
train
oliverklee/ext-oelib
Classes/Template.php
Tx_Oelib_Template.replaceSubparts
protected function replaceSubparts($templateCode) { $template = $this; return preg_replace_callback( self::SUBPART_PATTERN, function (array $matches) use ($template) { return $template->getSubpart($matches[1]); }, $templateCode ); }
php
protected function replaceSubparts($templateCode) { $template = $this; return preg_replace_callback( self::SUBPART_PATTERN, function (array $matches) use ($template) { return $template->getSubpart($matches[1]); }, $templateCode ); }
[ "protected", "function", "replaceSubparts", "(", "$", "templateCode", ")", "{", "$", "template", "=", "$", "this", ";", "return", "preg_replace_callback", "(", "self", "::", "SUBPART_PATTERN", ",", "function", "(", "array", "$", "matches", ")", "use", "(", "...
Recursively replaces subparts with their contents. @param string $templateCode the template, may be empty @return string the template with the subparts replaced
[ "Recursively", "replaces", "subparts", "with", "their", "contents", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Template.php#L751-L761
train
kenarkose/Tracker
src/Trackable.php
Trackable.attachTrackerView
public function attachTrackerView($view) { if ( ! $this->trackerViews->contains($view->getKey())) { return $this->trackerViews()->attach($view); } }
php
public function attachTrackerView($view) { if ( ! $this->trackerViews->contains($view->getKey())) { return $this->trackerViews()->attach($view); } }
[ "public", "function", "attachTrackerView", "(", "$", "view", ")", "{", "if", "(", "!", "$", "this", "->", "trackerViews", "->", "contains", "(", "$", "view", "->", "getKey", "(", ")", ")", ")", "{", "return", "$", "this", "->", "trackerViews", "(", "...
Attaches a tracker view @param $view
[ "Attaches", "a", "tracker", "view" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Trackable.php#L27-L33
train
wp-jungle/baobab
src/Baobab/Helper/Terms.php
Terms.implodeSlugs
public static function implodeSlugs($glue, $terms) { if ($terms==null || empty($terms) || is_wp_error($terms)) return ''; $tokens = array(); foreach ($terms as $t) { $tokens[] = $t->slug; } return implode($glue, $tokens); }
php
public static function implodeSlugs($glue, $terms) { if ($terms==null || empty($terms) || is_wp_error($terms)) return ''; $tokens = array(); foreach ($terms as $t) { $tokens[] = $t->slug; } return implode($glue, $tokens); }
[ "public", "static", "function", "implodeSlugs", "(", "$", "glue", ",", "$", "terms", ")", "{", "if", "(", "$", "terms", "==", "null", "||", "empty", "(", "$", "terms", ")", "||", "is_wp_error", "(", "$", "terms", ")", ")", "return", "''", ";", "$",...
Implode the slugs of the provided terms @param string $glue The glue between each token @param array $terms The terms to use @return string
[ "Implode", "the", "slugs", "of", "the", "provided", "terms" ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Helper/Terms.php#L22-L33
train
wp-jungle/baobab
src/Baobab/Helper/Terms.php
Terms.implodeNames
public static function implodeNames($glue, $terms) { if ($terms==null || empty($terms) || is_wp_error($terms)) return ''; $tokens = array(); foreach ($terms as $t) { $tokens[] = $t->name; } return implode($glue, $tokens); }
php
public static function implodeNames($glue, $terms) { if ($terms==null || empty($terms) || is_wp_error($terms)) return ''; $tokens = array(); foreach ($terms as $t) { $tokens[] = $t->name; } return implode($glue, $tokens); }
[ "public", "static", "function", "implodeNames", "(", "$", "glue", ",", "$", "terms", ")", "{", "if", "(", "$", "terms", "==", "null", "||", "empty", "(", "$", "terms", ")", "||", "is_wp_error", "(", "$", "terms", ")", ")", "return", "''", ";", "$",...
Implode the names of the provided terms @param string $glue The glue between each token @param array $terms The terms to use @return string
[ "Implode", "the", "names", "of", "the", "provided", "terms" ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Helper/Terms.php#L43-L54
train
oliverklee/ext-oelib
Classes/ConfigurationProxy.php
Tx_Oelib_ConfigurationProxy.get
protected function get($key) { $this->loadConfigurationLazily(); if ($this->hasConfigurationValue($key)) { $result = $this->configuration[$key]; } else { $result = ''; } return $result; }
php
protected function get($key) { $this->loadConfigurationLazily(); if ($this->hasConfigurationValue($key)) { $result = $this->configuration[$key]; } else { $result = ''; } return $result; }
[ "protected", "function", "get", "(", "$", "key", ")", "{", "$", "this", "->", "loadConfigurationLazily", "(", ")", ";", "if", "(", "$", "this", "->", "hasConfigurationValue", "(", "$", "key", ")", ")", "{", "$", "result", "=", "$", "this", "->", "con...
Returns a string configuration value. @param string $key key of the value to get, must not be empty @return string configuration value string, might be empty
[ "Returns", "a", "string", "configuration", "value", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigurationProxy.php#L138-L149
train
mocdk/MOC.Varnish
Classes/Command/VarnishCommandController.php
VarnishCommandController.clearCommand
public function clearCommand($domain = null, $contentType = null) { $this->varnishBanService->banAll($domain, $contentType); }
php
public function clearCommand($domain = null, $contentType = null) { $this->varnishBanService->banAll($domain, $contentType); }
[ "public", "function", "clearCommand", "(", "$", "domain", "=", "null", ",", "$", "contentType", "=", "null", ")", "{", "$", "this", "->", "varnishBanService", "->", "banAll", "(", "$", "domain", ",", "$", "contentType", ")", ";", "}" ]
Clear all cache in Varnish for a optionally given domain & content type The domain is required since the expected VCL only bans for a given domain. @param string $domain The domain to flush, e.g. "example.com" @param string $contentType The mime type to flush, e.g. "image/png" @return void
[ "Clear", "all", "cache", "in", "Varnish", "for", "a", "optionally", "given", "domain", "&", "content", "type" ]
f7f4cec4ceb0ce03ca259e896d8f75a645272759
https://github.com/mocdk/MOC.Varnish/blob/f7f4cec4ceb0ce03ca259e896d8f75a645272759/Classes/Command/VarnishCommandController.php#L28-L31
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.copyParameterBag
protected static function copyParameterBag(ParameterBag $src, ParameterBag $dst) { foreach ($src->keys() as $current) { if (true === in_array($current, DataTablesEnumerator::enumParameters())) { continue; } $dst->set($current, $src->get($current)); } }
php
protected static function copyParameterBag(ParameterBag $src, ParameterBag $dst) { foreach ($src->keys() as $current) { if (true === in_array($current, DataTablesEnumerator::enumParameters())) { continue; } $dst->set($current, $src->get($current)); } }
[ "protected", "static", "function", "copyParameterBag", "(", "ParameterBag", "$", "src", ",", "ParameterBag", "$", "dst", ")", "{", "foreach", "(", "$", "src", "->", "keys", "(", ")", "as", "$", "current", ")", "{", "if", "(", "true", "===", "in_array", ...
Copy a parameter bag. @param ParameterBag $src The source. @param ParameterBag $dst The destination. @return void
[ "Copy", "a", "parameter", "bag", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L51-L58
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.isValidRawColumn
protected static function isValidRawColumn(array $rawColumn) { if (false === array_key_exists(DataTablesColumnInterface::DATATABLES_PARAMETER_DATA, $rawColumn)) { return false; } if (false === array_key_exists(DataTablesColumnInterface::DATATABLES_PARAMETER_NAME, $rawColumn)) { return false; } return true; }
php
protected static function isValidRawColumn(array $rawColumn) { if (false === array_key_exists(DataTablesColumnInterface::DATATABLES_PARAMETER_DATA, $rawColumn)) { return false; } if (false === array_key_exists(DataTablesColumnInterface::DATATABLES_PARAMETER_NAME, $rawColumn)) { return false; } return true; }
[ "protected", "static", "function", "isValidRawColumn", "(", "array", "$", "rawColumn", ")", "{", "if", "(", "false", "===", "array_key_exists", "(", "DataTablesColumnInterface", "::", "DATATABLES_PARAMETER_DATA", ",", "$", "rawColumn", ")", ")", "{", "return", "fa...
Determines if a raw column is valid. @param array $rawColumn The raw column. @return bool Returns true in case of success, false otherwise.
[ "Determines", "if", "a", "raw", "column", "is", "valid", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L66-L74
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.isValidRawOrder
protected static function isValidRawOrder(array $rawOrder) { if (false === array_key_exists(DataTablesOrderInterface::DATATABLES_PARAMETER_COLUMN, $rawOrder)) { return false; } if (false === array_key_exists(DataTablesOrderInterface::DATATABLES_PARAMETER_DIR, $rawOrder)) { return false; } return true; }
php
protected static function isValidRawOrder(array $rawOrder) { if (false === array_key_exists(DataTablesOrderInterface::DATATABLES_PARAMETER_COLUMN, $rawOrder)) { return false; } if (false === array_key_exists(DataTablesOrderInterface::DATATABLES_PARAMETER_DIR, $rawOrder)) { return false; } return true; }
[ "protected", "static", "function", "isValidRawOrder", "(", "array", "$", "rawOrder", ")", "{", "if", "(", "false", "===", "array_key_exists", "(", "DataTablesOrderInterface", "::", "DATATABLES_PARAMETER_COLUMN", ",", "$", "rawOrder", ")", ")", "{", "return", "fals...
Determines if a raw order is valid. @param array $rawOrder The raw order. @return bool Returns true in case of success, false otherwise.
[ "Determines", "if", "a", "raw", "order", "is", "valid", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L82-L90
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.isValidRawSearch
protected static function isValidRawSearch(array $rawSearch) { if (false === array_key_exists(DataTablesSearchInterface::DATATABLES_PARAMETER_REGEX, $rawSearch)) { return false; } if (false === array_key_exists(DataTablesSearchInterface::DATATABLES_PARAMETER_VALUE, $rawSearch)) { return false; } return true; }
php
protected static function isValidRawSearch(array $rawSearch) { if (false === array_key_exists(DataTablesSearchInterface::DATATABLES_PARAMETER_REGEX, $rawSearch)) { return false; } if (false === array_key_exists(DataTablesSearchInterface::DATATABLES_PARAMETER_VALUE, $rawSearch)) { return false; } return true; }
[ "protected", "static", "function", "isValidRawSearch", "(", "array", "$", "rawSearch", ")", "{", "if", "(", "false", "===", "array_key_exists", "(", "DataTablesSearchInterface", "::", "DATATABLES_PARAMETER_REGEX", ",", "$", "rawSearch", ")", ")", "{", "return", "f...
Determines if a raw search is valid. @param array $rawSearch The raw search. @return bool Returns true in case of success, false otherwise.
[ "Determines", "if", "a", "raw", "search", "is", "valid", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L98-L106
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.newColumn
public static function newColumn($data, $name, $cellType = DataTablesColumnInterface::DATATABLES_CELL_TYPE_TD) { $dtColumn = new DataTablesColumn(); $dtColumn->getMapping()->setColumn($data); $dtColumn->setCellType($cellType); $dtColumn->setData($data); $dtColumn->setName($name); $dtColumn->setTitle($name); return $dtColumn; }
php
public static function newColumn($data, $name, $cellType = DataTablesColumnInterface::DATATABLES_CELL_TYPE_TD) { $dtColumn = new DataTablesColumn(); $dtColumn->getMapping()->setColumn($data); $dtColumn->setCellType($cellType); $dtColumn->setData($data); $dtColumn->setName($name); $dtColumn->setTitle($name); return $dtColumn; }
[ "public", "static", "function", "newColumn", "(", "$", "data", ",", "$", "name", ",", "$", "cellType", "=", "DataTablesColumnInterface", "::", "DATATABLES_CELL_TYPE_TD", ")", "{", "$", "dtColumn", "=", "new", "DataTablesColumn", "(", ")", ";", "$", "dtColumn",...
Create a new column instance. @param string $data The column data. @param string $name The column name. @param string $cellType The column cell type. @return DataTablesColumnInterface Returns a column.
[ "Create", "a", "new", "column", "instance", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L116-L126
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.newWrapper
public static function newWrapper($url, DataTablesProviderInterface $provider, UserInterface $user = null) { $dtWrapper = new DataTablesWrapper(); $dtWrapper->getMapping()->setPrefix($provider->getPrefix()); $dtWrapper->setMethod($provider->getMethod()); $dtWrapper->setProvider($provider); $dtWrapper->setUser($user); $dtWrapper->setUrl($url); return $dtWrapper; }
php
public static function newWrapper($url, DataTablesProviderInterface $provider, UserInterface $user = null) { $dtWrapper = new DataTablesWrapper(); $dtWrapper->getMapping()->setPrefix($provider->getPrefix()); $dtWrapper->setMethod($provider->getMethod()); $dtWrapper->setProvider($provider); $dtWrapper->setUser($user); $dtWrapper->setUrl($url); return $dtWrapper; }
[ "public", "static", "function", "newWrapper", "(", "$", "url", ",", "DataTablesProviderInterface", "$", "provider", ",", "UserInterface", "$", "user", "=", "null", ")", "{", "$", "dtWrapper", "=", "new", "DataTablesWrapper", "(", ")", ";", "$", "dtWrapper", ...
Create a new wrapper. @param string $url The URL. @param DataTablesProviderInterface $provider The provider. @param UserInterface $user The user. @return DataTablesWrapperInterface Returns a wrapper.
[ "Create", "a", "new", "wrapper", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L160-L170
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.parseColumn
protected static function parseColumn(array $rawColumn, DataTablesWrapperInterface $wrapper) { if (false === static::isValidRawColumn($rawColumn)) { return null; } $dtColumn = $wrapper->getColumn($rawColumn[DataTablesColumnInterface::DATATABLES_PARAMETER_DATA]); if (null === $dtColumn) { return null; } if ($dtColumn->getName() !== $rawColumn[DataTablesColumnInterface::DATATABLES_PARAMETER_NAME]) { return null; } if (false === $dtColumn->getSearchable()) { $dtColumn->setSearch(static::parseSearch([])); // Set a default search. return $dtColumn; } $dtColumn->setSearch(static::parseSearch($rawColumn[DataTablesColumnInterface::DATATABLES_PARAMETER_SEARCH])); return $dtColumn; }
php
protected static function parseColumn(array $rawColumn, DataTablesWrapperInterface $wrapper) { if (false === static::isValidRawColumn($rawColumn)) { return null; } $dtColumn = $wrapper->getColumn($rawColumn[DataTablesColumnInterface::DATATABLES_PARAMETER_DATA]); if (null === $dtColumn) { return null; } if ($dtColumn->getName() !== $rawColumn[DataTablesColumnInterface::DATATABLES_PARAMETER_NAME]) { return null; } if (false === $dtColumn->getSearchable()) { $dtColumn->setSearch(static::parseSearch([])); // Set a default search. return $dtColumn; } $dtColumn->setSearch(static::parseSearch($rawColumn[DataTablesColumnInterface::DATATABLES_PARAMETER_SEARCH])); return $dtColumn; }
[ "protected", "static", "function", "parseColumn", "(", "array", "$", "rawColumn", ",", "DataTablesWrapperInterface", "$", "wrapper", ")", "{", "if", "(", "false", "===", "static", "::", "isValidRawColumn", "(", "$", "rawColumn", ")", ")", "{", "return", "null"...
Parse a raw column. @param array $rawColumn The raw column. @param DataTablesWrapperInterface $wrapper The wrapper. @return DataTablesColumnInterface Returns the column.
[ "Parse", "a", "raw", "column", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L179-L200
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.parseColumns
protected static function parseColumns(array $rawColumns, DataTablesWrapperInterface $wrapper) { $dtColumns = []; foreach ($rawColumns as $current) { $dtColumn = static::parseColumn($current, $wrapper); if (null === $dtColumn) { continue; } $dtColumns[] = $dtColumn; } return $dtColumns; }
php
protected static function parseColumns(array $rawColumns, DataTablesWrapperInterface $wrapper) { $dtColumns = []; foreach ($rawColumns as $current) { $dtColumn = static::parseColumn($current, $wrapper); if (null === $dtColumn) { continue; } $dtColumns[] = $dtColumn; } return $dtColumns; }
[ "protected", "static", "function", "parseColumns", "(", "array", "$", "rawColumns", ",", "DataTablesWrapperInterface", "$", "wrapper", ")", "{", "$", "dtColumns", "=", "[", "]", ";", "foreach", "(", "$", "rawColumns", "as", "$", "current", ")", "{", "$", "...
Parse a raw columns. @param array $rawColumns The raw columns. @param DataTablesWrapperInterface $wrapper The wrapper. @return DataTablesColumnInterface[] Returns the columns.
[ "Parse", "a", "raw", "columns", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L209-L224
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.parseOrder
protected static function parseOrder(array $rawOrder) { $dtOrder = new DataTablesOrder(); if (false === static::isValidRawOrder($rawOrder)) { return $dtOrder; } $dtOrder->setColumn(intval($rawOrder[DataTablesOrderInterface::DATATABLES_PARAMETER_COLUMN])); $dtOrder->setDir($rawOrder[DataTablesOrderInterface::DATATABLES_PARAMETER_DIR]); return $dtOrder; }
php
protected static function parseOrder(array $rawOrder) { $dtOrder = new DataTablesOrder(); if (false === static::isValidRawOrder($rawOrder)) { return $dtOrder; } $dtOrder->setColumn(intval($rawOrder[DataTablesOrderInterface::DATATABLES_PARAMETER_COLUMN])); $dtOrder->setDir($rawOrder[DataTablesOrderInterface::DATATABLES_PARAMETER_DIR]); return $dtOrder; }
[ "protected", "static", "function", "parseOrder", "(", "array", "$", "rawOrder", ")", "{", "$", "dtOrder", "=", "new", "DataTablesOrder", "(", ")", ";", "if", "(", "false", "===", "static", "::", "isValidRawOrder", "(", "$", "rawOrder", ")", ")", "{", "re...
Parse a raw order. @param array $rawOrder The raw order. @return DataTablesOrderInterface Returns the order.
[ "Parse", "a", "raw", "order", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L232-L244
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.parseOrders
protected static function parseOrders(array $rawOrders) { $dtOrders = []; foreach ($rawOrders as $current) { $dtOrders[] = static::parseOrder($current); } return $dtOrders; }
php
protected static function parseOrders(array $rawOrders) { $dtOrders = []; foreach ($rawOrders as $current) { $dtOrders[] = static::parseOrder($current); } return $dtOrders; }
[ "protected", "static", "function", "parseOrders", "(", "array", "$", "rawOrders", ")", "{", "$", "dtOrders", "=", "[", "]", ";", "foreach", "(", "$", "rawOrders", "as", "$", "current", ")", "{", "$", "dtOrders", "[", "]", "=", "static", "::", "parseOrd...
Parse raw orders. @param array $rawOrders The raw orders. @return DataTablesOrderInterface[] Returns the orders.
[ "Parse", "raw", "orders", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L252-L261
train
webeweb/jquery-datatables-bundle
Factory/DataTablesFactory.php
DataTablesFactory.parseSearch
protected static function parseSearch(array $rawSearch) { $dtSearch = new DataTablesSearch(); if (false === static::isValidRawSearch($rawSearch)) { return $dtSearch; } $dtSearch->setRegex(BooleanHelper::parseString($rawSearch[DataTablesSearchInterface::DATATABLES_PARAMETER_REGEX])); $dtSearch->setValue($rawSearch[DataTablesSearchInterface::DATATABLES_PARAMETER_VALUE]); return $dtSearch; }
php
protected static function parseSearch(array $rawSearch) { $dtSearch = new DataTablesSearch(); if (false === static::isValidRawSearch($rawSearch)) { return $dtSearch; } $dtSearch->setRegex(BooleanHelper::parseString($rawSearch[DataTablesSearchInterface::DATATABLES_PARAMETER_REGEX])); $dtSearch->setValue($rawSearch[DataTablesSearchInterface::DATATABLES_PARAMETER_VALUE]); return $dtSearch; }
[ "protected", "static", "function", "parseSearch", "(", "array", "$", "rawSearch", ")", "{", "$", "dtSearch", "=", "new", "DataTablesSearch", "(", ")", ";", "if", "(", "false", "===", "static", "::", "isValidRawSearch", "(", "$", "rawSearch", ")", ")", "{",...
Parse a raw search. @param array $rawSearch The raw search. @return DataTablesSearchInterface Returns the search.
[ "Parse", "a", "raw", "search", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Factory/DataTablesFactory.php#L306-L318
train
wp-jungle/baobab
src/Baobab/Loader/ObjectRegistry.php
ObjectRegistry.register
public function register($nickname, $object) { if (isset($this->autoInstantiations[$nickname])) { throw new DuplicateObjectException($nickname); } $this->autoInstantiations[$nickname] = $object; }
php
public function register($nickname, $object) { if (isset($this->autoInstantiations[$nickname])) { throw new DuplicateObjectException($nickname); } $this->autoInstantiations[$nickname] = $object; }
[ "public", "function", "register", "(", "$", "nickname", ",", "$", "object", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "autoInstantiations", "[", "$", "nickname", "]", ")", ")", "{", "throw", "new", "DuplicateObjectException", "(", "$", "nickn...
Add an instance of a class to the registry @param string $nickname The nickname for this object @param mixed $object The object instance
[ "Add", "an", "instance", "of", "a", "class", "to", "the", "registry" ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Loader/ObjectRegistry.php#L53-L61
train
wp-jungle/baobab
src/Baobab/Loader/ObjectRegistry.php
ObjectRegistry.get
public function get($nickname) { if (isset($this->autoInstantiations[$nickname])) { return $this->autoInstantiations[$nickname]; } return null; }
php
public function get($nickname) { if (isset($this->autoInstantiations[$nickname])) { return $this->autoInstantiations[$nickname]; } return null; }
[ "public", "function", "get", "(", "$", "nickname", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "autoInstantiations", "[", "$", "nickname", "]", ")", ")", "{", "return", "$", "this", "->", "autoInstantiations", "[", "$", "nickname", "]", ";", ...
Get an instance of a class from the registry @param string $nickname The nickname we gave it @return mixed
[ "Get", "an", "instance", "of", "a", "class", "from", "the", "registry" ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Loader/ObjectRegistry.php#L70-L78
train
rakeev/oauth2-mailru
src/MailruResourceOwner.php
MailruResourceOwner.getLocation
public function getLocation() { $country = $this->getCountry(); $city = $this->getCity(); return (empty($country)) ? $city : $country . ', ' . $city; }
php
public function getLocation() { $country = $this->getCountry(); $city = $this->getCity(); return (empty($country)) ? $city : $country . ', ' . $city; }
[ "public", "function", "getLocation", "(", ")", "{", "$", "country", "=", "$", "this", "->", "getCountry", "(", ")", ";", "$", "city", "=", "$", "this", "->", "getCity", "(", ")", ";", "return", "(", "empty", "(", "$", "country", ")", ")", "?", "$...
User's location Returns city or concatenation of country and city @return string Location
[ "User", "s", "location" ]
718b7b5db469cd98e4382051c6d8a540622ba11b
https://github.com/rakeev/oauth2-mailru/blob/718b7b5db469cd98e4382051c6d8a540622ba11b/src/MailruResourceOwner.php#L136-L142
train
lincanbin/White-HTML-Filter
src/WhiteHTMLFilter.php
WhiteHTMLFilter.loadHTML
public function loadHTML($html) { $html = str_replace(chr(13), '', $html); $html = '<?xml version="1.0" encoding="utf-8" ?><' . $this->PARENT_TAG_NAME . '>' . $html . '</' . $this->PARENT_TAG_NAME . '>'; if (defined('LIBXML_HTML_NODEFDTD')) { return $this->dom->loadHTML($html, LIBXML_HTML_NODEFDTD); } else { return $this->dom->loadHTML($html); } }
php
public function loadHTML($html) { $html = str_replace(chr(13), '', $html); $html = '<?xml version="1.0" encoding="utf-8" ?><' . $this->PARENT_TAG_NAME . '>' . $html . '</' . $this->PARENT_TAG_NAME . '>'; if (defined('LIBXML_HTML_NODEFDTD')) { return $this->dom->loadHTML($html, LIBXML_HTML_NODEFDTD); } else { return $this->dom->loadHTML($html); } }
[ "public", "function", "loadHTML", "(", "$", "html", ")", "{", "$", "html", "=", "str_replace", "(", "chr", "(", "13", ")", ",", "''", ",", "$", "html", ")", ";", "$", "html", "=", "'<?xml version=\"1.0\" encoding=\"utf-8\" ?><'", ".", "$", "this", "->", ...
Load document markup into the class for cleaning @param string $html The markup to clean @return bool
[ "Load", "document", "markup", "into", "the", "class", "for", "cleaning" ]
a5a513dba88f7d5144fed711ddbf76bcac660a66
https://github.com/lincanbin/White-HTML-Filter/blob/a5a513dba88f7d5144fed711ddbf76bcac660a66/src/WhiteHTMLFilter.php#L80-L91
train
lincanbin/White-HTML-Filter
src/WhiteHTMLFilter.php
WhiteHTMLFilter.outputHtml
public function outputHtml() { $result = ''; if (!is_null($this->dom)) { //SaveXML : <br/><img/> //SaveHTML: <br><img> $result = trim($this->dom->saveXML($this->getRealElement())); $result = str_replace($this->TEMP_CONTENT, '', $result); $parentTagNameLength = strlen($this->PARENT_TAG_NAME); $result = substr($result, $parentTagNameLength + 2, -($parentTagNameLength + 3)); } return $result; }
php
public function outputHtml() { $result = ''; if (!is_null($this->dom)) { //SaveXML : <br/><img/> //SaveHTML: <br><img> $result = trim($this->dom->saveXML($this->getRealElement())); $result = str_replace($this->TEMP_CONTENT, '', $result); $parentTagNameLength = strlen($this->PARENT_TAG_NAME); $result = substr($result, $parentTagNameLength + 2, -($parentTagNameLength + 3)); } return $result; }
[ "public", "function", "outputHtml", "(", ")", "{", "$", "result", "=", "''", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "dom", ")", ")", "{", "//SaveXML : <br/><img/>", "//SaveHTML: <br><img>", "$", "result", "=", "trim", "(", "$", "this", ...
Output the result @return string HTML string
[ "Output", "the", "result" ]
a5a513dba88f7d5144fed711ddbf76bcac660a66
https://github.com/lincanbin/White-HTML-Filter/blob/a5a513dba88f7d5144fed711ddbf76bcac660a66/src/WhiteHTMLFilter.php#L97-L109
train
lincanbin/White-HTML-Filter
src/WhiteHTMLFilter.php
WhiteHTMLFilter.cleanNodes
private function cleanNodes(DOMElement $elem, $isFirstNode = false) { $nodeName = strtolower($elem->nodeName); $textContent = $elem->textContent; if ($isFirstNode || array_key_exists($nodeName, $this->config->WhiteListTag)) { if ($elem->hasAttributes()) { $this->cleanAttributes($elem); } /* * Iterate over the element's children. The reason we go backwards is because * going forwards will cause indexes to change when elements get removed */ if ($elem->hasChildNodes()) { $children = $elem->childNodes; $index = $children->length; while (--$index >= 0) { $cleanNode = $children->item($index);// DOMElement or DOMText if ($cleanNode instanceof DOMElement) { $this->cleanNodes($cleanNode); } } } else { if (!in_array($nodeName, $this->emptyElementList) && !$this->isValidText($textContent)) { $elem->nodeValue = $this->TEMP_CONTENT; } } } else { if ($this->config->KeepText === true && $this->isValidText($textContent)) { $result = $elem->parentNode->replaceChild($this->dom->createTextNode($textContent), $elem); } else { $result = $elem->parentNode->removeChild($elem); } if ($result) { $this->removedTags[] = $nodeName; } else { throw new Exception('Failed to remove node from DOM'); } } }
php
private function cleanNodes(DOMElement $elem, $isFirstNode = false) { $nodeName = strtolower($elem->nodeName); $textContent = $elem->textContent; if ($isFirstNode || array_key_exists($nodeName, $this->config->WhiteListTag)) { if ($elem->hasAttributes()) { $this->cleanAttributes($elem); } /* * Iterate over the element's children. The reason we go backwards is because * going forwards will cause indexes to change when elements get removed */ if ($elem->hasChildNodes()) { $children = $elem->childNodes; $index = $children->length; while (--$index >= 0) { $cleanNode = $children->item($index);// DOMElement or DOMText if ($cleanNode instanceof DOMElement) { $this->cleanNodes($cleanNode); } } } else { if (!in_array($nodeName, $this->emptyElementList) && !$this->isValidText($textContent)) { $elem->nodeValue = $this->TEMP_CONTENT; } } } else { if ($this->config->KeepText === true && $this->isValidText($textContent)) { $result = $elem->parentNode->replaceChild($this->dom->createTextNode($textContent), $elem); } else { $result = $elem->parentNode->removeChild($elem); } if ($result) { $this->removedTags[] = $nodeName; } else { throw new Exception('Failed to remove node from DOM'); } } }
[ "private", "function", "cleanNodes", "(", "DOMElement", "$", "elem", ",", "$", "isFirstNode", "=", "false", ")", "{", "$", "nodeName", "=", "strtolower", "(", "$", "elem", "->", "nodeName", ")", ";", "$", "textContent", "=", "$", "elem", "->", "textConte...
Recursivly remove elements from the DOM that aren't whitelisted @param DOMElement $elem @param boolean $isFirstNode @throws Exception If removal of a node failed than an exception is thrown
[ "Recursivly", "remove", "elements", "from", "the", "DOM", "that", "aren", "t", "whitelisted" ]
a5a513dba88f7d5144fed711ddbf76bcac660a66
https://github.com/lincanbin/White-HTML-Filter/blob/a5a513dba88f7d5144fed711ddbf76bcac660a66/src/WhiteHTMLFilter.php#L129-L167
train
lincanbin/White-HTML-Filter
src/WhiteHTMLFilter.php
WhiteHTMLFilter.cleanAttributes
private function cleanAttributes(DOMElement $elem) { $tagName = strtolower($elem->nodeName); $attributes = $elem->attributes; $attributesWhiteList = $this->config->WhiteListHtmlGlobalAttributes; $attributesFilterMap = array(); $allowDataAttribute = in_array("data-*", $attributesWhiteList); $whiteListAttr = $this->config->getWhiteListAttr($tagName); foreach ($whiteListAttr as $key => $val) { if (is_string($val)) { $attributesWhiteList[] = $val; } if ($val instanceof Closure) { $attributesWhiteList[] = $key; $attributesFilterMap[$key] = $val; } } $index = $attributes->length; while (--$index >= 0) { /* foreach会有一个严重的的问题: href="JavaScript:alert("customAttr="xxx"");" 这样嵌套的不合法的属性,会被解析出两个属性: 1. href="JavaScript:alert(" 2. customAttr="xxx" 但是foreach只能拿到一个。 foreach ($elem->attributes->item() as $attrName => $domAttr) { */ /* @var $domAttr DOMAttr */ $domAttr = $attributes->item($index); $attrName = strtolower($domAttr->name); $attrValue = $domAttr->value; // 如果不在白名单attr中,而且允许data-*,且不是data-*,则删除 if (!in_array($attrName, $attributesWhiteList) && $allowDataAttribute && (stripos($attrName, "data-") !== 0)) { $elem->removeAttribute($attrName); } else { if (isset($attributesFilterMap[$attrName])) { $filteredAttrValue = $attributesFilterMap[$attrName]($attrValue); if ($filteredAttrValue === false ) { $elem->removeAttribute($attrName); } else { // https://stackoverflow.com/questions/25475936/updating-domattr-value-with-url-results-in-parameters-being-lost-unless-htmlenti // Fix ampersands issue: https://github.com/lincanbin/White-HTML-Filter/issues/1 if ($filteredAttrValue !== $attrValue) { $elem->setAttribute($attrName, $filteredAttrValue); } } } else { $this->cleanAttrValue($domAttr); } } } }
php
private function cleanAttributes(DOMElement $elem) { $tagName = strtolower($elem->nodeName); $attributes = $elem->attributes; $attributesWhiteList = $this->config->WhiteListHtmlGlobalAttributes; $attributesFilterMap = array(); $allowDataAttribute = in_array("data-*", $attributesWhiteList); $whiteListAttr = $this->config->getWhiteListAttr($tagName); foreach ($whiteListAttr as $key => $val) { if (is_string($val)) { $attributesWhiteList[] = $val; } if ($val instanceof Closure) { $attributesWhiteList[] = $key; $attributesFilterMap[$key] = $val; } } $index = $attributes->length; while (--$index >= 0) { /* foreach会有一个严重的的问题: href="JavaScript:alert("customAttr="xxx"");" 这样嵌套的不合法的属性,会被解析出两个属性: 1. href="JavaScript:alert(" 2. customAttr="xxx" 但是foreach只能拿到一个。 foreach ($elem->attributes->item() as $attrName => $domAttr) { */ /* @var $domAttr DOMAttr */ $domAttr = $attributes->item($index); $attrName = strtolower($domAttr->name); $attrValue = $domAttr->value; // 如果不在白名单attr中,而且允许data-*,且不是data-*,则删除 if (!in_array($attrName, $attributesWhiteList) && $allowDataAttribute && (stripos($attrName, "data-") !== 0)) { $elem->removeAttribute($attrName); } else { if (isset($attributesFilterMap[$attrName])) { $filteredAttrValue = $attributesFilterMap[$attrName]($attrValue); if ($filteredAttrValue === false ) { $elem->removeAttribute($attrName); } else { // https://stackoverflow.com/questions/25475936/updating-domattr-value-with-url-results-in-parameters-being-lost-unless-htmlenti // Fix ampersands issue: https://github.com/lincanbin/White-HTML-Filter/issues/1 if ($filteredAttrValue !== $attrValue) { $elem->setAttribute($attrName, $filteredAttrValue); } } } else { $this->cleanAttrValue($domAttr); } } } }
[ "private", "function", "cleanAttributes", "(", "DOMElement", "$", "elem", ")", "{", "$", "tagName", "=", "strtolower", "(", "$", "elem", "->", "nodeName", ")", ";", "$", "attributes", "=", "$", "elem", "->", "attributes", ";", "$", "attributesWhiteList", "...
Clean the attributes of the html tags @param DOMElement $elem
[ "Clean", "the", "attributes", "of", "the", "html", "tags" ]
a5a513dba88f7d5144fed711ddbf76bcac660a66
https://github.com/lincanbin/White-HTML-Filter/blob/a5a513dba88f7d5144fed711ddbf76bcac660a66/src/WhiteHTMLFilter.php#L173-L225
train
lincanbin/White-HTML-Filter
src/WhiteHTMLFilter.php
WhiteHTMLFilter.cleanAttrValue
private function cleanAttrValue(DOMAttr $domAttr) { $attrName = strtolower($domAttr->name); if ($attrName === 'style' && !empty($this->config->WhiteListStyle)) { $styles = explode(';', $domAttr->value); foreach ($styles as $key => &$subStyle) { $subStyle = array_map("trim", explode(':', strtolower($subStyle), 2)); if (empty($subStyle[0]) || !in_array($subStyle[0], $this->config->WhiteListStyle)) { unset($styles[$key]); } } $implodeFunc = function ($styleSheet) { return implode(':', $styleSheet); }; $domAttr->ownerElement->setAttribute($attrName, implode(';', array_map($implodeFunc, $styles)) . ';'); } if ($attrName === 'class' && !empty($this->config->WhiteListCssClass)) { $domAttr->ownerElement->setAttribute($attrName, implode(' ', array_intersect(preg_split('/\s+/', $domAttr->value), $this->config->WhiteListCssClass))); } if ($attrName === 'src' || $attrName === 'href') { if (strtolower(parse_url($domAttr->value, PHP_URL_SCHEME)) === 'javascript') { $domAttr->ownerElement->removeAttribute($attrName); } else { $domAttr->ownerElement->setAttribute($attrName, filter_var($domAttr->value, FILTER_SANITIZE_URL)); } } }
php
private function cleanAttrValue(DOMAttr $domAttr) { $attrName = strtolower($domAttr->name); if ($attrName === 'style' && !empty($this->config->WhiteListStyle)) { $styles = explode(';', $domAttr->value); foreach ($styles as $key => &$subStyle) { $subStyle = array_map("trim", explode(':', strtolower($subStyle), 2)); if (empty($subStyle[0]) || !in_array($subStyle[0], $this->config->WhiteListStyle)) { unset($styles[$key]); } } $implodeFunc = function ($styleSheet) { return implode(':', $styleSheet); }; $domAttr->ownerElement->setAttribute($attrName, implode(';', array_map($implodeFunc, $styles)) . ';'); } if ($attrName === 'class' && !empty($this->config->WhiteListCssClass)) { $domAttr->ownerElement->setAttribute($attrName, implode(' ', array_intersect(preg_split('/\s+/', $domAttr->value), $this->config->WhiteListCssClass))); } if ($attrName === 'src' || $attrName === 'href') { if (strtolower(parse_url($domAttr->value, PHP_URL_SCHEME)) === 'javascript') { $domAttr->ownerElement->removeAttribute($attrName); } else { $domAttr->ownerElement->setAttribute($attrName, filter_var($domAttr->value, FILTER_SANITIZE_URL)); } } }
[ "private", "function", "cleanAttrValue", "(", "DOMAttr", "$", "domAttr", ")", "{", "$", "attrName", "=", "strtolower", "(", "$", "domAttr", "->", "name", ")", ";", "if", "(", "$", "attrName", "===", "'style'", "&&", "!", "empty", "(", "$", "this", "->"...
Clean the value of the attribute @param DOMAttr $domAttr
[ "Clean", "the", "value", "of", "the", "attribute" ]
a5a513dba88f7d5144fed711ddbf76bcac660a66
https://github.com/lincanbin/White-HTML-Filter/blob/a5a513dba88f7d5144fed711ddbf76bcac660a66/src/WhiteHTMLFilter.php#L231-L257
train
lincanbin/White-HTML-Filter
src/WhiteHTMLFilter.php
WhiteHTMLFilter.clean
public function clean() { $this->removedTags = array(); $elem = $this->getRealElement(); if (is_null($elem)) { return array(); } $this->cleanNodes($elem, true); return $this->removedTags; }
php
public function clean() { $this->removedTags = array(); $elem = $this->getRealElement(); if (is_null($elem)) { return array(); } $this->cleanNodes($elem, true); return $this->removedTags; }
[ "public", "function", "clean", "(", ")", "{", "$", "this", "->", "removedTags", "=", "array", "(", ")", ";", "$", "elem", "=", "$", "this", "->", "getRealElement", "(", ")", ";", "if", "(", "is_null", "(", "$", "elem", ")", ")", "{", "return", "a...
Perform the cleaning of the document @return array List of deleted HTML tags
[ "Perform", "the", "cleaning", "of", "the", "document" ]
a5a513dba88f7d5144fed711ddbf76bcac660a66
https://github.com/lincanbin/White-HTML-Filter/blob/a5a513dba88f7d5144fed711ddbf76bcac660a66/src/WhiteHTMLFilter.php#L263-L272
train
VM9/orion-explorer-php-frame-work
src/Orion/NGSIAPIv1.php
NGSIAPIv1.getEntities
public function getEntities($type = false, $offset = 0, $limit = 1000, $details = "on") { if ($type) { $url = $this->url . "contextTypes/" . $type; } else { $url = $this->url . "contextEntities/"; } $ret = $this->restRequest($url . "?offset=$offset&limit=$limit&details=$details", 'GET')->getResponseBody(); $Context = (new Context\Context($ret))->get(); $Entities = []; if($Context instanceof \stdClass && isset($Context->errorCode)){ switch ((int) $Context->errorCode->code) { case 404: case 500: throw new Exception\GeneralException($Context->errorCode->reasonPhrase,(int)$Context->errorCode->code, null, $ret); default: case 200: break; } }else{ throw new Exception\GeneralException("Malformed Orion Response",500, null, $ret); } if(isset($Context->contextResponses) && count($Context->contextResponses) > 0){ foreach ($Context->contextResponses as $entity) { $t = $entity->contextElement->type; $id = $entity->contextElement->id; if(!array_key_exists($t, $Entities)){ $Entities[$t] = []; } $Entities[$t][$id] = $entity->contextElement->attributes; } } return new Context\Context($Entities); }
php
public function getEntities($type = false, $offset = 0, $limit = 1000, $details = "on") { if ($type) { $url = $this->url . "contextTypes/" . $type; } else { $url = $this->url . "contextEntities/"; } $ret = $this->restRequest($url . "?offset=$offset&limit=$limit&details=$details", 'GET')->getResponseBody(); $Context = (new Context\Context($ret))->get(); $Entities = []; if($Context instanceof \stdClass && isset($Context->errorCode)){ switch ((int) $Context->errorCode->code) { case 404: case 500: throw new Exception\GeneralException($Context->errorCode->reasonPhrase,(int)$Context->errorCode->code, null, $ret); default: case 200: break; } }else{ throw new Exception\GeneralException("Malformed Orion Response",500, null, $ret); } if(isset($Context->contextResponses) && count($Context->contextResponses) > 0){ foreach ($Context->contextResponses as $entity) { $t = $entity->contextElement->type; $id = $entity->contextElement->id; if(!array_key_exists($t, $Entities)){ $Entities[$t] = []; } $Entities[$t][$id] = $entity->contextElement->attributes; } } return new Context\Context($Entities); }
[ "public", "function", "getEntities", "(", "$", "type", "=", "false", ",", "$", "offset", "=", "0", ",", "$", "limit", "=", "1000", ",", "$", "details", "=", "\"on\"", ")", "{", "if", "(", "$", "type", ")", "{", "$", "url", "=", "$", "this", "->...
This method returns Context Entities @param mixed $type Selected Type @param mixed $offset @param mixed $limit @param mixed $details @return Entities object
[ "This", "method", "returns", "Context", "Entities" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/NGSIAPIv1.php#L201-L241
train
Krinkle/intuition
src/Util.php
Util.strEscape
public static function strEscape( $str, $escape = 'plain' ) { switch ( $escape ) { case 'html' : case 'htmlspecialchars' : $str = htmlspecialchars( $str ); break; case 'htmlentities': $str = htmlentities( $str, ENT_QUOTES, 'UTF-8' ); break; // 'plain' or anything else: Do nothing } return $str; }
php
public static function strEscape( $str, $escape = 'plain' ) { switch ( $escape ) { case 'html' : case 'htmlspecialchars' : $str = htmlspecialchars( $str ); break; case 'htmlentities': $str = htmlentities( $str, ENT_QUOTES, 'UTF-8' ); break; // 'plain' or anything else: Do nothing } return $str; }
[ "public", "static", "function", "strEscape", "(", "$", "str", ",", "$", "escape", "=", "'plain'", ")", "{", "switch", "(", "$", "escape", ")", "{", "case", "'html'", ":", "case", "'htmlspecialchars'", ":", "$", "str", "=", "htmlspecialchars", "(", "$", ...
Escapes a string with one of the known method and returns it @param string $str The string to be escaped @param string $escape The name of the escape routine to be used if this is an unknown method name it will be ignored and 'plain' will be used instead. @return string The escaped string.
[ "Escapes", "a", "string", "with", "one", "of", "the", "known", "method", "and", "returns", "it" ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Util.php#L33-L45
train
Krinkle/intuition
src/Util.php
Util.tag
public static function tag( $str, $wrapTag = 0, $attributes = [] ) { $selfclose = [ 'link', 'input', 'br', 'img' ]; if ( !is_string( $str ) ) { return ''; } if ( !is_string( $wrapTag ) ) { return $str; } $wrapTag = trim( strtolower( $wrapTag ) ); $attrString = ''; if ( is_array( $attributes ) ) { foreach ( $attributes as $attrKey => $attrVal ) { $attrKey = htmlspecialchars( trim( strtolower( $attrKey ) ), ENT_QUOTES ); $attrVal = htmlspecialchars( trim( $attrVal ), ENT_QUOTES ); $attrString .= " $attrKey=\"$attrVal\""; } } $return = "<$wrapTag$attrString"; if ( in_array( $wrapTag, $selfclose ) ) { $return .= '/>'; } else { $return .= ">" . htmlspecialchars( $str ) . "</$wrapTag>"; } return $return; }
php
public static function tag( $str, $wrapTag = 0, $attributes = [] ) { $selfclose = [ 'link', 'input', 'br', 'img' ]; if ( !is_string( $str ) ) { return ''; } if ( !is_string( $wrapTag ) ) { return $str; } $wrapTag = trim( strtolower( $wrapTag ) ); $attrString = ''; if ( is_array( $attributes ) ) { foreach ( $attributes as $attrKey => $attrVal ) { $attrKey = htmlspecialchars( trim( strtolower( $attrKey ) ), ENT_QUOTES ); $attrVal = htmlspecialchars( trim( $attrVal ), ENT_QUOTES ); $attrString .= " $attrKey=\"$attrVal\""; } } $return = "<$wrapTag$attrString"; if ( in_array( $wrapTag, $selfclose ) ) { $return .= '/>'; } else { $return .= ">" . htmlspecialchars( $str ) . "</$wrapTag>"; } return $return; }
[ "public", "static", "function", "tag", "(", "$", "str", ",", "$", "wrapTag", "=", "0", ",", "$", "attributes", "=", "[", "]", ")", "{", "$", "selfclose", "=", "[", "'link'", ",", "'input'", ",", "'br'", ",", "'img'", "]", ";", "if", "(", "!", "...
Primitive html builder Based on similar methods in krinkle/toollabs-base, and Html::element in MediaWiki. @param string $str Content (text or HTML) @param string|int $wrapTag Name of HTML Element (tagName) @param array $attributes [optional] @return string HTML
[ "Primitive", "html", "builder" ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Util.php#L107-L132
train
Krinkle/intuition
src/Util.php
Util.getAcceptableLanguages
public static function getAcceptableLanguages( $rawList = false ) { // Implementation based on MediaWiki 1.21's WebRequest::getAcceptLang // Which is based on http://www.thefutureoftheweb.com/blog/use-accept-language-header // @codeCoverageIgnoreStart if ( $rawList === false ) { $rawList = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : ''; } // @codeCoverageIgnoreEnd // Return the language codes in lower case $rawList = strtolower( $rawList ); // The list of elements is separated by comma and optional LWS // Extract the language-range and, if present, the q-value $lang_parse = null; preg_match_all( '/([a-z]{1,8}(-[a-z]{1,8})*|\*)\s*(;\s*q\s*=\s*(1(\.0{0,3})?|0(\.[0-9]{0,3})?)?)?/', $rawList, $lang_parse ); if ( !count( $lang_parse[1] ) ) { return []; } $langcodes = $lang_parse[1]; $qvalues = $lang_parse[4]; $indices = range( 0, count( $lang_parse[1] ) - 1 ); // Set default q factor to 1 foreach ( $indices as $index ) { if ( $qvalues[$index] === '' ) { $qvalues[$index] = 1; } elseif ( $qvalues[$index] == 0 ) { unset( $langcodes[$index], $qvalues[$index], $indices[$index] ); } else { $qvalues[$index] = floatval( $qvalues[$index] ); } } // Sort list. First by $qvalues, then by order. Reorder $langcodes the same way array_multisort( $qvalues, SORT_DESC, SORT_NUMERIC, $indices, $langcodes ); // Create a list like "en" => 0.8 $langs = array_combine( $langcodes, $qvalues ); return $langs; }
php
public static function getAcceptableLanguages( $rawList = false ) { // Implementation based on MediaWiki 1.21's WebRequest::getAcceptLang // Which is based on http://www.thefutureoftheweb.com/blog/use-accept-language-header // @codeCoverageIgnoreStart if ( $rawList === false ) { $rawList = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : ''; } // @codeCoverageIgnoreEnd // Return the language codes in lower case $rawList = strtolower( $rawList ); // The list of elements is separated by comma and optional LWS // Extract the language-range and, if present, the q-value $lang_parse = null; preg_match_all( '/([a-z]{1,8}(-[a-z]{1,8})*|\*)\s*(;\s*q\s*=\s*(1(\.0{0,3})?|0(\.[0-9]{0,3})?)?)?/', $rawList, $lang_parse ); if ( !count( $lang_parse[1] ) ) { return []; } $langcodes = $lang_parse[1]; $qvalues = $lang_parse[4]; $indices = range( 0, count( $lang_parse[1] ) - 1 ); // Set default q factor to 1 foreach ( $indices as $index ) { if ( $qvalues[$index] === '' ) { $qvalues[$index] = 1; } elseif ( $qvalues[$index] == 0 ) { unset( $langcodes[$index], $qvalues[$index], $indices[$index] ); } else { $qvalues[$index] = floatval( $qvalues[$index] ); } } // Sort list. First by $qvalues, then by order. Reorder $langcodes the same way array_multisort( $qvalues, SORT_DESC, SORT_NUMERIC, $indices, $langcodes ); // Create a list like "en" => 0.8 $langs = array_combine( $langcodes, $qvalues ); return $langs; }
[ "public", "static", "function", "getAcceptableLanguages", "(", "$", "rawList", "=", "false", ")", "{", "// Implementation based on MediaWiki 1.21's WebRequest::getAcceptLang", "// Which is based on http://www.thefutureoftheweb.com/blog/use-accept-language-header", "// @codeCoverageIgnoreSt...
Return a list of acceptable languages from an Accept-Language header. @param string $rawList List of language tags, formatted like an HTTP Accept-Language header (optional; defaults to $_SERVER['HTTP_ACCEPT_LANGUAGE']) @return array keyed by language codes with q-values as values.
[ "Return", "a", "list", "of", "acceptable", "languages", "from", "an", "Accept", "-", "Language", "header", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Util.php#L140-L190
train
Krinkle/intuition
src/Util.php
Util.parseExternalLinks
public static function parseExternalLinks( $text ) { static $urlProtocols = false; static $counter = 0; // @codeCoverageIgnoreStart if ( !$urlProtocols ) { if ( function_exists( 'wfUrlProtocols' ) ) { // Allow custom protocols $urlProtocols = wfUrlProtocols(); } else { $urlProtocols = 'https?:\/\/|ftp:\/\/'; } } // @codeCoverageIgnoreEnd $extLinkBracketedRegex = '/(?:(<[^>]*)|' . '\[(((?i)' . $urlProtocols . ')' . self::EXT_LINK_URL_CLASS . '+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]|' . '(((?i)' . $urlProtocols . ')' . self::EXT_LINK_URL_CLASS . '+))/Su'; return preg_replace_callback( $extLinkBracketedRegex, function ( array $bits ) use ( &$counter ) { // @codeCoverageIgnoreStart if ( $bits[1] != '' ) { return $bits[1]; } // @codeCoverageIgnoreEnd if ( isset( $bits[4] ) && $bits[4] != '' ) { return '<a href="' . $bits[2] . '">' . $bits[4] . '</a>'; } elseif ( isset( $bits[5] ) ) { return '<a href="' . $bits[5] . '">' . $bits[5] . '</a>'; } else { return '<a href="' . $bits[2] . '">[' . ++$counter . ']</a>'; } }, $text ); }
php
public static function parseExternalLinks( $text ) { static $urlProtocols = false; static $counter = 0; // @codeCoverageIgnoreStart if ( !$urlProtocols ) { if ( function_exists( 'wfUrlProtocols' ) ) { // Allow custom protocols $urlProtocols = wfUrlProtocols(); } else { $urlProtocols = 'https?:\/\/|ftp:\/\/'; } } // @codeCoverageIgnoreEnd $extLinkBracketedRegex = '/(?:(<[^>]*)|' . '\[(((?i)' . $urlProtocols . ')' . self::EXT_LINK_URL_CLASS . '+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]|' . '(((?i)' . $urlProtocols . ')' . self::EXT_LINK_URL_CLASS . '+))/Su'; return preg_replace_callback( $extLinkBracketedRegex, function ( array $bits ) use ( &$counter ) { // @codeCoverageIgnoreStart if ( $bits[1] != '' ) { return $bits[1]; } // @codeCoverageIgnoreEnd if ( isset( $bits[4] ) && $bits[4] != '' ) { return '<a href="' . $bits[2] . '">' . $bits[4] . '</a>'; } elseif ( isset( $bits[5] ) ) { return '<a href="' . $bits[5] . '">' . $bits[5] . '</a>'; } else { return '<a href="' . $bits[2] . '">[' . ++$counter . ']</a>'; } }, $text ); }
[ "public", "static", "function", "parseExternalLinks", "(", "$", "text", ")", "{", "static", "$", "urlProtocols", "=", "false", ";", "static", "$", "counter", "=", "0", ";", "// @codeCoverageIgnoreStart", "if", "(", "!", "$", "urlProtocols", ")", "{", "if", ...
Given a text already html-escaped which contains urls in wiki format, convert it to html. @param string $text @return string HTML
[ "Given", "a", "text", "already", "html", "-", "escaped", "which", "contains", "urls", "in", "wiki", "format", "convert", "it", "to", "html", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Util.php#L202-L243
train
Krinkle/intuition
src/Util.php
Util.parseWikiLinks
public static function parseWikiLinks( $text, $articlePath ) { self::$articlePath = $articlePath; return preg_replace_callback( '/\[\[:?([^]|]+)(?:\|([^]]*))?\]\]/', function ( array $bits ) { if ( !isset( $bits[2] ) || $bits[2] == '' ) { $bits[2] = strtr( $bits[1], '_', ' ' ); } $article = html_entity_decode( $bits[1], ENT_QUOTES, 'UTF-8' ); return '<a href="' . htmlspecialchars( self::prettyEncodedWikiUrl( self::$articlePath, $article ), ENT_COMPAT, 'UTF-8' ) . '">' . $bits[2] . "</a>"; }, $text ); }
php
public static function parseWikiLinks( $text, $articlePath ) { self::$articlePath = $articlePath; return preg_replace_callback( '/\[\[:?([^]|]+)(?:\|([^]]*))?\]\]/', function ( array $bits ) { if ( !isset( $bits[2] ) || $bits[2] == '' ) { $bits[2] = strtr( $bits[1], '_', ' ' ); } $article = html_entity_decode( $bits[1], ENT_QUOTES, 'UTF-8' ); return '<a href="' . htmlspecialchars( self::prettyEncodedWikiUrl( self::$articlePath, $article ), ENT_COMPAT, 'UTF-8' ) . '">' . $bits[2] . "</a>"; }, $text ); }
[ "public", "static", "function", "parseWikiLinks", "(", "$", "text", ",", "$", "articlePath", ")", "{", "self", "::", "$", "articlePath", "=", "$", "articlePath", ";", "return", "preg_replace_callback", "(", "'/\\[\\[:?([^]|]+)(?:\\|([^]]*))?\\]\\]/'", ",", "function...
Given a text already html-escaped which contains wiki links, convert them to html. @param string $text @param string $articlePath @return string
[ "Given", "a", "text", "already", "html", "-", "escaped", "which", "contains", "wiki", "links", "convert", "them", "to", "html", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Util.php#L252-L270
train
Krinkle/intuition
src/Util.php
Util.prettyEncodedWikiUrl
public static function prettyEncodedWikiUrl( $articlePath, $article ) { $s = strtr( $article, ' ', '_' ); $s = urlencode( $s ); $s = str_ireplace( [ '%3B', '%40', '%24', '%21', '%2A', '%28', '%29', '%2C', '%2F', '%3A' ], [ ';', '@', '$', '!', '*', '(', ')', ',', '/', ':' ], $s ); $s = str_replace( '$1', $s, $articlePath ); return $s; }
php
public static function prettyEncodedWikiUrl( $articlePath, $article ) { $s = strtr( $article, ' ', '_' ); $s = urlencode( $s ); $s = str_ireplace( [ '%3B', '%40', '%24', '%21', '%2A', '%28', '%29', '%2C', '%2F', '%3A' ], [ ';', '@', '$', '!', '*', '(', ')', ',', '/', ':' ], $s ); $s = str_replace( '$1', $s, $articlePath ); return $s; }
[ "public", "static", "function", "prettyEncodedWikiUrl", "(", "$", "articlePath", ",", "$", "article", ")", "{", "$", "s", "=", "strtr", "(", "$", "article", ",", "' '", ",", "'_'", ")", ";", "$", "s", "=", "urlencode", "(", "$", "s", ")", ";", "$",...
Encode a page title the way MediaWiki would. This is based on MediaWiki's wfUrlencode(). @param string $articlePath @param string $article @return string
[ "Encode", "a", "page", "title", "the", "way", "MediaWiki", "would", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Util.php#L281-L293
train
ArgentCrusade/selectel-cloud-storage
src/FileUploader.php
FileUploader.upload
public function upload(ApiClientContract $api, $path, $body, array $params = [], $verifyChecksum = true) { $response = $api->request('PUT', $path, [ 'headers' => $this->convertUploadParamsToHeaders($body, $params, $verifyChecksum), 'body' => $body, 'query' => $this->extractQueryParameters($params), ]); if ($response->getStatusCode() !== 201) { throw new UploadFailedException('Unable to upload file.', $response->getStatusCode()); } return $response->getHeaderLine('ETag'); }
php
public function upload(ApiClientContract $api, $path, $body, array $params = [], $verifyChecksum = true) { $response = $api->request('PUT', $path, [ 'headers' => $this->convertUploadParamsToHeaders($body, $params, $verifyChecksum), 'body' => $body, 'query' => $this->extractQueryParameters($params), ]); if ($response->getStatusCode() !== 201) { throw new UploadFailedException('Unable to upload file.', $response->getStatusCode()); } return $response->getHeaderLine('ETag'); }
[ "public", "function", "upload", "(", "ApiClientContract", "$", "api", ",", "$", "path", ",", "$", "body", ",", "array", "$", "params", "=", "[", "]", ",", "$", "verifyChecksum", "=", "true", ")", "{", "$", "response", "=", "$", "api", "->", "request"...
Upload file from string or stream resource. @param \ArgentCrusade\Selectel\CloudStorage\Contracts\Api\ApiClientContract $api @param string $path Remote path. @param string|resource $body File contents. @param array $params = [] Upload params. @param bool $verifyChecksum = true @throws \ArgentCrusade\Selectel\CloudStorage\Exceptions\UploadFailedException @return string
[ "Upload", "file", "from", "string", "or", "stream", "resource", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/FileUploader.php#L24-L37
train
ArgentCrusade/selectel-cloud-storage
src/FileUploader.php
FileUploader.convertUploadParamsToHeaders
protected function convertUploadParamsToHeaders($body = null, array $params = [], $verifyChecksum = true) { $headers = []; if ($verifyChecksum) { $headers['ETag'] = md5($body); } $availableParams = [ 'contentType' => 'Content-Type', 'contentDisposition' => 'Content-Disposition', 'deleteAfter' => 'X-Delete-After', 'deleteAt' => 'X-Delete-At', ]; foreach ($availableParams as $key => $header) { if (isset($params[$key])) { $headers[$header] = $params[$key]; } } return $headers; }
php
protected function convertUploadParamsToHeaders($body = null, array $params = [], $verifyChecksum = true) { $headers = []; if ($verifyChecksum) { $headers['ETag'] = md5($body); } $availableParams = [ 'contentType' => 'Content-Type', 'contentDisposition' => 'Content-Disposition', 'deleteAfter' => 'X-Delete-After', 'deleteAt' => 'X-Delete-At', ]; foreach ($availableParams as $key => $header) { if (isset($params[$key])) { $headers[$header] = $params[$key]; } } return $headers; }
[ "protected", "function", "convertUploadParamsToHeaders", "(", "$", "body", "=", "null", ",", "array", "$", "params", "=", "[", "]", ",", "$", "verifyChecksum", "=", "true", ")", "{", "$", "headers", "=", "[", "]", ";", "if", "(", "$", "verifyChecksum", ...
Parses upload parameters and assigns them to appropriate HTTP headers. @param string|resource $body = null @param array $params = [] @param bool $verifyChecksum = true @return array
[ "Parses", "upload", "parameters", "and", "assigns", "them", "to", "appropriate", "HTTP", "headers", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/FileUploader.php#L48-L70
train
ArgentCrusade/selectel-cloud-storage
src/FileUploader.php
FileUploader.extractQueryParameters
protected function extractQueryParameters(array $params) { $availableParams = ['extract-archive']; $query = []; foreach ($params as $key => $value) { if (in_array($key, $availableParams)) { $query[$key] = $value; } } return $query; }
php
protected function extractQueryParameters(array $params) { $availableParams = ['extract-archive']; $query = []; foreach ($params as $key => $value) { if (in_array($key, $availableParams)) { $query[$key] = $value; } } return $query; }
[ "protected", "function", "extractQueryParameters", "(", "array", "$", "params", ")", "{", "$", "availableParams", "=", "[", "'extract-archive'", "]", ";", "$", "query", "=", "[", "]", ";", "foreach", "(", "$", "params", "as", "$", "key", "=>", "$", "valu...
Parses upload parameters and assigns them to appropriate query parameters. @param array $params @return array
[ "Parses", "upload", "parameters", "and", "assigns", "them", "to", "appropriate", "query", "parameters", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/FileUploader.php#L79-L91
train
mocdk/MOC.Varnish
Classes/Service/TokenStorage.php
TokenStorage.getToken
public function getToken() { $token = $this->cache->get($this->tokenName); if ($token === false) { $token = Algorithms::generateRandomToken(20); $this->storeToken($token); } return $token; }
php
public function getToken() { $token = $this->cache->get($this->tokenName); if ($token === false) { $token = Algorithms::generateRandomToken(20); $this->storeToken($token); } return $token; }
[ "public", "function", "getToken", "(", ")", "{", "$", "token", "=", "$", "this", "->", "cache", "->", "get", "(", "$", "this", "->", "tokenName", ")", ";", "if", "(", "$", "token", "===", "false", ")", "{", "$", "token", "=", "Algorithms", "::", ...
Fetch the token or generate a new random token @return string
[ "Fetch", "the", "token", "or", "generate", "a", "new", "random", "token" ]
f7f4cec4ceb0ce03ca259e896d8f75a645272759
https://github.com/mocdk/MOC.Varnish/blob/f7f4cec4ceb0ce03ca259e896d8f75a645272759/Classes/Service/TokenStorage.php#L29-L37
train
webeweb/jquery-datatables-bundle
API/DataTablesOrder.php
DataTablesOrder.setDir
public function setDir($dir) { if (false === in_array($dir, DataTablesEnumerator::enumDirs())) { $dir = self::DATATABLES_DIR_ASC; } $this->dir = strtoupper($dir); return $this; }
php
public function setDir($dir) { if (false === in_array($dir, DataTablesEnumerator::enumDirs())) { $dir = self::DATATABLES_DIR_ASC; } $this->dir = strtoupper($dir); return $this; }
[ "public", "function", "setDir", "(", "$", "dir", ")", "{", "if", "(", "false", "===", "in_array", "(", "$", "dir", ",", "DataTablesEnumerator", "::", "enumDirs", "(", ")", ")", ")", "{", "$", "dir", "=", "self", "::", "DATATABLES_DIR_ASC", ";", "}", ...
Set the dir. @param string $dir The dir. @return DataTablesOrderInterface Returns this order.
[ "Set", "the", "dir", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/API/DataTablesOrder.php#L74-L80
train
ArgentCrusade/selectel-cloud-storage
src/Api/ApiClient.php
ApiClient.getHttpClient
public function getHttpClient() { if (!is_null($this->httpClient)) { return $this->httpClient; } return $this->httpClient = new Client([ 'base_uri' => $this->storageUrl(), 'headers' => [ 'X-Auth-Token' => $this->token(), ], ]); }
php
public function getHttpClient() { if (!is_null($this->httpClient)) { return $this->httpClient; } return $this->httpClient = new Client([ 'base_uri' => $this->storageUrl(), 'headers' => [ 'X-Auth-Token' => $this->token(), ], ]); }
[ "public", "function", "getHttpClient", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "httpClient", ")", ")", "{", "return", "$", "this", "->", "httpClient", ";", "}", "return", "$", "this", "->", "httpClient", "=", "new", "Client", ...
HTTP Client. @return \GuzzleHttp\ClientInterface|null
[ "HTTP", "Client", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/Api/ApiClient.php#L82-L94
train
ArgentCrusade/selectel-cloud-storage
src/Api/ApiClient.php
ApiClient.authenticate
public function authenticate() { if (!is_null($this->token)) { return; } $response = $this->authenticationResponse(); if (!$response->hasHeader('X-Auth-Token')) { throw new AuthenticationFailedException('Given credentials are wrong.', 403); } if (!$response->hasHeader('X-Storage-Url')) { throw new RuntimeException('Storage URL is missing.', 500); } $this->token = $response->getHeaderLine('X-Auth-Token'); $this->storageUrl = $response->getHeaderLine('X-Storage-Url'); }
php
public function authenticate() { if (!is_null($this->token)) { return; } $response = $this->authenticationResponse(); if (!$response->hasHeader('X-Auth-Token')) { throw new AuthenticationFailedException('Given credentials are wrong.', 403); } if (!$response->hasHeader('X-Storage-Url')) { throw new RuntimeException('Storage URL is missing.', 500); } $this->token = $response->getHeaderLine('X-Auth-Token'); $this->storageUrl = $response->getHeaderLine('X-Storage-Url'); }
[ "public", "function", "authenticate", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "token", ")", ")", "{", "return", ";", "}", "$", "response", "=", "$", "this", "->", "authenticationResponse", "(", ")", ";", "if", "(", "!", "$...
Performs authentication request. @throws \ArgentCrusade\Selectel\CloudStorage\Exceptions\AuthenticationFailedException @throws \RuntimeException
[ "Performs", "authentication", "request", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/Api/ApiClient.php#L132-L150
train
ArgentCrusade/selectel-cloud-storage
src/Api/ApiClient.php
ApiClient.authenticationResponse
public function authenticationResponse() { $client = new Client(); try { $response = $client->request('GET', static::AUTH_URL, [ 'headers' => [ 'X-Auth-User' => $this->username, 'X-Auth-Key' => $this->password, ], ]); } catch (RequestException $e) { throw new AuthenticationFailedException('Given credentials are wrong.', 403); } return $response; }
php
public function authenticationResponse() { $client = new Client(); try { $response = $client->request('GET', static::AUTH_URL, [ 'headers' => [ 'X-Auth-User' => $this->username, 'X-Auth-Key' => $this->password, ], ]); } catch (RequestException $e) { throw new AuthenticationFailedException('Given credentials are wrong.', 403); } return $response; }
[ "public", "function", "authenticationResponse", "(", ")", "{", "$", "client", "=", "new", "Client", "(", ")", ";", "try", "{", "$", "response", "=", "$", "client", "->", "request", "(", "'GET'", ",", "static", "::", "AUTH_URL", ",", "[", "'headers'", "...
Performs authentication request and returns its response. @throws \ArgentCrusade\Selectel\CloudStorage\Exceptions\AuthenticationFailedException @return \Psr\Http\Message\ResponseInterface
[ "Performs", "authentication", "request", "and", "returns", "its", "response", "." ]
f085af14b496463dc30d4804eac8c5f574d121a4
https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/Api/ApiClient.php#L159-L175
train
Krinkle/intuition
language/mw-classes/LanguageEo.php
LanguageEo.iconv
function iconv( $in, $out, $string ) { if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) { return preg_replace_callback ( '/([cghjsu]x?)((?:xx)*)(?!x)/i', array( $this, 'strrtxuCallback' ), $string ); } elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) { # Double Xs only if they follow cxapelutaj literoj. return preg_replace_callback( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]|\xc5[\x9c\x9d\xac\xad])x*)/i', array( $this, 'strrtuxCallback' ), $string ); } return parent::iconv( $in, $out, $string ); }
php
function iconv( $in, $out, $string ) { if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) { return preg_replace_callback ( '/([cghjsu]x?)((?:xx)*)(?!x)/i', array( $this, 'strrtxuCallback' ), $string ); } elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) { # Double Xs only if they follow cxapelutaj literoj. return preg_replace_callback( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]|\xc5[\x9c\x9d\xac\xad])x*)/i', array( $this, 'strrtuxCallback' ), $string ); } return parent::iconv( $in, $out, $string ); }
[ "function", "iconv", "(", "$", "in", ",", "$", "out", ",", "$", "string", ")", "{", "if", "(", "strcasecmp", "(", "$", "in", ",", "'x'", ")", "==", "0", "&&", "strcasecmp", "(", "$", "out", ",", "'utf-8'", ")", "==", "0", ")", "{", "return", ...
Wrapper for charset conversions. In most languages, this calls through to standard system iconv(), but for Esperanto we're also adding a special pseudo-charset to convert accented characters to/from the ASCII-friendly "X" surrogate coding: cx = ĉ cxx = cx gx = ĝ gxx = gx hx = ĥ hxx = hx jx = ĵ jxx = jx sx = ŝ sxx = sx ux = ŭ uxx = ux xx = x http://en.wikipedia.org/wiki/Esperanto_orthography#X-system http://eo.wikipedia.org/wiki/X-sistemo X-conversion is applied, in either direction, between "utf-8" and "x" charsets; this comes into effect when input is run through $wgRequest->getText() and the $wgEditEncoding is set to 'x'. In the long run, this should be moved out of here and into the client-side editor behavior; the original server-side translation system dates to 2002-2003 when many browsers with really bad Unicode support were still in use. @param string $in input character set @param string $out output character set @param string $string text to be converted @return string
[ "Wrapper", "for", "charset", "conversions", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/language/mw-classes/LanguageEo.php#L40-L52
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/helper/GiroCheckout_SDK_TransactionType_helper.php
GiroCheckout_SDK_TransactionType_helper.getTransactionTypeByName
public static function getTransactionTypeByName($transType) { switch ($transType) { //credit card apis case 'creditCardTransaction': return new GiroCheckout_SDK_CreditCardTransaction(); case 'creditCardCapture': return new GiroCheckout_SDK_CreditCardCapture(); case 'creditCardRefund': return new GiroCheckout_SDK_CreditCardRefund(); case 'creditCardGetPKN': return new GiroCheckout_SDK_CreditCardGetPKN(); case 'creditCardRecurringTransaction': return new GiroCheckout_SDK_CreditCardRecurringTransaction(); case 'creditCardVoid': return new GiroCheckout_SDK_CreditCardVoid(); //direct debit apis case 'directDebitTransaction': return new GiroCheckout_SDK_DirectDebitTransaction(); case 'directDebitGetPKN': return new GiroCheckout_SDK_DirectDebitGetPKN(); case 'directDebitTransactionWithPaymentPage': return new GiroCheckout_SDK_DirectDebitTransactionWithPaymentPage(); case 'directDebitCapture': return new GiroCheckout_SDK_DirectDebitCapture(); case 'directDebitRefund': return new GiroCheckout_SDK_DirectDebitRefund(); case 'directDebitVoid': return new GiroCheckout_SDK_DirectDebitVoid(); //giropay apis case 'giropayBankstatus': return new GiroCheckout_SDK_GiropayBankstatus(); case 'giropayIDCheck': return new GiroCheckout_SDK_GiropayIDCheck(); case 'giropayTransaction': return new GiroCheckout_SDK_GiropayTransaction(); case 'giropayIssuerList': return new GiroCheckout_SDK_GiropayIssuerList(); //iDEAL apis case 'idealIssuerList': return new GiroCheckout_SDK_IdealIssuerList(); case 'idealPayment': return new GiroCheckout_SDK_IdealPayment(); case 'idealRefund': return new GiroCheckout_SDK_IdealPaymentRefund(); //PayPal apis case 'paypalTransaction': return new GiroCheckout_SDK_PaypalTransaction(); //eps apis case 'epsBankstatus': return new GiroCheckout_SDK_EpsBankstatus(); case 'epsTransaction': return new GiroCheckout_SDK_EpsTransaction(); case 'epsIssuerList': return new GiroCheckout_SDK_EpsIssuerList(); //tools apis case 'getTransactionTool': return new GiroCheckout_SDK_Tools_GetTransaction(); //GiroCode apis case 'giroCodeCreatePayment': return new GiroCheckout_SDK_GiroCodeCreatePayment(); case 'giroCodeCreateEpc': return new GiroCheckout_SDK_GiroCodeCreateEpc(); case 'giroCodeGetEpc': return new GiroCheckout_SDK_GiroCodeGetEpc(); //Paydirekt apis case 'paydirektTransaction': return new GiroCheckout_SDK_PaydirektTransaction(); case 'paydirektCapture': return new GiroCheckout_SDK_PaydirektCapture(); case 'paydirektRefund': return new GiroCheckout_SDK_PaydirektRefund(); case 'paydirektVoid': return new GiroCheckout_SDK_PaydirektVoid(); //Sofort apis case 'sofortuwTransaction': return new GiroCheckout_SDK_SofortUwTransaction(); //BlueCode apis case 'blueCodeTransaction': return new GiroCheckout_SDK_BlueCodeTransaction(); //Payment page apis case 'paypageTransaction': return new GiroCheckout_SDK_PaypageTransaction(); case 'paypageProjects': return new GiroCheckout_SDK_PaypageProjects(); //Maestro apis case 'maestroTransaction': return new GiroCheckout_SDK_MaestroTransaction(); case 'maestroCapture': return new GiroCheckout_SDK_MaestroCapture(); case 'maestroRefund': return new GiroCheckout_SDK_MaestroRefund(); } return null; }
php
public static function getTransactionTypeByName($transType) { switch ($transType) { //credit card apis case 'creditCardTransaction': return new GiroCheckout_SDK_CreditCardTransaction(); case 'creditCardCapture': return new GiroCheckout_SDK_CreditCardCapture(); case 'creditCardRefund': return new GiroCheckout_SDK_CreditCardRefund(); case 'creditCardGetPKN': return new GiroCheckout_SDK_CreditCardGetPKN(); case 'creditCardRecurringTransaction': return new GiroCheckout_SDK_CreditCardRecurringTransaction(); case 'creditCardVoid': return new GiroCheckout_SDK_CreditCardVoid(); //direct debit apis case 'directDebitTransaction': return new GiroCheckout_SDK_DirectDebitTransaction(); case 'directDebitGetPKN': return new GiroCheckout_SDK_DirectDebitGetPKN(); case 'directDebitTransactionWithPaymentPage': return new GiroCheckout_SDK_DirectDebitTransactionWithPaymentPage(); case 'directDebitCapture': return new GiroCheckout_SDK_DirectDebitCapture(); case 'directDebitRefund': return new GiroCheckout_SDK_DirectDebitRefund(); case 'directDebitVoid': return new GiroCheckout_SDK_DirectDebitVoid(); //giropay apis case 'giropayBankstatus': return new GiroCheckout_SDK_GiropayBankstatus(); case 'giropayIDCheck': return new GiroCheckout_SDK_GiropayIDCheck(); case 'giropayTransaction': return new GiroCheckout_SDK_GiropayTransaction(); case 'giropayIssuerList': return new GiroCheckout_SDK_GiropayIssuerList(); //iDEAL apis case 'idealIssuerList': return new GiroCheckout_SDK_IdealIssuerList(); case 'idealPayment': return new GiroCheckout_SDK_IdealPayment(); case 'idealRefund': return new GiroCheckout_SDK_IdealPaymentRefund(); //PayPal apis case 'paypalTransaction': return new GiroCheckout_SDK_PaypalTransaction(); //eps apis case 'epsBankstatus': return new GiroCheckout_SDK_EpsBankstatus(); case 'epsTransaction': return new GiroCheckout_SDK_EpsTransaction(); case 'epsIssuerList': return new GiroCheckout_SDK_EpsIssuerList(); //tools apis case 'getTransactionTool': return new GiroCheckout_SDK_Tools_GetTransaction(); //GiroCode apis case 'giroCodeCreatePayment': return new GiroCheckout_SDK_GiroCodeCreatePayment(); case 'giroCodeCreateEpc': return new GiroCheckout_SDK_GiroCodeCreateEpc(); case 'giroCodeGetEpc': return new GiroCheckout_SDK_GiroCodeGetEpc(); //Paydirekt apis case 'paydirektTransaction': return new GiroCheckout_SDK_PaydirektTransaction(); case 'paydirektCapture': return new GiroCheckout_SDK_PaydirektCapture(); case 'paydirektRefund': return new GiroCheckout_SDK_PaydirektRefund(); case 'paydirektVoid': return new GiroCheckout_SDK_PaydirektVoid(); //Sofort apis case 'sofortuwTransaction': return new GiroCheckout_SDK_SofortUwTransaction(); //BlueCode apis case 'blueCodeTransaction': return new GiroCheckout_SDK_BlueCodeTransaction(); //Payment page apis case 'paypageTransaction': return new GiroCheckout_SDK_PaypageTransaction(); case 'paypageProjects': return new GiroCheckout_SDK_PaypageProjects(); //Maestro apis case 'maestroTransaction': return new GiroCheckout_SDK_MaestroTransaction(); case 'maestroCapture': return new GiroCheckout_SDK_MaestroCapture(); case 'maestroRefund': return new GiroCheckout_SDK_MaestroRefund(); } return null; }
[ "public", "static", "function", "getTransactionTypeByName", "(", "$", "transType", ")", "{", "switch", "(", "$", "transType", ")", "{", "//credit card apis", "case", "'creditCardTransaction'", ":", "return", "new", "GiroCheckout_SDK_CreditCardTransaction", "(", ")", "...
Returns api call instance @param String api call name @return object
[ "Returns", "api", "call", "instance" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_TransactionType_helper.php#L57-L163
train
Distilleries/Expendable
src/Distilleries/Expendable/Http/Router/ControllerInspector.php
ControllerInspector.getRoutable
public function getRoutable($controller, $prefix) { $routable = []; $reflection = new ReflectionClass($controller); $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC); // To get the routable methods, we will simply spin through all methods on the // controller instance checking to see if it belongs to the given class and // is a publicly routable method. If so, we will add it to this listings. foreach ($methods as $method) { if ($this->isRoutable($method)) { $data = $this->getMethodData($method, $prefix); $routable[$method->name][] = $data; // If the routable method is an index method, we will create a special index // route which is simply the prefix and the verb and does not contain any // the wildcard place-holders that each "typical" routes would contain. if ($data['plain'] == $prefix.'/index') { $routable[$method->name][] = $this->getIndexData($data, $prefix); } } } return $routable; }
php
public function getRoutable($controller, $prefix) { $routable = []; $reflection = new ReflectionClass($controller); $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC); // To get the routable methods, we will simply spin through all methods on the // controller instance checking to see if it belongs to the given class and // is a publicly routable method. If so, we will add it to this listings. foreach ($methods as $method) { if ($this->isRoutable($method)) { $data = $this->getMethodData($method, $prefix); $routable[$method->name][] = $data; // If the routable method is an index method, we will create a special index // route which is simply the prefix and the verb and does not contain any // the wildcard place-holders that each "typical" routes would contain. if ($data['plain'] == $prefix.'/index') { $routable[$method->name][] = $this->getIndexData($data, $prefix); } } } return $routable; }
[ "public", "function", "getRoutable", "(", "$", "controller", ",", "$", "prefix", ")", "{", "$", "routable", "=", "[", "]", ";", "$", "reflection", "=", "new", "ReflectionClass", "(", "$", "controller", ")", ";", "$", "methods", "=", "$", "reflection", ...
Get the routable methods for a controller. @param string $controller @param string $prefix @return array
[ "Get", "the", "routable", "methods", "for", "a", "controller", "." ]
badfdabb7fc78447906fc9856bd313f2f1dbae8d
https://github.com/Distilleries/Expendable/blob/badfdabb7fc78447906fc9856bd313f2f1dbae8d/src/Distilleries/Expendable/Http/Router/ControllerInspector.php#L33-L54
train
Distilleries/Expendable
src/Distilleries/Expendable/Http/Router/ControllerInspector.php
ControllerInspector.getMethodData
public function getMethodData(ReflectionMethod $method, $prefix) { $verb = $this->getVerb($name = $method->name); $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix)); return compact('verb', 'plain', 'uri'); }
php
public function getMethodData(ReflectionMethod $method, $prefix) { $verb = $this->getVerb($name = $method->name); $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix)); return compact('verb', 'plain', 'uri'); }
[ "public", "function", "getMethodData", "(", "ReflectionMethod", "$", "method", ",", "$", "prefix", ")", "{", "$", "verb", "=", "$", "this", "->", "getVerb", "(", "$", "name", "=", "$", "method", "->", "name", ")", ";", "$", "uri", "=", "$", "this", ...
Get the method data for a given method. @param \ReflectionMethod $method @param string $prefix @return array
[ "Get", "the", "method", "data", "for", "a", "given", "method", "." ]
badfdabb7fc78447906fc9856bd313f2f1dbae8d
https://github.com/Distilleries/Expendable/blob/badfdabb7fc78447906fc9856bd313f2f1dbae8d/src/Distilleries/Expendable/Http/Router/ControllerInspector.php#L75-L80
train
oliverklee/ext-oelib
Classes/Model/BackEndUser.php
Tx_Oelib_Model_BackEndUser.getLanguage
public function getLanguage() { $configuration = $this->getConfiguration(); $result = !empty($configuration['lang']) ? $configuration['lang'] : $this->getDefaultLanguage(); return ($result !== '') ? $result : 'default'; }
php
public function getLanguage() { $configuration = $this->getConfiguration(); $result = !empty($configuration['lang']) ? $configuration['lang'] : $this->getDefaultLanguage(); return ($result !== '') ? $result : 'default'; }
[ "public", "function", "getLanguage", "(", ")", "{", "$", "configuration", "=", "$", "this", "->", "getConfiguration", "(", ")", ";", "$", "result", "=", "!", "empty", "(", "$", "configuration", "[", "'lang'", "]", ")", "?", "$", "configuration", "[", "...
Gets this user's language. Will be a two-letter "lg_typo3" key of the "static_languages" table or "default" for the default language. @return string this user's language key, will not be empty
[ "Gets", "this", "user", "s", "language", ".", "Will", "be", "a", "two", "-", "letter", "lg_typo3", "key", "of", "the", "static_languages", "table", "or", "default", "for", "the", "default", "language", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Model/BackEndUser.php#L52-L58
train
oliverklee/ext-oelib
Classes/Model/BackEndUser.php
Tx_Oelib_Model_BackEndUser.getAllGroups
public function getAllGroups() { $result = new \Tx_Oelib_List(); $groupsToProcess = $this->getGroups(); do { $groupsForNextStep = new \Tx_Oelib_List(); $result->append($groupsToProcess); /** @var \Tx_Oelib_Model_BackEndUserGroup $group */ foreach ($groupsToProcess as $group) { $subgroups = $group->getSubgroups(); /** @var \Tx_Oelib_Model_BackEndUserGroup $subgroup */ foreach ($subgroups as $subgroup) { if (!$result->hasUid($subgroup->getUid())) { $groupsForNextStep->add($subgroup); } } } $groupsToProcess = $groupsForNextStep; } while (!$groupsToProcess->isEmpty()); return $result; }
php
public function getAllGroups() { $result = new \Tx_Oelib_List(); $groupsToProcess = $this->getGroups(); do { $groupsForNextStep = new \Tx_Oelib_List(); $result->append($groupsToProcess); /** @var \Tx_Oelib_Model_BackEndUserGroup $group */ foreach ($groupsToProcess as $group) { $subgroups = $group->getSubgroups(); /** @var \Tx_Oelib_Model_BackEndUserGroup $subgroup */ foreach ($subgroups as $subgroup) { if (!$result->hasUid($subgroup->getUid())) { $groupsForNextStep->add($subgroup); } } } $groupsToProcess = $groupsForNextStep; } while (!$groupsToProcess->isEmpty()); return $result; }
[ "public", "function", "getAllGroups", "(", ")", "{", "$", "result", "=", "new", "\\", "Tx_Oelib_List", "(", ")", ";", "$", "groupsToProcess", "=", "$", "this", "->", "getGroups", "(", ")", ";", "do", "{", "$", "groupsForNextStep", "=", "new", "\\", "Tx...
Recursively gets all groups and subgroups of this user. @return \Tx_Oelib_List<\Tx_Oelib_Model_BackEndUserGroup> all groups and subgroups of this user, will be empty if this user has no groups
[ "Recursively", "gets", "all", "groups", "and", "subgroups", "of", "this", "user", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Model/BackEndUser.php#L109-L131
train
oliverklee/ext-oelib
Classes/Model/BackEndUser.php
Tx_Oelib_Model_BackEndUser.getConfiguration
private function getConfiguration() { if (empty($this->configuration)) { $this->configuration = unserialize($this->getAsString('uc')); } return $this->configuration; }
php
private function getConfiguration() { if (empty($this->configuration)) { $this->configuration = unserialize($this->getAsString('uc')); } return $this->configuration; }
[ "private", "function", "getConfiguration", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "configuration", ")", ")", "{", "$", "this", "->", "configuration", "=", "unserialize", "(", "$", "this", "->", "getAsString", "(", "'uc'", ")", ")", ...
Retrieves the user's configuration, and unserializes it. @return string[] the user's configuration, will be empty if the user has no configuration set
[ "Retrieves", "the", "user", "s", "configuration", "and", "unserializes", "it", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Model/BackEndUser.php#L138-L145
train
rotassator/omnipay-payway-restapi
src/Message/Response.php
Response.getErrorData
public function getErrorData($key = null) { if ($this->isSuccessful()) { return null; } // get error data (array in data) $data = isset($this->getData('data')[0]) ? $this->getData('data')[0] : null; if ($key) { return isset($data[$key]) ? $data[$key] : null; } return $data; }
php
public function getErrorData($key = null) { if ($this->isSuccessful()) { return null; } // get error data (array in data) $data = isset($this->getData('data')[0]) ? $this->getData('data')[0] : null; if ($key) { return isset($data[$key]) ? $data[$key] : null; } return $data; }
[ "public", "function", "getErrorData", "(", "$", "key", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isSuccessful", "(", ")", ")", "{", "return", "null", ";", "}", "// get error data (array in data)", "$", "data", "=", "isset", "(", "$", "this", ...
Get error data from response @param string $key Optional data key @return string|array Response error item or all data if no key
[ "Get", "error", "data", "from", "response" ]
4241c1fd0d52a663839d5b65858d6ddf2af2670f
https://github.com/rotassator/omnipay-payway-restapi/blob/4241c1fd0d52a663839d5b65858d6ddf2af2670f/src/Message/Response.php#L138-L149
train
rotassator/omnipay-payway-restapi
src/Message/Response.php
Response.getMessage
public function getMessage() { if ($this->getErrorMessage()) { return $this->getErrorMessage() . ' (' . $this->getErrorFieldName() . ')'; } if ($this->isSuccessful()) { return ($this->getStatus()) ? ucfirst($this->getStatus()) : 'Successful'; } // default to unsuccessful message return 'The transaction was unsuccessful.'; }
php
public function getMessage() { if ($this->getErrorMessage()) { return $this->getErrorMessage() . ' (' . $this->getErrorFieldName() . ')'; } if ($this->isSuccessful()) { return ($this->getStatus()) ? ucfirst($this->getStatus()) : 'Successful'; } // default to unsuccessful message return 'The transaction was unsuccessful.'; }
[ "public", "function", "getMessage", "(", ")", "{", "if", "(", "$", "this", "->", "getErrorMessage", "(", ")", ")", "{", "return", "$", "this", "->", "getErrorMessage", "(", ")", ".", "' ('", ".", "$", "this", "->", "getErrorFieldName", "(", ")", ".", ...
Get error message from the response @return string|null Error message or null if successful
[ "Get", "error", "message", "from", "the", "response" ]
4241c1fd0d52a663839d5b65858d6ddf2af2670f
https://github.com/rotassator/omnipay-payway-restapi/blob/4241c1fd0d52a663839d5b65858d6ddf2af2670f/src/Message/Response.php#L155-L166
train
rotassator/omnipay-payway-restapi
src/Message/Response.php
Response.getHttpResponseCodeText
public function getHttpResponseCodeText() { $code = $this->getHttpResponseCode(); $statusTexts = \Symfony\Component\HttpFoundation\Response::$statusTexts; return (isset($statusTexts[$code])) ? $statusTexts[$code] : null; }
php
public function getHttpResponseCodeText() { $code = $this->getHttpResponseCode(); $statusTexts = \Symfony\Component\HttpFoundation\Response::$statusTexts; return (isset($statusTexts[$code])) ? $statusTexts[$code] : null; }
[ "public", "function", "getHttpResponseCodeText", "(", ")", "{", "$", "code", "=", "$", "this", "->", "getHttpResponseCode", "(", ")", ";", "$", "statusTexts", "=", "\\", "Symfony", "\\", "Component", "\\", "HttpFoundation", "\\", "Response", "::", "$", "stat...
Get HTTP Response code text @return string
[ "Get", "HTTP", "Response", "code", "text" ]
4241c1fd0d52a663839d5b65858d6ddf2af2670f
https://github.com/rotassator/omnipay-payway-restapi/blob/4241c1fd0d52a663839d5b65858d6ddf2af2670f/src/Message/Response.php#L266-L272
train
webeweb/jquery-datatables-bundle
Controller/AbstractController.php
AbstractController.buildDataTablesResponse
protected function buildDataTablesResponse(Request $request, $name, ActionResponse $output) { if (true === $request->isXmlHttpRequest()) { return new JsonResponse($output); } // Notify the user. switch ($output->getStatus()) { case 200: $this->notifySuccess($output->getNotify()); break; case 404: $this->notifyDanger($output->getNotify()); break; case 500: $this->notifyWarning($output->getNotify()); break; } return $this->redirectToRoute("jquery_datatables_index", ["name" => $name]); }
php
protected function buildDataTablesResponse(Request $request, $name, ActionResponse $output) { if (true === $request->isXmlHttpRequest()) { return new JsonResponse($output); } // Notify the user. switch ($output->getStatus()) { case 200: $this->notifySuccess($output->getNotify()); break; case 404: $this->notifyDanger($output->getNotify()); break; case 500: $this->notifyWarning($output->getNotify()); break; } return $this->redirectToRoute("jquery_datatables_index", ["name" => $name]); }
[ "protected", "function", "buildDataTablesResponse", "(", "Request", "$", "request", ",", "$", "name", ",", "ActionResponse", "$", "output", ")", "{", "if", "(", "true", "===", "$", "request", "->", "isXmlHttpRequest", "(", ")", ")", "{", "return", "new", "...
Build a response. @param Request $request The request. @param string $name The provider name. @param ActionResponse $output The output. @return Response Returns the response.
[ "Build", "a", "response", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Controller/AbstractController.php#L62-L85
train
webeweb/jquery-datatables-bundle
Controller/AbstractController.php
AbstractController.exportDataTablesCallback
protected function exportDataTablesCallback(DataTablesProviderInterface $dtProvider, DataTablesRepositoryInterface $repository, DataTablesCSVExporterInterface $dtExporter, $windows) { $em = $this->getDoctrine()->getManager(); $stream = fopen("php://output", "w+"); // Export the columns. fputcsv($stream, DataTablesExportHelper::convert($dtExporter->exportColumns(), $windows), ";"); // Paginates. $total = $repository->dataTablesCountExported($dtProvider); $pages = PaginateHelper::getPagesCount($total, DataTablesRepositoryInterface::REPOSITORY_LIMIT); // Handle each page. for ($i = 0; $i < $pages; ++$i) { // Get the offset and limit. list($offset, $limit) = PaginateHelper::getPageOffsetAndLimit($i, DataTablesRepositoryInterface::REPOSITORY_LIMIT, $total); // Get the export query with offset and limit. $result = $repository->dataTablesExportAll($dtProvider) ->setFirstResult($offset) ->setMaxResults($limit) ->getQuery() ->iterate(); while (false !== ($row = $result->next())) { $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_PRE_EXPORT, [$row[0]]); fputcsv($stream, DataTablesExportHelper::convert($dtExporter->exportRow($row[0]), $windows), ";"); // Detach the entity to avoid memory consumption. $em->detach($row[0]); $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_POST_EXPORT, [$row[0]]); } } // Close the file. fclose($stream); }
php
protected function exportDataTablesCallback(DataTablesProviderInterface $dtProvider, DataTablesRepositoryInterface $repository, DataTablesCSVExporterInterface $dtExporter, $windows) { $em = $this->getDoctrine()->getManager(); $stream = fopen("php://output", "w+"); // Export the columns. fputcsv($stream, DataTablesExportHelper::convert($dtExporter->exportColumns(), $windows), ";"); // Paginates. $total = $repository->dataTablesCountExported($dtProvider); $pages = PaginateHelper::getPagesCount($total, DataTablesRepositoryInterface::REPOSITORY_LIMIT); // Handle each page. for ($i = 0; $i < $pages; ++$i) { // Get the offset and limit. list($offset, $limit) = PaginateHelper::getPageOffsetAndLimit($i, DataTablesRepositoryInterface::REPOSITORY_LIMIT, $total); // Get the export query with offset and limit. $result = $repository->dataTablesExportAll($dtProvider) ->setFirstResult($offset) ->setMaxResults($limit) ->getQuery() ->iterate(); while (false !== ($row = $result->next())) { $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_PRE_EXPORT, [$row[0]]); fputcsv($stream, DataTablesExportHelper::convert($dtExporter->exportRow($row[0]), $windows), ";"); // Detach the entity to avoid memory consumption. $em->detach($row[0]); $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_POST_EXPORT, [$row[0]]); } } // Close the file. fclose($stream); }
[ "protected", "function", "exportDataTablesCallback", "(", "DataTablesProviderInterface", "$", "dtProvider", ",", "DataTablesRepositoryInterface", "$", "repository", ",", "DataTablesCSVExporterInterface", "$", "dtExporter", ",", "$", "windows", ")", "{", "$", "em", "=", ...
Export callback. @param DataTablesProviderInterface $dtProvider The provider. @param DataTablesRepositoryInterface $repository The repository. @param DataTablesCSVExporterInterface $dtExporter The exporter. @param bool $windows Windows ? @return void
[ "Export", "callback", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Controller/AbstractController.php#L115-L156
train
webeweb/jquery-datatables-bundle
Controller/AbstractController.php
AbstractController.getDataTablesColumn
protected function getDataTablesColumn(DataTablesProviderInterface $dtProvider, $data) { $this->getLogger()->debug(sprintf("DataTables controller search for a column with name \"%s\"", $data)); $dtColumn = $this->getDataTablesWrapper($dtProvider)->getColumn($data); if (null === $dtColumn) { throw new BadDataTablesColumnException($data); } $this->getLogger()->debug(sprintf("DataTables controller found a column with name \"%s\"", $data)); return $dtColumn; }
php
protected function getDataTablesColumn(DataTablesProviderInterface $dtProvider, $data) { $this->getLogger()->debug(sprintf("DataTables controller search for a column with name \"%s\"", $data)); $dtColumn = $this->getDataTablesWrapper($dtProvider)->getColumn($data); if (null === $dtColumn) { throw new BadDataTablesColumnException($data); } $this->getLogger()->debug(sprintf("DataTables controller found a column with name \"%s\"", $data)); return $dtColumn; }
[ "protected", "function", "getDataTablesColumn", "(", "DataTablesProviderInterface", "$", "dtProvider", ",", "$", "data", ")", "{", "$", "this", "->", "getLogger", "(", ")", "->", "debug", "(", "sprintf", "(", "\"DataTables controller search for a column with name \\\"%s...
Get a column. @param DataTablesProviderInterface $dtProvider The provider. @param string $data The data. @return DataTablesColumnInterface Returns the column. @throws BadDataTablesColumnException Throws a bad column exception.
[ "Get", "a", "column", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Controller/AbstractController.php#L187-L199
train
webeweb/jquery-datatables-bundle
Controller/AbstractController.php
AbstractController.getDataTablesEntityById
protected function getDataTablesEntityById(DataTablesProviderInterface $dtProvider, $id) { $repository = $this->getDataTablesRepository($dtProvider); $this->getLogger()->debug(sprintf("DataTables controller search for an entity [%s]", $id)); $entity = $repository->find($id); if (null === $entity) { throw EntityNotFoundException::fromClassNameAndIdentifier($dtProvider->getEntity(), [$id]); } $this->getLogger()->debug(sprintf("DataTables controller found an entity [%s]", $id)); return $entity; }
php
protected function getDataTablesEntityById(DataTablesProviderInterface $dtProvider, $id) { $repository = $this->getDataTablesRepository($dtProvider); $this->getLogger()->debug(sprintf("DataTables controller search for an entity [%s]", $id)); $entity = $repository->find($id); if (null === $entity) { throw EntityNotFoundException::fromClassNameAndIdentifier($dtProvider->getEntity(), [$id]); } $this->getLogger()->debug(sprintf("DataTables controller found an entity [%s]", $id)); return $entity; }
[ "protected", "function", "getDataTablesEntityById", "(", "DataTablesProviderInterface", "$", "dtProvider", ",", "$", "id", ")", "{", "$", "repository", "=", "$", "this", "->", "getDataTablesRepository", "(", "$", "dtProvider", ")", ";", "$", "this", "->", "getLo...
Get an entity by id. @param DataTablesProviderInterface $dtProvider The provider. @param int $id The entity id. @return object Returns the entity. @throws BadDataTablesRepositoryException Throws a bad repository exception. @throws EntityNotFoundException Throws an Entity not found exception.
[ "Get", "an", "entity", "by", "id", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Controller/AbstractController.php#L231-L245
train