repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
cpliakas/search-framework
src/Search/Framework/Schema.php
Schema.toArray
public function toArray() { $schema_options = array( 'unique_field' => $this->_uniqueField, 'fields' => array(), ); foreach ($this->_fields as $id => $field) { $schema_options['fields'][$id] = $field->toArray(); } return $schema_options; ...
php
public function toArray() { $schema_options = array( 'unique_field' => $this->_uniqueField, 'fields' => array(), ); foreach ($this->_fields as $id => $field) { $schema_options['fields'][$id] = $field->toArray(); } return $schema_options; ...
[ "public", "function", "toArray", "(", ")", "{", "$", "schema_options", "=", "array", "(", "'unique_field'", "=>", "$", "this", "->", "_uniqueField", ",", "'fields'", "=>", "array", "(", ")", ",", ")", ";", "foreach", "(", "$", "this", "->", "_fields", ...
Returns the array of schema options. @return
[ "Returns", "the", "array", "of", "schema", "options", "." ]
train
https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Schema.php#L259-L269
antarestupin/Accessible
lib/Accessible/AutoMethodsTrait.php
AutoMethodsTrait.getMethodCallInfo
private function getMethodCallInfo($name) { $extractedMethod = preg_match("/^(set|get|is|add|remove)([A-Z].*)/", $name, $pregMatches); if ($extractedMethod) { $method = $pregMatches[1]; $property = lcfirst($pregMatches[2]); } else { $method = 'call'; ...
php
private function getMethodCallInfo($name) { $extractedMethod = preg_match("/^(set|get|is|add|remove)([A-Z].*)/", $name, $pregMatches); if ($extractedMethod) { $method = $pregMatches[1]; $property = lcfirst($pregMatches[2]); } else { $method = 'call'; ...
[ "private", "function", "getMethodCallInfo", "(", "$", "name", ")", "{", "$", "extractedMethod", "=", "preg_match", "(", "\"/^(set|get|is|add|remove)([A-Z].*)/\"", ",", "$", "name", ",", "$", "pregMatches", ")", ";", "if", "(", "$", "extractedMethod", ")", "{", ...
Extract the info about the method called. @param string $name @return array
[ "Extract", "the", "info", "about", "the", "method", "called", "." ]
train
https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/AutoMethodsTrait.php#L117-L147
oscarotero/fol
src/App.php
App.getPath
public function getPath(string ...$dirs): string { if (empty($dirs)) { return $this->path; } return self::canonicalize($this->path, ...$dirs); }
php
public function getPath(string ...$dirs): string { if (empty($dirs)) { return $this->path; } return self::canonicalize($this->path, ...$dirs); }
[ "public", "function", "getPath", "(", "string", "...", "$", "dirs", ")", ":", "string", "{", "if", "(", "empty", "(", "$", "dirs", ")", ")", "{", "return", "$", "this", "->", "path", ";", "}", "return", "self", "::", "canonicalize", "(", "$", "this...
Returns the absolute path of the app.
[ "Returns", "the", "absolute", "path", "of", "the", "app", "." ]
train
https://github.com/oscarotero/fol/blob/898c9f657adc12fb1b46acc2adbf0199caaebe3b/src/App.php#L111-L118
oscarotero/fol
src/App.php
App.getUri
public function getUri(string ...$dirs): UriInterface { if (empty($dirs)) { return $this->uri; } return $this->uri->withPath(self::canonicalize($this->uri->getPath(), ...$dirs)); }
php
public function getUri(string ...$dirs): UriInterface { if (empty($dirs)) { return $this->uri; } return $this->uri->withPath(self::canonicalize($this->uri->getPath(), ...$dirs)); }
[ "public", "function", "getUri", "(", "string", "...", "$", "dirs", ")", ":", "UriInterface", "{", "if", "(", "empty", "(", "$", "dirs", ")", ")", "{", "return", "$", "this", "->", "uri", ";", "}", "return", "$", "this", "->", "uri", "->", "withPath...
/* Returns the base uri of the app.
[ "/", "*", "Returns", "the", "base", "uri", "of", "the", "app", "." ]
train
https://github.com/oscarotero/fol/blob/898c9f657adc12fb1b46acc2adbf0199caaebe3b/src/App.php#L123-L130
oscarotero/fol
src/App.php
App.canonicalize
private static function canonicalize(string $base, string ...$dirs): string { $path = $base.'/'.implode('/', $dirs); $replace = ['#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#']; do { $path = preg_replace($replace, '/', $path, -1, $n); } while ($n > 0); return $path; ...
php
private static function canonicalize(string $base, string ...$dirs): string { $path = $base.'/'.implode('/', $dirs); $replace = ['#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#']; do { $path = preg_replace($replace, '/', $path, -1, $n); } while ($n > 0); return $path; ...
[ "private", "static", "function", "canonicalize", "(", "string", "$", "base", ",", "string", "...", "$", "dirs", ")", ":", "string", "{", "$", "path", "=", "$", "base", ".", "'/'", ".", "implode", "(", "'/'", ",", "$", "dirs", ")", ";", "$", "replac...
helper function to fix paths '//' or '/./' or '/foo/../' in a path.
[ "helper", "function", "to", "fix", "paths", "//", "or", "/", ".", "/", "or", "/", "foo", "/", "..", "/", "in", "a", "path", "." ]
train
https://github.com/oscarotero/fol/blob/898c9f657adc12fb1b46acc2adbf0199caaebe3b/src/App.php#L135-L145
sifophp/sifo-common-instance
models/OAuth/twitter.php
OAuthTwitterModel.getAuth
public function getAuth( $oauth_token ) { try { $this->setToken( $oauth_token ); $token = $this->getAccessToken(); $this->setToken( $token->oauth_token, $token->oauth_token_secret ); return array( 'oauth_token' => $token->oauth_token, 'oauth_token_secret' => $token->oauth_token_secret, 'us...
php
public function getAuth( $oauth_token ) { try { $this->setToken( $oauth_token ); $token = $this->getAccessToken(); $this->setToken( $token->oauth_token, $token->oauth_token_secret ); return array( 'oauth_token' => $token->oauth_token, 'oauth_token_secret' => $token->oauth_token_secret, 'us...
[ "public", "function", "getAuth", "(", "$", "oauth_token", ")", "{", "try", "{", "$", "this", "->", "setToken", "(", "$", "oauth_token", ")", ";", "$", "token", "=", "$", "this", "->", "getAccessToken", "(", ")", ";", "$", "this", "->", "setToken", "(...
Returns the authentication token and secret. @param string $oauth_token Authorization request given by Twitter via GET when calling the callback Url. @return array
[ "Returns", "the", "authentication", "token", "and", "secret", "." ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/models/OAuth/twitter.php#L70-L91
dekalee/cdn77
src/Cdn77/Query/DeleteResourceQuery.php
DeleteResourceQuery.execute
public function execute($resource = null) { if (null === $resource) { throw new QueryErrorException('Could not delete no resource'); } $this->populateCDNResources(); $cdnResources = array_filter($this->cdnResources, function($value, $key) use ($resource) { r...
php
public function execute($resource = null) { if (null === $resource) { throw new QueryErrorException('Could not delete no resource'); } $this->populateCDNResources(); $cdnResources = array_filter($this->cdnResources, function($value, $key) use ($resource) { r...
[ "public", "function", "execute", "(", "$", "resource", "=", "null", ")", "{", "if", "(", "null", "===", "$", "resource", ")", "{", "throw", "new", "QueryErrorException", "(", "'Could not delete no resource'", ")", ";", "}", "$", "this", "->", "populateCDNRes...
@param null $resource @return mixed|null @throws QueryErrorException
[ "@param", "null", "$resource" ]
train
https://github.com/dekalee/cdn77/blob/71d1771e047cf2fbd273018f6f35d44b87c53b24/src/Cdn77/Query/DeleteResourceQuery.php#L20-L52
delatbabel/site-config
src/SiteConfigServiceProvider.php
SiteConfigServiceProvider.boot
public function boot(DispatcherContract $events) { if (method_exists('Illuminate\\Support\\ServiceProvider', 'boot')) { parent::boot($events); } // Publish the database migrations $this->publishes([ __DIR__ . '/../database/migrations' => $this->app->databaseP...
php
public function boot(DispatcherContract $events) { if (method_exists('Illuminate\\Support\\ServiceProvider', 'boot')) { parent::boot($events); } // Publish the database migrations $this->publishes([ __DIR__ . '/../database/migrations' => $this->app->databaseP...
[ "public", "function", "boot", "(", "DispatcherContract", "$", "events", ")", "{", "if", "(", "method_exists", "(", "'Illuminate\\\\Support\\\\ServiceProvider'", ",", "'boot'", ")", ")", "{", "parent", "::", "boot", "(", "$", "events", ")", ";", "}", "// Publis...
Boot the service provider. This method is called after all other service providers have been registered, meaning you have access to all other services that have been registered by the framework. @return void
[ "Boot", "the", "service", "provider", "." ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/SiteConfigServiceProvider.php#L55-L68
todstoychev/icr
src/Processor.php
Processor.upload
public function upload($context, $file, $extension, FilesystemAdapter $filesystemAdapter, $fileName) { // Upload original image $fileName = $this->fileManager->setFileSystemAdapter($filesystemAdapter) ->uploadFile($file, $extension, $context, null, $fileName); $this->processSizes...
php
public function upload($context, $file, $extension, FilesystemAdapter $filesystemAdapter, $fileName) { // Upload original image $fileName = $this->fileManager->setFileSystemAdapter($filesystemAdapter) ->uploadFile($file, $extension, $context, null, $fileName); $this->processSizes...
[ "public", "function", "upload", "(", "$", "context", ",", "$", "file", ",", "$", "extension", ",", "FilesystemAdapter", "$", "filesystemAdapter", ",", "$", "fileName", ")", "{", "// Upload original image", "$", "fileName", "=", "$", "this", "->", "fileManager"...
Handles image upload @param string $context @param string $file @param string $extension @param FilesystemAdapter $filesystemAdapter @param string $fileName @return string @throws \Exception
[ "Handles", "image", "upload" ]
train
https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Processor.php#L71-L79
todstoychev/icr
src/Processor.php
Processor.delete
public function delete($fileName, $context, FilesystemAdapter $filesystemAdapter) { // Delete sizes $this->deleteSizes($fileName, $context, $filesystemAdapter); // Delete original file $filesystemAdapter->delete('/' . $context . '/' . $fileName); return true; }
php
public function delete($fileName, $context, FilesystemAdapter $filesystemAdapter) { // Delete sizes $this->deleteSizes($fileName, $context, $filesystemAdapter); // Delete original file $filesystemAdapter->delete('/' . $context . '/' . $fileName); return true; }
[ "public", "function", "delete", "(", "$", "fileName", ",", "$", "context", ",", "FilesystemAdapter", "$", "filesystemAdapter", ")", "{", "// Delete sizes", "$", "this", "->", "deleteSizes", "(", "$", "fileName", ",", "$", "context", ",", "$", "filesystemAdapte...
Delete file @param string $fileName File to delete @param string $context Context name @param FilesystemAdapter $filesystemAdapter @return bool
[ "Delete", "file" ]
train
https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Processor.php#L90-L99
todstoychev/icr
src/Processor.php
Processor.rebuild
public function rebuild($fileName, $context, FilesystemAdapter $filesystemAdapter) { // Open original file $originalImage = $filesystemAdapter->get('/' . $context . '/' . $fileName); $originalImage = $this->openImageHandler->loadImage($originalImage); $extension = $this->findExtensio...
php
public function rebuild($fileName, $context, FilesystemAdapter $filesystemAdapter) { // Open original file $originalImage = $filesystemAdapter->get('/' . $context . '/' . $fileName); $originalImage = $this->openImageHandler->loadImage($originalImage); $extension = $this->findExtensio...
[ "public", "function", "rebuild", "(", "$", "fileName", ",", "$", "context", ",", "FilesystemAdapter", "$", "filesystemAdapter", ")", "{", "// Open original file", "$", "originalImage", "=", "$", "filesystemAdapter", "->", "get", "(", "'/'", ".", "$", "context", ...
Rebuilds image sizes @param string $fileName @param string $context @param FilesystemAdapter $filesystemAdapter @return bool @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
[ "Rebuilds", "image", "sizes" ]
train
https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Processor.php#L111-L124
todstoychev/icr
src/Processor.php
Processor.deleteSizes
protected function deleteSizes($fileName, $context, FilesystemAdapter $filesystemAdapter) { $this->fileManager->setFileSystemAdapter($filesystemAdapter); foreach ($this->config[$context] as $sizeName => $values) { $path = $this->fileManager->path($context, $sizeName); $files...
php
protected function deleteSizes($fileName, $context, FilesystemAdapter $filesystemAdapter) { $this->fileManager->setFileSystemAdapter($filesystemAdapter); foreach ($this->config[$context] as $sizeName => $values) { $path = $this->fileManager->path($context, $sizeName); $files...
[ "protected", "function", "deleteSizes", "(", "$", "fileName", ",", "$", "context", ",", "FilesystemAdapter", "$", "filesystemAdapter", ")", "{", "$", "this", "->", "fileManager", "->", "setFileSystemAdapter", "(", "$", "filesystemAdapter", ")", ";", "foreach", "...
Deletes sizes @param string $fileName File name @param string $context Context name @param FilesystemAdapter $filesystemAdapter @return Processor$context
[ "Deletes", "sizes" ]
train
https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Processor.php#L135-L145
todstoychev/icr
src/Processor.php
Processor.processSizes
public function processSizes($file, $fileName, $context, $extension, FilesystemAdapter $filesystemAdapter) { foreach ($this->config[$context] as $sizeName => $values) { $image = $this->openImageHandler->loadImage($file); $operation = $this->manipulatorFactory->create( ...
php
public function processSizes($file, $fileName, $context, $extension, FilesystemAdapter $filesystemAdapter) { foreach ($this->config[$context] as $sizeName => $values) { $image = $this->openImageHandler->loadImage($file); $operation = $this->manipulatorFactory->create( ...
[ "public", "function", "processSizes", "(", "$", "file", ",", "$", "fileName", ",", "$", "context", ",", "$", "extension", ",", "FilesystemAdapter", "$", "filesystemAdapter", ")", "{", "foreach", "(", "$", "this", "->", "config", "[", "$", "context", "]", ...
Process sizes @param string $file File data @param string $fileName File name @param string $context File context @param string $extension File extension @param FilesystemAdapter $filesystemAdapter @return Processor
[ "Process", "sizes" ]
train
https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Processor.php#L172-L186
todstoychev/icr
src/Processor.php
Processor.rename
public function rename($oldFileName, $newFileName, $context, FilesystemAdapter $filesystemAdapter) { if ($filesystemAdapter->exists($context . '/' . $newFileName)) { throw new IcrRuntimeException("File with name {$newFileName} already exists!"); } $image = $filesystemAdapter->ge...
php
public function rename($oldFileName, $newFileName, $context, FilesystemAdapter $filesystemAdapter) { if ($filesystemAdapter->exists($context . '/' . $newFileName)) { throw new IcrRuntimeException("File with name {$newFileName} already exists!"); } $image = $filesystemAdapter->ge...
[ "public", "function", "rename", "(", "$", "oldFileName", ",", "$", "newFileName", ",", "$", "context", ",", "FilesystemAdapter", "$", "filesystemAdapter", ")", "{", "if", "(", "$", "filesystemAdapter", "->", "exists", "(", "$", "context", ".", "'/'", ".", ...
Renames existing file @param string $oldFileName @param string $newFileName @param string $context @param FilesystemAdapter $filesystemAdapter @return boolean
[ "Renames", "existing", "file" ]
train
https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Processor.php#L198-L214
liip/LiipDrupalConnectorModule
src/Liip/Drupal/Modules/DrupalConnector/Node.php
Node.node_load
public function node_load($nid = null, $vid = null, $reset = false) { return node_load($nid, $vid, $reset); }
php
public function node_load($nid = null, $vid = null, $reset = false) { return node_load($nid, $vid, $reset); }
[ "public", "function", "node_load", "(", "$", "nid", "=", "null", ",", "$", "vid", "=", "null", ",", "$", "reset", "=", "false", ")", "{", "return", "node_load", "(", "$", "nid", ",", "$", "vid", ",", "$", "reset", ")", ";", "}" ]
Load a node object from the database. @param integer $nid The node ID. @param integer $vid The revision ID. @param boolean $reset Whether to reset the node_load_multiple cache. @return \stdClass|false A fully-populated node object, or FALSE if the node is not found. @link http://api.drupal.org/api/drupal/modules...
[ "Load", "a", "node", "object", "from", "the", "database", "." ]
train
https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Node.php#L84-L87
liip/LiipDrupalConnectorModule
src/Liip/Drupal/Modules/DrupalConnector/Node.php
Node.node_save
public function node_save(&$node) { try { node_save($node); } catch (\Exception $e) { throw new NodeException( sprintf(NodeException::FailedToSaveNodeText, $node->nid), NodeException::FailedToSaveNode, $e->getCode(), ...
php
public function node_save(&$node) { try { node_save($node); } catch (\Exception $e) { throw new NodeException( sprintf(NodeException::FailedToSaveNodeText, $node->nid), NodeException::FailedToSaveNode, $e->getCode(), ...
[ "public", "function", "node_save", "(", "&", "$", "node", ")", "{", "try", "{", "node_save", "(", "$", "node", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "throw", "new", "NodeException", "(", "sprintf", "(", "NodeException", ...
Save changes to a node or add a new node. @param \stdClass &$node The $node object to be saved. If $node->nid is omitted (or $node->is_new is TRUE), a new node will be added. @throws \Liip\Drupal\Modules\DrupalConnector\NodeException in case the node could not be persisted. @link http://api.drupal.org/api/drupal/mod...
[ "Save", "changes", "to", "a", "node", "or", "add", "a", "new", "node", "." ]
train
https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Node.php#L113-L125
mimmi20/Wurfl
src/Handlers/NokiaHandler.php
NokiaHandler.applyRecoveryMatch
public function applyRecoveryMatch($userAgent) { if (Utils::checkIfContains($userAgent, 'Series60')) { return 'nokia_generic_series60'; } if (Utils::checkIfContains($userAgent, 'Series80')) { return 'nokia_generic_series80'; } if (Utils::checkIfConta...
php
public function applyRecoveryMatch($userAgent) { if (Utils::checkIfContains($userAgent, 'Series60')) { return 'nokia_generic_series60'; } if (Utils::checkIfContains($userAgent, 'Series80')) { return 'nokia_generic_series80'; } if (Utils::checkIfConta...
[ "public", "function", "applyRecoveryMatch", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "checkIfContains", "(", "$", "userAgent", ",", "'Series60'", ")", ")", "{", "return", "'nokia_generic_series60'", ";", "}", "if", "(", "Utils", "::", "chec...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/NokiaHandler.php#L78-L93
vardius/crud-bundle
Data/Provider/Doctrine/DataProvider.php
DataProvider.remove
public function remove($data, bool $flush = true) { $entity = null; if (is_object($data)) { $entity = $data; } elseif (is_numeric($data)) { $entity = $this->source->findOneById($data); } else { throw new \InvalidArgumentException('Argument passed i...
php
public function remove($data, bool $flush = true) { $entity = null; if (is_object($data)) { $entity = $data; } elseif (is_numeric($data)) { $entity = $this->source->findOneById($data); } else { throw new \InvalidArgumentException('Argument passed i...
[ "public", "function", "remove", "(", "$", "data", ",", "bool", "$", "flush", "=", "true", ")", "{", "$", "entity", "=", "null", ";", "if", "(", "is_object", "(", "$", "data", ")", ")", "{", "$", "entity", "=", "$", "data", ";", "}", "elseif", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Data/Provider/Doctrine/DataProvider.php#L90-L110
vardius/crud-bundle
Data/Provider/Doctrine/DataProvider.php
DataProvider.add
public function add($data) { if ($this->crudManager instanceof CrudManagerInterface) { $this->crudManager->add($data); } else { $this->entityManager->persist($data); } $this->entityManager->flush(); }
php
public function add($data) { if ($this->crudManager instanceof CrudManagerInterface) { $this->crudManager->add($data); } else { $this->entityManager->persist($data); } $this->entityManager->flush(); }
[ "public", "function", "add", "(", "$", "data", ")", "{", "if", "(", "$", "this", "->", "crudManager", "instanceof", "CrudManagerInterface", ")", "{", "$", "this", "->", "crudManager", "->", "add", "(", "$", "data", ")", ";", "}", "else", "{", "$", "t...
{@inheritdoc}
[ "{" ]
train
https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Data/Provider/Doctrine/DataProvider.php#L115-L124
vardius/crud-bundle
Data/Provider/Doctrine/DataProvider.php
DataProvider.update
public function update($data) { if ($this->crudManager instanceof CrudManagerInterface) { $this->crudManager->update($data); } else { $this->entityManager->persist($data); } $this->entityManager->flush(); }
php
public function update($data) { if ($this->crudManager instanceof CrudManagerInterface) { $this->crudManager->update($data); } else { $this->entityManager->persist($data); } $this->entityManager->flush(); }
[ "public", "function", "update", "(", "$", "data", ")", "{", "if", "(", "$", "this", "->", "crudManager", "instanceof", "CrudManagerInterface", ")", "{", "$", "this", "->", "crudManager", "->", "update", "(", "$", "data", ")", ";", "}", "else", "{", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Data/Provider/Doctrine/DataProvider.php#L129-L138
incraigulous/contentful-sdk
src/PayloadBuilders/ContentTypeValidation.php
ContentTypeValidation.size
function size($min = null, $max = null) { $size = []; if ($min) $size['min'] = $min; if ($max) $size['max'] = $max; if (count($size)) $this->data['size'] = $size; return $this; }
php
function size($min = null, $max = null) { $size = []; if ($min) $size['min'] = $min; if ($max) $size['max'] = $max; if (count($size)) $this->data['size'] = $size; return $this; }
[ "function", "size", "(", "$", "min", "=", "null", ",", "$", "max", "=", "null", ")", "{", "$", "size", "=", "[", "]", ";", "if", "(", "$", "min", ")", "$", "size", "[", "'min'", "]", "=", "$", "min", ";", "if", "(", "$", "max", ")", "$", ...
Validates that the size of a text, object or array is within a range. @param null $min @param null $max @return $this
[ "Validates", "that", "the", "size", "of", "a", "text", "object", "or", "array", "is", "within", "a", "range", "." ]
train
https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/ContentTypeValidation.php#L13-L19
incraigulous/contentful-sdk
src/PayloadBuilders/ContentTypeValidation.php
ContentTypeValidation.regexp
function regexp($pattern, $flags = null) { $regexp['pattern'] = $pattern; if ($flags) $regexp['flags'] = $flags; $this->data['regexp'] = $regexp; return $this; }
php
function regexp($pattern, $flags = null) { $regexp['pattern'] = $pattern; if ($flags) $regexp['flags'] = $flags; $this->data['regexp'] = $regexp; return $this; }
[ "function", "regexp", "(", "$", "pattern", ",", "$", "flags", "=", "null", ")", "{", "$", "regexp", "[", "'pattern'", "]", "=", "$", "pattern", ";", "if", "(", "$", "flags", ")", "$", "regexp", "[", "'flags'", "]", "=", "$", "flags", ";", "$", ...
Validates that the value of a field matches a Regular Expression. @param $pattern @param null $flags @return $this
[ "Validates", "that", "the", "value", "of", "a", "field", "matches", "a", "Regular", "Expression", "." ]
train
https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/ContentTypeValidation.php#L37-L42
incraigulous/contentful-sdk
src/PayloadBuilders/ContentTypeValidation.php
ContentTypeValidation.dateRange
function dateRange($min = null, $max = null) { $range = []; if ($min) $range['min'] = $min; if ($max) $range['max'] = $max; if (count($range)) $this->data['dateRange'] = $range; return $this; }
php
function dateRange($min = null, $max = null) { $range = []; if ($min) $range['min'] = $min; if ($max) $range['max'] = $max; if (count($range)) $this->data['dateRange'] = $range; return $this; }
[ "function", "dateRange", "(", "$", "min", "=", "null", ",", "$", "max", "=", "null", ")", "{", "$", "range", "=", "[", "]", ";", "if", "(", "$", "min", ")", "$", "range", "[", "'min'", "]", "=", "$", "min", ";", "if", "(", "$", "max", ")", ...
Validates that the value of a field is within a date range. It's defined specifying the min and max values of that range. @param null $min @param null $max @return $this
[ "Validates", "that", "the", "value", "of", "a", "field", "is", "within", "a", "date", "range", ".", "It", "s", "defined", "specifying", "the", "min", "and", "max", "values", "of", "that", "range", "." ]
train
https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/ContentTypeValidation.php#L50-L56
incraigulous/contentful-sdk
src/PayloadBuilders/ContentTypeValidation.php
ContentTypeValidation.assetFileSize
function assetFileSize($min = null, $max = null) { $range = []; if ($min) $range['min'] = $min; if ($max) $range['max'] = $max; if (count($range)) $this->data['assetFileSize'] = $range; return $this; }
php
function assetFileSize($min = null, $max = null) { $range = []; if ($min) $range['min'] = $min; if ($max) $range['max'] = $max; if (count($range)) $this->data['assetFileSize'] = $range; return $this; }
[ "function", "assetFileSize", "(", "$", "min", "=", "null", ",", "$", "max", "=", "null", ")", "{", "$", "range", "=", "[", "]", ";", "if", "(", "$", "min", ")", "$", "range", "[", "'min'", "]", "=", "$", "min", ";", "if", "(", "$", "max", "...
Validates that the size of an asset is within a range. It's defined specifying the min and max values of that range. min and max are inclusive. @param null $min @param null $max @return $this
[ "Validates", "that", "the", "size", "of", "an", "asset", "is", "within", "a", "range", ".", "It", "s", "defined", "specifying", "the", "min", "and", "max", "values", "of", "that", "range", ".", "min", "and", "max", "are", "inclusive", "." ]
train
https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/ContentTypeValidation.php#L64-L70
incraigulous/contentful-sdk
src/PayloadBuilders/ContentTypeValidation.php
ContentTypeValidation.assetImageDimensions
function assetImageDimensions($height = null, $width = null) { $imageDimensions = []; if ($height) $imageDimensions['height'] = $height; if ($width) $imageDimensions['width'] = $width; if (count($imageDimensions)) $this->data['assetImageDimensions'] = $imageDimensions; return $th...
php
function assetImageDimensions($height = null, $width = null) { $imageDimensions = []; if ($height) $imageDimensions['height'] = $height; if ($width) $imageDimensions['width'] = $width; if (count($imageDimensions)) $this->data['assetImageDimensions'] = $imageDimensions; return $th...
[ "function", "assetImageDimensions", "(", "$", "height", "=", "null", ",", "$", "width", "=", "null", ")", "{", "$", "imageDimensions", "=", "[", "]", ";", "if", "(", "$", "height", ")", "$", "imageDimensions", "[", "'height'", "]", "=", "$", "height", ...
Validates that the dimensions of an image are within a range. @param null $height @param null $width @return $this
[ "Validates", "that", "the", "dimensions", "of", "an", "image", "are", "within", "a", "range", "." ]
train
https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/ContentTypeValidation.php#L78-L84
incraigulous/contentful-sdk
src/PayloadBuilders/ContentTypeValidation.php
ContentTypeValidation.make
function make() { $result = []; foreach($this->data as $key => $data) { $result[] = [$key => $data]; } return $result; }
php
function make() { $result = []; foreach($this->data as $key => $data) { $result[] = [$key => $data]; } return $result; }
[ "function", "make", "(", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "data", "as", "$", "key", "=>", "$", "data", ")", "{", "$", "result", "[", "]", "=", "[", "$", "key", "=>", "$", "data", "]", ";", "}",...
Return the payload builder array part. @return array
[ "Return", "the", "payload", "builder", "array", "part", "." ]
train
https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/PayloadBuilders/ContentTypeValidation.php#L89-L96
granulephp/util
lib/Map/ArrayMap.php
ArrayMap.get
public function get($key) { TypeHelper::validateKey($key, $this); if ($this->containsKey($key)) { return $this->elements[$key]; } return null; }
php
public function get($key) { TypeHelper::validateKey($key, $this); if ($this->containsKey($key)) { return $this->elements[$key]; } return null; }
[ "public", "function", "get", "(", "$", "key", ")", "{", "TypeHelper", "::", "validateKey", "(", "$", "key", ",", "$", "this", ")", ";", "if", "(", "$", "this", "->", "containsKey", "(", "$", "key", ")", ")", "{", "return", "$", "this", "->", "ele...
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/ArrayMap.php#L96-L103
granulephp/util
lib/Map/ArrayMap.php
ArrayMap.getOrDefault
public function getOrDefault($key, $defaultValue) { TypeHelper::validateKey($key, $this); if ($this->containsKey($key)) { return $this->elements[$key]; } return $defaultValue; }
php
public function getOrDefault($key, $defaultValue) { TypeHelper::validateKey($key, $this); if ($this->containsKey($key)) { return $this->elements[$key]; } return $defaultValue; }
[ "public", "function", "getOrDefault", "(", "$", "key", ",", "$", "defaultValue", ")", "{", "TypeHelper", "::", "validateKey", "(", "$", "key", ",", "$", "this", ")", ";", "if", "(", "$", "this", "->", "containsKey", "(", "$", "key", ")", ")", "{", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/ArrayMap.php#L106-L113
unimapper/unimapper
src/Association/ManyToMany.php
ManyToMany.load
public function load(Connection $connection, array $primaryValues) { $targetAdapter = $connection->getAdapter($this->targetReflection->getAdapterName()); if ($this->dominant) { $currentAdapter = $connection->getAdapter( $this->sourceReflection->getAdapterName() ...
php
public function load(Connection $connection, array $primaryValues) { $targetAdapter = $connection->getAdapter($this->targetReflection->getAdapterName()); if ($this->dominant) { $currentAdapter = $connection->getAdapter( $this->sourceReflection->getAdapterName() ...
[ "public", "function", "load", "(", "Connection", "$", "connection", ",", "array", "$", "primaryValues", ")", "{", "$", "targetAdapter", "=", "$", "connection", "->", "getAdapter", "(", "$", "this", "->", "targetReflection", "->", "getAdapterName", "(", ")", ...
@param Connection $connection @param array $primaryValues @return array @throws AssociationException @todo should be optimized with 1 query only on same adapters
[ "@param", "Connection", "$connection", "@param", "array", "$primaryValues" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Association/ManyToMany.php#L82-L152
unimapper/unimapper
src/Association/ManyToMany.php
ManyToMany.saveChanges
public function saveChanges($primaryValue, Connection $connection, Collection $collection) { if ($collection->getEntityClass() !== $this->targetReflection->getClassName()) { throw new AssociationException( "Input collection should be type of " . $this->targetRefle...
php
public function saveChanges($primaryValue, Connection $connection, Collection $collection) { if ($collection->getEntityClass() !== $this->targetReflection->getClassName()) { throw new AssociationException( "Input collection should be type of " . $this->targetRefle...
[ "public", "function", "saveChanges", "(", "$", "primaryValue", ",", "Connection", "$", "connection", ",", "Collection", "$", "collection", ")", "{", "if", "(", "$", "collection", "->", "getEntityClass", "(", ")", "!==", "$", "this", "->", "targetReflection", ...
Save changes in target collection @param string $primaryValue Primary value from source entity @param Connection $connection @param Collection $collection Target collection @throws AssociationException
[ "Save", "changes", "in", "target", "collection" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Association/ManyToMany.php#L163-L207
iP1SMS/ip1-php-sdk
src/Recipient/Membership.php
Membership.getGroup
public function getGroup(Communicator $communicator): ProcessedGroup { $groupJSON = $communicator->get('api/groups/'.$this->groupID); $group = RecipientFactory::createProcessedGroupFromJSON($groupJSON); return $group; }
php
public function getGroup(Communicator $communicator): ProcessedGroup { $groupJSON = $communicator->get('api/groups/'.$this->groupID); $group = RecipientFactory::createProcessedGroupFromJSON($groupJSON); return $group; }
[ "public", "function", "getGroup", "(", "Communicator", "$", "communicator", ")", ":", "ProcessedGroup", "{", "$", "groupJSON", "=", "$", "communicator", "->", "get", "(", "'api/groups/'", ".", "$", "this", "->", "groupID", ")", ";", "$", "group", "=", "Rec...
Returns the Group this membership is referenced to. @param Communicator $communicator Used to fetch the Group from the API. @return ProcessedGroup
[ "Returns", "the", "Group", "this", "membership", "is", "referenced", "to", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/Membership.php#L66-L71
iP1SMS/ip1-php-sdk
src/Recipient/Membership.php
Membership.getContact
public function getContact(Communicator $communicator): ProcessedContact { $contactJSON = $communicator->get('api/groups/'.$this->contactID); $contact = RecipientFactory::createProcessedGroupFromJSON($contactJSON); return $contact; }
php
public function getContact(Communicator $communicator): ProcessedContact { $contactJSON = $communicator->get('api/groups/'.$this->contactID); $contact = RecipientFactory::createProcessedGroupFromJSON($contactJSON); return $contact; }
[ "public", "function", "getContact", "(", "Communicator", "$", "communicator", ")", ":", "ProcessedContact", "{", "$", "contactJSON", "=", "$", "communicator", "->", "get", "(", "'api/groups/'", ".", "$", "this", "->", "contactID", ")", ";", "$", "contact", "...
Returns the Contact this membership is referenced to. @param Communicator $communicator Used to fetch the Contact from the API. @return ProcessedContact
[ "Returns", "the", "Contact", "this", "membership", "is", "referenced", "to", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/Membership.php#L77-L82
iP1SMS/ip1-php-sdk
src/Recipient/ProcessedContact.php
ProcessedContact.getGroups
public function getGroups(Communicator $communicator = null): ClassValidationArray { if ($communicator !== null) { $groupsJSON = $communicator->get('api/contacts/'.$this->contactID. '/groups'); $groupStd = json_decode($groupsJSON); $groups = RecipientFactory::createProces...
php
public function getGroups(Communicator $communicator = null): ClassValidationArray { if ($communicator !== null) { $groupsJSON = $communicator->get('api/contacts/'.$this->contactID. '/groups'); $groupStd = json_decode($groupsJSON); $groups = RecipientFactory::createProces...
[ "public", "function", "getGroups", "(", "Communicator", "$", "communicator", "=", "null", ")", ":", "ClassValidationArray", "{", "if", "(", "$", "communicator", "!==", "null", ")", "{", "$", "groupsJSON", "=", "$", "communicator", "->", "get", "(", "'api/con...
Returns an array of all the Groups the group is referenced in. If a communicator is not provided it will not fetch memberships from the API but return those that has been fetched, if any. @param Communicator $communicator Used to fetch Groups from the API. @return ClassValidationArray An array of Group objects.
[ "Returns", "an", "array", "of", "all", "the", "Groups", "the", "group", "is", "referenced", "in", ".", "If", "a", "communicator", "is", "not", "provided", "it", "will", "not", "fetch", "memberships", "from", "the", "API", "but", "return", "those", "that", ...
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/ProcessedContact.php#L144-L154
iP1SMS/ip1-php-sdk
src/Recipient/ProcessedContact.php
ProcessedContact.addGroup
public function addGroup(Communicator $communicator, ProcessedGroup $group): ProcessedMembership { $response = $communicator->post('api/memberships', new Membership($group->getID(), $this->contactID)); $returnValue = RecipientFactory::createProcessedMembershipFromJSON($response); if ($this-...
php
public function addGroup(Communicator $communicator, ProcessedGroup $group): ProcessedMembership { $response = $communicator->post('api/memberships', new Membership($group->getID(), $this->contactID)); $returnValue = RecipientFactory::createProcessedMembershipFromJSON($response); if ($this-...
[ "public", "function", "addGroup", "(", "Communicator", "$", "communicator", ",", "ProcessedGroup", "$", "group", ")", ":", "ProcessedMembership", "{", "$", "response", "=", "$", "communicator", "->", "post", "(", "'api/memberships'", ",", "new", "Membership", "(...
Adds the contact to the given group and returns the membership. @param Communicator $communicator Used to fetch Groups from the API. @param ProcessedGroup $group The group the contact should be added to. @return ProcessedMembership
[ "Adds", "the", "contact", "to", "the", "given", "group", "and", "returns", "the", "membership", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/ProcessedContact.php#L161-L169
iP1SMS/ip1-php-sdk
src/Recipient/ProcessedContact.php
ProcessedContact.jsonSerialize
public function jsonSerialize(): array { $contactArray = parent::jsonSerialize(); $contactArray['ID'] = $this->contactID; $contactArray['OwnerID'] = $this->ownerID; $contactArray['Modified'] = isset($this->created) ? $this->updated->format("Y-m-d\TH:i:s."). substr($this->...
php
public function jsonSerialize(): array { $contactArray = parent::jsonSerialize(); $contactArray['ID'] = $this->contactID; $contactArray['OwnerID'] = $this->ownerID; $contactArray['Modified'] = isset($this->created) ? $this->updated->format("Y-m-d\TH:i:s."). substr($this->...
[ "public", "function", "jsonSerialize", "(", ")", ":", "array", "{", "$", "contactArray", "=", "parent", "::", "jsonSerialize", "(", ")", ";", "$", "contactArray", "[", "'ID'", "]", "=", "$", "this", "->", "contactID", ";", "$", "contactArray", "[", "'Own...
Serializes the object to a value that can be serialized natively by json_encode(). @return array Associative. @link http://php.net/manual/en/jsonserializable.jsonserialize.php
[ "Serializes", "the", "object", "to", "a", "value", "that", "can", "be", "serialized", "natively", "by", "json_encode", "()", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/ProcessedContact.php#L240-L251
unimapper/unimapper
src/Convention.php
Convention.classToName
public static function classToName($class, $type) { if (!class_exists($class)) { throw new InvalidArgumentException( "Class '" . $class . "' not found!" ); } $class = self::_trimNamespace($class); if (!isset(self::$masks[$type])) { ...
php
public static function classToName($class, $type) { if (!class_exists($class)) { throw new InvalidArgumentException( "Class '" . $class . "' not found!" ); } $class = self::_trimNamespace($class); if (!isset(self::$masks[$type])) { ...
[ "public", "static", "function", "classToName", "(", "$", "class", ",", "$", "type", ")", "{", "if", "(", "!", "class_exists", "(", "$", "class", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"Class '\"", ".", "$", "class", ".", "\"' n...
Converts class to name @param string $class @param integer $type Mask type @return string @throws InvalidArgumentException
[ "Converts", "class", "to", "name" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Convention.php#L67-L90
unimapper/unimapper
src/Convention.php
Convention.nameToClass
public static function nameToClass($name, $type) { if (!isset(self::$masks[$type])) { throw new InvalidArgumentException( "Invalid mask type " . $type . "!" ); } return str_replace("*", $name, self::$masks[$type]); }
php
public static function nameToClass($name, $type) { if (!isset(self::$masks[$type])) { throw new InvalidArgumentException( "Invalid mask type " . $type . "!" ); } return str_replace("*", $name, self::$masks[$type]); }
[ "public", "static", "function", "nameToClass", "(", "$", "name", ",", "$", "type", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "masks", "[", "$", "type", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"Invalid mas...
Converts name to class @param string $name @param integer $type @return string @throws InvalidArgumentException
[ "Converts", "name", "to", "class" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Convention.php#L102-L110
LIN3S/WPFoundation
src/LIN3S/WPFoundation/Configuration/Assets/Assets.php
Assets.addScript
protected function addScript( $name, $from = AssetsInterface::ASSETS_JS, array $dependencies = ['jquery'], $version = '1.0.0', $inFooter = true, $ajaxUrl = null ) { wp_enqueue_script($name, $this->path($from, $name), $dependencies, $version, $inFooter); ...
php
protected function addScript( $name, $from = AssetsInterface::ASSETS_JS, array $dependencies = ['jquery'], $version = '1.0.0', $inFooter = true, $ajaxUrl = null ) { wp_enqueue_script($name, $this->path($from, $name), $dependencies, $version, $inFooter); ...
[ "protected", "function", "addScript", "(", "$", "name", ",", "$", "from", "=", "AssetsInterface", "::", "ASSETS_JS", ",", "array", "$", "dependencies", "=", "[", "'jquery'", "]", ",", "$", "version", "=", "'1.0.0'", ",", "$", "inFooter", "=", "true", ","...
Method that wraps the WordPress internal "wp_enqueue_script" simplifying the process adding some common default values. @param string $name The name of asset @param string $from The from location, by default is the JS files default location @param array $dependencies A...
[ "Method", "that", "wraps", "the", "WordPress", "internal", "wp_enqueue_script", "simplifying", "the", "process", "adding", "some", "common", "default", "values", "." ]
train
https://github.com/LIN3S/WPFoundation/blob/4f5674b0544b770809f1ffa7bd7d8fdfe013e4bf/src/LIN3S/WPFoundation/Configuration/Assets/Assets.php#L73-L88
LIN3S/WPFoundation
src/LIN3S/WPFoundation/Configuration/Assets/Assets.php
Assets.addStylesheet
protected function addStylesheet( $name, $from = AssetsInterface::CSS, array $dependencies = [], $version = '1.0.0', $media = 'all' ) { wp_enqueue_style($name, $this->path($from, $name, 'css'), $dependencies, $version, $media); return $this; }
php
protected function addStylesheet( $name, $from = AssetsInterface::CSS, array $dependencies = [], $version = '1.0.0', $media = 'all' ) { wp_enqueue_style($name, $this->path($from, $name, 'css'), $dependencies, $version, $media); return $this; }
[ "protected", "function", "addStylesheet", "(", "$", "name", ",", "$", "from", "=", "AssetsInterface", "::", "CSS", ",", "array", "$", "dependencies", "=", "[", "]", ",", "$", "version", "=", "'1.0.0'", ",", "$", "media", "=", "'all'", ")", "{", "wp_enq...
Method that wraps the WordPress internal "wp_enqueue_style" simplifying the process adding some common default values. @param string $name The name of asset @param string $from The from location, by default is the CSS files default location @param array $dependencies Array which contains the dependenc...
[ "Method", "that", "wraps", "the", "WordPress", "internal", "wp_enqueue_style", "simplifying", "the", "process", "adding", "some", "common", "default", "values", "." ]
train
https://github.com/LIN3S/WPFoundation/blob/4f5674b0544b770809f1ffa7bd7d8fdfe013e4bf/src/LIN3S/WPFoundation/Configuration/Assets/Assets.php#L102-L112
LIN3S/WPFoundation
src/LIN3S/WPFoundation/Configuration/Assets/Assets.php
Assets.registerAjaxUrls
protected function registerAjaxUrls($name, $ajaxUrl) { if (false === is_array($ajaxUrl)) { $ajaxUrl = [$ajaxUrl]; } foreach ($ajaxUrl as $url) { wp_localize_script($name, $url, [ 'ajaxUrl' => admin_url('admin-ajax.php'), ]); } }
php
protected function registerAjaxUrls($name, $ajaxUrl) { if (false === is_array($ajaxUrl)) { $ajaxUrl = [$ajaxUrl]; } foreach ($ajaxUrl as $url) { wp_localize_script($name, $url, [ 'ajaxUrl' => admin_url('admin-ajax.php'), ]); } }
[ "protected", "function", "registerAjaxUrls", "(", "$", "name", ",", "$", "ajaxUrl", ")", "{", "if", "(", "false", "===", "is_array", "(", "$", "ajaxUrl", ")", ")", "{", "$", "ajaxUrl", "=", "[", "$", "ajaxUrl", "]", ";", "}", "foreach", "(", "$", "...
Registers the ajax urls inside given JS filename. @param string $name The script file name @param string $ajaxUrl The name that is going to expose in JS file as ajaxUrl Usage example with name="subscribe" and ajaxUrl="subscribeAjax": // subscribe.js $.ajax({ url: subscribeAjax.ajaxUrl, method: 'GET', data: { act...
[ "Registers", "the", "ajax", "urls", "inside", "given", "JS", "filename", "." ]
train
https://github.com/LIN3S/WPFoundation/blob/4f5674b0544b770809f1ffa7bd7d8fdfe013e4bf/src/LIN3S/WPFoundation/Configuration/Assets/Assets.php#L134-L144
tollwerk/TYPO3-ext-tw_googleanalytics
Classes/Controller/GoogleanalyticsController.php
GoogleanalyticsController.trackAction
public function trackAction() { $this->settings['features']['anonymizeIP'] = intval((boolean)$this->settings['features']['anonymizeIP']); foreach ($this->settings['features']['track'] as $feature => $enabled) { $this->settings['features']['track'][$feature] = intval((boolean)$enabled); ...
php
public function trackAction() { $this->settings['features']['anonymizeIP'] = intval((boolean)$this->settings['features']['anonymizeIP']); foreach ($this->settings['features']['track'] as $feature => $enabled) { $this->settings['features']['track'][$feature] = intval((boolean)$enabled); ...
[ "public", "function", "trackAction", "(", ")", "{", "$", "this", "->", "settings", "[", "'features'", "]", "[", "'anonymizeIP'", "]", "=", "intval", "(", "(", "boolean", ")", "$", "this", "->", "settings", "[", "'features'", "]", "[", "'anonymizeIP'", "]...
Inclusion of the tracking code @return void
[ "Inclusion", "of", "the", "tracking", "code" ]
train
https://github.com/tollwerk/TYPO3-ext-tw_googleanalytics/blob/f7f57bc64b7adb324c8da2fe50d7f978f854a53d/Classes/Controller/GoogleanalyticsController.php#L105-L252
tollwerk/TYPO3-ext-tw_googleanalytics
Classes/Controller/GoogleanalyticsController.php
GoogleanalyticsController._getTypoScriptValue
protected function _getTypoScriptValue($value, $default = null) { // If a configuration array has been passed ... if (is_array($value) && array_key_exists('_typoScriptNodeValue', $value)) { /** @var TypoScriptService $typoScriptService */ $typoScriptService = GeneralUtility::...
php
protected function _getTypoScriptValue($value, $default = null) { // If a configuration array has been passed ... if (is_array($value) && array_key_exists('_typoScriptNodeValue', $value)) { /** @var TypoScriptService $typoScriptService */ $typoScriptService = GeneralUtility::...
[ "protected", "function", "_getTypoScriptValue", "(", "$", "value", ",", "$", "default", "=", "null", ")", "{", "// If a configuration array has been passed ...", "if", "(", "is_array", "(", "$", "value", ")", "&&", "array_key_exists", "(", "'_typoScriptNodeValue'", ...
Extract a TypoScript value (if available) @param mixed $value Value @param mixed $default Default value @return string|null Value
[ "Extract", "a", "TypoScript", "value", "(", "if", "available", ")" ]
train
https://github.com/tollwerk/TYPO3-ext-tw_googleanalytics/blob/f7f57bc64b7adb324c8da2fe50d7f978f854a53d/Classes/Controller/GoogleanalyticsController.php#L276-L294
tollwerk/TYPO3-ext-tw_googleanalytics
Classes/Controller/GoogleanalyticsController.php
GoogleanalyticsController._getValue
protected function _getValue(array $valueConfig) { $returnValue = null; if (array_key_exists('_typoScriptNodeValue', $valueConfig)) { $valueType = strtolower($valueConfig['_typoScriptNodeValue']); switch ($valueType) { // Value extraction based on a GET / P...
php
protected function _getValue(array $valueConfig) { $returnValue = null; if (array_key_exists('_typoScriptNodeValue', $valueConfig)) { $valueType = strtolower($valueConfig['_typoScriptNodeValue']); switch ($valueType) { // Value extraction based on a GET / P...
[ "protected", "function", "_getValue", "(", "array", "$", "valueConfig", ")", "{", "$", "returnValue", "=", "null", ";", "if", "(", "array_key_exists", "(", "'_typoScriptNodeValue'", ",", "$", "valueConfig", ")", ")", "{", "$", "valueType", "=", "strtolower", ...
Extraction of complex values @param array $valueConfig Value configuration @return string Value
[ "Extraction", "of", "complex", "values" ]
train
https://github.com/tollwerk/TYPO3-ext-tw_googleanalytics/blob/f7f57bc64b7adb324c8da2fe50d7f978f854a53d/Classes/Controller/GoogleanalyticsController.php#L302-L387
tollwerk/TYPO3-ext-tw_googleanalytics
Classes/Controller/GoogleanalyticsController.php
GoogleanalyticsController._getDomains
protected function _getDomains($str) { $domains = array(); $str = trim($str); if (strlen($str)) { $str = array_map('trim', preg_split("%[^a-z\-\d\.]+%", strtolower($str))); foreach ($str as $domain) { if (strlen($domain)) { $domains...
php
protected function _getDomains($str) { $domains = array(); $str = trim($str); if (strlen($str)) { $str = array_map('trim', preg_split("%[^a-z\-\d\.]+%", strtolower($str))); foreach ($str as $domain) { if (strlen($domain)) { $domains...
[ "protected", "function", "_getDomains", "(", "$", "str", ")", "{", "$", "domains", "=", "array", "(", ")", ";", "$", "str", "=", "trim", "(", "$", "str", ")", ";", "if", "(", "strlen", "(", "$", "str", ")", ")", "{", "$", "str", "=", "array_map...
Filter domain names out of a delimiter separated string (no domain name validation though) @param string $str Domain name string @return array Domain names
[ "Filter", "domain", "names", "out", "of", "a", "delimiter", "separated", "string", "(", "no", "domain", "name", "validation", "though", ")" ]
train
https://github.com/tollwerk/TYPO3-ext-tw_googleanalytics/blob/f7f57bc64b7adb324c8da2fe50d7f978f854a53d/Classes/Controller/GoogleanalyticsController.php#L395-L408
vardius/crud-bundle
Actions/Action/DeleteAction.php
DeleteAction.call
public function call(ActionEvent $event, string $format):Response { $controller = $event->getController(); $dataProvider = $event->getDataProvider(); $request = $event->getRequest(); $id = $request->get('id'); $data = $dataProvider->get($id); if ($data === null) { ...
php
public function call(ActionEvent $event, string $format):Response { $controller = $event->getController(); $dataProvider = $event->getDataProvider(); $request = $event->getRequest(); $id = $request->get('id'); $data = $dataProvider->get($id); if ($data === null) { ...
[ "public", "function", "call", "(", "ActionEvent", "$", "event", ",", "string", "$", "format", ")", ":", "Response", "{", "$", "controller", "=", "$", "event", "->", "getController", "(", ")", ";", "$", "dataProvider", "=", "$", "event", "->", "getDataPro...
{@inheritdoc}
[ "{" ]
train
https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Actions/Action/DeleteAction.php#L34-L88
cauditor/php-analyzer
src/Analyzers/PDepend/Analyzer.php
Analyzer.execute
public function execute() { // all paths in build_path are relative to project root, which may not // be where this code is run from, so prepend the project root! $buildPath = $this->config['path'].DIRECTORY_SEPARATOR.$this->config['build_path']; exec('mkdir -p '.$buildPath.DIRECTOR...
php
public function execute() { // all paths in build_path are relative to project root, which may not // be where this code is run from, so prepend the project root! $buildPath = $this->config['path'].DIRECTORY_SEPARATOR.$this->config['build_path']; exec('mkdir -p '.$buildPath.DIRECTOR...
[ "public", "function", "execute", "(", ")", "{", "// all paths in build_path are relative to project root, which may not", "// be where this code is run from, so prepend the project root!", "$", "buildPath", "=", "$", "this", "->", "config", "[", "'path'", "]", ".", "DIRECTORY_S...
{@inheritdoc}
[ "{" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/Analyzer.php#L49-L72
cauditor/php-analyzer
src/Analyzers/PDepend/Analyzer.php
Analyzer.pdepend
protected function pdepend($path) { $jsonGenerator = new JsonGenerator(); $jsonGenerator->setLogFile($path.DIRECTORY_SEPARATOR.$this->json); $application = new Application(); // overwrite default config to ensure that cache files are stored in // different folders per build...
php
protected function pdepend($path) { $jsonGenerator = new JsonGenerator(); $jsonGenerator->setLogFile($path.DIRECTORY_SEPARATOR.$this->json); $application = new Application(); // overwrite default config to ensure that cache files are stored in // different folders per build...
[ "protected", "function", "pdepend", "(", "$", "path", ")", "{", "$", "jsonGenerator", "=", "new", "JsonGenerator", "(", ")", ";", "$", "jsonGenerator", "->", "setLogFile", "(", "$", "path", ".", "DIRECTORY_SEPARATOR", ".", "$", "this", "->", "json", ")", ...
Runs pdepend to generate the metrics. @param string $path @throws Exception
[ "Runs", "pdepend", "to", "generate", "the", "metrics", "." ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/Analyzer.php#L81-L111
cauditor/php-analyzer
src/Analyzers/PDepend/Analyzer.php
Analyzer.warningHandler
protected function warningHandler($errno, $errstr, $errfile, $errline, array $errcontext) { if ( strpos($errstr, 'filesize(): stat failed') !== false && strpos($errfile, 'FileCacheDriver.php') !== false ) { throw new Exception('Failed to load from cache; risk pote...
php
protected function warningHandler($errno, $errstr, $errfile, $errline, array $errcontext) { if ( strpos($errstr, 'filesize(): stat failed') !== false && strpos($errfile, 'FileCacheDriver.php') !== false ) { throw new Exception('Failed to load from cache; risk pote...
[ "protected", "function", "warningHandler", "(", "$", "errno", ",", "$", "errstr", ",", "$", "errfile", ",", "$", "errline", ",", "array", "$", "errcontext", ")", "{", "if", "(", "strpos", "(", "$", "errstr", ",", "'filesize(): stat failed'", ")", "!==", ...
@param int $errno @param string $errstr @param string $errfile @param string $errline @param array $errcontext @throws Exception
[ "@param", "int", "$errno", "@param", "string", "$errstr", "@param", "string", "$errfile", "@param", "string", "$errline", "@param", "array", "$errcontext" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/Analyzer.php#L122-L132
joomla-projects/jorobo
src/Tasks/Deploy/Package.php
Package.run
public function run() { // TODO improve DRY! $this->say('Creating package ' . $this->getJConfig()->extension . " " . $this->getJConfig()->version); // Start getting single archives if (file_exists(JPATH_BASE . '/dist/zips')) { $this->_deleteDir(JPATH_BASE . '/dist/zips'); } $this->_mkdir(JPATH_BASE ...
php
public function run() { // TODO improve DRY! $this->say('Creating package ' . $this->getJConfig()->extension . " " . $this->getJConfig()->version); // Start getting single archives if (file_exists(JPATH_BASE . '/dist/zips')) { $this->_deleteDir(JPATH_BASE . '/dist/zips'); } $this->_mkdir(JPATH_BASE ...
[ "public", "function", "run", "(", ")", "{", "// TODO improve DRY!", "$", "this", "->", "say", "(", "'Creating package '", ".", "$", "this", "->", "getJConfig", "(", ")", "->", "extension", ".", "\" \"", ".", "$", "this", "->", "getJConfig", "(", ")", "->...
Build the package @return bool @since 1.0
[ "Build", "the", "package" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/Package.php#L69-L121
joomla-projects/jorobo
src/Tasks/Deploy/Package.php
Package.analyze
private function analyze() { // Check if we have component, module, plugin etc. if (!file_exists($this->current . "/administrator/components/com_" . $this->getExtensionName()) && !file_exists($this->current . "/components/com_" . $this->getExtensionName()) ) { $this->say("Extension has no component"); ...
php
private function analyze() { // Check if we have component, module, plugin etc. if (!file_exists($this->current . "/administrator/components/com_" . $this->getExtensionName()) && !file_exists($this->current . "/components/com_" . $this->getExtensionName()) ) { $this->say("Extension has no component"); ...
[ "private", "function", "analyze", "(", ")", "{", "// Check if we have component, module, plugin etc.", "if", "(", "!", "file_exists", "(", "$", "this", "->", "current", ".", "\"/administrator/components/com_\"", ".", "$", "this", "->", "getExtensionName", "(", ")", ...
Analyze the extension structure @return void @since 1.0
[ "Analyze", "the", "extension", "structure" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/Package.php#L157-L192
joomla-projects/jorobo
src/Tasks/Deploy/Package.php
Package.addFiles
private function addFiles($zip, $path = null) { if (!$path) { $path = $this->current; } $source = str_replace('\\', '/', realpath($path)); if (is_dir($source) === true) { $files = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($source), \RecursiveIteratorIterator::SELF_FIRST ...
php
private function addFiles($zip, $path = null) { if (!$path) { $path = $this->current; } $source = str_replace('\\', '/', realpath($path)); if (is_dir($source) === true) { $files = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($source), \RecursiveIteratorIterator::SELF_FIRST ...
[ "private", "function", "addFiles", "(", "$", "zip", ",", "$", "path", "=", "null", ")", "{", "if", "(", "!", "$", "path", ")", "{", "$", "path", "=", "$", "this", "->", "current", ";", "}", "$", "source", "=", "str_replace", "(", "'\\\\'", ",", ...
Add files @param \ZipArchive $zip The zip object @param string $path Optional path @return void @since 1.0
[ "Add", "files" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/Package.php#L204-L250
joomla-projects/jorobo
src/Tasks/Deploy/Package.php
Package.createComponentZip
public function createComponentZip() { $comZip = new \ZipArchive(JPATH_BASE . "/dist", \ZipArchive::CREATE); $tmp_path = '/dist/tmp/cbuild'; if (file_exists(JPATH_BASE . $tmp_path)) { $this->_deleteDir(JPATH_BASE . $tmp_path); } // Improve, should been a whitelist instead of a hardcoded copy $this-...
php
public function createComponentZip() { $comZip = new \ZipArchive(JPATH_BASE . "/dist", \ZipArchive::CREATE); $tmp_path = '/dist/tmp/cbuild'; if (file_exists(JPATH_BASE . $tmp_path)) { $this->_deleteDir(JPATH_BASE . $tmp_path); } // Improve, should been a whitelist instead of a hardcoded copy $this-...
[ "public", "function", "createComponentZip", "(", ")", "{", "$", "comZip", "=", "new", "\\", "ZipArchive", "(", "JPATH_BASE", ".", "\"/dist\"", ",", "\\", "ZipArchive", "::", "CREATE", ")", ";", "$", "tmp_path", "=", "'/dist/tmp/cbuild'", ";", "if", "(", "f...
Create a installable zip file for a component @TODO implement possibility for multiple components (without duplicate content) @return void @since 1.0
[ "Create", "a", "installable", "zip", "file", "for", "a", "component" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/Package.php#L261-L295
joomla-projects/jorobo
src/Tasks/Deploy/Package.php
Package.createLibraryZips
public function createLibraryZips() { $path = $this->current . "/libraries"; // Get every module $hdl = opendir($path); while ($lib = readdir($hdl)) { // Only folders $p = $path . "/" . $lib; if (substr($lib, 0, 1) == '.') { continue; } // Workaround for libraries without lib_ if...
php
public function createLibraryZips() { $path = $this->current . "/libraries"; // Get every module $hdl = opendir($path); while ($lib = readdir($hdl)) { // Only folders $p = $path . "/" . $lib; if (substr($lib, 0, 1) == '.') { continue; } // Workaround for libraries without lib_ if...
[ "public", "function", "createLibraryZips", "(", ")", "{", "$", "path", "=", "$", "this", "->", "current", ".", "\"/libraries\"", ";", "// Get every module", "$", "hdl", "=", "opendir", "(", "$", "path", ")", ";", "while", "(", "$", "lib", "=", "readdir",...
Create zips for libraries @return void @since 1.0
[ "Create", "zips", "for", "libraries" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/Package.php#L304-L347
joomla-projects/jorobo
src/Tasks/Deploy/Package.php
Package.createModuleZips
public function createModuleZips() { $path = $this->current . "/modules"; // Get every module $hdl = opendir($path); while ($entry = readdir($hdl)) { // Only folders $p = $path . "/" . $entry; if (substr($entry, 0, 1) == '.') { continue; } if (!is_file($p)) { $this->say("Pack...
php
public function createModuleZips() { $path = $this->current . "/modules"; // Get every module $hdl = opendir($path); while ($entry = readdir($hdl)) { // Only folders $p = $path . "/" . $entry; if (substr($entry, 0, 1) == '.') { continue; } if (!is_file($p)) { $this->say("Pack...
[ "public", "function", "createModuleZips", "(", ")", "{", "$", "path", "=", "$", "this", "->", "current", ".", "\"/modules\"", ";", "// Get every module", "$", "hdl", "=", "opendir", "(", "$", "path", ")", ";", "while", "(", "$", "entry", "=", "readdir", ...
Create zips for modules @return void @since 1.0
[ "Create", "zips", "for", "modules" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/Package.php#L356-L393
joomla-projects/jorobo
src/Tasks/Deploy/Package.php
Package.createPluginZips
public function createPluginZips() { $path = $this->current . "/plugins"; // Get every plugin $hdl = opendir($path); while ($entry = readdir($hdl)) { // Only folders $p = $path . "/" . $entry; if (substr($entry, 0, 1) == '.') { continue; } if (!is_file($p)) { // Plugin type f...
php
public function createPluginZips() { $path = $this->current . "/plugins"; // Get every plugin $hdl = opendir($path); while ($entry = readdir($hdl)) { // Only folders $p = $path . "/" . $entry; if (substr($entry, 0, 1) == '.') { continue; } if (!is_file($p)) { // Plugin type f...
[ "public", "function", "createPluginZips", "(", ")", "{", "$", "path", "=", "$", "this", "->", "current", ".", "\"/plugins\"", ";", "// Get every plugin", "$", "hdl", "=", "opendir", "(", "$", "path", ")", ";", "while", "(", "$", "entry", "=", "readdir", ...
Create zips for plugins @return void @since 1.0
[ "Create", "zips", "for", "plugins" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/Package.php#L402-L460
joomla-projects/jorobo
src/Tasks/Deploy/Package.php
Package.createPackageZip
public function createPackageZip() { $zip = new \ZipArchive($this->target, \ZipArchive::CREATE); // Instantiate the zip archive $zip->open($this->target, \ZipArchive::CREATE); // Process the files to zip $this->addFiles($zip, JPATH_BASE . '/dist/zips/'); $pkg_path = $this->current . "/administrator/mani...
php
public function createPackageZip() { $zip = new \ZipArchive($this->target, \ZipArchive::CREATE); // Instantiate the zip archive $zip->open($this->target, \ZipArchive::CREATE); // Process the files to zip $this->addFiles($zip, JPATH_BASE . '/dist/zips/'); $pkg_path = $this->current . "/administrator/mani...
[ "public", "function", "createPackageZip", "(", ")", "{", "$", "zip", "=", "new", "\\", "ZipArchive", "(", "$", "this", "->", "target", ",", "\\", "ZipArchive", "::", "CREATE", ")", ";", "// Instantiate the zip archive", "$", "zip", "->", "open", "(", "$", ...
Create package zip (called latest) @return void @since 1.0
[ "Create", "package", "zip", "(", "called", "latest", ")" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/Package.php#L515-L543
nyeholt/silverstripe-simplewiki
thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/URI.php
HTMLPurifier_URI.getSchemeObj
public function getSchemeObj($config, $context) { $registry = HTMLPurifier_URISchemeRegistry::instance(); if ($this->scheme !== null) { $scheme_obj = $registry->getScheme($this->scheme, $config, $context); if (!$scheme_obj) return false; // invalid scheme, clean it out } ...
php
public function getSchemeObj($config, $context) { $registry = HTMLPurifier_URISchemeRegistry::instance(); if ($this->scheme !== null) { $scheme_obj = $registry->getScheme($this->scheme, $config, $context); if (!$scheme_obj) return false; // invalid scheme, clean it out } ...
[ "public", "function", "getSchemeObj", "(", "$", "config", ",", "$", "context", ")", "{", "$", "registry", "=", "HTMLPurifier_URISchemeRegistry", "::", "instance", "(", ")", ";", "if", "(", "$", "this", "->", "scheme", "!==", "null", ")", "{", "$", "schem...
Retrieves a scheme object corresponding to the URI's scheme/default @param $config Instance of HTMLPurifier_Config @param $context Instance of HTMLPurifier_Context @return Scheme object appropriate for validating this URI
[ "Retrieves", "a", "scheme", "object", "corresponding", "to", "the", "URI", "s", "scheme", "/", "default" ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/URI.php#L35-L54
PandaPlatform/framework
src/Panda/Localization/Translator.php
Translator.translate
public function translate($key, $package = 'default', $locale = '', $default = null) { // Normalize locale to current if the given is empty $defaultLocale = Locale::getDefault(); $locale = $locale ?: Locale::get(); $locale = $locale ?: $defaultLocale; // Get locale fallback ...
php
public function translate($key, $package = 'default', $locale = '', $default = null) { // Normalize locale to current if the given is empty $defaultLocale = Locale::getDefault(); $locale = $locale ?: Locale::get(); $locale = $locale ?: $defaultLocale; // Get locale fallback ...
[ "public", "function", "translate", "(", "$", "key", ",", "$", "package", "=", "'default'", ",", "$", "locale", "=", "''", ",", "$", "default", "=", "null", ")", "{", "// Normalize locale to current if the given is empty", "$", "defaultLocale", "=", "Locale", "...
Get a translation value. If there is no value for the given locale, it tries to fallback to default locale. If the default value is null and no translation is found, it throws Exception. @param string $key @param string $package @param string $locale @param mixed $default @return string @throws Exception
[ "Get", "a", "translation", "value", ".", "If", "there", "is", "no", "value", "for", "the", "given", "locale", "it", "tries", "to", "fallback", "to", "default", "locale", ".", "If", "the", "default", "value", "is", "null", "and", "no", "translation", "is"...
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Localization/Translator.php#L53-L76
ipunkt/social-auth
src/Ipunkt/SocialAuth/Profile/CompositeProfile.php
CompositeProfile.getValue
protected function getValue($field) { $value = null; $readField = 'get'.$field; foreach($this->readProfiles as $profile) { $value = $profile->$readField(); if($value !== null) { $this->setValue($field, $value); break; } } return $value; }
php
protected function getValue($field) { $value = null; $readField = 'get'.$field; foreach($this->readProfiles as $profile) { $value = $profile->$readField(); if($value !== null) { $this->setValue($field, $value); break; } } return $value; }
[ "protected", "function", "getValue", "(", "$", "field", ")", "{", "$", "value", "=", "null", ";", "$", "readField", "=", "'get'", ".", "$", "field", ";", "foreach", "(", "$", "this", "->", "readProfiles", "as", "$", "profile", ")", "{", "$", "value",...
Searches all profiles for the given value @param $field @return mixed
[ "Searches", "all", "profiles", "for", "the", "given", "value" ]
train
https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/Ipunkt/SocialAuth/Profile/CompositeProfile.php#L42-L57
jimmyoak/utilities
src/Event/EventPublisher.php
EventPublisher.publish
public function publish(Event $event) { foreach ($this->subscribers as $subscriber) { if ($subscriber->isSubscribedTo($event)) { $subscriber->handle($event); } } return $this; }
php
public function publish(Event $event) { foreach ($this->subscribers as $subscriber) { if ($subscriber->isSubscribedTo($event)) { $subscriber->handle($event); } } return $this; }
[ "public", "function", "publish", "(", "Event", "$", "event", ")", "{", "foreach", "(", "$", "this", "->", "subscribers", "as", "$", "subscriber", ")", "{", "if", "(", "$", "subscriber", "->", "isSubscribedTo", "(", "$", "event", ")", ")", "{", "$", "...
@param Event $event @return $this
[ "@param", "Event", "$event" ]
train
https://github.com/jimmyoak/utilities/blob/ab2b4a574bd67c04784695a3c206daf5800979a4/src/Event/EventPublisher.php#L29-L38
markwatkinson/luminous
src/Luminous/Caches/FileSystemCache.php
FileSystemCache.purgeRecurse
private function purgeRecurse($dir) { $base = $dir . '/'; $time = time(); if (substr($dir, 0, strlen($this->dir)) !== $this->dir) { // uh oh, we somehow tried to escape from the cache directory assert(0); return; } foreach (scandir($dir) as...
php
private function purgeRecurse($dir) { $base = $dir . '/'; $time = time(); if (substr($dir, 0, strlen($this->dir)) !== $this->dir) { // uh oh, we somehow tried to escape from the cache directory assert(0); return; } foreach (scandir($dir) as...
[ "private", "function", "purgeRecurse", "(", "$", "dir", ")", "{", "$", "base", "=", "$", "dir", ".", "'/'", ";", "$", "time", "=", "time", "(", ")", ";", "if", "(", "substr", "(", "$", "dir", ",", "0", ",", "strlen", "(", "$", "this", "->", "...
Purges the contents of a directory recursively
[ "Purges", "the", "contents", "of", "a", "directory", "recursively" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Caches/FileSystemCache.php#L119-L144
opus-online/yii2-giimodel
Generator.php
Generator.generateClassName
protected function generateClassName($tableName, $short = false) { $ns = null; if (list($prefix, $ns) = $this->tablePrefixMatches($tableName)) { $tableName = substr($tableName, strlen($prefix)); } $className = parent::generateClassName($tableName); if (nu...
php
protected function generateClassName($tableName, $short = false) { $ns = null; if (list($prefix, $ns) = $this->tablePrefixMatches($tableName)) { $tableName = substr($tableName, strlen($prefix)); } $className = parent::generateClassName($tableName); if (nu...
[ "protected", "function", "generateClassName", "(", "$", "tableName", ",", "$", "short", "=", "false", ")", "{", "$", "ns", "=", "null", ";", "if", "(", "list", "(", "$", "prefix", ",", "$", "ns", ")", "=", "$", "this", "->", "tablePrefixMatches", "("...
Generates a class name with namespace prefix from the specified table name. @param string $tableName the table name (which may contain schema prefix) @param bool $short @return string the generated class name
[ "Generates", "a", "class", "name", "with", "namespace", "prefix", "from", "the", "specified", "table", "name", "." ]
train
https://github.com/opus-online/yii2-giimodel/blob/85303396a5e5b540cb38138f4b6af2e6f19d0487/Generator.php#L258-L270
dpolac/dictionary
Dictionary.php
Dictionary.generateHash
protected function generateHash($value) { if (is_object($value)) { if ($value instanceof \Closure) { throw new \InvalidArgumentException("Closure cannot be Dictionary key."); } return 'object:' . spl_object_hash($value); } elseif (is_string($value)...
php
protected function generateHash($value) { if (is_object($value)) { if ($value instanceof \Closure) { throw new \InvalidArgumentException("Closure cannot be Dictionary key."); } return 'object:' . spl_object_hash($value); } elseif (is_string($value)...
[ "protected", "function", "generateHash", "(", "$", "value", ")", "{", "if", "(", "is_object", "(", "$", "value", ")", ")", "{", "if", "(", "$", "value", "instanceof", "\\", "Closure", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Cl...
@internal Create hash for each element. @param $value @return string
[ "@internal" ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L29-L49
dpolac/dictionary
Dictionary.php
Dictionary.offsetExists
public function offsetExists($offset) { $hash = $this->generateHash($offset); return isset($this->data[$hash]); }
php
public function offsetExists($offset) { $hash = $this->generateHash($offset); return isset($this->data[$hash]); }
[ "public", "function", "offsetExists", "(", "$", "offset", ")", "{", "$", "hash", "=", "$", "this", "->", "generateHash", "(", "$", "offset", ")", ";", "return", "isset", "(", "$", "this", "->", "data", "[", "$", "hash", "]", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L63-L67
dpolac/dictionary
Dictionary.php
Dictionary.offsetSet
public function offsetSet($offset, $value) { $hash = $this->generateHash($offset); if (!isset($this->keys[$hash])) { $this->keys[$hash] = $offset; } $this->data[$hash] = $value; }
php
public function offsetSet($offset, $value) { $hash = $this->generateHash($offset); if (!isset($this->keys[$hash])) { $this->keys[$hash] = $offset; } $this->data[$hash] = $value; }
[ "public", "function", "offsetSet", "(", "$", "offset", ",", "$", "value", ")", "{", "$", "hash", "=", "$", "this", "->", "generateHash", "(", "$", "offset", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "keys", "[", "$", "hash", "]",...
{@inheritdoc}
[ "{" ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L81-L88
dpolac/dictionary
Dictionary.php
Dictionary.offsetUnset
public function offsetUnset($offset) { $hash = $this->generateHash($offset); unset($this->data[$hash]); unset($this->keys[$hash]); }
php
public function offsetUnset($offset) { $hash = $this->generateHash($offset); unset($this->data[$hash]); unset($this->keys[$hash]); }
[ "public", "function", "offsetUnset", "(", "$", "offset", ")", "{", "$", "hash", "=", "$", "this", "->", "generateHash", "(", "$", "offset", ")", ";", "unset", "(", "$", "this", "->", "data", "[", "$", "hash", "]", ")", ";", "unset", "(", "$", "th...
{@inheritdoc}
[ "{" ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L93-L98
dpolac/dictionary
Dictionary.php
Dictionary.serialize
public function serialize() { $pairs = []; foreach ($this as $key => $value) { $pairs[] = [$key, $value]; } return \serialize($pairs); }
php
public function serialize() { $pairs = []; foreach ($this as $key => $value) { $pairs[] = [$key, $value]; } return \serialize($pairs); }
[ "public", "function", "serialize", "(", ")", "{", "$", "pairs", "=", "[", "]", ";", "foreach", "(", "$", "this", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "pairs", "[", "]", "=", "[", "$", "key", ",", "$", "value", "]", ";", "}", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L111-L118
dpolac/dictionary
Dictionary.php
Dictionary.unserialize
public function unserialize($serialized) { $pairs = \unserialize($serialized); foreach ($pairs as $pair) { $this[$pair[0]] = $pair[1]; } }
php
public function unserialize($serialized) { $pairs = \unserialize($serialized); foreach ($pairs as $pair) { $this[$pair[0]] = $pair[1]; } }
[ "public", "function", "unserialize", "(", "$", "serialized", ")", "{", "$", "pairs", "=", "\\", "unserialize", "(", "$", "serialized", ")", ";", "foreach", "(", "$", "pairs", "as", "$", "pair", ")", "{", "$", "this", "[", "$", "pair", "[", "0", "]"...
{@inheritdoc}
[ "{" ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L123-L129
dpolac/dictionary
Dictionary.php
Dictionary.fromPairs
public static function fromPairs($array) { if (!is_array($array) && !($array instanceof \Traversable)) { throw new \InvalidArgumentException(sprintf( 'Dictionary::fromPairs() argument must be array or Traversable, ' . 'but is "%s".', gettype($array) ))...
php
public static function fromPairs($array) { if (!is_array($array) && !($array instanceof \Traversable)) { throw new \InvalidArgumentException(sprintf( 'Dictionary::fromPairs() argument must be array or Traversable, ' . 'but is "%s".', gettype($array) ))...
[ "public", "static", "function", "fromPairs", "(", "$", "array", ")", "{", "if", "(", "!", "is_array", "(", "$", "array", ")", "&&", "!", "(", "$", "array", "instanceof", "\\", "Traversable", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException"...
Create new Dictionary from array of key-value pairs. @param $array array Array of pairs. Each pair must be 2-element array. @return Dictionary
[ "Create", "new", "Dictionary", "from", "array", "of", "key", "-", "value", "pairs", "." ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L137-L158
dpolac/dictionary
Dictionary.php
Dictionary.fromArray
public static function fromArray($array) { if (!is_array($array) && !($array instanceof \Traversable)) { throw new \InvalidArgumentException(sprintf( 'Dictionary::fromArray() argument must be array or Traversable, ' . 'but is "%s".', gettype($array) ))...
php
public static function fromArray($array) { if (!is_array($array) && !($array instanceof \Traversable)) { throw new \InvalidArgumentException(sprintf( 'Dictionary::fromArray() argument must be array or Traversable, ' . 'but is "%s".', gettype($array) ))...
[ "public", "static", "function", "fromArray", "(", "$", "array", ")", "{", "if", "(", "!", "is_array", "(", "$", "array", ")", "&&", "!", "(", "$", "array", "instanceof", "\\", "Traversable", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException"...
Create new Dictionary from standard PHP array. @param $array array Array to create Dictionary from. @return Dictionary
[ "Create", "new", "Dictionary", "from", "standard", "PHP", "array", "." ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L166-L180
dpolac/dictionary
Dictionary.php
Dictionary.toPairs
public function toPairs() { $result = []; foreach ($this as $key => $value) { $result[] = [$key, $value]; } return $result; }
php
public function toPairs() { $result = []; foreach ($this as $key => $value) { $result[] = [$key, $value]; } return $result; }
[ "public", "function", "toPairs", "(", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "this", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "result", "[", "]", "=", "[", "$", "key", ",", "$", "value", "]", ";", "}", ...
Get array of all key-value pairs in dictionary. @return array Array of pairs. Each pair is 2-element array.
[ "Get", "array", "of", "all", "key", "-", "value", "pairs", "in", "dictionary", "." ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L187-L194
dpolac/dictionary
Dictionary.php
Dictionary.sortBy
public function sortBy($callback = null, $direction = 'ASC') { if (!is_callable($callback)) { if (is_null($callback) or is_string($callback) && 'values' === strtolower($callback)) { $callback = function ($value, $key) { return $value; }; } else if (is_string($callback...
php
public function sortBy($callback = null, $direction = 'ASC') { if (!is_callable($callback)) { if (is_null($callback) or is_string($callback) && 'values' === strtolower($callback)) { $callback = function ($value, $key) { return $value; }; } else if (is_string($callback...
[ "public", "function", "sortBy", "(", "$", "callback", "=", "null", ",", "$", "direction", "=", "'ASC'", ")", "{", "if", "(", "!", "is_callable", "(", "$", "callback", ")", ")", "{", "if", "(", "is_null", "(", "$", "callback", ")", "or", "is_string", ...
Sort Dictionary by values returned by callback. @param string|callable $callback Callback returning value for each Dictionary's element. If argument is a string "values" or "keys", it will be sorted by Dictionary's values or keys. @param string $direction Sorting direction. "ASC" or "DESC". @return $t...
[ "Sort", "Dictionary", "by", "values", "returned", "by", "callback", "." ]
train
https://github.com/dpolac/dictionary/blob/7078d8bfe47cfcb11882140f5dbd7c106c1906e6/Dictionary.php#L225-L267
terdia/legato-framework
src/Routing/RouteDispatcher.php
RouteDispatcher.handle
private function handle($handler, $parameters) { if ($handler instanceof \Closure) { $this->app->execute($handler, $parameters); } else { list($controller, $action) = explode('@', $handler); $class = $this->app->construct($controller); $this->app->exe...
php
private function handle($handler, $parameters) { if ($handler instanceof \Closure) { $this->app->execute($handler, $parameters); } else { list($controller, $action) = explode('@', $handler); $class = $this->app->construct($controller); $this->app->exe...
[ "private", "function", "handle", "(", "$", "handler", ",", "$", "parameters", ")", "{", "if", "(", "$", "handler", "instanceof", "\\", "Closure", ")", "{", "$", "this", "->", "app", "->", "execute", "(", "$", "handler", ",", "$", "parameters", ")", "...
Handler for route found, support Closure and Controller methods. @param $handler @param $parameters
[ "Handler", "for", "route", "found", "support", "Closure", "and", "Controller", "methods", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Routing/RouteDispatcher.php#L52-L62
terdia/legato-framework
src/Routing/RouteDispatcher.php
RouteDispatcher.prepareUriForLocalhostAccess
private function prepareUriForLocalhostAccess($uri) { $public = 'public'; $index = 'index.php'; if (strpos($uri, $index)) { return substr($uri, strpos($uri, $index) + strlen($index)); } elseif (strpos($uri, $public)) { return substr($uri, strpos($uri, $public...
php
private function prepareUriForLocalhostAccess($uri) { $public = 'public'; $index = 'index.php'; if (strpos($uri, $index)) { return substr($uri, strpos($uri, $index) + strlen($index)); } elseif (strpos($uri, $public)) { return substr($uri, strpos($uri, $public...
[ "private", "function", "prepareUriForLocalhostAccess", "(", "$", "uri", ")", "{", "$", "public", "=", "'public'", ";", "$", "index", "=", "'index.php'", ";", "if", "(", "strpos", "(", "$", "uri", ",", "$", "index", ")", ")", "{", "return", "substr", "(...
We attempt to parse direct request to localhost/public/ or localhost/public/index.php. @param $uri @return bool|string
[ "We", "attempt", "to", "parse", "direct", "request", "to", "localhost", "/", "public", "/", "or", "localhost", "/", "public", "/", "index", ".", "php", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Routing/RouteDispatcher.php#L72-L84
dekuan/delib
src/CDateTimeLib.php
CDateTimeLib.isValidISODateString
static function isValidISODateString( $sDate ) { if ( ! CLib::IsExistingString( $sDate ) ) { return false; } $nTime = strtotime( $sDate ); return ( false !== $nTime && 0 == strcasecmp( $sDate, date( "Y-m-d", $nTime ) ) ); }
php
static function isValidISODateString( $sDate ) { if ( ! CLib::IsExistingString( $sDate ) ) { return false; } $nTime = strtotime( $sDate ); return ( false !== $nTime && 0 == strcasecmp( $sDate, date( "Y-m-d", $nTime ) ) ); }
[ "static", "function", "isValidISODateString", "(", "$", "sDate", ")", "{", "if", "(", "!", "CLib", "::", "IsExistingString", "(", "$", "sDate", ")", ")", "{", "return", "false", ";", "}", "$", "nTime", "=", "strtotime", "(", "$", "sDate", ")", ";", "...
https://en.wikipedia.org/wiki/ISO_8601 @param string $sDate @return bool
[ "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "ISO_8601" ]
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CDateTimeLib.php#L200-L210
liuguangw/mvc
src/ServiceLoader.php
ServiceLoader.loadContainerService
public function loadContainerService(Container $container): void { // 添加错误处理服务 $container->addClassMap(IErrorHandler::class, ErrorHandler::class, '@errorHandler'); // 路由错误处理 $container->addClassMap(IRouteErrorHandler::class, RouteErrorHandler::class, '@routeErrorHandler'); //...
php
public function loadContainerService(Container $container): void { // 添加错误处理服务 $container->addClassMap(IErrorHandler::class, ErrorHandler::class, '@errorHandler'); // 路由错误处理 $container->addClassMap(IRouteErrorHandler::class, RouteErrorHandler::class, '@routeErrorHandler'); //...
[ "public", "function", "loadContainerService", "(", "Container", "$", "container", ")", ":", "void", "{", "// 添加错误处理服务", "$", "container", "->", "addClassMap", "(", "IErrorHandler", "::", "class", ",", "ErrorHandler", "::", "class", ",", "'@errorHandler'", ")", "...
加载容器服务 @param Container $container @return void
[ "加载容器服务" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/ServiceLoader.php#L37-L62
pantera-digital/yii2-seo
models/SeoPresetsSearch.php
SeoPresetsSearch.search
public function search($params) { $query = SeoPresets::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); $this->load($params); if (!$this->validate()) { // uncomment the ...
php
public function search($params) { $query = SeoPresets::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); $this->load($params); if (!$this->validate()) { // uncomment the ...
[ "public", "function", "search", "(", "$", "params", ")", "{", "$", "query", "=", "SeoPresets", "::", "find", "(", ")", ";", "// add conditions that should always apply here", "$", "dataProvider", "=", "new", "ActiveDataProvider", "(", "[", "'query'", "=>", "$", ...
Creates data provider instance with search query applied @param array $params @return ActiveDataProvider
[ "Creates", "data", "provider", "instance", "with", "search", "query", "applied" ]
train
https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/models/SeoPresetsSearch.php#L42-L74
mimmi20/Wurfl
src/Handlers/UcwebU3Handler.php
UcwebU3Handler.canHandle
public function canHandle($userAgent) { if (Utils::isDesktopBrowser($userAgent)) { return false; } return (Utils::checkIfStartsWith($userAgent, 'Mozilla') && Utils::checkIfContains($userAgent, 'UCBrowser')); }
php
public function canHandle($userAgent) { if (Utils::isDesktopBrowser($userAgent)) { return false; } return (Utils::checkIfStartsWith($userAgent, 'Mozilla') && Utils::checkIfContains($userAgent, 'UCBrowser')); }
[ "public", "function", "canHandle", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "isDesktopBrowser", "(", "$", "userAgent", ")", ")", "{", "return", "false", ";", "}", "return", "(", "Utils", "::", "checkIfStartsWith", "(", "$", "userAgent", ...
@param string $userAgent @return bool
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/UcwebU3Handler.php#L71-L78
mimmi20/Wurfl
src/Handlers/UcwebU3Handler.php
UcwebU3Handler.applyRecoveryMatch
public function applyRecoveryMatch($userAgent) { // Windows Phone U3K if ($deviceID = $this->applyRecoveryWindowsPhone($userAgent)) { return $deviceID; } // Android U3K Mobile + Tablet. This will also handle UCWEB7 recovery and point it to the UCWEB generic IDs. ...
php
public function applyRecoveryMatch($userAgent) { // Windows Phone U3K if ($deviceID = $this->applyRecoveryWindowsPhone($userAgent)) { return $deviceID; } // Android U3K Mobile + Tablet. This will also handle UCWEB7 recovery and point it to the UCWEB generic IDs. ...
[ "public", "function", "applyRecoveryMatch", "(", "$", "userAgent", ")", "{", "// Windows Phone U3K", "if", "(", "$", "deviceID", "=", "$", "this", "->", "applyRecoveryWindowsPhone", "(", "$", "userAgent", ")", ")", "{", "return", "$", "deviceID", ";", "}", "...
@param string $userAgent @return string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/UcwebU3Handler.php#L101-L124
mimmi20/Wurfl
src/Handlers/UcwebU3Handler.php
UcwebU3Handler.getUcAndroidVersion
public static function getUcAndroidVersion($userAgent, $useDefault = true) { if (preg_match('/; Adr (\d+\.\d+)\.?/', $userAgent, $matches)) { $u2k_an_version = $matches[1]; if (in_array($u2k_an_version, AndroidHandler::$validAndroidVersions)) { return $u2k_an_version...
php
public static function getUcAndroidVersion($userAgent, $useDefault = true) { if (preg_match('/; Adr (\d+\.\d+)\.?/', $userAgent, $matches)) { $u2k_an_version = $matches[1]; if (in_array($u2k_an_version, AndroidHandler::$validAndroidVersions)) { return $u2k_an_version...
[ "public", "static", "function", "getUcAndroidVersion", "(", "$", "userAgent", ",", "$", "useDefault", "=", "true", ")", "{", "if", "(", "preg_match", "(", "'/; Adr (\\d+\\.\\d+)\\.?/'", ",", "$", "userAgent", ",", "$", "matches", ")", ")", "{", "$", "u2k_an_...
@param string $userAgent @param bool $useDefault @return float|null
[ "@param", "string", "$userAgent", "@param", "bool", "$useDefault" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/UcwebU3Handler.php#L223-L234
mimmi20/Wurfl
src/Handlers/UcwebU3Handler.php
UcwebU3Handler.getUcAndroidModel
public static function getUcAndroidModel($userAgent) { // Locales are optional for matching model name since UAs like Chrome Mobile do not contain them if (!preg_match('#Adr [\d\.]+; [a-zA-Z]+-[a-zA-Z]+; (.*)\) U2#', $userAgent, $matches)) { return null; } $model = $matc...
php
public static function getUcAndroidModel($userAgent) { // Locales are optional for matching model name since UAs like Chrome Mobile do not contain them if (!preg_match('#Adr [\d\.]+; [a-zA-Z]+-[a-zA-Z]+; (.*)\) U2#', $userAgent, $matches)) { return null; } $model = $matc...
[ "public", "static", "function", "getUcAndroidModel", "(", "$", "userAgent", ")", "{", "// Locales are optional for matching model name since UAs like Chrome Mobile do not contain them", "if", "(", "!", "preg_match", "(", "'#Adr [\\d\\.]+; [a-zA-Z]+-[a-zA-Z]+; (.*)\\) U2#'", ",", "$...
Slightly modified from Android's get model function @param $userAgent @return null|string
[ "Slightly", "modified", "from", "Android", "s", "get", "model", "function" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/UcwebU3Handler.php#L243-L273
liuguangw/mvc
src/data/ObserverData.php
ObserverData.hasChanged
public function hasChanged(): bool { return ! (empty($this->addAttributes) && empty($this->updateAttributes) && empty($this->removeAttributes)); }
php
public function hasChanged(): bool { return ! (empty($this->addAttributes) && empty($this->updateAttributes) && empty($this->removeAttributes)); }
[ "public", "function", "hasChanged", "(", ")", ":", "bool", "{", "return", "!", "(", "empty", "(", "$", "this", "->", "addAttributes", ")", "&&", "empty", "(", "$", "this", "->", "updateAttributes", ")", "&&", "empty", "(", "$", "this", "->", "removeAtt...
判断数据是否发生了变化 @return bool
[ "判断数据是否发生了变化" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/data/ObserverData.php#L25-L28
liuguangw/mvc
src/data/ObserverData.php
ObserverData.toArray
public function toArray(): array { $result = $this->orgData; foreach ($this->addAttributes as $key => $value) { $result[$key] = $value; } foreach ($this->updateAttributes as $key => $value) { $result[$key] = $value; } foreach ($this->removeAttr...
php
public function toArray(): array { $result = $this->orgData; foreach ($this->addAttributes as $key => $value) { $result[$key] = $value; } foreach ($this->updateAttributes as $key => $value) { $result[$key] = $value; } foreach ($this->removeAttr...
[ "public", "function", "toArray", "(", ")", ":", "array", "{", "$", "result", "=", "$", "this", "->", "orgData", ";", "foreach", "(", "$", "this", "->", "addAttributes", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "result", "[", "$", "key",...
获取最终数组 @return array
[ "获取最终数组" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/data/ObserverData.php#L35-L48
liuguangw/mvc
src/data/ObserverData.php
ObserverData.containsKey
public function containsKey(string $key): bool { if (isset($this->orgData[$key])) { return ! isset($this->removeAttributes[$key]); } else { return isset($this->addAttributes[$key]); } }
php
public function containsKey(string $key): bool { if (isset($this->orgData[$key])) { return ! isset($this->removeAttributes[$key]); } else { return isset($this->addAttributes[$key]); } }
[ "public", "function", "containsKey", "(", "string", "$", "key", ")", ":", "bool", "{", "if", "(", "isset", "(", "$", "this", "->", "orgData", "[", "$", "key", "]", ")", ")", "{", "return", "!", "isset", "(", "$", "this", "->", "removeAttributes", "...
判断是否存在指定的键 @param string $key 键名 @return bool
[ "判断是否存在指定的键" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/data/ObserverData.php#L57-L64
liuguangw/mvc
src/data/ObserverData.php
ObserverData.getValue
public function getValue(string $key, $defaultValue = null) { if (isset($this->orgData[$key])) { if (isset($this->removeAttributes[$key])) { // 已经被删除 return $defaultValue; } elseif (isset($this->updateAttributes[$key])) { // 被修改 ...
php
public function getValue(string $key, $defaultValue = null) { if (isset($this->orgData[$key])) { if (isset($this->removeAttributes[$key])) { // 已经被删除 return $defaultValue; } elseif (isset($this->updateAttributes[$key])) { // 被修改 ...
[ "public", "function", "getValue", "(", "string", "$", "key", ",", "$", "defaultValue", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "orgData", "[", "$", "key", "]", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", ...
读取键值,或者不存在时默认值 @param string $key 键名 @param mixed $defaultValue 当键名不存在时,返回的默认值 @return mixed
[ "读取键值", "或者不存在时默认值" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/data/ObserverData.php#L87-L104
liuguangw/mvc
src/data/ObserverData.php
ObserverData.setValue
public function setValue(string $key, $value): void { if (isset($this->orgData[$key])) { if (isset($this->removeAttributes[$key])) { // 已经被删除 unset($this->removeAttributes[$key]); } if ($this->orgData[$key] != $value) { $thi...
php
public function setValue(string $key, $value): void { if (isset($this->orgData[$key])) { if (isset($this->removeAttributes[$key])) { // 已经被删除 unset($this->removeAttributes[$key]); } if ($this->orgData[$key] != $value) { $thi...
[ "public", "function", "setValue", "(", "string", "$", "key", ",", "$", "value", ")", ":", "void", "{", "if", "(", "isset", "(", "$", "this", "->", "orgData", "[", "$", "key", "]", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "remo...
设置键值 @param string $key 键名 @param mixed $value 键值 @return void
[ "设置键值" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/data/ObserverData.php#L115-L130
liuguangw/mvc
src/data/ObserverData.php
ObserverData.remove
public function remove(string $key): void { if (isset($this->orgData[$key])) { if (isset($this->updateAttributes[$key])) { unset($this->updateAttributes[$key]); } } else { if (isset($this->addAttributes[$key])) { unset($this->addAtt...
php
public function remove(string $key): void { if (isset($this->orgData[$key])) { if (isset($this->updateAttributes[$key])) { unset($this->updateAttributes[$key]); } } else { if (isset($this->addAttributes[$key])) { unset($this->addAtt...
[ "public", "function", "remove", "(", "string", "$", "key", ")", ":", "void", "{", "if", "(", "isset", "(", "$", "this", "->", "orgData", "[", "$", "key", "]", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "updateAttributes", "[", "$"...
删除键对应的映射关系 @param string $key 键名 @return void
[ "删除键对应的映射关系" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/data/ObserverData.php#L139-L151
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.createFromConfig
public static function createFromConfig(array $config) { $fields = []; foreach ($config as $name => $field) { $fields[$name] = Fields::create($name, $field); } return new static($fields); }
php
public static function createFromConfig(array $config) { $fields = []; foreach ($config as $name => $field) { $fields[$name] = Fields::create($name, $field); } return new static($fields); }
[ "public", "static", "function", "createFromConfig", "(", "array", "$", "config", ")", "{", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "config", "as", "$", "name", "=>", "$", "field", ")", "{", "$", "fields", "[", "$", "name", "]", "=",...
Method to create form fieldset object and fields from config @param array $config @return Fieldset
[ "Method", "to", "create", "form", "fieldset", "object", "and", "fields", "from", "config" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L61-L68
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.setCurrent
public function setCurrent($i) { $this->current = (int)$i; if (!isset($this->fields[$this->current])) { $this->fields[$this->current] = []; } return $this; }
php
public function setCurrent($i) { $this->current = (int)$i; if (!isset($this->fields[$this->current])) { $this->fields[$this->current] = []; } return $this; }
[ "public", "function", "setCurrent", "(", "$", "i", ")", "{", "$", "this", "->", "current", "=", "(", "int", ")", "$", "i", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "fields", "[", "$", "this", "->", "current", "]", ")", ")", "{", ...
Method to get current group index @param int $i @return Fieldset
[ "Method", "to", "get", "current", "group", "index" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L86-L93
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.addField
public function addField(Element\AbstractElement $field) { if (!isset($this->fields[$this->current])) { $this->fields[$this->current] = []; } $this->fields[$this->current][$field->getName()] = $field; return $this; }
php
public function addField(Element\AbstractElement $field) { if (!isset($this->fields[$this->current])) { $this->fields[$this->current] = []; } $this->fields[$this->current][$field->getName()] = $field; return $this; }
[ "public", "function", "addField", "(", "Element", "\\", "AbstractElement", "$", "field", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "fields", "[", "$", "this", "->", "current", "]", ")", ")", "{", "$", "this", "->", "fields", "[", "...
Method to add a form field @param Element\AbstractElement $field @return Fieldset
[ "Method", "to", "add", "a", "form", "field" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L111-L118
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.insertFieldAfter
public function insertFieldAfter($name, Element\AbstractElement $field) { foreach ($this->fields as $i => $group) { $fields = []; foreach ($group as $key => $value) { if ($key == $name) { $fields[$key] = $value; $fields[$field->...
php
public function insertFieldAfter($name, Element\AbstractElement $field) { foreach ($this->fields as $i => $group) { $fields = []; foreach ($group as $key => $value) { if ($key == $name) { $fields[$key] = $value; $fields[$field->...
[ "public", "function", "insertFieldAfter", "(", "$", "name", ",", "Element", "\\", "AbstractElement", "$", "field", ")", "{", "foreach", "(", "$", "this", "->", "fields", "as", "$", "i", "=>", "$", "group", ")", "{", "$", "fields", "=", "[", "]", ";",...
Method to insert a field after another one @param string $name @param Element\AbstractElement $field @return Fieldset
[ "Method", "to", "insert", "a", "field", "after", "another", "one" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L162-L177
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.count
public function count() { $count = 0; foreach ($this->fields as $group) { $count += count($group); } return $count; }
php
public function count() { $count = 0; foreach ($this->fields as $group) { $count += count($group); } return $count; }
[ "public", "function", "count", "(", ")", "{", "$", "count", "=", "0", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "group", ")", "{", "$", "count", "+=", "count", "(", "$", "group", ")", ";", "}", "return", "$", "count", ";", "}...
Method to get the count of elements in the form fieldset @return int
[ "Method", "to", "get", "the", "count", "of", "elements", "in", "the", "form", "fieldset" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L183-L190
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.toArray
public function toArray() { $fieldValues = []; foreach ($this->fields as $group) { foreach ($group as $name => $field) { $fieldValues[$name] = $field->getValue(); } } return $fieldValues; }
php
public function toArray() { $fieldValues = []; foreach ($this->fields as $group) { foreach ($group as $name => $field) { $fieldValues[$name] = $field->getValue(); } } return $fieldValues; }
[ "public", "function", "toArray", "(", ")", "{", "$", "fieldValues", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "group", ")", "{", "foreach", "(", "$", "group", "as", "$", "name", "=>", "$", "field", ")", "{", "$",...
Method to get the field values as an array @return array
[ "Method", "to", "get", "the", "field", "values", "as", "an", "array" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L196-L205
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.hasField
public function hasField($name) { $result = false; foreach ($this->fields as $key => $fields) { if (isset($fields[$name])) { $result = true; break; } } return $result; }
php
public function hasField($name) { $result = false; foreach ($this->fields as $key => $fields) { if (isset($fields[$name])) { $result = true; break; } } return $result; }
[ "public", "function", "hasField", "(", "$", "name", ")", "{", "$", "result", "=", "false", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "key", "=>", "$", "fields", ")", "{", "if", "(", "isset", "(", "$", "fields", "[", "$", "name"...
Method to determine if the fieldset has a field @param string $name @return boolean
[ "Method", "to", "determine", "if", "the", "fieldset", "has", "a", "field" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L239-L249
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.getField
public function getField($name) { $result = null; foreach ($this->fields as $key => $fields) { if (isset($fields[$name])) { $result = $fields[$name]; } } return $result; }
php
public function getField($name) { $result = null; foreach ($this->fields as $key => $fields) { if (isset($fields[$name])) { $result = $fields[$name]; } } return $result; }
[ "public", "function", "getField", "(", "$", "name", ")", "{", "$", "result", "=", "null", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "key", "=>", "$", "fields", ")", "{", "if", "(", "isset", "(", "$", "fields", "[", "$", "name",...
Method to get a field element object @param string $name @return Element\AbstractElement
[ "Method", "to", "get", "a", "field", "element", "object" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L256-L265
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.getFields
public function getFields($i) { return (isset($this->fields[$i])) ? $this->fields[$i] : null; }
php
public function getFields($i) { return (isset($this->fields[$i])) ? $this->fields[$i] : null; }
[ "public", "function", "getFields", "(", "$", "i", ")", "{", "return", "(", "isset", "(", "$", "this", "->", "fields", "[", "$", "i", "]", ")", ")", "?", "$", "this", "->", "fields", "[", "$", "i", "]", ":", "null", ";", "}" ]
Method to get field element objects in a group @param int $i @return array
[ "Method", "to", "get", "field", "element", "objects", "in", "a", "group" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L272-L275
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.getAllFields
public function getAllFields() { $fields = []; foreach ($this->fields as $group) { foreach ($group as $field) { $fields[$field->getName()] = $field; } } return $fields; }
php
public function getAllFields() { $fields = []; foreach ($this->fields as $group) { foreach ($group as $field) { $fields[$field->getName()] = $field; } } return $fields; }
[ "public", "function", "getAllFields", "(", ")", "{", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "group", ")", "{", "foreach", "(", "$", "group", "as", "$", "field", ")", "{", "$", "fields", "[", "$"...
Method to get all field elements @return array
[ "Method", "to", "get", "all", "field", "elements" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L290-L299
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.getFieldValue
public function getFieldValue($name) { $result = null; foreach ($this->fields as $key => $fields) { if (isset($fields[$name])) { $result = $this->fields[$key][$name]->getValue(); } } return $result; }
php
public function getFieldValue($name) { $result = null; foreach ($this->fields as $key => $fields) { if (isset($fields[$name])) { $result = $this->fields[$key][$name]->getValue(); } } return $result; }
[ "public", "function", "getFieldValue", "(", "$", "name", ")", "{", "$", "result", "=", "null", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "key", "=>", "$", "fields", ")", "{", "if", "(", "isset", "(", "$", "fields", "[", "$", "n...
Method to get a field element value @param string $name @return mixed
[ "Method", "to", "get", "a", "field", "element", "value" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L306-L315
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.setFieldValue
public function setFieldValue($name, $value) { foreach ($this->fields as $key => $fields) { if (isset($fields[$name])) { $this->fields[$key][$name]->setValue($value); } } return $this; }
php
public function setFieldValue($name, $value) { foreach ($this->fields as $key => $fields) { if (isset($fields[$name])) { $this->fields[$key][$name]->setValue($value); } } return $this; }
[ "public", "function", "setFieldValue", "(", "$", "name", ",", "$", "value", ")", "{", "foreach", "(", "$", "this", "->", "fields", "as", "$", "key", "=>", "$", "fields", ")", "{", "if", "(", "isset", "(", "$", "fields", "[", "$", "name", "]", ")"...
Method to set a field element value @param string $name @param mixed $value @return Fieldset
[ "Method", "to", "set", "a", "field", "element", "value" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L334-L342
christophe-brachet/aspi-framework
src/Framework/Form/Fieldset.php
Fieldset.setFieldValues
public function setFieldValues(array $values) { foreach ($values as $name => $value) { $this->setFieldValue($name, $value); } return $this; }
php
public function setFieldValues(array $values) { foreach ($values as $name => $value) { $this->setFieldValue($name, $value); } return $this; }
[ "public", "function", "setFieldValues", "(", "array", "$", "values", ")", "{", "foreach", "(", "$", "values", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "this", "->", "setFieldValue", "(", "$", "name", ",", "$", "value", ")", ";", "}", "...
Method to set field element values @param array $values @return Fieldset
[ "Method", "to", "set", "field", "element", "values" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L349-L355