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
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php
ProjectDescriptorBuilder.filterAndValidateEachDescriptor
private function filterAndValidateEachDescriptor($descriptor) { $descriptors = new Collection(); foreach ($descriptor as $key => $item) { $item = $this->filterAndValidateDescriptor($item); if (!$item) { continue; } $descriptors[$key] =...
php
private function filterAndValidateEachDescriptor($descriptor) { $descriptors = new Collection(); foreach ($descriptor as $key => $item) { $item = $this->filterAndValidateDescriptor($item); if (!$item) { continue; } $descriptors[$key] =...
[ "private", "function", "filterAndValidateEachDescriptor", "(", "$", "descriptor", ")", "{", "$", "descriptors", "=", "new", "Collection", "(", ")", ";", "foreach", "(", "$", "descriptor", "as", "$", "key", "=>", "$", "item", ")", "{", "$", "item", "=", "...
Filters each descriptor, validates them, stores the validation results and returns a collection of transmuted objects. @param DescriptorAbstract[] $descriptor @return Collection
[ "Filters", "each", "descriptor", "validates", "them", "stores", "the", "validation", "results", "and", "returns", "a", "collection", "of", "transmuted", "objects", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php#L213-L226
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php
ProjectDescriptorBuilder.filterAndValidateDescriptor
protected function filterAndValidateDescriptor($descriptor) { if (!$descriptor instanceof Filterable) { return $descriptor; } // filter the descriptor; this may result in the descriptor being removed! $descriptor = $this->filter($descriptor); if (!$descriptor) { ...
php
protected function filterAndValidateDescriptor($descriptor) { if (!$descriptor instanceof Filterable) { return $descriptor; } // filter the descriptor; this may result in the descriptor being removed! $descriptor = $this->filter($descriptor); if (!$descriptor) { ...
[ "protected", "function", "filterAndValidateDescriptor", "(", "$", "descriptor", ")", "{", "if", "(", "!", "$", "descriptor", "instanceof", "Filterable", ")", "{", "return", "$", "descriptor", ";", "}", "// filter the descriptor; this may result in the descriptor being rem...
Filters a descriptor, validates it, stores the validation results and returns the transmuted object or null if it is supposed to be removed. @param DescriptorAbstract $descriptor @return DescriptorAbstract|null
[ "Filters", "a", "descriptor", "validates", "it", "stores", "the", "validation", "results", "and", "returns", "the", "transmuted", "object", "or", "null", "if", "it", "is", "supposed", "to", "be", "removed", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php#L236-L252
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php
ProjectDescriptorBuilder.mapCodeToSeverity
protected function mapCodeToSeverity($code) { if (is_int($code) && $this->translator->translate('VAL:ERRLVL-'.$code)) { $severity = $this->translator->translate('VAL:ERRLVL-'.$code); } else { $severity = LogLevel::ERROR; } return $severity; }
php
protected function mapCodeToSeverity($code) { if (is_int($code) && $this->translator->translate('VAL:ERRLVL-'.$code)) { $severity = $this->translator->translate('VAL:ERRLVL-'.$code); } else { $severity = LogLevel::ERROR; } return $severity; }
[ "protected", "function", "mapCodeToSeverity", "(", "$", "code", ")", "{", "if", "(", "is_int", "(", "$", "code", ")", "&&", "$", "this", "->", "translator", "->", "translate", "(", "'VAL:ERRLVL-'", ".", "$", "code", ")", ")", "{", "$", "severity", "=",...
Map error code to severity. @param int $code @return string
[ "Map", "error", "code", "to", "severity", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php#L261-L270
ComposePress/core
src/Abstracts/Plugin.php
Plugin.get_plugin_info
public function get_plugin_info( $field = null ) { $info = get_plugin_data( $this->plugin_file ); if ( null !== $field && isset( $info[ $field ] ) ) { return $info[ $field ]; } return $info; }
php
public function get_plugin_info( $field = null ) { $info = get_plugin_data( $this->plugin_file ); if ( null !== $field && isset( $info[ $field ] ) ) { return $info[ $field ]; } return $info; }
[ "public", "function", "get_plugin_info", "(", "$", "field", "=", "null", ")", "{", "$", "info", "=", "get_plugin_data", "(", "$", "this", "->", "plugin_file", ")", ";", "if", "(", "null", "!==", "$", "field", "&&", "isset", "(", "$", "info", "[", "$"...
@param string $field @return string|array
[ "@param", "string", "$field" ]
train
https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Abstracts/Plugin.php#L182-L189
ComposePress/core
src/Abstracts/Plugin.php
Plugin.get_asset_url
public function get_asset_url( $file ) { if ( $this->get_wp_filesystem()->is_file( $file ) ) { $file = str_replace( plugin_dir_path( $this->plugin_file ), '', $file ); } return plugins_url( $file, $this->plugin_file ); }
php
public function get_asset_url( $file ) { if ( $this->get_wp_filesystem()->is_file( $file ) ) { $file = str_replace( plugin_dir_path( $this->plugin_file ), '', $file ); } return plugins_url( $file, $this->plugin_file ); }
[ "public", "function", "get_asset_url", "(", "$", "file", ")", "{", "if", "(", "$", "this", "->", "get_wp_filesystem", "(", ")", "->", "is_file", "(", "$", "file", ")", ")", "{", "$", "file", "=", "str_replace", "(", "plugin_dir_path", "(", "$", "this",...
@param $file @return string
[ "@param", "$file" ]
train
https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Abstracts/Plugin.php#L203-L209
DataDo/data
src/main/php/DataDo/Data/DefaultNamingConvention.php
DefaultNamingConvention.propertyToColumnName
public function propertyToColumnName($property) { $name = $property->getName(); $columnName = $this->removeCamelCasing($name); return $columnName; }
php
public function propertyToColumnName($property) { $name = $property->getName(); $columnName = $this->removeCamelCasing($name); return $columnName; }
[ "public", "function", "propertyToColumnName", "(", "$", "property", ")", "{", "$", "name", "=", "$", "property", "->", "getName", "(", ")", ";", "$", "columnName", "=", "$", "this", "->", "removeCamelCasing", "(", "$", "name", ")", ";", "return", "$", ...
{$@inheritdoc}
[ "{", "$" ]
train
https://github.com/DataDo/data/blob/555b02a27755032fcd53e165b0674e81a68067c0/src/main/php/DataDo/Data/DefaultNamingConvention.php#L25-L30
ekuiter/feature-php
FeaturePhp/Model/ConfigurationRenderer.php
ConfigurationRenderer._render
public function _render($textOnly) { $str = ""; if ($textOnly) $str .= "\nModel Analysis\n==============\n"; else $str .= "<h2>Model Analysis</h2>"; $str .= $this->analyzeModel($this->configuration->getModel(), $textOnly); if ($textOnly) $str ....
php
public function _render($textOnly) { $str = ""; if ($textOnly) $str .= "\nModel Analysis\n==============\n"; else $str .= "<h2>Model Analysis</h2>"; $str .= $this->analyzeModel($this->configuration->getModel(), $textOnly); if ($textOnly) $str ....
[ "public", "function", "_render", "(", "$", "textOnly", ")", "{", "$", "str", "=", "\"\"", ";", "if", "(", "$", "textOnly", ")", "$", "str", ".=", "\"\\nModel Analysis\\n==============\\n\"", ";", "else", "$", "str", ".=", "\"<h2>Model Analysis</h2>\"", ";", ...
Returns the model and configuration analysis. @param bool $textOnly whether to render text or HTML @return string
[ "Returns", "the", "model", "and", "configuration", "analysis", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Model/ConfigurationRenderer.php#L43-L56
ekuiter/feature-php
FeaturePhp/Model/ConfigurationRenderer.php
ConfigurationRenderer.analyzeModel
private function analyzeModel($model, $textOnly) { $featureNum = count($model->getFeatures()); $rootFeatureName = $model->getRootFeature()->getName(); $constraintNum = count($model->getConstraintSolver()->getConstraints()); $ruleNum = count($model->getXmlModel()->getRules()); $s...
php
private function analyzeModel($model, $textOnly) { $featureNum = count($model->getFeatures()); $rootFeatureName = $model->getRootFeature()->getName(); $constraintNum = count($model->getConstraintSolver()->getConstraints()); $ruleNum = count($model->getXmlModel()->getRules()); $s...
[ "private", "function", "analyzeModel", "(", "$", "model", ",", "$", "textOnly", ")", "{", "$", "featureNum", "=", "count", "(", "$", "model", "->", "getFeatures", "(", ")", ")", ";", "$", "rootFeatureName", "=", "$", "model", "->", "getRootFeature", "(",...
Returns a model analysis. @param Model $model @param bool $textOnly whether to render text or HTML @return string
[ "Returns", "a", "model", "analysis", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Model/ConfigurationRenderer.php#L64-L110
ekuiter/feature-php
FeaturePhp/Model/ConfigurationRenderer.php
ConfigurationRenderer.analyzeConfiguration
private function analyzeConfiguration($configuration, $textOnly) { $validity = $configuration->isValid() ? "valid" : "invalid"; $str = ""; $selectedColor = "\033[1;32m"; $deselectedColor = "\033[1;31m"; if ($textOnly) $str .= "The given configuration has the...
php
private function analyzeConfiguration($configuration, $textOnly) { $validity = $configuration->isValid() ? "valid" : "invalid"; $str = ""; $selectedColor = "\033[1;32m"; $deselectedColor = "\033[1;31m"; if ($textOnly) $str .= "The given configuration has the...
[ "private", "function", "analyzeConfiguration", "(", "$", "configuration", ",", "$", "textOnly", ")", "{", "$", "validity", "=", "$", "configuration", "->", "isValid", "(", ")", "?", "\"valid\"", ":", "\"invalid\"", ";", "$", "str", "=", "\"\"", ";", "$", ...
Returns a configuration analysis. @param Configuration $configuration @param bool $textOnly whether to render text or HTML @return string
[ "Returns", "a", "configuration", "analysis", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Model/ConfigurationRenderer.php#L118-L153
tourze/flow
src/Flow.php
Flow.start
public function start() { foreach ($this->layers as $layer) { // 数组格式,可以传参 if (is_array($layer)) { } // 如果是字符串 if (is_string($layer)) { $layer = new $layer; } if ($layer inst...
php
public function start() { foreach ($this->layers as $layer) { // 数组格式,可以传参 if (is_array($layer)) { } // 如果是字符串 if (is_string($layer)) { $layer = new $layer; } if ($layer inst...
[ "public", "function", "start", "(", ")", "{", "foreach", "(", "$", "this", "->", "layers", "as", "$", "layer", ")", "{", "// 数组格式,可以传参", "if", "(", "is_array", "(", "$", "layer", ")", ")", "{", "}", "// 如果是字符串", "if", "(", "is_string", "(", "$", "l...
开始流程
[ "开始流程" ]
train
https://github.com/tourze/flow/blob/2256f9458e4ef1dbeeffc3659aaf06ed9c895133/src/Flow.php#L58-L81
tourze/flow
src/Flow.php
Flow.addLayer
public function addLayer($layers) { if ( ! is_array($layers)) { $layers = [$layers]; } foreach ($layers as $layer) { if ( ! in_array($layer, $this->layers)) { $this->layers[] = $layer; } } }
php
public function addLayer($layers) { if ( ! is_array($layers)) { $layers = [$layers]; } foreach ($layers as $layer) { if ( ! in_array($layer, $this->layers)) { $this->layers[] = $layer; } } }
[ "public", "function", "addLayer", "(", "$", "layers", ")", "{", "if", "(", "!", "is_array", "(", "$", "layers", ")", ")", "{", "$", "layers", "=", "[", "$", "layers", "]", ";", "}", "foreach", "(", "$", "layers", "as", "$", "layer", ")", "{", "...
增加执行请求层 @param $layers
[ "增加执行请求层" ]
train
https://github.com/tourze/flow/blob/2256f9458e4ef1dbeeffc3659aaf06ed9c895133/src/Flow.php#L110-L123
petrica/php-statsd-system
Config/Definition/ConfigDefinition.php
ConfigDefinition.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('gauges'); $rootNode ->useAttributeAsKey('path') ->prototype('array') ->children() ->scalarNode('class') ->isRequi...
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('gauges'); $rootNode ->useAttributeAsKey('path') ->prototype('array') ->children() ->scalarNode('class') ->isRequi...
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", ")", ";", "$", "rootNode", "=", "$", "treeBuilder", "->", "root", "(", "'gauges'", ")", ";", "$", "rootNode", "->", "useAttributeAsKey", "(", "...
Provides configuration mapping @return TreeBuilder
[ "Provides", "configuration", "mapping" ]
train
https://github.com/petrica/php-statsd-system/blob/c476be3514a631a605737888bb8f6eb096789c9d/Config/Definition/ConfigDefinition.php#L24-L40
stk2k/net-driver
src/Http/ResponseHeaders.php
ResponseHeaders.parse
public function parse() { $this->parsed = []; $status_line = isset($this->headers[0]) ? trim($this->headers[0]) : null; if ( $status_line ){ $parts = explode(' ', $status_line, 3); $protocol_and_version = isset($parts[0]) ? $parts[0] : ''; $this->status_...
php
public function parse() { $this->parsed = []; $status_line = isset($this->headers[0]) ? trim($this->headers[0]) : null; if ( $status_line ){ $parts = explode(' ', $status_line, 3); $protocol_and_version = isset($parts[0]) ? $parts[0] : ''; $this->status_...
[ "public", "function", "parse", "(", ")", "{", "$", "this", "->", "parsed", "=", "[", "]", ";", "$", "status_line", "=", "isset", "(", "$", "this", "->", "headers", "[", "0", "]", ")", "?", "trim", "(", "$", "this", "->", "headers", "[", "0", "]...
Parse headers
[ "Parse", "headers" ]
train
https://github.com/stk2k/net-driver/blob/75e0bc1a95ba430dd9ed9e69f6a0a5dd8f2e7b1c/src/Http/ResponseHeaders.php#L92-L124
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.execute
public function execute(ProjectDescriptor $project) { $this->setObjectAliasesList($project->getIndexes()->elements->getAll()); $this->substitute($project); }
php
public function execute(ProjectDescriptor $project) { $this->setObjectAliasesList($project->getIndexes()->elements->getAll()); $this->substitute($project); }
[ "public", "function", "execute", "(", "ProjectDescriptor", "$", "project", ")", "{", "$", "this", "->", "setObjectAliasesList", "(", "$", "project", "->", "getIndexes", "(", ")", "->", "elements", "->", "getAll", "(", ")", ")", ";", "$", "this", "->", "s...
Executes the linker. @param ProjectDescriptor $project Representation of the Object Graph that can be manipulated. @return void
[ "Executes", "the", "linker", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L82-L86
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.substitute
public function substitute($item, $container = null) { $result = null; if (is_string($item)) { $result = $this->findAlias($item, $container); } elseif (is_array($item) || ($item instanceof \Traversable && ! $item instanceof ProjectInterface)) { $isModified = false; ...
php
public function substitute($item, $container = null) { $result = null; if (is_string($item)) { $result = $this->findAlias($item, $container); } elseif (is_array($item) || ($item instanceof \Traversable && ! $item instanceof ProjectInterface)) { $isModified = false; ...
[ "public", "function", "substitute", "(", "$", "item", ",", "$", "container", "=", "null", ")", "{", "$", "result", "=", "null", ";", "if", "(", "is_string", "(", "$", "item", ")", ")", "{", "$", "result", "=", "$", "this", "->", "findAlias", "(", ...
Substitutes the given item or its children's FQCN with an object alias. This method may do either of the following depending on the item's type String If the given item is a string then this method will attempt to find an appropriate Class, Interface or TraitDescriptor object and return that. See {@see findAlias()} f...
[ "Substitutes", "the", "given", "item", "or", "its", "children", "s", "FQCN", "with", "an", "object", "alias", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L138-L189
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.findAlias
public function findAlias($fqsen, $container = null) { $fqsen = $this->replacePseudoTypes($fqsen, $container); if ($this->isContextMarkerInFqsen($fqsen) && $container instanceof DescriptorAbstract) { // first exchange `@context::element` for `\My\Class::element` and if it exists, return...
php
public function findAlias($fqsen, $container = null) { $fqsen = $this->replacePseudoTypes($fqsen, $container); if ($this->isContextMarkerInFqsen($fqsen) && $container instanceof DescriptorAbstract) { // first exchange `@context::element` for `\My\Class::element` and if it exists, return...
[ "public", "function", "findAlias", "(", "$", "fqsen", ",", "$", "container", "=", "null", ")", "{", "$", "fqsen", "=", "$", "this", "->", "replacePseudoTypes", "(", "$", "fqsen", ",", "$", "container", ")", ";", "if", "(", "$", "this", "->", "isConte...
Attempts to find a Descriptor object alias with the FQSEN of the element it represents. This method will try to fetch an element after normalizing the provided FQSEN. The FQSEN may contain references (bindings) that can only be resolved during linking (such as `self`) or it may contain a context marker {@see CONTEXT_M...
[ "Attempts", "to", "find", "a", "Descriptor", "object", "alias", "with", "the", "FQSEN", "of", "the", "element", "it", "represents", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L217-L241
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.isDescriptorContainer
protected function isDescriptorContainer($item) { return $item instanceof FileDescriptor || $item instanceof NamespaceDescriptor || $item instanceof ClassDescriptor || $item instanceof TraitDescriptor || $item instanceof InterfaceDescriptor; }
php
protected function isDescriptorContainer($item) { return $item instanceof FileDescriptor || $item instanceof NamespaceDescriptor || $item instanceof ClassDescriptor || $item instanceof TraitDescriptor || $item instanceof InterfaceDescriptor; }
[ "protected", "function", "isDescriptorContainer", "(", "$", "item", ")", "{", "return", "$", "item", "instanceof", "FileDescriptor", "||", "$", "item", "instanceof", "NamespaceDescriptor", "||", "$", "item", "instanceof", "ClassDescriptor", "||", "$", "item", "ins...
Returns true if the given Descriptor is a container type. @param DescriptorAbstract|mixed $item @return bool
[ "Returns", "true", "if", "the", "given", "Descriptor", "is", "a", "container", "type", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L265-L272
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.replacePseudoTypes
protected function replacePseudoTypes($fqsen, $container) { $pseudoTypes = array('self', '$this'); foreach ($pseudoTypes as $pseudoType) { if ((strpos($fqsen, $pseudoType . '::') === 0 || $fqsen === $pseudoType) && $container) { $fqsen = $container->getFullyQualifiedStruc...
php
protected function replacePseudoTypes($fqsen, $container) { $pseudoTypes = array('self', '$this'); foreach ($pseudoTypes as $pseudoType) { if ((strpos($fqsen, $pseudoType . '::') === 0 || $fqsen === $pseudoType) && $container) { $fqsen = $container->getFullyQualifiedStruc...
[ "protected", "function", "replacePseudoTypes", "(", "$", "fqsen", ",", "$", "container", ")", "{", "$", "pseudoTypes", "=", "array", "(", "'self'", ",", "'$this'", ")", ";", "foreach", "(", "$", "pseudoTypes", "as", "$", "pseudoType", ")", "{", "if", "("...
Replaces pseudo-types, such as `self`, into a normalized version based on the last container that was encountered. @param string $fqsen @param DescriptorAbstract|null $container @return string
[ "Replaces", "pseudo", "-", "types", "such", "as", "self", "into", "a", "normalized", "version", "based", "on", "the", "last", "container", "that", "was", "encountered", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L283-L294
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.fetchElementByFqsen
protected function fetchElementByFqsen($fqsen) { return isset($this->elementList[$fqsen]) ? $this->elementList[$fqsen] : null; }
php
protected function fetchElementByFqsen($fqsen) { return isset($this->elementList[$fqsen]) ? $this->elementList[$fqsen] : null; }
[ "protected", "function", "fetchElementByFqsen", "(", "$", "fqsen", ")", "{", "return", "isset", "(", "$", "this", "->", "elementList", "[", "$", "fqsen", "]", ")", "?", "$", "this", "->", "elementList", "[", "$", "fqsen", "]", ":", "null", ";", "}" ]
Attempts to find an element with the given Fqsen in the list of elements for this project and returns null if it cannot find it. @param string $fqsen @return DescriptorAbstract|null
[ "Attempts", "to", "find", "an", "element", "with", "the", "given", "Fqsen", "in", "the", "list", "of", "elements", "for", "this", "project", "and", "returns", "null", "if", "it", "cannot", "find", "it", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L356-L359
Danack/GithubArtaxService
lib/GithubService/Operation/createOrGetAuthorization.php
createOrGetAuthorization.createRequest
public function createRequest() { $request = new \Amp\Artax\Request(); $url = null; $request->setMethod('PUT'); $jsonParams = []; if (array_key_exists('Accept', $this->parameters) == true) { $value = $this->getFilteredParameter('Accept'); $request->setHeader...
php
public function createRequest() { $request = new \Amp\Artax\Request(); $url = null; $request->setMethod('PUT'); $jsonParams = []; if (array_key_exists('Accept', $this->parameters) == true) { $value = $this->getFilteredParameter('Accept'); $request->setHeader...
[ "public", "function", "createRequest", "(", ")", "{", "$", "request", "=", "new", "\\", "Amp", "\\", "Artax", "\\", "Request", "(", ")", ";", "$", "url", "=", "null", ";", "$", "request", "->", "setMethod", "(", "'PUT'", ")", ";", "$", "jsonParams", ...
Create an Amp\Artax\Request object from the operation. @return \Amp\Artax\Request
[ "Create", "an", "Amp", "\\", "Artax", "\\", "Request", "object", "from", "the", "operation", "." ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/Operation/createOrGetAuthorization.php#L260-L306
Danack/GithubArtaxService
lib/GithubService/Operation/createOrGetAuthorization.php
createOrGetAuthorization.call
public function call() { $request = $this->createRequest(); $response = $this->api->execute($request, $this); $this->response = $response; if ($this->shouldResponseBeProcessed($response)) { $instance = \GithubService\Model\OauthAccess::createFromResponse($response, $this); ...
php
public function call() { $request = $this->createRequest(); $response = $this->api->execute($request, $this); $this->response = $response; if ($this->shouldResponseBeProcessed($response)) { $instance = \GithubService\Model\OauthAccess::createFromResponse($response, $this); ...
[ "public", "function", "call", "(", ")", "{", "$", "request", "=", "$", "this", "->", "createRequest", "(", ")", ";", "$", "response", "=", "$", "this", "->", "api", "->", "execute", "(", "$", "request", ",", "$", "this", ")", ";", "$", "this", "-...
Create and execute the operation, then return the processed response. @return mixed|\GithubService\Model\OauthAccess
[ "Create", "and", "execute", "the", "operation", "then", "return", "the", "processed", "response", "." ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/Operation/createOrGetAuthorization.php#L326-L337
Danack/GithubArtaxService
lib/GithubService/Operation/createOrGetAuthorization.php
createOrGetAuthorization.dispatch
public function dispatch(\Amp\Artax\Request $request) { $response = $this->api->execute($request, $this); $this->response = $response; $instance = \GithubService\Model\OauthAccess::createFromResponse($response, $this); return $instance; }
php
public function dispatch(\Amp\Artax\Request $request) { $response = $this->api->execute($request, $this); $this->response = $response; $instance = \GithubService\Model\OauthAccess::createFromResponse($response, $this); return $instance; }
[ "public", "function", "dispatch", "(", "\\", "Amp", "\\", "Artax", "\\", "Request", "$", "request", ")", "{", "$", "response", "=", "$", "this", "->", "api", "->", "execute", "(", "$", "request", ",", "$", "this", ")", ";", "$", "this", "->", "resp...
Dispatch the request for this operation and process the response. Allows you to modify the request before it is sent. @return \GithubService\Model\OauthAccess @param \Amp\Artax\Request $request The request to be processed
[ "Dispatch", "the", "request", "for", "this", "operation", "and", "process", "the", "response", ".", "Allows", "you", "to", "modify", "the", "request", "before", "it", "is", "sent", "." ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/Operation/createOrGetAuthorization.php#L367-L373
Danack/GithubArtaxService
lib/GithubService/Operation/createOrGetAuthorization.php
createOrGetAuthorization.processResponse
public function processResponse(\Amp\Artax\Response $response) { $instance = \GithubService\Model\OauthAccess::createFromResponse($response, $this); return $instance; }
php
public function processResponse(\Amp\Artax\Response $response) { $instance = \GithubService\Model\OauthAccess::createFromResponse($response, $this); return $instance; }
[ "public", "function", "processResponse", "(", "\\", "Amp", "\\", "Artax", "\\", "Response", "$", "response", ")", "{", "$", "instance", "=", "\\", "GithubService", "\\", "Model", "\\", "OauthAccess", "::", "createFromResponse", "(", "$", "response", ",", "$"...
Dispatch the request for this operation and process the response. Allows you to modify the request before it is sent. @return \GithubService\Model\OauthAccess @param \Amp\Artax\Response $response The HTTP response.
[ "Dispatch", "the", "request", "for", "this", "operation", "and", "process", "the", "response", ".", "Allows", "you", "to", "modify", "the", "request", "before", "it", "is", "sent", "." ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/Operation/createOrGetAuthorization.php#L394-L398
hametuha/wpametu
src/WPametu/UI/Widget.php
Widget.widget
public function widget($args, $instance){ $content = $this->widget_content($instance); if( $content ){ echo $args['before_widget']; if( isset($instance['title']) && !empty($instance['title']) ){ echo $args['before_title']; echo $instance['title']; ...
php
public function widget($args, $instance){ $content = $this->widget_content($instance); if( $content ){ echo $args['before_widget']; if( isset($instance['title']) && !empty($instance['title']) ){ echo $args['before_title']; echo $instance['title']; ...
[ "public", "function", "widget", "(", "$", "args", ",", "$", "instance", ")", "{", "$", "content", "=", "$", "this", "->", "widget_content", "(", "$", "instance", ")", ";", "if", "(", "$", "content", ")", "{", "echo", "$", "args", "[", "'before_widget...
Show widget content @param array $args @param array $instance
[ "Show", "widget", "content" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Widget.php#L82-L94
hametuha/wpametu
src/WPametu/UI/Widget.php
Widget.replace
protected function replace($content, $instance){ foreach( $this->placeholders as $key => $desc ){ $fill = $this->fill($key, $instance); if( $fill && false !== strpos($content, '%'.$key.'%') ){ $content = str_replace("%{$key}%", $fill, $content); } } ...
php
protected function replace($content, $instance){ foreach( $this->placeholders as $key => $desc ){ $fill = $this->fill($key, $instance); if( $fill && false !== strpos($content, '%'.$key.'%') ){ $content = str_replace("%{$key}%", $fill, $content); } } ...
[ "protected", "function", "replace", "(", "$", "content", ",", "$", "instance", ")", "{", "foreach", "(", "$", "this", "->", "placeholders", "as", "$", "key", "=>", "$", "desc", ")", "{", "$", "fill", "=", "$", "this", "->", "fill", "(", "$", "key",...
Replace content @param string $content @param array $instance Widget's setting @return string
[ "Replace", "content" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Widget.php#L111-L119
hametuha/wpametu
src/WPametu/UI/Widget.php
Widget.get_placeholders
protected function get_placeholders(){ return [ 'title' => $this->__('Post title'), 'url' => $this->__('Permalink'), 'excerpt' => $this->__('Excerpt'), 'date' => $this->__('Published'), 'modified' => $this->__('Last modified'), 'author' => ...
php
protected function get_placeholders(){ return [ 'title' => $this->__('Post title'), 'url' => $this->__('Permalink'), 'excerpt' => $this->__('Excerpt'), 'date' => $this->__('Published'), 'modified' => $this->__('Last modified'), 'author' => ...
[ "protected", "function", "get_placeholders", "(", ")", "{", "return", "[", "'title'", "=>", "$", "this", "->", "__", "(", "'Post title'", ")", ",", "'url'", "=>", "$", "this", "->", "__", "(", "'Permalink'", ")", ",", "'excerpt'", "=>", "$", "this", "-...
Set placeholder @return array
[ "Set", "placeholder" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Widget.php#L126-L137
hametuha/wpametu
src/WPametu/UI/Widget.php
Widget.fill
protected function fill($placeholder, $instance){ switch( $placeholder ){ case 'title': return get_the_title(); break; case 'url': return get_permalink(); break; case 'excerpt': return get_the_ex...
php
protected function fill($placeholder, $instance){ switch( $placeholder ){ case 'title': return get_the_title(); break; case 'url': return get_permalink(); break; case 'excerpt': return get_the_ex...
[ "protected", "function", "fill", "(", "$", "placeholder", ",", "$", "instance", ")", "{", "switch", "(", "$", "placeholder", ")", "{", "case", "'title'", ":", "return", "get_the_title", "(", ")", ";", "break", ";", "case", "'url'", ":", "return", "get_pe...
Get placeholder's content @param string $placeholder @param array $instance Widget's setting @return bool|string
[ "Get", "placeholder", "s", "content" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Widget.php#L146-L170
caffeinated/beverage
src/Traits/DotArrayAccess.php
DotArrayAccess.offsetSet
public function offsetSet($offset, $value = null) { if (is_array($offset)) { foreach ($offset as $innerKey => $innerValue) { array_set($this->{$this->getArrayAccessor()}, $innerKey, $innerValue); } } else { array_set($this->{$this->getArrayAccessor...
php
public function offsetSet($offset, $value = null) { if (is_array($offset)) { foreach ($offset as $innerKey => $innerValue) { array_set($this->{$this->getArrayAccessor()}, $innerKey, $innerValue); } } else { array_set($this->{$this->getArrayAccessor...
[ "public", "function", "offsetSet", "(", "$", "offset", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "offset", ")", ")", "{", "foreach", "(", "$", "offset", "as", "$", "innerKey", "=>", "$", "innerValue", ")", "{", "arr...
Set the item at a given offset. @param $offset @param mixed $value @return $this @internal param mixed $key
[ "Set", "the", "item", "at", "a", "given", "offset", "." ]
train
https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Traits/DotArrayAccess.php#L56-L67
miguelibero/meinhof
src/Meinhof/Action/SetupSiteAction.php
SetupSiteAction.take
public function take() { $params = array_merge(array( 'author' => null, 'categories' => null ), $this->input->getOptions()); $params = $this->fixAuthorSetupParameters($params); $params = $this->fixCategoriesSetupParameters($params); $this->...
php
public function take() { $params = array_merge(array( 'author' => null, 'categories' => null ), $this->input->getOptions()); $params = $this->fixAuthorSetupParameters($params); $params = $this->fixCategoriesSetupParameters($params); $this->...
[ "public", "function", "take", "(", ")", "{", "$", "params", "=", "array_merge", "(", "array", "(", "'author'", "=>", "null", ",", "'categories'", "=>", "null", ")", ",", "$", "this", "->", "input", "->", "getOptions", "(", ")", ")", ";", "$", "params...
Creates the site structure.
[ "Creates", "the", "site", "structure", "." ]
train
https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Action/SetupSiteAction.php#L44-L59
miguelibero/meinhof
src/Meinhof/Action/SetupSiteAction.php
SetupSiteAction.fixAuthorSetupParameters
protected function fixAuthorSetupParameters(array $params) { if (!isset($params['author'])) { $params['author'] = null; } if (preg_match('/(.*) <(.+)>/', $params['author'], $m)) { $params['author'] = $m[1]; $params['author-email'] = $m[2]; } else {...
php
protected function fixAuthorSetupParameters(array $params) { if (!isset($params['author'])) { $params['author'] = null; } if (preg_match('/(.*) <(.+)>/', $params['author'], $m)) { $params['author'] = $m[1]; $params['author-email'] = $m[2]; } else {...
[ "protected", "function", "fixAuthorSetupParameters", "(", "array", "$", "params", ")", "{", "if", "(", "!", "isset", "(", "$", "params", "[", "'author'", "]", ")", ")", "{", "$", "params", "[", "'author'", "]", "=", "null", ";", "}", "if", "(", "preg...
Fixes the author setup parameter. In the setup you can specify an author as `Author Name <author@email.com>`. This function separates this into two different keys, `author` and `author_email`. @param array $params setup parameter array @return array fixed setup parameter array
[ "Fixes", "the", "author", "setup", "parameter", "." ]
train
https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Action/SetupSiteAction.php#L71-L84
libreworks/caridea-validate
src/Builder.php
Builder.field
public function field(string $field, ...$rules): self { $this->validators[$field] = $this->parser->parse($rules); return $this; }
php
public function field(string $field, ...$rules): self { $this->validators[$field] = $this->parser->parse($rules); return $this; }
[ "public", "function", "field", "(", "string", "$", "field", ",", "...", "$", "rules", ")", ":", "self", "{", "$", "this", "->", "validators", "[", "$", "field", "]", "=", "$", "this", "->", "parser", "->", "parse", "(", "$", "rules", ")", ";", "r...
Adds one or more rules to this builder. @param string $field The field to validate @param string|object|array $rules Either a string name, an associative array, or an object with name → arguments @return $this provides a fluent interface
[ "Adds", "one", "or", "more", "rules", "to", "this", "builder", "." ]
train
https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Builder.php#L58-L62
libreworks/caridea-validate
src/Builder.php
Builder.build
public function build($ruleset = null): Validator { $validators = array_merge([], $this->validators); if (is_object($ruleset) || (is_array($ruleset) && Parser::isAssociative($ruleset))) { foreach ($ruleset as $field => $rules) { $validators[$field] = $this->parser->parse(...
php
public function build($ruleset = null): Validator { $validators = array_merge([], $this->validators); if (is_object($ruleset) || (is_array($ruleset) && Parser::isAssociative($ruleset))) { foreach ($ruleset as $field => $rules) { $validators[$field] = $this->parser->parse(...
[ "public", "function", "build", "(", "$", "ruleset", "=", "null", ")", ":", "Validator", "{", "$", "validators", "=", "array_merge", "(", "[", "]", ",", "$", "this", "->", "validators", ")", ";", "if", "(", "is_object", "(", "$", "ruleset", ")", "||",...
Builds a validator for the provided ruleset. ```javascript // rules.json { name: 'required', email: ['required', 'email'], drinks: { one_of: [['coffee', 'tea']] }, phone: {max_length: 10} } ``` ```php $ruleset = json_decode(file_get_contents('rules.json')); $builder = new \Caridea\Validate\Builder(); $validator = $bui...
[ "Builds", "a", "validator", "for", "the", "provided", "ruleset", "." ]
train
https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Builder.php#L86-L95
cmsgears/module-community
admin/controllers/base/group/PostController.php
PostController.init
public function init() { parent::init(); // Views $this->setViewPath( '@cmsgears/module-community/admin/views/group/post' ); // Permission $this->crudPermission = CmnGlobal::PERM_GROUP_ADMIN; // Config $this->type = CoreGlobal::TYPE_DEFAULT; $this->templateType = CmnGlobal::TYPE_GROUP_POST; // S...
php
public function init() { parent::init(); // Views $this->setViewPath( '@cmsgears/module-community/admin/views/group/post' ); // Permission $this->crudPermission = CmnGlobal::PERM_GROUP_ADMIN; // Config $this->type = CoreGlobal::TYPE_DEFAULT; $this->templateType = CmnGlobal::TYPE_GROUP_POST; // S...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "// Views", "$", "this", "->", "setViewPath", "(", "'@cmsgears/module-community/admin/views/group/post'", ")", ";", "// Permission", "$", "this", "->", "crudPermission", "=", "Cm...
Constructor and Initialisation ------------------------------
[ "Constructor", "and", "Initialisation", "------------------------------" ]
train
https://github.com/cmsgears/module-community/blob/0ca9cf0aa0cee395a4788bd6085f291e10728555/admin/controllers/base/group/PostController.php#L53-L74
gplcart/cli
controllers/commands/Shipping.php
Shipping.cmdGetShipping
public function cmdGetShipping() { $result = $this->getListShipping(); $this->outputFormat($result); $this->outputFormatTableShipping($result); $this->output(); }
php
public function cmdGetShipping() { $result = $this->getListShipping(); $this->outputFormat($result); $this->outputFormatTableShipping($result); $this->output(); }
[ "public", "function", "cmdGetShipping", "(", ")", "{", "$", "result", "=", "$", "this", "->", "getListShipping", "(", ")", ";", "$", "this", "->", "outputFormat", "(", "$", "result", ")", ";", "$", "this", "->", "outputFormatTableShipping", "(", "$", "re...
Callback for "shipping-get" command
[ "Callback", "for", "shipping", "-", "get", "command" ]
train
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Shipping.php#L40-L46
gplcart/cli
controllers/commands/Shipping.php
Shipping.getListShipping
protected function getListShipping() { $id = $this->getParam(0); if (!isset($id)) { $list = $this->shipping->getList(); $this->limitArray($list); return $list; } $method = $this->shipping->get($id); if (empty($method)) { $thi...
php
protected function getListShipping() { $id = $this->getParam(0); if (!isset($id)) { $list = $this->shipping->getList(); $this->limitArray($list); return $list; } $method = $this->shipping->get($id); if (empty($method)) { $thi...
[ "protected", "function", "getListShipping", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getParam", "(", "0", ")", ";", "if", "(", "!", "isset", "(", "$", "id", ")", ")", "{", "$", "list", "=", "$", "this", "->", "shipping", "->", "getList"...
Returns an array of shipping methods @return array
[ "Returns", "an", "array", "of", "shipping", "methods" ]
train
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Shipping.php#L52-L69
perryflynn/PerrysLambda
src/PerrysLambda/Converter/ListConverter.php
ListConverter.setArraySource
public function setArraySource(array $data=null) { if($data===null) { $this->iterator = null; } else { $this->iterator = new \ArrayIterator($data); } }
php
public function setArraySource(array $data=null) { if($data===null) { $this->iterator = null; } else { $this->iterator = new \ArrayIterator($data); } }
[ "public", "function", "setArraySource", "(", "array", "$", "data", "=", "null", ")", "{", "if", "(", "$", "data", "===", "null", ")", "{", "$", "this", "->", "iterator", "=", "null", ";", "}", "else", "{", "$", "this", "->", "iterator", "=", "new",...
Array as import source @param array $data
[ "Array", "as", "import", "source" ]
train
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/Converter/ListConverter.php#L110-L120
perryflynn/PerrysLambda
src/PerrysLambda/Converter/ListConverter.php
ListConverter.setIteratorSource
public function setIteratorSource(\Iterator $iterator=null, $start=0, $end=-1) { $this->iteratorstartindex = (int)$start; $this->iteratorendindex = (int)$end; $this->iterator = $iterator; }
php
public function setIteratorSource(\Iterator $iterator=null, $start=0, $end=-1) { $this->iteratorstartindex = (int)$start; $this->iteratorendindex = (int)$end; $this->iterator = $iterator; }
[ "public", "function", "setIteratorSource", "(", "\\", "Iterator", "$", "iterator", "=", "null", ",", "$", "start", "=", "0", ",", "$", "end", "=", "-", "1", ")", "{", "$", "this", "->", "iteratorstartindex", "=", "(", "int", ")", "$", "start", ";", ...
Iterator as import source @param \Iterator $iterator @param int $start @param int $end
[ "Iterator", "as", "import", "source" ]
train
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/Converter/ListConverter.php#L136-L141
perryflynn/PerrysLambda
src/PerrysLambda/Converter/ListConverter.php
ListConverter.importInto
public function importInto(ArrayBase $collection) { if($this->iterator instanceof \Iterator) { $i = 0; foreach($this->iterator as $key => $row) { if($this->iteratorendindex>=0 && $i>$this->iteratorendindex) { bre...
php
public function importInto(ArrayBase $collection) { if($this->iterator instanceof \Iterator) { $i = 0; foreach($this->iterator as $key => $row) { if($this->iteratorendindex>=0 && $i>$this->iteratorendindex) { bre...
[ "public", "function", "importInto", "(", "ArrayBase", "$", "collection", ")", "{", "if", "(", "$", "this", "->", "iterator", "instanceof", "\\", "Iterator", ")", "{", "$", "i", "=", "0", ";", "foreach", "(", "$", "this", "->", "iterator", "as", "$", ...
Import into ArrayBase @param ArrayBase $collection
[ "Import", "into", "ArrayBase" ]
train
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/Converter/ListConverter.php#L147-L178
perryflynn/PerrysLambda
src/PerrysLambda/Converter/ListConverter.php
ListConverter.newInstance
public function newInstance() { $class = get_called_class(); $instance = new $class(); $instance->setSerializer($this->getSerializer()); $instance->setItemConverter($this->getItemConverter()->newInstance()); return $instance; }
php
public function newInstance() { $class = get_called_class(); $instance = new $class(); $instance->setSerializer($this->getSerializer()); $instance->setItemConverter($this->getItemConverter()->newInstance()); return $instance; }
[ "public", "function", "newInstance", "(", ")", "{", "$", "class", "=", "get_called_class", "(", ")", ";", "$", "instance", "=", "new", "$", "class", "(", ")", ";", "$", "instance", "->", "setSerializer", "(", "$", "this", "->", "getSerializer", "(", ")...
Creates a new instance of this class @return \PerrysLambda\Converter\ListConverter
[ "Creates", "a", "new", "instance", "of", "this", "class" ]
train
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/Converter/ListConverter.php#L184-L191
Linkvalue-Interne/MajoraFrameworkExtraBundle
src/Majora/Framework/Loader/LoaderTrait.php
LoaderTrait.setUp
public function setUp( $entityClass, array $entityProperties, $collectionClass, RepositoryInterface $entityRepository = null ) { @trigger_error(__METHOD__.'() is deprecated and will be removed in 2.0. Please use configureMetadata() instead.', E_USER_DEPRECATED); if (...
php
public function setUp( $entityClass, array $entityProperties, $collectionClass, RepositoryInterface $entityRepository = null ) { @trigger_error(__METHOD__.'() is deprecated and will be removed in 2.0. Please use configureMetadata() instead.', E_USER_DEPRECATED); if (...
[ "public", "function", "setUp", "(", "$", "entityClass", ",", "array", "$", "entityProperties", ",", "$", "collectionClass", ",", "RepositoryInterface", "$", "entityRepository", "=", "null", ")", "{", "@", "trigger_error", "(", "__METHOD__", ".", "'() is deprecated...
setUp method. @param string $entityClass @param array $entityProperties @param string $collectionClass @param RepositoryInterface $entityRepository
[ "setUp", "method", "." ]
train
https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Loader/LoaderTrait.php#L53-L68
mwyatt/core
src/Cache.php
Cache.create
public function create($fileName, $data) { $path = $this->getPathBase($fileName); if (file_exists($path)) { return; } $data = serialize($data); return file_put_contents($path, $data); }
php
public function create($fileName, $data) { $path = $this->getPathBase($fileName); if (file_exists($path)) { return; } $data = serialize($data); return file_put_contents($path, $data); }
[ "public", "function", "create", "(", "$", "fileName", ",", "$", "data", ")", "{", "$", "path", "=", "$", "this", "->", "getPathBase", "(", "$", "fileName", ")", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")", "{", "return", ";", "}", "...
serialises and creates cache file if required if the file already exists, skip this @param string $key example-file-name @param array $data @return bool
[ "serialises", "and", "creates", "cache", "file", "if", "required", "if", "the", "file", "already", "exists", "skip", "this" ]
train
https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Cache.php#L76-L87
mwyatt/core
src/Cache.php
Cache.read
public function read($fileName) { $path = $this->getPathBase($fileName); if (!file_exists($path)) { return; } $data = file_get_contents($path); return $this->data = unserialize($data); }
php
public function read($fileName) { $path = $this->getPathBase($fileName); if (!file_exists($path)) { return; } $data = file_get_contents($path); return $this->data = unserialize($data); }
[ "public", "function", "read", "(", "$", "fileName", ")", "{", "$", "path", "=", "$", "this", "->", "getPathBase", "(", "$", "fileName", ")", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "return", ";", "}", "$", "data", "="...
reads in the cached file, if it exists unserialises and stores in data property @param string $key example-file-name @return bool
[ "reads", "in", "the", "cached", "file", "if", "it", "exists", "unserialises", "and", "stores", "in", "data", "property" ]
train
https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Cache.php#L96-L106
mwyatt/core
src/Cache.php
Cache.delete
public function delete($fileName) { $path = $this->getPathBase($fileName); if (!file_exists($path)) { return; } return unlink($path); }
php
public function delete($fileName) { $path = $this->getPathBase($fileName); if (!file_exists($path)) { return; } return unlink($path); }
[ "public", "function", "delete", "(", "$", "fileName", ")", "{", "$", "path", "=", "$", "this", "->", "getPathBase", "(", "$", "fileName", ")", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "return", ";", "}", "return", "unlin...
removes the file from the cache @param string $key @return bool
[ "removes", "the", "file", "from", "the", "cache" ]
train
https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Cache.php#L114-L123
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.getModel
public function getModel() { if(null === $this->model) { $mainService = $this->getServiceLocator()->get('neobazaar.service.main'); $this->model = $mainService->getDocumentEntityRepository(); } return $this->model; }
php
public function getModel() { if(null === $this->model) { $mainService = $this->getServiceLocator()->get('neobazaar.service.main'); $this->model = $mainService->getDocumentEntityRepository(); } return $this->model; }
[ "public", "function", "getModel", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "model", ")", "{", "$", "mainService", "=", "$", "this", "->", "getServiceLocator", "(", ")", "->", "get", "(", "'neobazaar.service.main'", ")", ";", "$", "th...
Get the model
[ "Get", "the", "model" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L78-L85
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.checkOptions
public function checkOptions(MvcEvent $e) { $matches = $e->getRouteMatch(); $response = $e->getResponse(); $request = $e->getRequest(); $method = $request->getMethod(); // test if we matched an individual resource, and then test // if we allow the particular requ...
php
public function checkOptions(MvcEvent $e) { $matches = $e->getRouteMatch(); $response = $e->getResponse(); $request = $e->getRequest(); $method = $request->getMethod(); // test if we matched an individual resource, and then test // if we allow the particular requ...
[ "public", "function", "checkOptions", "(", "MvcEvent", "$", "e", ")", "{", "$", "matches", "=", "$", "e", "->", "getRouteMatch", "(", ")", ";", "$", "response", "=", "$", "e", "->", "getResponse", "(", ")", ";", "$", "request", "=", "$", "e", "->",...
Checks that is an allowed method @param Zend\Mvc\MvcEvent $e @return void|Zend\Http\Response
[ "Checks", "that", "is", "an", "allowed", "method" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L104-L127
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.injectLinkHeader
public function injectLinkHeader(MvcEvent $e) { $response = $e->getResponse(); $headers = $response->getHeaders(); // $headers->addHeaderLine('Link', sprintf( // '<%s>; rel="describedby"', // $this->url()->fromRoute('static-classified-service') // )); $headers->addHeaderLine('Access-...
php
public function injectLinkHeader(MvcEvent $e) { $response = $e->getResponse(); $headers = $response->getHeaders(); // $headers->addHeaderLine('Link', sprintf( // '<%s>; rel="describedby"', // $this->url()->fromRoute('static-classified-service') // )); $headers->addHeaderLine('Access-...
[ "public", "function", "injectLinkHeader", "(", "MvcEvent", "$", "e", ")", "{", "$", "response", "=", "$", "e", "->", "getResponse", "(", ")", ";", "$", "headers", "=", "$", "response", "->", "getHeaders", "(", ")", ";", "// \t$headers->addHeaderLine('Lin...
Inject documentation link header to the response @param Zend\Mvc\MvcEvent $e @return void
[ "Inject", "documentation", "link", "header", "to", "the", "response" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L135-L146
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.getList
public function getList() { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_200); // 1) getting params $page = (int) $this->params()->fromQuery("page", 1); $category = $this->params()->fromQuery("category", "usato"); $purpose = $this->params()->fromQuery("purpose", "compravendita"); $locat...
php
public function getList() { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_200); // 1) getting params $page = (int) $this->params()->fromQuery("page", 1); $category = $this->params()->fromQuery("category", "usato"); $purpose = $this->params()->fromQuery("purpose", "compravendita"); $locat...
[ "public", "function", "getList", "(", ")", "{", "$", "this", "->", "getResponse", "(", ")", "->", "setStatusCode", "(", "Response", "::", "STATUS_CODE_200", ")", ";", "// 1) getting params", "$", "page", "=", "(", "int", ")", "$", "this", "->", "params", ...
Respond to HTTP GET method without :id @see \Zend\Mvc\Controller\AbstractRestfulController::getList()
[ "Respond", "to", "HTTP", "GET", "method", "without", ":", "id" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L152-L231
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.get
public function get($id) { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_200); $classifiedService = $this->getServiceLocator()->get('document.service.classified'); try { $data = $classifiedService->get($id); } catch(\Exception $e) { $this->getResponse() ->setStatusCode(Response:...
php
public function get($id) { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_200); $classifiedService = $this->getServiceLocator()->get('document.service.classified'); try { $data = $classifiedService->get($id); } catch(\Exception $e) { $this->getResponse() ->setStatusCode(Response:...
[ "public", "function", "get", "(", "$", "id", ")", "{", "$", "this", "->", "getResponse", "(", ")", "->", "setStatusCode", "(", "Response", "::", "STATUS_CODE_200", ")", ";", "$", "classifiedService", "=", "$", "this", "->", "getServiceLocator", "(", ")", ...
Respond to HTTP GET method with :id @see \Zend\Mvc\Controller\AbstractRestfulController::get()
[ "Respond", "to", "HTTP", "GET", "method", "with", ":", "id" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L237-L255
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.create
public function create($data) { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_201); $request = $this->getRequest(); $content = $request->getContent(); $content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array(); $post = array_merge_recursive( $request->getPost()->to...
php
public function create($data) { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_201); $request = $this->getRequest(); $content = $request->getContent(); $content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array(); $post = array_merge_recursive( $request->getPost()->to...
[ "public", "function", "create", "(", "$", "data", ")", "{", "$", "this", "->", "getResponse", "(", ")", "->", "setStatusCode", "(", "Response", "::", "STATUS_CODE_201", ")", ";", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$",...
Respond to HTTP POST method with data, without :id @see \Zend\Mvc\Controller\AbstractRestfulController::create()
[ "Respond", "to", "HTTP", "POST", "method", "with", "data", "without", ":", "id" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L261-L341
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.update
public function update($id, $data) { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_201); $returnData = ''; $action = strtolower($this->params()->fromQuery('action')); $classifiedService = $this->getServiceLocator()->get('document.service.classified'); switch($action) { case 'activation...
php
public function update($id, $data) { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_201); $returnData = ''; $action = strtolower($this->params()->fromQuery('action')); $classifiedService = $this->getServiceLocator()->get('document.service.classified'); switch($action) { case 'activation...
[ "public", "function", "update", "(", "$", "id", ",", "$", "data", ")", "{", "$", "this", "->", "getResponse", "(", ")", "->", "setStatusCode", "(", "Response", "::", "STATUS_CODE_201", ")", ";", "$", "returnData", "=", "''", ";", "$", "action", "=", ...
Respond to HTTP PUT method with data, with :id Utilizzao per attivazione/disattivazione annuncio @see \Zend\Mvc\Controller\AbstractRestfulController::update()
[ "Respond", "to", "HTTP", "PUT", "method", "with", "data", "with", ":", "id", "Utilizzao", "per", "attivazione", "/", "disattivazione", "annuncio" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L348-L410
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.delete
public function delete($id) { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_200); $request = $this->getRequest(); $content = $request->getContent(); $content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array(); $post = array_merge_recursive( $request->getPost()->toAr...
php
public function delete($id) { $this->getResponse() ->setStatusCode(Response::STATUS_CODE_200); $request = $this->getRequest(); $content = $request->getContent(); $content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array(); $post = array_merge_recursive( $request->getPost()->toAr...
[ "public", "function", "delete", "(", "$", "id", ")", "{", "$", "this", "->", "getResponse", "(", ")", "->", "setStatusCode", "(", "Response", "::", "STATUS_CODE_200", ")", ";", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$", ...
Respond to HTTP DELETE method with :id @see \Zend\Mvc\Controller\AbstractRestfulController::delete()
[ "Respond", "to", "HTTP", "DELETE", "method", "with", ":", "id" ]
train
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L416-L473
AnonymPHP/Anonym-Database
Traits/Builder.php
Builder.buildQuery
private function buildQuery($pattern, $args) { if (count($args['parameters']) > 0) { $string = $pattern[0]; } else { $string = $pattern[1]; } if (preg_match_all("/:(\w+)/", $string, $match)) { $match = $match[0]; $values = array_va...
php
private function buildQuery($pattern, $args) { if (count($args['parameters']) > 0) { $string = $pattern[0]; } else { $string = $pattern[1]; } if (preg_match_all("/:(\w+)/", $string, $match)) { $match = $match[0]; $values = array_va...
[ "private", "function", "buildQuery", "(", "$", "pattern", ",", "$", "args", ")", "{", "if", "(", "count", "(", "$", "args", "[", "'parameters'", "]", ")", ">", "0", ")", "{", "$", "string", "=", "$", "pattern", "[", "0", "]", ";", "}", "else", ...
create the a sql query @param array $pattern @param array $args @return mixed
[ "create", "the", "a", "sql", "query" ]
train
https://github.com/AnonymPHP/Anonym-Database/blob/4d034219e0e3eb2833fa53204e9f52a74a9a7e4b/Traits/Builder.php#L19-L36
Blipfoto/php-sdk
src/Blipfoto/Api/Client.php
Client.endpoint
public function endpoint() { $endpoint = $this->getset('endpoint', func_get_args()); return $this->validateEndpoint($endpoint ?: self::URI_API); }
php
public function endpoint() { $endpoint = $this->getset('endpoint', func_get_args()); return $this->validateEndpoint($endpoint ?: self::URI_API); }
[ "public", "function", "endpoint", "(", ")", "{", "$", "endpoint", "=", "$", "this", "->", "getset", "(", "'endpoint'", ",", "func_get_args", "(", ")", ")", ";", "return", "$", "this", "->", "validateEndpoint", "(", "$", "endpoint", "?", ":", "self", ":...
Get and optionally set the endpoint. @param string $endpoint (optional) @return string
[ "Get", "and", "optionally", "set", "the", "endpoint", "." ]
train
https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Client.php#L104-L107
Blipfoto/php-sdk
src/Blipfoto/Api/Client.php
Client.authorizationEndpoint
public function authorizationEndpoint() { $endpoint = $this->getset('authorization_endpoint', func_get_args()); return $this->validateEndpoint($endpoint ?: self::URI_AUTHORIZE); }
php
public function authorizationEndpoint() { $endpoint = $this->getset('authorization_endpoint', func_get_args()); return $this->validateEndpoint($endpoint ?: self::URI_AUTHORIZE); }
[ "public", "function", "authorizationEndpoint", "(", ")", "{", "$", "endpoint", "=", "$", "this", "->", "getset", "(", "'authorization_endpoint'", ",", "func_get_args", "(", ")", ")", ";", "return", "$", "this", "->", "validateEndpoint", "(", "$", "endpoint", ...
Get and optionally set the authorization endpoint. @param string $authorization_endpoint (optional) @return string
[ "Get", "and", "optionally", "set", "the", "authorization", "endpoint", "." ]
train
https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Client.php#L115-L118
Blipfoto/php-sdk
src/Blipfoto/Api/Client.php
Client.run
protected function run($method, $args) { $request = $this->request(); $request->method($method); $request->resource(array_shift($args)); if (count($args)) { $request->params(array_shift($args)); } if (count($args)) { $request->files(array_shift($args)); } return $request->send(); }
php
protected function run($method, $args) { $request = $this->request(); $request->method($method); $request->resource(array_shift($args)); if (count($args)) { $request->params(array_shift($args)); } if (count($args)) { $request->files(array_shift($args)); } return $request->send(); }
[ "protected", "function", "run", "(", "$", "method", ",", "$", "args", ")", "{", "$", "request", "=", "$", "this", "->", "request", "(", ")", ";", "$", "request", "->", "method", "(", "$", "method", ")", ";", "$", "request", "->", "resource", "(", ...
Convenience method for sending a request and returning a response. @return Response @throws OAuthException|ApiResponseException
[ "Convenience", "method", "for", "sending", "a", "request", "and", "returning", "a", "response", "." ]
train
https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Client.php#L173-L184
lanfisis/deflection
src/Deflection/Element/Classes.php
Classes.isAbstract
public function isAbstract($status = null) { $this->is_abstract = $status !== null ? $status : $this->is_abstract; return $this->is_abstract ; }
php
public function isAbstract($status = null) { $this->is_abstract = $status !== null ? $status : $this->is_abstract; return $this->is_abstract ; }
[ "public", "function", "isAbstract", "(", "$", "status", "=", "null", ")", "{", "$", "this", "->", "is_abstract", "=", "$", "status", "!==", "null", "?", "$", "status", ":", "$", "this", "->", "is_abstract", ";", "return", "$", "this", "->", "is_abstrac...
Is an abstract class @return \Deflection\Element\Classes
[ "Is", "an", "abstract", "class" ]
train
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Element/Classes.php#L70-L74
lanfisis/deflection
src/Deflection/Element/Classes.php
Classes.addUse
public function addUse($class, $alias = null) { $as = $alias == null ? (int)(count($this->uses) + 1) : $alias; $this->uses[$as] = (string)$class; return $this; }
php
public function addUse($class, $alias = null) { $as = $alias == null ? (int)(count($this->uses) + 1) : $alias; $this->uses[$as] = (string)$class; return $this; }
[ "public", "function", "addUse", "(", "$", "class", ",", "$", "alias", "=", "null", ")", "{", "$", "as", "=", "$", "alias", "==", "null", "?", "(", "int", ")", "(", "count", "(", "$", "this", "->", "uses", ")", "+", "1", ")", ":", "$", "alias"...
Add use @param string $class Class name @param string|null $alias Use alias @return \Deflection\Element\Classes
[ "Add", "use" ]
train
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Element/Classes.php#L164-L169
lanfisis/deflection
src/Deflection/Element/Classes.php
Classes.addParam
public function addParam(\Deflection\Element\Param $param) { $element = $param->getElement(); $this->params = array_merge($this->params, array(''), $element); return $this; }
php
public function addParam(\Deflection\Element\Param $param) { $element = $param->getElement(); $this->params = array_merge($this->params, array(''), $element); return $this; }
[ "public", "function", "addParam", "(", "\\", "Deflection", "\\", "Element", "\\", "Param", "$", "param", ")", "{", "$", "element", "=", "$", "param", "->", "getElement", "(", ")", ";", "$", "this", "->", "params", "=", "array_merge", "(", "$", "this", ...
Add function to structure @param \Deflection\Element\Param $param Param @return \Deflection\Element\Classes
[ "Add", "function", "to", "structure" ]
train
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Element/Classes.php#L188-L193
lanfisis/deflection
src/Deflection/Element/Classes.php
Classes.addFunction
public function addFunction(\Deflection\Element\Functions $function) { $element = $function->getElement(); $this->functions = array_merge($this->functions, array(''), $element); return $this; }
php
public function addFunction(\Deflection\Element\Functions $function) { $element = $function->getElement(); $this->functions = array_merge($this->functions, array(''), $element); return $this; }
[ "public", "function", "addFunction", "(", "\\", "Deflection", "\\", "Element", "\\", "Functions", "$", "function", ")", "{", "$", "element", "=", "$", "function", "->", "getElement", "(", ")", ";", "$", "this", "->", "functions", "=", "array_merge", "(", ...
Add param to structure @param \Deflection\Element\Functions $function Function @return \Deflection\Element\Classes
[ "Add", "param", "to", "structure" ]
train
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Element/Classes.php#L212-L217
lanfisis/deflection
src/Deflection/Element/Classes.php
Classes.getElement
public function getElement() { if ($this->getDocblock()) { $this->setLines($this->getDocblock()->getElement()); $this->addBlankLine(); } if ($this->getNamespace()) { $this->addLine('namespace '.$this->getNamespace().';'); $this->addBlankLine();...
php
public function getElement() { if ($this->getDocblock()) { $this->setLines($this->getDocblock()->getElement()); $this->addBlankLine(); } if ($this->getNamespace()) { $this->addLine('namespace '.$this->getNamespace().';'); $this->addBlankLine();...
[ "public", "function", "getElement", "(", ")", "{", "if", "(", "$", "this", "->", "getDocblock", "(", ")", ")", "{", "$", "this", "->", "setLines", "(", "$", "this", "->", "getDocblock", "(", ")", "->", "getElement", "(", ")", ")", ";", "$", "this",...
Generate docblock @return array
[ "Generate", "docblock" ]
train
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Element/Classes.php#L234-L270
lasallecms/lasallecms-l5-lasallecmsapi-pkg
database/migrations/2016_01_25_190724_create_failed_jobs_table.php
CreateFailedJobsTable.up
public function up() { Schema::create('failed_jobs', function (Blueprint $table) { $table->increments('id'); $table->text('connection'); $table->text('queue'); $table->longText('payload'); $table->timestamp('failed_at'); }); }
php
public function up() { Schema::create('failed_jobs', function (Blueprint $table) { $table->increments('id'); $table->text('connection'); $table->text('queue'); $table->longText('payload'); $table->timestamp('failed_at'); }); }
[ "public", "function", "up", "(", ")", "{", "Schema", "::", "create", "(", "'failed_jobs'", ",", "function", "(", "Blueprint", "$", "table", ")", "{", "$", "table", "->", "increments", "(", "'id'", ")", ";", "$", "table", "->", "text", "(", "'connection...
Run the migrations. @return void
[ "Run", "the", "migrations", "." ]
train
https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/database/migrations/2016_01_25_190724_create_failed_jobs_table.php#L48-L57
miaoxing/user
src/Controller/Users.php
Users.createAction
public function createAction($req) { // 1. 调用注册接口 $user = wei()->user(); $ret = $user->register($req); if ($ret['code'] !== 1) { return $this->ret($ret); } // 2. 登录用户 $loginRet = wei()->curUser->loginById($user['id']); if ($loginRet['code'...
php
public function createAction($req) { // 1. 调用注册接口 $user = wei()->user(); $ret = $user->register($req); if ($ret['code'] !== 1) { return $this->ret($ret); } // 2. 登录用户 $loginRet = wei()->curUser->loginById($user['id']); if ($loginRet['code'...
[ "public", "function", "createAction", "(", "$", "req", ")", "{", "// 1. 调用注册接口", "$", "user", "=", "wei", "(", ")", "->", "user", "(", ")", ";", "$", "ret", "=", "$", "user", "->", "register", "(", "$", "req", ")", ";", "if", "(", "$", "ret", "...
用户注册 @param $req @return \Wei\Response
[ "用户注册" ]
train
https://github.com/miaoxing/user/blob/d94e52f64a0151ba7202c857b373394ad09e06ce/src/Controller/Users.php#L95-L111
miaoxing/user
src/Controller/Users.php
Users.editAction
public function editAction($req) { $user = $this->curUser; $enableMobileVerify = $this->setting('user.enableMobileVerify', false); $isMobileVerified = $user->isMobileVerified(); // 如果认证了手机号码,又没启用认证功能,就不显示手机号 $hideMobile = $isMobileVerified && !$enableMobileVerify; ...
php
public function editAction($req) { $user = $this->curUser; $enableMobileVerify = $this->setting('user.enableMobileVerify', false); $isMobileVerified = $user->isMobileVerified(); // 如果认证了手机号码,又没启用认证功能,就不显示手机号 $hideMobile = $isMobileVerified && !$enableMobileVerify; ...
[ "public", "function", "editAction", "(", "$", "req", ")", "{", "$", "user", "=", "$", "this", "->", "curUser", ";", "$", "enableMobileVerify", "=", "$", "this", "->", "setting", "(", "'user.enableMobileVerify'", ",", "false", ")", ";", "$", "isMobileVerifi...
个人信息页面 @return array
[ "个人信息页面" ]
train
https://github.com/miaoxing/user/blob/d94e52f64a0151ba7202c857b373394ad09e06ce/src/Controller/Users.php#L118-L131
miaoxing/user
src/Controller/Users.php
Users.loginAction
public function loginAction(Request $req) { if ($req->isPost()) { if (wei()->setting('user.enableLoginCaptcha')) { $ret = wei()->captcha->check($req['captcha']); if ($ret['code'] !== 1) { $ret['captchaErr'] = true; return $...
php
public function loginAction(Request $req) { if ($req->isPost()) { if (wei()->setting('user.enableLoginCaptcha')) { $ret = wei()->captcha->check($req['captcha']); if ($ret['code'] !== 1) { $ret['captchaErr'] = true; return $...
[ "public", "function", "loginAction", "(", "Request", "$", "req", ")", "{", "if", "(", "$", "req", "->", "isPost", "(", ")", ")", "{", "if", "(", "wei", "(", ")", "->", "setting", "(", "'user.enableLoginCaptcha'", ")", ")", "{", "$", "ret", "=", "we...
用户登录 @param Request $req @return array|\Wei\Response
[ "用户登录" ]
train
https://github.com/miaoxing/user/blob/d94e52f64a0151ba7202c857b373394ad09e06ce/src/Controller/Users.php#L152-L175
miaoxing/user
src/Controller/Users.php
Users.logoutAction
public function logoutAction($req) { wei()->curUser->logout(); $next = $req('next', $this->request->getReferer()); return $this->response->redirect($next); }
php
public function logoutAction($req) { wei()->curUser->logout(); $next = $req('next', $this->request->getReferer()); return $this->response->redirect($next); }
[ "public", "function", "logoutAction", "(", "$", "req", ")", "{", "wei", "(", ")", "->", "curUser", "->", "logout", "(", ")", ";", "$", "next", "=", "$", "req", "(", "'next'", ",", "$", "this", "->", "request", "->", "getReferer", "(", ")", ")", "...
用户退出登录 @param $req @return \Wei\Response
[ "用户退出登录" ]
train
https://github.com/miaoxing/user/blob/d94e52f64a0151ba7202c857b373394ad09e06ce/src/Controller/Users.php#L183-L190
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.isAllowed
public function isAllowed($role, $resource) { if(false === is_string($role)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($role)), E_USER_ERROR); } if(false === is_string($resource)) { return trigger_error(sprintf('Argument 2...
php
public function isAllowed($role, $resource) { if(false === is_string($role)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($role)), E_USER_ERROR); } if(false === is_string($resource)) { return trigger_error(sprintf('Argument 2...
[ "public", "function", "isAllowed", "(", "$", "role", ",", "$", "resource", ")", "{", "if", "(", "false", "===", "is_string", "(", "$", "role", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 1 passed to %s() must be of the type string, ...
Returns if a role is allowed access to the resource @param string $role @param string $resource @return boolean
[ "Returns", "if", "a", "role", "is", "allowed", "access", "to", "the", "resource" ]
train
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L29-L44
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.inherit
public function inherit($roles, $inherits) { if(true === is_string($roles)) { $roles = [$roles]; } if(true === is_string($inherits)) { $inherits = [$inherits]; } if(false === is_array($roles)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or array,...
php
public function inherit($roles, $inherits) { if(true === is_string($roles)) { $roles = [$roles]; } if(true === is_string($inherits)) { $inherits = [$inherits]; } if(false === is_array($roles)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or array,...
[ "public", "function", "inherit", "(", "$", "roles", ",", "$", "inherits", ")", "{", "if", "(", "true", "===", "is_string", "(", "$", "roles", ")", ")", "{", "$", "roles", "=", "[", "$", "roles", "]", ";", "}", "if", "(", "true", "===", "is_string...
Let a single or multiple roles inherit the resources of other single or multiple roles @param string|array $roles @param string|array $inherits @return sFire\Permissions\ACL
[ "Let", "a", "single", "or", "multiple", "roles", "inherit", "the", "resources", "of", "other", "single", "or", "multiple", "roles" ]
train
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L86-L119
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.getRoles
public function getRoles() { $roles = []; foreach($this -> permissions as $role => $permissions) { $roles[$role] = $this -> getRole($role); } return $roles; }
php
public function getRoles() { $roles = []; foreach($this -> permissions as $role => $permissions) { $roles[$role] = $this -> getRole($role); } return $roles; }
[ "public", "function", "getRoles", "(", ")", "{", "$", "roles", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "permissions", "as", "$", "role", "=>", "$", "permissions", ")", "{", "$", "roles", "[", "$", "role", "]", "=", "$", "this", "->...
Returns all the roles as an array @return array
[ "Returns", "all", "the", "roles", "as", "an", "array" ]
train
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L126-L135
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.getRole
public function getRole($role) { if(false === is_string($role)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($role)), E_USER_ERROR); } foreach($this -> permissions as $type => $resources) { if($role === $type) { ...
php
public function getRole($role) { if(false === is_string($role)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($role)), E_USER_ERROR); } foreach($this -> permissions as $type => $resources) { if($role === $type) { ...
[ "public", "function", "getRole", "(", "$", "role", ")", "{", "if", "(", "false", "===", "is_string", "(", "$", "role", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 1 passed to %s() must be of the type string, \"%s\" given'", ",", "__ME...
Returns the roles in array @return array
[ "Returns", "the", "roles", "in", "array" ]
train
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L142-L160
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.getResources
public function getResources($match = null) { if(null !== $match && false === is_string($match)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($match)), E_USER_ERROR); } $permissions = []; $match = null === $match ? '.*?' : ...
php
public function getResources($match = null) { if(null !== $match && false === is_string($match)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($match)), E_USER_ERROR); } $permissions = []; $match = null === $match ? '.*?' : ...
[ "public", "function", "getResources", "(", "$", "match", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "match", "&&", "false", "===", "is_string", "(", "$", "match", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 1 pass...
Returns all the resourses in array @param string|null $match @return array
[ "Returns", "all", "the", "resourses", "in", "array" ]
train
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L168-L188
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.fill
private function fill($roles, $resources, $allow) { if(true === is_string($roles)) { $roles = [$roles]; } if(true === is_string($resources)) { $resources = [$resources]; } if(false === is_array($roles)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string...
php
private function fill($roles, $resources, $allow) { if(true === is_string($roles)) { $roles = [$roles]; } if(true === is_string($resources)) { $resources = [$resources]; } if(false === is_array($roles)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string...
[ "private", "function", "fill", "(", "$", "roles", ",", "$", "resources", ",", "$", "allow", ")", "{", "if", "(", "true", "===", "is_string", "(", "$", "roles", ")", ")", "{", "$", "roles", "=", "[", "$", "roles", "]", ";", "}", "if", "(", "true...
Add a new permission entry @param string|array $roles @param string|array $resources @param boolean $allow @return sFire\Permissions\ACL
[ "Add", "a", "new", "permission", "entry" ]
train
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L198-L241
Wedeto/IO
src/File.php
File.touch
public function touch() { // Check permissions $path = $this->getFullPath(); if (file_exists($path)) { if (!is_writable($path)) Path::makeWritable($path); } touch($path); Path::setPermissions($path); }
php
public function touch() { // Check permissions $path = $this->getFullPath(); if (file_exists($path)) { if (!is_writable($path)) Path::makeWritable($path); } touch($path); Path::setPermissions($path); }
[ "public", "function", "touch", "(", ")", "{", "// Check permissions", "$", "path", "=", "$", "this", "->", "getFullPath", "(", ")", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")", "{", "if", "(", "!", "is_writable", "(", "$", "path", ")", ...
Touch the file, updating its permissions
[ "Touch", "the", "file", "updating", "its", "permissions" ]
train
https://github.com/Wedeto/IO/blob/4cfeaedd1bd9bda3097d18cb12233a4afecb2e85/src/File.php#L47-L59
Wedeto/IO
src/File.php
File.getMime
public function getMime() { if (!$this->mime) { $type = FileType::getFromFile($this->getFullPath()); $this->mime = $type->getMimeType(); } return $this->mime; }
php
public function getMime() { if (!$this->mime) { $type = FileType::getFromFile($this->getFullPath()); $this->mime = $type->getMimeType(); } return $this->mime; }
[ "public", "function", "getMime", "(", ")", "{", "if", "(", "!", "$", "this", "->", "mime", ")", "{", "$", "type", "=", "FileType", "::", "getFromFile", "(", "$", "this", "->", "getFullPath", "(", ")", ")", ";", "$", "this", "->", "mime", "=", "$"...
Return the appropriate mime type for the file
[ "Return", "the", "appropriate", "mime", "type", "for", "the", "file" ]
train
https://github.com/Wedeto/IO/blob/4cfeaedd1bd9bda3097d18cb12233a4afecb2e85/src/File.php#L84-L92
Wedeto/IO
src/File.php
File.open
public function open(string $mode) { $read = strpbrk($mode, "r+") !== false; $write = strpbrk($mode, "waxc+") !== false; $x = strpbrk($mode, "x") !== false; $path = $this->getFullPath(); $fh = @fopen($path, $mode); if (is_resource($fh)) return $fh; ...
php
public function open(string $mode) { $read = strpbrk($mode, "r+") !== false; $write = strpbrk($mode, "waxc+") !== false; $x = strpbrk($mode, "x") !== false; $path = $this->getFullPath(); $fh = @fopen($path, $mode); if (is_resource($fh)) return $fh; ...
[ "public", "function", "open", "(", "string", "$", "mode", ")", "{", "$", "read", "=", "strpbrk", "(", "$", "mode", ",", "\"r+\"", ")", "!==", "false", ";", "$", "write", "=", "strpbrk", "(", "$", "mode", ",", "\"waxc+\"", ")", "!==", "false", ";", ...
Open the file for reading or writing, throwing informative exceptions when it fails. @param string $mode The file opening mode @return resource The opened file resource @throws IOException When opening the file failed. @seealso fopen
[ "Open", "the", "file", "for", "reading", "or", "writing", "throwing", "informative", "exceptions", "when", "it", "fails", "." ]
train
https://github.com/Wedeto/IO/blob/4cfeaedd1bd9bda3097d18cb12233a4afecb2e85/src/File.php#L154-L173
Dhii/placeholder-template-abstract
src/TokenStartAwareTrait.php
TokenStartAwareTrait._setTokenStart
protected function _setTokenStart($delimiter) { if (!is_null($delimiter)) { $delimiter = $this->_normalizeTokenDelimiter($delimiter); } $this->tokenStart = $delimiter; }
php
protected function _setTokenStart($delimiter) { if (!is_null($delimiter)) { $delimiter = $this->_normalizeTokenDelimiter($delimiter); } $this->tokenStart = $delimiter; }
[ "protected", "function", "_setTokenStart", "(", "$", "delimiter", ")", "{", "if", "(", "!", "is_null", "(", "$", "delimiter", ")", ")", "{", "$", "delimiter", "=", "$", "this", "->", "_normalizeTokenDelimiter", "(", "$", "delimiter", ")", ";", "}", "$", ...
Assigns the token start delimiter. @since [*next-version*] @param Stringable|string|int|float|bool|null $delimiter The delimiter that marks the start of a token. @throws InvalidArgumentException If the delimiter is invalid.
[ "Assigns", "the", "token", "start", "delimiter", "." ]
train
https://github.com/Dhii/placeholder-template-abstract/blob/bfa7cea3b1e078b19bcf59d9a3da63b8c12ed03b/src/TokenStartAwareTrait.php#L43-L50
miaoxing/plugin
src/Service/App.php
App.getNamespaceFromWechatAppId
protected function getNamespaceFromWechatAppId($namespace) { if (substr($namespace, 0, 2) != 'wx') { return false; } wei()->logger->debug('Got wechat appId', ['appId' => $namespace]); $appId = wei()->wechatAccount()->select('appId')->fetchColumn(['applicationId' => $nam...
php
protected function getNamespaceFromWechatAppId($namespace) { if (substr($namespace, 0, 2) != 'wx') { return false; } wei()->logger->debug('Got wechat appId', ['appId' => $namespace]); $appId = wei()->wechatAccount()->select('appId')->fetchColumn(['applicationId' => $nam...
[ "protected", "function", "getNamespaceFromWechatAppId", "(", "$", "namespace", ")", "{", "if", "(", "substr", "(", "$", "namespace", ",", "0", ",", "2", ")", "!=", "'wx'", ")", "{", "return", "false", ";", "}", "wei", "(", ")", "->", "logger", "->", ...
通过微信AppID获取应用的名称 @param string $namespace @return string|false
[ "通过微信AppID获取应用的名称" ]
train
https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/App.php#L164-L181
miaoxing/plugin
src/Service/App.php
App.getDefaultTemplate
public function getDefaultTemplate($controller = null, $action = null) { $file = lcfirst($controller ?: $this->controller) . '/' . ($action ?: $this->action) . $this->view->getExtension(); $plugin = $this->getPlugin(); return $plugin ? '@' . $plugin . '/' . $file : $file; }
php
public function getDefaultTemplate($controller = null, $action = null) { $file = lcfirst($controller ?: $this->controller) . '/' . ($action ?: $this->action) . $this->view->getExtension(); $plugin = $this->getPlugin(); return $plugin ? '@' . $plugin . '/' . $file : $file; }
[ "public", "function", "getDefaultTemplate", "(", "$", "controller", "=", "null", ",", "$", "action", "=", "null", ")", "{", "$", "file", "=", "lcfirst", "(", "$", "controller", "?", ":", "$", "this", "->", "controller", ")", ".", "'/'", ".", "(", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/App.php#L197-L205
miaoxing/plugin
src/Service/App.php
App.getPlugin
public function getPlugin() { if (!$this->plugin) { $classes = array_reverse($this->getControllerClasses($this->controller)); foreach ($classes as $class) { // 认为第二部分是插件名称 list(, $plugin) = explode('\\', $class, 3); $this->plugin = $thi...
php
public function getPlugin() { if (!$this->plugin) { $classes = array_reverse($this->getControllerClasses($this->controller)); foreach ($classes as $class) { // 认为第二部分是插件名称 list(, $plugin) = explode('\\', $class, 3); $this->plugin = $thi...
[ "public", "function", "getPlugin", "(", ")", "{", "if", "(", "!", "$", "this", "->", "plugin", ")", "{", "$", "classes", "=", "array_reverse", "(", "$", "this", "->", "getControllerClasses", "(", "$", "this", "->", "controller", ")", ")", ";", "foreach...
获取当前运行的插件名称 @return string
[ "获取当前运行的插件名称" ]
train
https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/App.php#L234-L248
miaoxing/plugin
src/Service/App.php
App.getRecord
public function getRecord() { $this->record || $this->record = wei()->appRecord() ->tags(false) ->setCacheKey('appName:' . $this->namespace) ->cache(86400) ->find(['name' => $this->namespace]); return $this->record; }
php
public function getRecord() { $this->record || $this->record = wei()->appRecord() ->tags(false) ->setCacheKey('appName:' . $this->namespace) ->cache(86400) ->find(['name' => $this->namespace]); return $this->record; }
[ "public", "function", "getRecord", "(", ")", "{", "$", "this", "->", "record", "||", "$", "this", "->", "record", "=", "wei", "(", ")", "->", "appRecord", "(", ")", "->", "tags", "(", "false", ")", "->", "setCacheKey", "(", "'appName:'", ".", "$", ...
获取App数据表对象 @return \Miaoxing\Plugin\Service\AppRecord
[ "获取App数据表对象" ]
train
https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/App.php#L255-L264
miaoxing/plugin
src/Service/App.php
App.getId
public function getId() { if (isset($this->ids[$this->namespace])) { return $this->ids[$this->namespace]; } else { return (int) $this->getRecord()->get('id'); } }
php
public function getId() { if (isset($this->ids[$this->namespace])) { return $this->ids[$this->namespace]; } else { return (int) $this->getRecord()->get('id'); } }
[ "public", "function", "getId", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "ids", "[", "$", "this", "->", "namespace", "]", ")", ")", "{", "return", "$", "this", "->", "ids", "[", "$", "this", "->", "namespace", "]", ";", "}", "e...
Record: 获取当前项目的编号 @return int @throws \Exception
[ "Record", ":", "获取当前项目的编号" ]
train
https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/App.php#L272-L279
miaoxing/plugin
src/Service/App.php
App.getDbName
public function getDbName($id) { if (!$this->dbNames[$id]) { $record = wei()->appRecord()->findById($id); $this->dbNames[$id] = $record['name']; } return $this->dbNames[$id]; }
php
public function getDbName($id) { if (!$this->dbNames[$id]) { $record = wei()->appRecord()->findById($id); $this->dbNames[$id] = $record['name']; } return $this->dbNames[$id]; }
[ "public", "function", "getDbName", "(", "$", "id", ")", "{", "if", "(", "!", "$", "this", "->", "dbNames", "[", "$", "id", "]", ")", "{", "$", "record", "=", "wei", "(", ")", "->", "appRecord", "(", ")", "->", "findById", "(", "$", "id", ")", ...
Repo: 根据应用ID获取应用数据库名称 @param int $id @return string
[ "Repo", ":", "根据应用ID获取应用数据库名称" ]
train
https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/App.php#L287-L295
miaoxing/plugin
src/Service/App.php
App.handleResponse
public function handleResponse($response) { if ($this->isRet($response)) { return $this->handleRet($response); } elseif (is_array($response)) { $template = $this->getDefaultTemplate(); $file = $this->view->resolveFile($template) ? $template : $this->defaultViewFil...
php
public function handleResponse($response) { if ($this->isRet($response)) { return $this->handleRet($response); } elseif (is_array($response)) { $template = $this->getDefaultTemplate(); $file = $this->view->resolveFile($template) ? $template : $this->defaultViewFil...
[ "public", "function", "handleResponse", "(", "$", "response", ")", "{", "if", "(", "$", "this", "->", "isRet", "(", "$", "response", ")", ")", "{", "return", "$", "this", "->", "handleRet", "(", "$", "response", ")", ";", "}", "elseif", "(", "is_arra...
重写handleResponse,支持Ret结构 @param mixed $response @return Response @throws \Exception
[ "重写handleResponse", "支持Ret结构" ]
train
https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/App.php#L314-L326
miaoxing/plugin
src/Service/App.php
App.handleRet
protected function handleRet(array $ret) { if ($this->request->acceptJson() || php_sapi_name() == 'cli' || $this->isApi()) { return $this->response->json($ret); } else { $type = isset($ret['retType']) ? $ret['retType'] : ($ret['code'] === 1 ? 'success' : 'warning'); ...
php
protected function handleRet(array $ret) { if ($this->request->acceptJson() || php_sapi_name() == 'cli' || $this->isApi()) { return $this->response->json($ret); } else { $type = isset($ret['retType']) ? $ret['retType'] : ($ret['code'] === 1 ? 'success' : 'warning'); ...
[ "protected", "function", "handleRet", "(", "array", "$", "ret", ")", "{", "if", "(", "$", "this", "->", "request", "->", "acceptJson", "(", ")", "||", "php_sapi_name", "(", ")", "==", "'cli'", "||", "$", "this", "->", "isApi", "(", ")", ")", "{", "...
转换Ret结构为response @param array $ret @return Response @throws \Exception
[ "转换Ret结构为response" ]
train
https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/App.php#L335-L345
spryker/price-product-merchant-relationship-data-import
src/Spryker/Zed/PriceProductMerchantRelationshipDataImport/Business/Model/PriceProductMerchantRelationshipWriterStep.php
PriceProductMerchantRelationshipWriterStep.execute
public function execute(DataSetInterface $dataSet): void { $priceProductMerchantRelationshipEntity = $this->findExistingPriceProductStoreEntity($dataSet); $idPriceProductStore = $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRICE_PRODUCT_STORE]; if ($priceProductMerchantRela...
php
public function execute(DataSetInterface $dataSet): void { $priceProductMerchantRelationshipEntity = $this->findExistingPriceProductStoreEntity($dataSet); $idPriceProductStore = $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRICE_PRODUCT_STORE]; if ($priceProductMerchantRela...
[ "public", "function", "execute", "(", "DataSetInterface", "$", "dataSet", ")", ":", "void", "{", "$", "priceProductMerchantRelationshipEntity", "=", "$", "this", "->", "findExistingPriceProductStoreEntity", "(", "$", "dataSet", ")", ";", "$", "idPriceProductStore", ...
@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @return void
[ "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ]
train
https://github.com/spryker/price-product-merchant-relationship-data-import/blob/2b96c8a449920daa286e60ce6f98bde0989c7683/src/Spryker/Zed/PriceProductMerchantRelationshipDataImport/Business/Model/PriceProductMerchantRelationshipWriterStep.php#L25-L58
spryker/price-product-merchant-relationship-data-import
src/Spryker/Zed/PriceProductMerchantRelationshipDataImport/Business/Model/PriceProductMerchantRelationshipWriterStep.php
PriceProductMerchantRelationshipWriterStep.findExistingPriceProductStoreEntity
protected function findExistingPriceProductStoreEntity(DataSetInterface $dataSet): ?SpyPriceProductMerchantRelationship { $query = SpyPriceProductMerchantRelationshipQuery::create() ->usePriceProductStoreQuery() ->filterByFkStore($dataSet[PriceProductMerchantRelationshipDataSetIn...
php
protected function findExistingPriceProductStoreEntity(DataSetInterface $dataSet): ?SpyPriceProductMerchantRelationship { $query = SpyPriceProductMerchantRelationshipQuery::create() ->usePriceProductStoreQuery() ->filterByFkStore($dataSet[PriceProductMerchantRelationshipDataSetIn...
[ "protected", "function", "findExistingPriceProductStoreEntity", "(", "DataSetInterface", "$", "dataSet", ")", ":", "?", "SpyPriceProductMerchantRelationship", "{", "$", "query", "=", "SpyPriceProductMerchantRelationshipQuery", "::", "create", "(", ")", "->", "usePriceProduc...
@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @return \Orm\Zed\PriceProductMerchantRelationship\Persistence\SpyPriceProductMerchantRelationship|null
[ "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ]
train
https://github.com/spryker/price-product-merchant-relationship-data-import/blob/2b96c8a449920daa286e60ce6f98bde0989c7683/src/Spryker/Zed/PriceProductMerchantRelationshipDataImport/Business/Model/PriceProductMerchantRelationshipWriterStep.php#L65-L82
fiiSoft/fiisoft-console
src/Tools/Console/AbstractCommand.php
AbstractCommand.createPidFile
final protected function createPidFile($pidfilesPath, $pidfilePrefix) { if (!$this->openPidFile($pidfilesPath, $pidfilePrefix, $pidFile)) { $this->output->writeln('Unable to create pid file '.$pidFile); $this->output->writeln('Please be sure pid file can be created in this location.'...
php
final protected function createPidFile($pidfilesPath, $pidfilePrefix) { if (!$this->openPidFile($pidfilesPath, $pidfilePrefix, $pidFile)) { $this->output->writeln('Unable to create pid file '.$pidFile); $this->output->writeln('Please be sure pid file can be created in this location.'...
[ "final", "protected", "function", "createPidFile", "(", "$", "pidfilesPath", ",", "$", "pidfilePrefix", ")", "{", "if", "(", "!", "$", "this", "->", "openPidFile", "(", "$", "pidfilesPath", ",", "$", "pidfilePrefix", ",", "$", "pidFile", ")", ")", "{", "...
Create pid file (ind default directory). If pid file cannot be created, stop execution with exit code 1. @param string $pidfilesPath path to directory where pid file will be created @param string $pidfilePrefix prefix for name of pid file @return string path to created pid file
[ "Create", "pid", "file", "(", "ind", "default", "directory", ")", ".", "If", "pid", "file", "cannot", "be", "created", "stop", "execution", "with", "exit", "code", "1", "." ]
train
https://github.com/fiiSoft/fiisoft-console/blob/50e1be6e26429bed5b5b932dc21605ca09161a49/src/Tools/Console/AbstractCommand.php#L95-L105
Wedeto/Log
src/Writer/ExternalLogWriter.php
ExternalLogWriter.write
public function write(string $level, string $message, array $context) { $this->logger->log($level, $message, $context); }
php
public function write(string $level, string $message, array $context) { $this->logger->log($level, $message, $context); }
[ "public", "function", "write", "(", "string", "$", "level", ",", "string", "$", "message", ",", "array", "$", "context", ")", "{", "$", "this", "->", "logger", "->", "log", "(", "$", "level", ",", "$", "message", ",", "$", "context", ")", ";", "}" ...
Write a log message. @param string $level The LogLevel @param string $message The message to write @param array $context The context variables
[ "Write", "a", "log", "message", "." ]
train
https://github.com/Wedeto/Log/blob/88252c5052089fdcc5dae466d1ad5889bb2b735f/src/Writer/ExternalLogWriter.php#L64-L67
lanfisis/deflection
src/Deflection/Transformer.php
Transformer.arrayToClassElement
public function arrayToClassElement($definition) { $class = new Classes(); if (isset($definition['docblock'])) { $docblock = $this->arrayToDocblockElement($definition['docblock']); $class->setDocbloc($docblock); } if (isset($definition['namespace'])) { ...
php
public function arrayToClassElement($definition) { $class = new Classes(); if (isset($definition['docblock'])) { $docblock = $this->arrayToDocblockElement($definition['docblock']); $class->setDocbloc($docblock); } if (isset($definition['namespace'])) { ...
[ "public", "function", "arrayToClassElement", "(", "$", "definition", ")", "{", "$", "class", "=", "new", "Classes", "(", ")", ";", "if", "(", "isset", "(", "$", "definition", "[", "'docblock'", "]", ")", ")", "{", "$", "docblock", "=", "$", "this", "...
Transform an array to a class element object @param array $definition Class definitoion @return Deflection\Element\Classes
[ "Transform", "an", "array", "to", "a", "class", "element", "object" ]
train
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Transformer.php#L26-L60
lanfisis/deflection
src/Deflection/Transformer.php
Transformer.arrayToDocblockElement
public function arrayToDocblockElement(array $definition) { $docblock = new Docblock(); if (isset($definition['description'])) { $docblock->setDescription($definition['description']); } if (isset($definition['params'])) { foreach ($definition['params'] as $par...
php
public function arrayToDocblockElement(array $definition) { $docblock = new Docblock(); if (isset($definition['description'])) { $docblock->setDescription($definition['description']); } if (isset($definition['params'])) { foreach ($definition['params'] as $par...
[ "public", "function", "arrayToDocblockElement", "(", "array", "$", "definition", ")", "{", "$", "docblock", "=", "new", "Docblock", "(", ")", ";", "if", "(", "isset", "(", "$", "definition", "[", "'description'", "]", ")", ")", "{", "$", "docblock", "->"...
Returns well formated header with descriptions, param, return, ... @param array $definition Header definition @return Deflection\Element\Docblock
[ "Returns", "well", "formated", "header", "with", "descriptions", "param", "return", "..." ]
train
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Transformer.php#L69-L91
lanfisis/deflection
src/Deflection/Transformer.php
Transformer.arrayToFunctionElement
public function arrayToFunctionElement(array $definition) { $function = new Functions; if (isset($definition['docblock'])) { $docblock = $this->arrayToDocblockElement($definition['docblock']); $function->setDocbloc($docblock); } if (isset($definition['public']...
php
public function arrayToFunctionElement(array $definition) { $function = new Functions; if (isset($definition['docblock'])) { $docblock = $this->arrayToDocblockElement($definition['docblock']); $function->setDocbloc($docblock); } if (isset($definition['public']...
[ "public", "function", "arrayToFunctionElement", "(", "array", "$", "definition", ")", "{", "$", "function", "=", "new", "Functions", ";", "if", "(", "isset", "(", "$", "definition", "[", "'docblock'", "]", ")", ")", "{", "$", "docblock", "=", "$", "this"...
Returns well formated function declaration @param array $definition Functions definition @return Deflection\Element\Functions
[ "Returns", "well", "formated", "function", "declaration" ]
train
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Transformer.php#L100-L122
intpro/scalar
src/Service/DbCleaner.php
DbCleaner.strategy
private function strategy(callable $action) { $report = false; $tables = [ 'string' => StringModel::class, 'text' => TextModel::class, 'bool' => BoolModel::class, 'float' => FloatModel::class, 'int' => IntModel::class, 'timesta...
php
private function strategy(callable $action) { $report = false; $tables = [ 'string' => StringModel::class, 'text' => TextModel::class, 'bool' => BoolModel::class, 'float' => FloatModel::class, 'int' => IntModel::class, 'timesta...
[ "private", "function", "strategy", "(", "callable", "$", "action", ")", "{", "$", "report", "=", "false", ";", "$", "tables", "=", "[", "'string'", "=>", "StringModel", "::", "class", ",", "'text'", "=>", "TextModel", "::", "class", ",", "'bool'", "=>", ...
@param callable $action @return bool
[ "@param", "callable", "$action" ]
train
https://github.com/intpro/scalar/blob/de2d8c6e39efc9edf479447d8b2ed265aebe0a8d/src/Service/DbCleaner.php#L32-L82
rzajac/phptools
src/Helper/Err.php
Err.errToException
public static function errToException($turnOn = true) { if (!$turnOn) { return set_error_handler(null); } /* * Error handler * * @param int $errno * @param string $errStr * @param string $errFile * @param int $errLine ...
php
public static function errToException($turnOn = true) { if (!$turnOn) { return set_error_handler(null); } /* * Error handler * * @param int $errno * @param string $errStr * @param string $errFile * @param int $errLine ...
[ "public", "static", "function", "errToException", "(", "$", "turnOn", "=", "true", ")", "{", "if", "(", "!", "$", "turnOn", ")", "{", "return", "set_error_handler", "(", "null", ")", ";", "}", "/*\n * Error handler\n *\n * @param int $errno\n...
Change errors to exceptions. @see http://php.net/manual/en/class.errorexception.php @param bool $turnOn Set to false to turn off user defined error exception handling and set the default one. @return mixed
[ "Change", "errors", "to", "exceptions", "." ]
train
https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Helper/Err.php#L38-L63
peridot-php/peridot-scope
src/Scope.php
Scope.&
public function &__get($name) { list($result, $found) = $this->peridotScanChildren($this, function ($childScope, &$accumulator) use ($name) { if (property_exists($childScope, $name)) { $accumulator = [$childScope->$name, true, $childScope]; } }); if (!...
php
public function &__get($name) { list($result, $found) = $this->peridotScanChildren($this, function ($childScope, &$accumulator) use ($name) { if (property_exists($childScope, $name)) { $accumulator = [$childScope->$name, true, $childScope]; } }); if (!...
[ "public", "function", "&", "__get", "(", "$", "name", ")", "{", "list", "(", "$", "result", ",", "$", "found", ")", "=", "$", "this", "->", "peridotScanChildren", "(", "$", "this", ",", "function", "(", "$", "childScope", ",", "&", "$", "accumulator"...
Lookup properties on child scopes. @param $name @return mixed @throws DomainException
[ "Lookup", "properties", "on", "child", "scopes", "." ]
train
https://github.com/peridot-php/peridot-scope/blob/baabb128c805f84279c1506435120314ac09d9ff/src/Scope.php#L106-L117
peridot-php/peridot-scope
src/Scope.php
Scope.peridotScanChildren
protected function peridotScanChildren(Scope $scope, callable $fn, &$accumulator = []) { if (! empty($accumulator)) { return $accumulator; } $children = $scope->peridotGetChildScopes(); foreach ($children as $childScope) { $fn($childScope, $accumulator); ...
php
protected function peridotScanChildren(Scope $scope, callable $fn, &$accumulator = []) { if (! empty($accumulator)) { return $accumulator; } $children = $scope->peridotGetChildScopes(); foreach ($children as $childScope) { $fn($childScope, $accumulator); ...
[ "protected", "function", "peridotScanChildren", "(", "Scope", "$", "scope", ",", "callable", "$", "fn", ",", "&", "$", "accumulator", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "accumulator", ")", ")", "{", "return", "$", "accumulator"...
Scan child scopes and execute a function against each one passing an accumulator reference along. @param Scope $scope @param callable $fn @param array $accumulator @return array
[ "Scan", "child", "scopes", "and", "execute", "a", "function", "against", "each", "one", "passing", "an", "accumulator", "reference", "along", "." ]
train
https://github.com/peridot-php/peridot-scope/blob/baabb128c805f84279c1506435120314ac09d9ff/src/Scope.php#L128-L145
netzmacht-archive/subcolumns_bootstrap_customizable
src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php
ColumnSet.prepareContainer
public static function prepareContainer($id) { // use array key exists so non existing column will researched if(array_key_exists('id', self::$container)) { return static::$container[$id]; } $model = ColumnsetModel::findByPk($id); if($model === null) { static::$container[$id] = null; return null...
php
public static function prepareContainer($id) { // use array key exists so non existing column will researched if(array_key_exists('id', self::$container)) { return static::$container[$id]; } $model = ColumnsetModel::findByPk($id); if($model === null) { static::$container[$id] = null; return null...
[ "public", "static", "function", "prepareContainer", "(", "$", "id", ")", "{", "// use array key exists so non existing column will researched", "if", "(", "array_key_exists", "(", "'id'", ",", "self", "::", "$", "container", ")", ")", "{", "return", "static", "::", ...
prepare the container which sub columns expects @param int $id id of the columnset @return array
[ "prepare", "the", "container", "which", "sub", "columns", "expects" ]
train
https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L39-L75
netzmacht-archive/subcolumns_bootstrap_customizable
src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php
ColumnSet.prepareSize
protected static function prepareSize($size, array $definition) { $css = sprintf('col-%s-%s', $size, $definition['width']); if($definition['offset']) { $css .= sprintf(' col-%s-offset-%s', $size, $definition['offset']); } if($definition['order']) { $css .= sprintf(' col-%s-%s', $size, $definition['orde...
php
protected static function prepareSize($size, array $definition) { $css = sprintf('col-%s-%s', $size, $definition['width']); if($definition['offset']) { $css .= sprintf(' col-%s-offset-%s', $size, $definition['offset']); } if($definition['order']) { $css .= sprintf(' col-%s-%s', $size, $definition['orde...
[ "protected", "static", "function", "prepareSize", "(", "$", "size", ",", "array", "$", "definition", ")", "{", "$", "css", "=", "sprintf", "(", "'col-%s-%s'", ",", "$", "size", ",", "$", "definition", "[", "'width'", "]", ")", ";", "if", "(", "$", "d...
generates the css class defnition for one column @param string $size the selected size @param array $definition the column definition @return string
[ "generates", "the", "css", "class", "defnition", "for", "one", "column" ]
train
https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L85-L98
netzmacht-archive/subcolumns_bootstrap_customizable
src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php
ColumnSet.appendColumnsetIdToPalette
public function appendColumnsetIdToPalette($dc) { if($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') { return; } if($dc->table == 'tl_content') { $model = \ContentModel::findByPK($dc->id); if($model->sc_type > 0) { \MetaPalettes::appendFields($dc->table, 'colsetStart', 'colset', a...
php
public function appendColumnsetIdToPalette($dc) { if($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') { return; } if($dc->table == 'tl_content') { $model = \ContentModel::findByPK($dc->id); if($model->sc_type > 0) { \MetaPalettes::appendFields($dc->table, 'colsetStart', 'colset', a...
[ "public", "function", "appendColumnsetIdToPalette", "(", "$", "dc", ")", "{", "if", "(", "$", "GLOBALS", "[", "'TL_CONFIG'", "]", "[", "'subcolumns'", "]", "!=", "'bootstrap_customizable'", ")", "{", "return", ";", "}", "if", "(", "$", "dc", "->", "table",...
add column set field to the colsetStart content element. We need to do it dynamically because subcolumns creates its palette dynamically @param $dc
[ "add", "column", "set", "field", "to", "the", "colsetStart", "content", "element", ".", "We", "need", "to", "do", "it", "dynamically", "because", "subcolumns", "creates", "its", "palette", "dynamically" ]
train
https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L107-L133
netzmacht-archive/subcolumns_bootstrap_customizable
src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php
ColumnSet.appendColumnSizesToPalette
public function appendColumnSizesToPalette($dc) { $model = ColumnsetModel::findByPk($dc->id); $sizes = array_merge(deserialize($model->sizes, true)); foreach($sizes as $size) { $field = 'columnset_' . $size; \MetaPalettes::appendFields('tl_columnset', 'columnset', array($field)); } }
php
public function appendColumnSizesToPalette($dc) { $model = ColumnsetModel::findByPk($dc->id); $sizes = array_merge(deserialize($model->sizes, true)); foreach($sizes as $size) { $field = 'columnset_' . $size; \MetaPalettes::appendFields('tl_columnset', 'columnset', array($field)); } }
[ "public", "function", "appendColumnSizesToPalette", "(", "$", "dc", ")", "{", "$", "model", "=", "ColumnsetModel", "::", "findByPk", "(", "$", "dc", "->", "id", ")", ";", "$", "sizes", "=", "array_merge", "(", "deserialize", "(", "$", "model", "->", "siz...
Append column sizes fields dynamically to the palettes. Not using @param $dc
[ "Append", "column", "sizes", "fields", "dynamically", "to", "the", "palettes", ".", "Not", "using" ]
train
https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L140-L151
netzmacht-archive/subcolumns_bootstrap_customizable
src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php
ColumnSet.createColumns
public function createColumns($value, $mcw) { $columns = (int) $mcw->activeRecord->columns; $value = deserialize($value, true); $count = count($value); // initialize columns if($count == 0) { for($i= 0; $i < $columns; $i++) { $value[$i]['width'] = floor(12/$columns); } } // reduce columns if n...
php
public function createColumns($value, $mcw) { $columns = (int) $mcw->activeRecord->columns; $value = deserialize($value, true); $count = count($value); // initialize columns if($count == 0) { for($i= 0; $i < $columns; $i++) { $value[$i]['width'] = floor(12/$columns); } } // reduce columns if n...
[ "public", "function", "createColumns", "(", "$", "value", ",", "$", "mcw", ")", "{", "$", "columns", "=", "(", "int", ")", "$", "mcw", "->", "activeRecord", "->", "columns", ";", "$", "value", "=", "deserialize", "(", "$", "value", ",", "true", ")", ...
create a MCW row for each column @param string $value deseriazable value, for getting an array @param $mcw multi column wizard or DC_Table @return mixed
[ "create", "a", "MCW", "row", "for", "each", "column" ]
train
https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L161-L190
netzmacht-archive/subcolumns_bootstrap_customizable
src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php
ColumnSet.getAllTypes
public function getAllTypes($dc) { if($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') { $sc = new \tl_content_sc(); return $sc->getAllTypes(); } $this->import('Database'); $collection = $this->Database->execute('SELECT columns FROM tl_columnset GROUP BY columns ORDER BY columns'); $t...
php
public function getAllTypes($dc) { if($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') { $sc = new \tl_content_sc(); return $sc->getAllTypes(); } $this->import('Database'); $collection = $this->Database->execute('SELECT columns FROM tl_columnset GROUP BY columns ORDER BY columns'); $t...
[ "public", "function", "getAllTypes", "(", "$", "dc", ")", "{", "if", "(", "$", "GLOBALS", "[", "'TL_CONFIG'", "]", "[", "'subcolumns'", "]", "!=", "'bootstrap_customizable'", ")", "{", "$", "sc", "=", "new", "\\", "tl_content_sc", "(", ")", ";", "return"...
replace subcolumns getAllTypes method, to load all created columnsets. There is a fallback provided if not bootstra_customizable is used @param DC_Table $dc @return array
[ "replace", "subcolumns", "getAllTypes", "method", "to", "load", "all", "created", "columnsets", ".", "There", "is", "a", "fallback", "provided", "if", "not", "bootstra_customizable", "is", "used" ]
train
https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L200-L217