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
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/TypeNode.php
TypeNode.getEnumerations
public function getEnumerations() { $enums = array(); foreach ($this->element->getElementsByTagName('enumeration') as $enum) { $enums[] = $enum->getAttribute('value'); }; return $enums; }
php
public function getEnumerations() { $enums = array(); foreach ($this->element->getElementsByTagName('enumeration') as $enum) { $enums[] = $enum->getAttribute('value'); }; return $enums; }
[ "public", "function", "getEnumerations", "(", ")", "{", "$", "enums", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "element", "->", "getElementsByTagName", "(", "'enumeration'", ")", "as", "$", "enum", ")", "{", "$", "enums", "[", "]...
Returns an array of values that the type may have if the type is an enumeration. @return string[] The valid enumeration values.
[ "Returns", "an", "array", "of", "values", "that", "the", "type", "may", "have", "if", "the", "type", "is", "an", "enumeration", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/TypeNode.php#L183-L190
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/TypeNode.php
TypeNode.isArray
public function isArray() { $parts = $this->getParts(); // Array types are complex types with one element, their names begins with 'ArrayOf'. // So if not - that's not array. Only field must be array also. return $this->isComplex() && count($parts) == 1 && (s...
php
public function isArray() { $parts = $this->getParts(); // Array types are complex types with one element, their names begins with 'ArrayOf'. // So if not - that's not array. Only field must be array also. return $this->isComplex() && count($parts) == 1 && (s...
[ "public", "function", "isArray", "(", ")", "{", "$", "parts", "=", "$", "this", "->", "getParts", "(", ")", ";", "// Array types are complex types with one element, their names begins with 'ArrayOf'.", "// So if not - that's not array. Only field must be array also.", "return", ...
Returns whether the type is an array. @return bool If the type is an array.
[ "Returns", "whether", "the", "type", "is", "an", "array", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/TypeNode.php#L230-L240
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/DocumentedNode.php
DocumentedNode.getDocumentation
public function getDocumentation() { $documentation = null; $documentationNodes = $this->element->getElementsByTagName('documentation'); if ($documentationNodes->length > 0) { $documentation = $documentationNodes->item(0)->nodeValue; } return $documentation; }
php
public function getDocumentation() { $documentation = null; $documentationNodes = $this->element->getElementsByTagName('documentation'); if ($documentationNodes->length > 0) { $documentation = $documentationNodes->item(0)->nodeValue; } return $documentation; }
[ "public", "function", "getDocumentation", "(", ")", "{", "$", "documentation", "=", "null", ";", "$", "documentationNodes", "=", "$", "this", "->", "element", "->", "getElementsByTagName", "(", "'documentation'", ")", ";", "if", "(", "$", "documentationNodes", ...
Retrieves the documentation for the node. @return string The documentation.
[ "Retrieves", "the", "documentation", "for", "the", "node", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/DocumentedNode.php#L17-L25
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/SchemaDocument.php
SchemaDocument.findTypeElement
public function findTypeElement($name) { $type = null; $elements = $this->xpath('//s:simpleType[@name=%s]|//s:complexType[@name=%s]', $name, $name); if ($elements->length > 0) { $type = $elements->item(0); } if (empty($type)) { foreach ($this->refere...
php
public function findTypeElement($name) { $type = null; $elements = $this->xpath('//s:simpleType[@name=%s]|//s:complexType[@name=%s]', $name, $name); if ($elements->length > 0) { $type = $elements->item(0); } if (empty($type)) { foreach ($this->refere...
[ "public", "function", "findTypeElement", "(", "$", "name", ")", "{", "$", "type", "=", "null", ";", "$", "elements", "=", "$", "this", "->", "xpath", "(", "'//s:simpleType[@name=%s]|//s:complexType[@name=%s]'", ",", "$", "name", ",", "$", "name", ")", ";", ...
Parses the schema for a type with a specific name. @param string $name The name of the type @return DOMElement|null Returns the type node with the provided if it is found. Null otherwise.
[ "Parses", "the", "schema", "for", "a", "type", "with", "a", "specific", "name", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/SchemaDocument.php#L89-L108
wsdl2phpgenerator/wsdl2phpgenerator
src/ComplexType.php
ComplexType.generateClass
protected function generateClass() { if ($this->class != null) { throw new Exception("The class has already been generated"); } $classBaseType = $this->getBaseTypeClass(); $this->class = new PhpClass( $this->phpIdentifier, false, $cla...
php
protected function generateClass() { if ($this->class != null) { throw new Exception("The class has already been generated"); } $classBaseType = $this->getBaseTypeClass(); $this->class = new PhpClass( $this->phpIdentifier, false, $cla...
[ "protected", "function", "generateClass", "(", ")", "{", "if", "(", "$", "this", "->", "class", "!=", "null", ")", "{", "throw", "new", "Exception", "(", "\"The class has already been generated\"", ")", ";", "}", "$", "classBaseType", "=", "$", "this", "->",...
Implements the loading of the class object @throws Exception if the class is already generated(not null)
[ "Implements", "the", "loading", "of", "the", "class", "object" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/ComplexType.php#L62-L192
wsdl2phpgenerator/wsdl2phpgenerator
src/ComplexType.php
ComplexType.getBaseTypeClass
public function getBaseTypeClass() { // If we have a base type which is different than the current class then extend that. // It is actually possible to have different classes with the same name as PHP SoapClient has a poor // understanding of namespaces. Two types with the same name but in ...
php
public function getBaseTypeClass() { // If we have a base type which is different than the current class then extend that. // It is actually possible to have different classes with the same name as PHP SoapClient has a poor // understanding of namespaces. Two types with the same name but in ...
[ "public", "function", "getBaseTypeClass", "(", ")", "{", "// If we have a base type which is different than the current class then extend that.", "// It is actually possible to have different classes with the same name as PHP SoapClient has a poor", "// understanding of namespaces. Two types with th...
Determine parent class @return string|null Returns a string containing the PHP identifier for the parent class or null if there is no applicable parent class.
[ "Determine", "parent", "class" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/ComplexType.php#L201-L212
wsdl2phpgenerator/wsdl2phpgenerator
src/ComplexType.php
ComplexType.addMember
public function addMember($type, $name, $nullable) { $this->members[$name] = new Variable($type, $name, $nullable); }
php
public function addMember($type, $name, $nullable) { $this->members[$name] = new Variable($type, $name, $nullable); }
[ "public", "function", "addMember", "(", "$", "type", ",", "$", "name", ",", "$", "nullable", ")", "{", "$", "this", "->", "members", "[", "$", "name", "]", "=", "new", "Variable", "(", "$", "type", ",", "$", "name", ",", "$", "nullable", ")", ";"...
Adds the member. Owerwrites members with same name @param string $type @param string $name @param bool $nullable
[ "Adds", "the", "member", ".", "Owerwrites", "members", "with", "same", "name" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/ComplexType.php#L258-L261
wsdl2phpgenerator/wsdl2phpgenerator
src/ComplexType.php
ComplexType.buildParametersString
protected function buildParametersString(array $parameters, $includeType = true, $defaultNull = false) { $parameterStrings = array(); foreach ($parameters as $name => $type) { $parameterString = '$' . $name; if (!empty($type) && $includeType) { $parameterStrin...
php
protected function buildParametersString(array $parameters, $includeType = true, $defaultNull = false) { $parameterStrings = array(); foreach ($parameters as $name => $type) { $parameterString = '$' . $name; if (!empty($type) && $includeType) { $parameterStrin...
[ "protected", "function", "buildParametersString", "(", "array", "$", "parameters", ",", "$", "includeType", "=", "true", ",", "$", "defaultNull", "=", "false", ")", "{", "$", "parameterStrings", "=", "array", "(", ")", ";", "foreach", "(", "$", "parameters",...
Generate a string representing the parameters for a function e.g. "type1 $param1, type2 $param2, $param3" @param array $parameters A map of parameters. Keys are parameter names and values are parameter types. Parameter types may be empty. In that case they are not used. @param bool $includeType Whether to include the ...
[ "Generate", "a", "string", "representing", "the", "parameters", "for", "a", "function", "e", ".", "g", ".", "type1", "$param1", "type2", "$param2", "$param3" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/ComplexType.php#L282-L297
wsdl2phpgenerator/wsdl2phpgenerator
src/ComplexType.php
ComplexType.getBaseTypeMembers
protected function getBaseTypeMembers(ComplexType $type) { if (empty($type->baseType)) { return array(); } // Only get members from the base type if it differs from the current class. It is possible that they will be // the same due to poor handling of namespaces in PHP ...
php
protected function getBaseTypeMembers(ComplexType $type) { if (empty($type->baseType)) { return array(); } // Only get members from the base type if it differs from the current class. It is possible that they will be // the same due to poor handling of namespaces in PHP ...
[ "protected", "function", "getBaseTypeMembers", "(", "ComplexType", "$", "type", ")", "{", "if", "(", "empty", "(", "$", "type", "->", "baseType", ")", ")", "{", "return", "array", "(", ")", ";", "}", "// Only get members from the base type if it differs from the c...
Get members from base types all the way through the type hierarchy. @param ComplexType $type The type to retrieve base type members from. @return Variable[] Member variables from all base types.
[ "Get", "members", "from", "base", "types", "all", "the", "way", "through", "the", "type", "hierarchy", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/ComplexType.php#L305-L318
wsdl2phpgenerator/wsdl2phpgenerator
src/OutputManager.php
OutputManager.save
public function save(PhpClass $service, array $types) { $this->setOutputDirectory(); $this->saveClassToFile($service); foreach ($types as $type) { $this->saveClassToFile($type); } $classes = array_merge(array($service), $types); $this->saveAutoloader($se...
php
public function save(PhpClass $service, array $types) { $this->setOutputDirectory(); $this->saveClassToFile($service); foreach ($types as $type) { $this->saveClassToFile($type); } $classes = array_merge(array($service), $types); $this->saveAutoloader($se...
[ "public", "function", "save", "(", "PhpClass", "$", "service", ",", "array", "$", "types", ")", "{", "$", "this", "->", "setOutputDirectory", "(", ")", ";", "$", "this", "->", "saveClassToFile", "(", "$", "service", ")", ";", "foreach", "(", "$", "type...
Saves the service and types php code to file @param PhpClass $service @param array $types
[ "Saves", "the", "service", "and", "types", "php", "code", "to", "file" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/OutputManager.php#L47-L58
wsdl2phpgenerator/wsdl2phpgenerator
src/OutputManager.php
OutputManager.setOutputDirectory
private function setOutputDirectory() { $outputDirectory = $this->config->get('outputDir'); //Try to create output dir if non existing if (is_dir($outputDirectory) == false) { if (mkdir($outputDirectory, 0777, true) == false) { throw new Exception('Could not crea...
php
private function setOutputDirectory() { $outputDirectory = $this->config->get('outputDir'); //Try to create output dir if non existing if (is_dir($outputDirectory) == false) { if (mkdir($outputDirectory, 0777, true) == false) { throw new Exception('Could not crea...
[ "private", "function", "setOutputDirectory", "(", ")", "{", "$", "outputDirectory", "=", "$", "this", "->", "config", "->", "get", "(", "'outputDir'", ")", ";", "//Try to create output dir if non existing", "if", "(", "is_dir", "(", "$", "outputDirectory", ")", ...
Sets the output directory, creates it if needed This must be called before saving a file @throws Exception If the dir can't be created and dont already exists
[ "Sets", "the", "output", "directory", "creates", "it", "if", "needed", "This", "must", "be", "called", "before", "saving", "a", "file" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/OutputManager.php#L66-L78
wsdl2phpgenerator/wsdl2phpgenerator
src/OutputManager.php
OutputManager.saveClassToFile
private function saveClassToFile(PhpClass $class) { if ($this->isValidClass($class)) { $file = new PhpFile($class->getIdentifier()); $namespace = $this->config->get('namespaceName'); if (!empty($namespace)) { $file->addNamespace($namespace); }...
php
private function saveClassToFile(PhpClass $class) { if ($this->isValidClass($class)) { $file = new PhpFile($class->getIdentifier()); $namespace = $this->config->get('namespaceName'); if (!empty($namespace)) { $file->addNamespace($namespace); }...
[ "private", "function", "saveClassToFile", "(", "PhpClass", "$", "class", ")", "{", "if", "(", "$", "this", "->", "isValidClass", "(", "$", "class", ")", ")", "{", "$", "file", "=", "new", "PhpFile", "(", "$", "class", "->", "getIdentifier", "(", ")", ...
Append a class to a file and save it If no file is created the name of the class is the filename @param PhpClass $class
[ "Append", "a", "class", "to", "a", "file", "and", "save", "it", "If", "no", "file", "is", "created", "the", "name", "of", "the", "class", "is", "the", "filename" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/OutputManager.php#L86-L99
wsdl2phpgenerator/wsdl2phpgenerator
src/OutputManager.php
OutputManager.isValidClass
private function isValidClass(PhpClass $class) { $classNames = $this->config->get('classNames'); return (empty($classNames) || in_array( $class->getIdentifier(), $classNames )); }
php
private function isValidClass(PhpClass $class) { $classNames = $this->config->get('classNames'); return (empty($classNames) || in_array( $class->getIdentifier(), $classNames )); }
[ "private", "function", "isValidClass", "(", "PhpClass", "$", "class", ")", "{", "$", "classNames", "=", "$", "this", "->", "config", "->", "get", "(", "'classNames'", ")", ";", "return", "(", "empty", "(", "$", "classNames", ")", "||", "in_array", "(", ...
Checks if the class is approved Removes the prefix and suffix for namechecking @param PhpClass $class @return bool Returns true if the class is ok to add to file
[ "Checks", "if", "the", "class", "is", "approved", "Removes", "the", "prefix", "and", "suffix", "for", "namechecking" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/OutputManager.php#L108-L115
wsdl2phpgenerator/wsdl2phpgenerator
src/OutputManager.php
OutputManager.saveAutoloader
private function saveAutoloader($name, array $classes) { $autoloaderName = 'autoload_' . md5($name . $this->config->get('namespaceName')); // The autoloader function we build contain two parts: // 1. An array of generated classes and their paths. // 2. A check to see if the autoload...
php
private function saveAutoloader($name, array $classes) { $autoloaderName = 'autoload_' . md5($name . $this->config->get('namespaceName')); // The autoloader function we build contain two parts: // 1. An array of generated classes and their paths. // 2. A check to see if the autoload...
[ "private", "function", "saveAutoloader", "(", "$", "name", ",", "array", "$", "classes", ")", "{", "$", "autoloaderName", "=", "'autoload_'", ".", "md5", "(", "$", "name", ".", "$", "this", "->", "config", "->", "get", "(", "'namespaceName'", ")", ")", ...
Save a file containing an autoloader for the generated files. Developers can include this when using the generated classes. @param string $name The name of the autoloader. Should be unique for the service to avoid name clashes. @param PhpClass[] $classes The classes to include in the autoloader.
[ "Save", "a", "file", "containing", "an", "autoloader", "for", "the", "generated", "files", ".", "Developers", "can", "include", "this", "when", "using", "the", "generated", "classes", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/OutputManager.php#L124-L164
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpFile.php
PhpFile.getSource
public function getSource() { $ret = '<?php' . PHP_EOL . PHP_EOL; if (count($this->namespaces) > 0) { $ret .= 'namespace ' . $this->namespaces[0] . ';' . PHP_EOL . PHP_EOL; } if (count($this->classes) > 0) { foreach ($this->classes as $class) { ...
php
public function getSource() { $ret = '<?php' . PHP_EOL . PHP_EOL; if (count($this->namespaces) > 0) { $ret .= 'namespace ' . $this->namespaces[0] . ';' . PHP_EOL . PHP_EOL; } if (count($this->classes) > 0) { foreach ($this->classes as $class) { ...
[ "public", "function", "getSource", "(", ")", "{", "$", "ret", "=", "'<?php'", ".", "PHP_EOL", ".", "PHP_EOL", ";", "if", "(", "count", "(", "$", "this", "->", "namespaces", ")", ">", "0", ")", "{", "$", "ret", ".=", "'namespace '", ".", "$", "this"...
Generates the complete source code for the file @return string The source code for the file
[ "Generates", "the", "complete", "source", "code", "for", "the", "file" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpFile.php#L65-L86
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpFile.php
PhpFile.addClass
public function addClass(PhpClass $class) { if ($this->classExists($class->getIdentifier())) { throw new Exception('A class of the name (' . $class->getIdentifier() . ') does already exist.'); } $this->classes[$class->getIdentifier()] = $class; }
php
public function addClass(PhpClass $class) { if ($this->classExists($class->getIdentifier())) { throw new Exception('A class of the name (' . $class->getIdentifier() . ') does already exist.'); } $this->classes[$class->getIdentifier()] = $class; }
[ "public", "function", "addClass", "(", "PhpClass", "$", "class", ")", "{", "if", "(", "$", "this", "->", "classExists", "(", "$", "class", "->", "getIdentifier", "(", ")", ")", ")", "{", "throw", "new", "Exception", "(", "'A class of the name ('", ".", "...
Adds a class to the file @param PhpClass $class The class to add @throws Exception If the class already exists
[ "Adds", "a", "class", "to", "the", "file" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpFile.php#L126-L133
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpFile.php
PhpFile.addFunction
public function addFunction(PhpFunction $function) { if ($this->functionExists($function->getIdentifier())) { throw new Exception('A function of the name (' . $function->getIdentifier() . ') does already exist.'); } $this->functions[$function->getIdentifier()] = $function; }
php
public function addFunction(PhpFunction $function) { if ($this->functionExists($function->getIdentifier())) { throw new Exception('A function of the name (' . $function->getIdentifier() . ') does already exist.'); } $this->functions[$function->getIdentifier()] = $function; }
[ "public", "function", "addFunction", "(", "PhpFunction", "$", "function", ")", "{", "if", "(", "$", "this", "->", "functionExists", "(", "$", "function", "->", "getIdentifier", "(", ")", ")", ")", "{", "throw", "new", "Exception", "(", "'A function of the na...
Adds a global function to the file, should not be used, classes rocks :) @param PhpFunction $function The function to add @throws Exception If the function already exists
[ "Adds", "a", "global", "function", "to", "the", "file", "should", "not", "be", "used", "classes", "rocks", ":", ")" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpFile.php#L141-L148
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpDocElementFactory.php
PhpDocElementFactory.getParam
public static function getParam($dataType, $name, $description) { if (strlen($name) == 0) { throw new Exception('A parameter must have a name!'); } if ($name[0] == '$') { $name = substr($name, 1); } if ($dataType == 'long') { $dataType = '...
php
public static function getParam($dataType, $name, $description) { if (strlen($name) == 0) { throw new Exception('A parameter must have a name!'); } if ($name[0] == '$') { $name = substr($name, 1); } if ($dataType == 'long') { $dataType = '...
[ "public", "static", "function", "getParam", "(", "$", "dataType", ",", "$", "name", ",", "$", "description", ")", "{", "if", "(", "strlen", "(", "$", "name", ")", "==", "0", ")", "{", "throw", "new", "Exception", "(", "'A parameter must have a name!'", "...
Creates a param element @param string $dataType The name of the datatype of the variable @param string $name The name of the variable @param string $description @throws Exception Throws exception if no name is supplied @return PhpDocElement The created element
[ "Creates", "a", "param", "element" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpDocElementFactory.php#L29-L45
wsdl2phpgenerator/wsdl2phpgenerator
src/Filter/FilterFactory.php
FilterFactory.create
public function create(ConfigInterface $config) { $operationNames = $config->get('operationNames'); if (!empty($operationNames)) { return new ServiceOperationFilter($config); } else { return new DefaultFilter(); } }
php
public function create(ConfigInterface $config) { $operationNames = $config->get('operationNames'); if (!empty($operationNames)) { return new ServiceOperationFilter($config); } else { return new DefaultFilter(); } }
[ "public", "function", "create", "(", "ConfigInterface", "$", "config", ")", "{", "$", "operationNames", "=", "$", "config", "->", "get", "(", "'operationNames'", ")", ";", "if", "(", "!", "empty", "(", "$", "operationNames", ")", ")", "{", "return", "new...
Returns a filter matching the provided configuration. @param ConfigInterface $config The configuration to create a filter for. @return FilterInterface A matching filter.
[ "Returns", "a", "filter", "matching", "the", "provided", "configuration", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Filter/FilterFactory.php#L18-L26
wsdl2phpgenerator/wsdl2phpgenerator
src/Service.php
Service.getOperation
public function getOperation($operationName) { return isset($this->operations[$operationName])? $this->operations[$operationName]: null; }
php
public function getOperation($operationName) { return isset($this->operations[$operationName])? $this->operations[$operationName]: null; }
[ "public", "function", "getOperation", "(", "$", "operationName", ")", "{", "return", "isset", "(", "$", "this", "->", "operations", "[", "$", "operationName", "]", ")", "?", "$", "this", "->", "operations", "[", "$", "operationName", "]", ":", "null", ";...
Returns an operation provided by the service based on its name. @param string $operationName The name of the operation. @return Operation|null The operation or null if it does not exist.
[ "Returns", "an", "operation", "provided", "by", "the", "service", "based", "on", "its", "name", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Service.php#L91-L94
wsdl2phpgenerator/wsdl2phpgenerator
src/Service.php
Service.getType
public function getType($identifier) { return isset($this->types[$identifier])? $this->types[$identifier]: null; }
php
public function getType($identifier) { return isset($this->types[$identifier])? $this->types[$identifier]: null; }
[ "public", "function", "getType", "(", "$", "identifier", ")", "{", "return", "isset", "(", "$", "this", "->", "types", "[", "$", "identifier", "]", ")", "?", "$", "this", "->", "types", "[", "$", "identifier", "]", ":", "null", ";", "}" ]
Returns a type used by the service based on its name. @param string $identifier The identifier for the type. @return Type|null The type or null if the type does not exist.
[ "Returns", "a", "type", "used", "by", "the", "service", "based", "on", "its", "name", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Service.php#L123-L126
wsdl2phpgenerator/wsdl2phpgenerator
src/Service.php
Service.generateClass
public function generateClass() { $name = $this->identifier; // Generate a valid classname $name = Validator::validateClass($name, $this->config->get('namespaceName')); // uppercase the name $name = ucfirst($name); // Create the class object $comment = new ...
php
public function generateClass() { $name = $this->identifier; // Generate a valid classname $name = Validator::validateClass($name, $this->config->get('namespaceName')); // uppercase the name $name = ucfirst($name); // Create the class object $comment = new ...
[ "public", "function", "generateClass", "(", ")", "{", "$", "name", "=", "$", "this", "->", "identifier", ";", "// Generate a valid classname", "$", "name", "=", "Validator", "::", "validateClass", "(", "$", "name", ",", "$", "this", "->", "config", "->", "...
Generates the class if not already generated
[ "Generates", "the", "class", "if", "not", "already", "generated" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Service.php#L140-L214
wsdl2phpgenerator/wsdl2phpgenerator
src/Filter/ServiceOperationFilter.php
ServiceOperationFilter.findUsedTypes
private function findUsedTypes($service, Type $type) { if ($type instanceof Enum) { return array($type); } if (!$type instanceof ComplexType) { return array(); } $foundTypes = array($type); // Process Base type $baseType = $type->getB...
php
private function findUsedTypes($service, Type $type) { if ($type instanceof Enum) { return array($type); } if (!$type instanceof ComplexType) { return array(); } $foundTypes = array($type); // Process Base type $baseType = $type->getB...
[ "private", "function", "findUsedTypes", "(", "$", "service", ",", "Type", "$", "type", ")", "{", "if", "(", "$", "type", "instanceof", "Enum", ")", "{", "return", "array", "(", "$", "type", ")", ";", "}", "if", "(", "!", "$", "type", "instanceof", ...
Function to find all needed types. @param Service $service Source service with all types and operations @param Type $type Type to extract types from. @return Type[] All identified types referred to including the current type.
[ "Function", "to", "find", "all", "needed", "types", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Filter/ServiceOperationFilter.php#L93-L124
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpDocElement.php
PhpDocElement.getSource
public function getSource() { $ret = ' * '; $ret .= '@' . $this->type; if (strlen($this->datatype) > 0) { $ret .= ' ' . $this->datatype; } if (strlen($this->variableName) > 0) { $ret .= ' $' . $this->variableName; } if (strlen($this...
php
public function getSource() { $ret = ' * '; $ret .= '@' . $this->type; if (strlen($this->datatype) > 0) { $ret .= ' ' . $this->datatype; } if (strlen($this->variableName) > 0) { $ret .= ' $' . $this->variableName; } if (strlen($this...
[ "public", "function", "getSource", "(", ")", "{", "$", "ret", "=", "' * '", ";", "$", "ret", ".=", "'@'", ".", "$", "this", "->", "type", ";", "if", "(", "strlen", "(", "$", "this", "->", "datatype", ")", ">", "0", ")", "{", "$", "ret", ".=", ...
Returns the whole row of generated comment source @access public @return string
[ "Returns", "the", "whole", "row", "of", "generated", "comment", "source" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpDocElement.php#L61-L82
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpElement.php
PhpElement.getSourceRow
public function getSourceRow($source) { if (strpos($source, PHP_EOL) === false) { return $this->indentionStr . $source . PHP_EOL; } $ret = ''; $rows = explode(PHP_EOL, $source); if (strlen(trim($rows[0])) == 0) { $rows = array_splice($rows, 1); ...
php
public function getSourceRow($source) { if (strpos($source, PHP_EOL) === false) { return $this->indentionStr . $source . PHP_EOL; } $ret = ''; $rows = explode(PHP_EOL, $source); if (strlen(trim($rows[0])) == 0) { $rows = array_splice($rows, 1); ...
[ "public", "function", "getSourceRow", "(", "$", "source", ")", "{", "if", "(", "strpos", "(", "$", "source", ",", "PHP_EOL", ")", "===", "false", ")", "{", "return", "$", "this", "->", "indentionStr", ".", "$", "source", ".", "PHP_EOL", ";", "}", "$"...
Takes a string and prepends ith with the current indention string Has support for multiple lines @param string $source @return string
[ "Takes", "a", "string", "and", "prepends", "ith", "with", "the", "current", "indention", "string", "Has", "support", "for", "multiple", "lines" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpElement.php#L87-L106
wsdl2phpgenerator/wsdl2phpgenerator
src/Config.php
Config.get
public function get($key) { if (!array_key_exists($key, $this->options)) { throw new InvalidArgumentException(sprintf('The key %s does not exist.', $key)); } return $this->options[$key]; }
php
public function get($key) { if (!array_key_exists($key, $this->options)) { throw new InvalidArgumentException(sprintf('The key %s does not exist.', $key)); } return $this->options[$key]; }
[ "public", "function", "get", "(", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "options", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'The key %s does not exist.'", ...
Get a value from the configuration by key. @param $key @return mixed @throws \InvalidArgumentException
[ "Get", "a", "value", "from", "the", "configuration", "by", "key", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Config.php#L39-L46
wsdl2phpgenerator/wsdl2phpgenerator
src/Config.php
Config.normalizeSoapClientOptions
protected function normalizeSoapClientOptions(Options $options, array $value) { // The SOAP_SINGLE_ELEMENT_ARRAYS feature should be enabled by default if no other option has been set // explicitly while leaving this out. This cannot be handled in the defaults as soapClientOptions is a // nes...
php
protected function normalizeSoapClientOptions(Options $options, array $value) { // The SOAP_SINGLE_ELEMENT_ARRAYS feature should be enabled by default if no other option has been set // explicitly while leaving this out. This cannot be handled in the defaults as soapClientOptions is a // nes...
[ "protected", "function", "normalizeSoapClientOptions", "(", "Options", "$", "options", ",", "array", "$", "value", ")", "{", "// The SOAP_SINGLE_ELEMENT_ARRAYS feature should be enabled by default if no other option has been set", "// explicitly while leaving this out. This cannot be han...
Normalize the soapClientOptions configuration option. @see http://php.net/manual/en/soapclient.soapclient.php. @param Options $options @param array $value The value to be normalized. @return array An array of normalized values.
[ "Normalize", "the", "soapClientOptions", "configuration", "option", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Config.php#L133-L150
wsdl2phpgenerator/wsdl2phpgenerator
src/Config.php
Config.normalizeProxy
protected function normalizeProxy(Options $options, $value) { if (!$value) { // proxy setting is optional return false; } if (is_string($value)) { $url_parts = parse_url($value); if ($url_parts === false) { throw new InvalidOpti...
php
protected function normalizeProxy(Options $options, $value) { if (!$value) { // proxy setting is optional return false; } if (is_string($value)) { $url_parts = parse_url($value); if ($url_parts === false) { throw new InvalidOpti...
[ "protected", "function", "normalizeProxy", "(", "Options", "$", "options", ",", "$", "value", ")", "{", "if", "(", "!", "$", "value", ")", "{", "// proxy setting is optional", "return", "false", ";", "}", "if", "(", "is_string", "(", "$", "value", ")", "...
Normalize the proxy configuration option. The normalized value is an array with the following keys: - proxy_host - proxy_port - proxy_login (optional) - proxy_password (optional) @param Options $options @param string|array $value The value to be normalized @return array|bool The normalized value.
[ "Normalize", "the", "proxy", "configuration", "option", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Config.php#L166-L214
wsdl2phpgenerator/wsdl2phpgenerator
src/Validator.php
Validator.validateClass
public static function validateClass($name, $namespace = null) { $name = self::validateNamingConvention($name); $prefix = !empty($namespace) ? $namespace . '\\' : ''; $name = self::validateUnique($name, function ($name) use ($prefix) { // Use reflection to get access to pri...
php
public static function validateClass($name, $namespace = null) { $name = self::validateNamingConvention($name); $prefix = !empty($namespace) ? $namespace . '\\' : ''; $name = self::validateUnique($name, function ($name) use ($prefix) { // Use reflection to get access to pri...
[ "public", "static", "function", "validateClass", "(", "$", "name", ",", "$", "namespace", "=", "null", ")", "{", "$", "name", "=", "self", "::", "validateNamingConvention", "(", "$", "name", ")", ";", "$", "prefix", "=", "!", "empty", "(", "$", "namesp...
Validates a class name against PHP naming conventions and already defined classes. @param string $name the name of the class to test @param string $namespace the name of the namespace @return string The validated version of the submitted class name
[ "Validates", "a", "class", "name", "against", "PHP", "naming", "conventions", "and", "already", "defined", "classes", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Validator.php#L119-L137
wsdl2phpgenerator/wsdl2phpgenerator
src/Validator.php
Validator.validateOperation
public static function validateOperation($name) { $name = self::validateNamingConvention($name); if (self::isKeyword($name)) { $name = self::NAME_PREFIX . ucfirst($name); } return $name; }
php
public static function validateOperation($name) { $name = self::validateNamingConvention($name); if (self::isKeyword($name)) { $name = self::NAME_PREFIX . ucfirst($name); } return $name; }
[ "public", "static", "function", "validateOperation", "(", "$", "name", ")", "{", "$", "name", "=", "self", "::", "validateNamingConvention", "(", "$", "name", ")", ";", "if", "(", "self", "::", "isKeyword", "(", "$", "name", ")", ")", "{", "$", "name",...
Validates an operation name against PHP naming conventions. @param string $name the name of the operation to test @return string The validated version of the submitted operation name
[ "Validates", "an", "operation", "name", "against", "PHP", "naming", "conventions", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Validator.php#L145-L152
wsdl2phpgenerator/wsdl2phpgenerator
src/Validator.php
Validator.validateConstant
public static function validateConstant($name) { $name = self::validateNamingConvention($name); if (self::isKeyword($name)) { $name = self::NAME_PREFIX . ucfirst($name); } return $name; }
php
public static function validateConstant($name) { $name = self::validateNamingConvention($name); if (self::isKeyword($name)) { $name = self::NAME_PREFIX . ucfirst($name); } return $name; }
[ "public", "static", "function", "validateConstant", "(", "$", "name", ")", "{", "$", "name", "=", "self", "::", "validateNamingConvention", "(", "$", "name", ")", ";", "if", "(", "self", "::", "isKeyword", "(", "$", "name", ")", ")", "{", "$", "name", ...
Validates a constant name against PHP naming conventions. @param string $name the name of the constant to test @return string The validated version of the submitted constant name
[ "Validates", "a", "constant", "name", "against", "PHP", "naming", "conventions", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Validator.php#L173-L180
wsdl2phpgenerator/wsdl2phpgenerator
src/Validator.php
Validator.validateType
public static function validateType($typeName) { if (substr($typeName, -2) == "[]") { return self::validateNamingConvention(substr($typeName, 0, -2)) . "[]"; } switch (strtolower($typeName)) { case "int": case "integer": case "long": ...
php
public static function validateType($typeName) { if (substr($typeName, -2) == "[]") { return self::validateNamingConvention(substr($typeName, 0, -2)) . "[]"; } switch (strtolower($typeName)) { case "int": case "integer": case "long": ...
[ "public", "static", "function", "validateType", "(", "$", "typeName", ")", "{", "if", "(", "substr", "(", "$", "typeName", ",", "-", "2", ")", "==", "\"[]\"", ")", "{", "return", "self", "::", "validateNamingConvention", "(", "substr", "(", "$", "typeNam...
Validates a wsdl type against known PHP primitive types, or otherwise validates the namespace of the type to PHP naming conventions @param string $typeName the type to test @return string the validated version of the submitted type
[ "Validates", "a", "wsdl", "type", "against", "known", "PHP", "primitive", "types", "or", "otherwise", "validates", "the", "namespace", "of", "the", "type", "to", "PHP", "naming", "conventions" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Validator.php#L189-L236
wsdl2phpgenerator/wsdl2phpgenerator
src/Validator.php
Validator.validateTypeHint
public static function validateTypeHint($typeName) { $typeHint = null; // We currently only support type hints for arrays and DateTimes. // Going forward we could support it for generated types. The challenge here are enums as they are actually // strings and not class instances and...
php
public static function validateTypeHint($typeName) { $typeHint = null; // We currently only support type hints for arrays and DateTimes. // Going forward we could support it for generated types. The challenge here are enums as they are actually // strings and not class instances and...
[ "public", "static", "function", "validateTypeHint", "(", "$", "typeName", ")", "{", "$", "typeHint", "=", "null", ";", "// We currently only support type hints for arrays and DateTimes.", "// Going forward we could support it for generated types. The challenge here are enums as they ar...
Validates a type to be used as a method parameter type hint. @param string $typeName The name of the type to test. @return null|string Returns a valid type hint for the type or null if there is no valid type hint.
[ "Validates", "a", "type", "to", "be", "used", "as", "a", "method", "parameter", "type", "hint", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Validator.php#L244-L258
wsdl2phpgenerator/wsdl2phpgenerator
src/Validator.php
Validator.validateUnique
public static function validateUnique($name, $function, $suffix = null) { $i = 1; $newName = $name; while (!call_user_func($function, $newName)) { if (!$suffix) { $newName = $name . ($i + 1); } elseif ($i == 1) { $newName = $name . $suf...
php
public static function validateUnique($name, $function, $suffix = null) { $i = 1; $newName = $name; while (!call_user_func($function, $newName)) { if (!$suffix) { $newName = $name . ($i + 1); } elseif ($i == 1) { $newName = $name . $suf...
[ "public", "static", "function", "validateUnique", "(", "$", "name", ",", "$", "function", ",", "$", "suffix", "=", "null", ")", "{", "$", "i", "=", "1", ";", "$", "newName", "=", "$", "name", ";", "while", "(", "!", "call_user_func", "(", "$", "fun...
Validate that a name is unique. If a name is not unique then append a suffix and numbering. @param $name The name to test. @param callable $function A callback which should return true if the element is unique. Otherwise false. @param string $suffix A suffix to append between the name and numbering. @return string A ...
[ "Validate", "that", "a", "name", "is", "unique", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Validator.php#L270-L286
wsdl2phpgenerator/wsdl2phpgenerator
src/Validator.php
Validator.validateNamingConvention
private static function validateNamingConvention($name) { $name = iconv("UTF-8", "ASCII//TRANSLIT", $name); // Prepend the string a to names that begin with anything but a-z This is to make a valid name if (preg_match('/^[A-Za-z_]/', $name) == false) { $name = self::NAME_PREFIX ...
php
private static function validateNamingConvention($name) { $name = iconv("UTF-8", "ASCII//TRANSLIT", $name); // Prepend the string a to names that begin with anything but a-z This is to make a valid name if (preg_match('/^[A-Za-z_]/', $name) == false) { $name = self::NAME_PREFIX ...
[ "private", "static", "function", "validateNamingConvention", "(", "$", "name", ")", "{", "$", "name", "=", "iconv", "(", "\"UTF-8\"", ",", "\"ASCII//TRANSLIT\"", ",", "$", "name", ")", ";", "// Prepend the string a to names that begin with anything but a-z This is to make...
Validates a name against standard PHP naming conventions @param string $name the name to validate @return string the validated version of the submitted name
[ "Validates", "a", "name", "against", "standard", "PHP", "naming", "conventions" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Validator.php#L294-L304
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpClass.php
PhpClass.addDependency
public function addDependency($filename) { if (in_array($filename, $this->dependencies) == false) { $this->dependencies[] = $filename; } }
php
public function addDependency($filename) { if (in_array($filename, $this->dependencies) == false) { $this->dependencies[] = $filename; } }
[ "public", "function", "addDependency", "(", "$", "filename", ")", "{", "if", "(", "in_array", "(", "$", "filename", ",", "$", "this", "->", "dependencies", ")", "==", "false", ")", "{", "$", "this", "->", "dependencies", "[", "]", "=", "$", "filename",...
Adds a dependency to be loaded for the class to use Only adds it if it does not already exist @param string $filename
[ "Adds", "a", "dependency", "to", "be", "loaded", "for", "the", "class", "to", "use", "Only", "adds", "it", "if", "it", "does", "not", "already", "exist" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpClass.php#L202-L207
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpClass.php
PhpClass.addConstant
public function addConstant($value, $name = '') { if (strlen($value) == 0) { throw new Exception('No value supplied'); } // If no name is supplied use the value as name if (strlen($name) == 0) { if (is_string($value)) { $name = $value; ...
php
public function addConstant($value, $name = '') { if (strlen($value) == 0) { throw new Exception('No value supplied'); } // If no name is supplied use the value as name if (strlen($name) == 0) { if (is_string($value)) { $name = $value; ...
[ "public", "function", "addConstant", "(", "$", "value", ",", "$", "name", "=", "''", ")", "{", "if", "(", "strlen", "(", "$", "value", ")", "==", "0", ")", "{", "throw", "new", "Exception", "(", "'No value supplied'", ")", ";", "}", "// If no name is s...
Adds a constant to the class. If no name is supplied and the value is a string the value is used as name otherwise exception is raised @param mixed $value @param string $name @throws Exception
[ "Adds", "a", "constant", "to", "the", "class", ".", "If", "no", "name", "is", "supplied", "and", "the", "value", "is", "a", "string", "the", "value", "is", "used", "as", "name", "otherwise", "exception", "is", "raised" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpClass.php#L235-L255
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpClass.php
PhpClass.addVariable
public function addVariable(PhpVariable $variable) { if ($this->variableExists($variable->getIdentifier())) { throw new Exception('A variable of the name (' . $variable->getIdentifier() . ') does already exist.'); } $this->variables[$variable->getIdentifier()] = $variable; }
php
public function addVariable(PhpVariable $variable) { if ($this->variableExists($variable->getIdentifier())) { throw new Exception('A variable of the name (' . $variable->getIdentifier() . ') does already exist.'); } $this->variables[$variable->getIdentifier()] = $variable; }
[ "public", "function", "addVariable", "(", "PhpVariable", "$", "variable", ")", "{", "if", "(", "$", "this", "->", "variableExists", "(", "$", "variable", "->", "getIdentifier", "(", ")", ")", ")", "{", "throw", "new", "Exception", "(", "'A variable of the na...
Adds a variable to the class Throws Exception if the variable does already exist @param PhpVariable $variable The variable object to add @access public @throws Exception If the variable name already exists
[ "Adds", "a", "variable", "to", "the", "class", "Throws", "Exception", "if", "the", "variable", "does", "already", "exist" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpClass.php#L265-L272
wsdl2phpgenerator/wsdl2phpgenerator
src/Enum.php
Enum.generateClass
protected function generateClass() { if ($this->class != null) { throw new Exception("The class has already been generated"); } $this->class = new PhpClass($this->phpIdentifier, false); $first = true; $names = array(); foreach ($this->values as $value) ...
php
protected function generateClass() { if ($this->class != null) { throw new Exception("The class has already been generated"); } $this->class = new PhpClass($this->phpIdentifier, false); $first = true; $names = array(); foreach ($this->values as $value) ...
[ "protected", "function", "generateClass", "(", ")", "{", "if", "(", "$", "this", "->", "class", "!=", "null", ")", "{", "throw", "new", "Exception", "(", "\"The class has already been generated\"", ")", ";", "}", "$", "this", "->", "class", "=", "new", "Ph...
Implements the loading of the class object @throws Exception if the class is already generated(not null)
[ "Implements", "the", "loading", "of", "the", "class", "object" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Enum.php#L43-L69
wsdl2phpgenerator/wsdl2phpgenerator
src/Enum.php
Enum.addValue
public function addValue($value) { if ($this->datatype == 'string') { if (is_string($value) == false) { throw new InvalidArgumentException('The value(' . $value . ') is not string but the restriction demands it'); } } elseif ($this->datatype == 'integer') { ...
php
public function addValue($value) { if ($this->datatype == 'string') { if (is_string($value) == false) { throw new InvalidArgumentException('The value(' . $value . ') is not string but the restriction demands it'); } } elseif ($this->datatype == 'integer') { ...
[ "public", "function", "addValue", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "datatype", "==", "'string'", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", "==", "false", ")", "{", "throw", "new", "InvalidArgumentException", "(...
Adds the value, typechecks strings and integers. Otherwise it only checks so the value is not null @param mixed $value The value to add @throws InvalidArgumentException if the value doesn'nt fit in the restriction
[ "Adds", "the", "value", "typechecks", "strings", "and", "integers", ".", "Otherwise", "it", "only", "checks", "so", "the", "value", "is", "not", "null" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Enum.php#L78-L100
wsdl2phpgenerator/wsdl2phpgenerator
src/Enum.php
Enum.getValidValues
public function getValidValues() { $ret = ''; foreach ($this->values as $value) { $ret .= $value . ', '; } $ret = substr($ret, 0, -2); return $ret; }
php
public function getValidValues() { $ret = ''; foreach ($this->values as $value) { $ret .= $value . ', '; } $ret = substr($ret, 0, -2); return $ret; }
[ "public", "function", "getValidValues", "(", ")", "{", "$", "ret", "=", "''", ";", "foreach", "(", "$", "this", "->", "values", "as", "$", "value", ")", "{", "$", "ret", ".=", "$", "value", ".", "', '", ";", "}", "$", "ret", "=", "substr", "(", ...
Returns a comma separated list of all the possible values for the enum @return string
[ "Returns", "a", "comma", "separated", "list", "of", "all", "the", "possible", "values", "for", "the", "enum" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Enum.php#L107-L117
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/WsdlDocument.php
WsdlDocument.getTypes
public function getTypes() { $types = array(); $typeStrings = $this->soapClient->__getTypes(); foreach ($typeStrings as $typeString) { $type = new TypeNode($typeString); $element = $this->findTypeElement($type->getName()); if (!empty($element)) { ...
php
public function getTypes() { $types = array(); $typeStrings = $this->soapClient->__getTypes(); foreach ($typeStrings as $typeString) { $type = new TypeNode($typeString); $element = $this->findTypeElement($type->getName()); if (!empty($element)) { ...
[ "public", "function", "getTypes", "(", ")", "{", "$", "types", "=", "array", "(", ")", ";", "$", "typeStrings", "=", "$", "this", "->", "soapClient", "->", "__getTypes", "(", ")", ";", "foreach", "(", "$", "typeStrings", "as", "$", "typeString", ")", ...
Returns representations of all the data types used when working with the SOAP service. @return TypeNode[] Data types related to the service.
[ "Returns", "representations", "of", "all", "the", "data", "types", "used", "when", "working", "with", "the", "SOAP", "service", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/WsdlDocument.php#L57-L73
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/WsdlDocument.php
WsdlDocument.getService
public function getService() { $serviceNodes = $this->element->getElementsByTagName('service'); if ($serviceNodes->length > 0) { return new ServiceNode($this->document, $serviceNodes->item(0)); } return null; }
php
public function getService() { $serviceNodes = $this->element->getElementsByTagName('service'); if ($serviceNodes->length > 0) { return new ServiceNode($this->document, $serviceNodes->item(0)); } return null; }
[ "public", "function", "getService", "(", ")", "{", "$", "serviceNodes", "=", "$", "this", "->", "element", "->", "getElementsByTagName", "(", "'service'", ")", ";", "if", "(", "$", "serviceNodes", "->", "length", ">", "0", ")", "{", "return", "new", "Ser...
Returns a representation of the service described by the WSDL file. @return ServiceNode The service described by the WSDL.
[ "Returns", "a", "representation", "of", "the", "service", "described", "by", "the", "WSDL", "file", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/WsdlDocument.php#L80-L87
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/WsdlDocument.php
WsdlDocument.getOperations
public function getOperations() { $functions = array(); foreach ($this->soapClient->__getFunctions() as $functionString) { $function = new OperationNode($functionString); $functionNodes = $this->xpath('//wsdl:operation[@name=%s]', $function->getName()); if ($funct...
php
public function getOperations() { $functions = array(); foreach ($this->soapClient->__getFunctions() as $functionString) { $function = new OperationNode($functionString); $functionNodes = $this->xpath('//wsdl:operation[@name=%s]', $function->getName()); if ($funct...
[ "public", "function", "getOperations", "(", ")", "{", "$", "functions", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "soapClient", "->", "__getFunctions", "(", ")", "as", "$", "functionString", ")", "{", "$", "function", "=", "new", ...
Returns representations of all the operations exposed by the service. @return OperationNode[] The operations exposed by the service.
[ "Returns", "representations", "of", "all", "the", "operations", "exposed", "by", "the", "service", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/WsdlDocument.php#L94-L106
wsdl2phpgenerator/wsdl2phpgenerator
src/StreamContextFactory.php
StreamContextFactory.create
public function create(ConfigInterface $config) { $options = array(); $headers = array(); $proxy = $config->get('proxy'); if (is_array($proxy)) { $options = array( 'http' => array( 'proxy' => $proxy['proxy_host'] . ':' . $proxy['proxy_...
php
public function create(ConfigInterface $config) { $options = array(); $headers = array(); $proxy = $config->get('proxy'); if (is_array($proxy)) { $options = array( 'http' => array( 'proxy' => $proxy['proxy_host'] . ':' . $proxy['proxy_...
[ "public", "function", "create", "(", "ConfigInterface", "$", "config", ")", "{", "$", "options", "=", "array", "(", ")", ";", "$", "headers", "=", "array", "(", ")", ";", "$", "proxy", "=", "$", "config", "->", "get", "(", "'proxy'", ")", ";", "if"...
Creates a stream context based on the provided configuration. @param ConfigInterface $config The configuration. @return resource A stream context based on the provided configuration.
[ "Creates", "a", "stream", "context", "based", "on", "the", "provided", "configuration", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/StreamContextFactory.php#L19-L54
denpamusic/php-bitcoinrpc
src/Traits/Message.php
Message.withHeader
public function withHeader($name, $value) : self { $new = clone $this; return $new->setResponse($this->response->withHeader($name, $value)); }
php
public function withHeader($name, $value) : self { $new = clone $this; return $new->setResponse($this->response->withHeader($name, $value)); }
[ "public", "function", "withHeader", "(", "$", "name", ",", "$", "value", ")", ":", "self", "{", "$", "new", "=", "clone", "$", "this", ";", "return", "$", "new", "->", "setResponse", "(", "$", "this", "->", "response", "->", "withHeader", "(", "$", ...
Returns an instance with the provided value replacing the specified header. @param string $name @param string|array $value @return self
[ "Returns", "an", "instance", "with", "the", "provided", "value", "replacing", "the", "specified", "header", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Message.php#L91-L96
denpamusic/php-bitcoinrpc
src/Traits/Message.php
Message.withAddedHeader
public function withAddedHeader($name, $value) : self { $new = clone $this; return $new->setResponse($this->response->withAddedHeader($name, $value)); }
php
public function withAddedHeader($name, $value) : self { $new = clone $this; return $new->setResponse($this->response->withAddedHeader($name, $value)); }
[ "public", "function", "withAddedHeader", "(", "$", "name", ",", "$", "value", ")", ":", "self", "{", "$", "new", "=", "clone", "$", "this", ";", "return", "$", "new", "->", "setResponse", "(", "$", "this", "->", "response", "->", "withAddedHeader", "("...
Returns an instance with the specified header appended with the given value. @param string $name @param string|array $value @return self
[ "Returns", "an", "instance", "with", "the", "specified", "header", "appended", "with", "the", "given", "value", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Message.php#L106-L111
denpamusic/php-bitcoinrpc
src/Traits/Message.php
Message.withBody
public function withBody(StreamInterface $body) : self { $new = clone $this; return $new->setResponse($this->response->withBody($body)); }
php
public function withBody(StreamInterface $body) : self { $new = clone $this; return $new->setResponse($this->response->withBody($body)); }
[ "public", "function", "withBody", "(", "StreamInterface", "$", "body", ")", ":", "self", "{", "$", "new", "=", "clone", "$", "this", ";", "return", "$", "new", "->", "setResponse", "(", "$", "this", "->", "response", "->", "withBody", "(", "$", "body",...
Returns an instance with the specified message body. @param \Psr\Http\Message\StreamInterface $body @return self
[ "Returns", "an", "instance", "with", "the", "specified", "message", "body", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Message.php#L144-L149
denpamusic/php-bitcoinrpc
src/Traits/HandlesAsync.php
HandlesAsync.onSuccess
protected function onSuccess(ResponseInterface $response, ?callable $callback = null) : void { if (!is_null($callback)) { $callback($response); } }
php
protected function onSuccess(ResponseInterface $response, ?callable $callback = null) : void { if (!is_null($callback)) { $callback($response); } }
[ "protected", "function", "onSuccess", "(", "ResponseInterface", "$", "response", ",", "?", "callable", "$", "callback", "=", "null", ")", ":", "void", "{", "if", "(", "!", "is_null", "(", "$", "callback", ")", ")", "{", "$", "callback", "(", "$", "resp...
Handles async request success. @param \Psr\Http\Message\ResponseInterface $response @param callable|null $callback @return void
[ "Handles", "async", "request", "success", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/HandlesAsync.php#L20-L25
denpamusic/php-bitcoinrpc
src/Traits/HandlesAsync.php
HandlesAsync.onError
protected function onError(Exception $exception, ?callable $callback = null) : void { if (!is_null($callback)) { $callback($exception); } }
php
protected function onError(Exception $exception, ?callable $callback = null) : void { if (!is_null($callback)) { $callback($exception); } }
[ "protected", "function", "onError", "(", "Exception", "$", "exception", ",", "?", "callable", "$", "callback", "=", "null", ")", ":", "void", "{", "if", "(", "!", "is_null", "(", "$", "callback", ")", ")", "{", "$", "callback", "(", "$", "exception", ...
Handles async request failure. @param \Exception $exception @param callable|null $callback @return void
[ "Handles", "async", "request", "failure", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/HandlesAsync.php#L35-L40
denpamusic/php-bitcoinrpc
src/Exceptions/Handler.php
Handler.namespaceHandler
protected function namespaceHandler(Throwable $exception) : ?Throwable { if ($this->namespace && $exception instanceof ClientException) { return $exception->withNamespace($this->namespace); } return null; }
php
protected function namespaceHandler(Throwable $exception) : ?Throwable { if ($this->namespace && $exception instanceof ClientException) { return $exception->withNamespace($this->namespace); } return null; }
[ "protected", "function", "namespaceHandler", "(", "Throwable", "$", "exception", ")", ":", "?", "Throwable", "{", "if", "(", "$", "this", "->", "namespace", "&&", "$", "exception", "instanceof", "ClientException", ")", "{", "return", "$", "exception", "->", ...
Handle namespace change. @param \Throwable $exception @return \Throwable|null
[ "Handle", "namespace", "change", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Exceptions/Handler.php#L47-L54
denpamusic/php-bitcoinrpc
src/Exceptions/Handler.php
Handler.requestExceptionHandler
protected function requestExceptionHandler(Throwable $exception) : ?Throwable { if ($exception instanceof RequestException) { if ( $exception->hasResponse() && $exception->getResponse()->hasError() ) { return new BadRemoteCallException(...
php
protected function requestExceptionHandler(Throwable $exception) : ?Throwable { if ($exception instanceof RequestException) { if ( $exception->hasResponse() && $exception->getResponse()->hasError() ) { return new BadRemoteCallException(...
[ "protected", "function", "requestExceptionHandler", "(", "Throwable", "$", "exception", ")", ":", "?", "Throwable", "{", "if", "(", "$", "exception", "instanceof", "RequestException", ")", "{", "if", "(", "$", "exception", "->", "hasResponse", "(", ")", "&&", ...
Handle request exception. @param \Throwable $exception @return \Throwable|null
[ "Handle", "request", "exception", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Exceptions/Handler.php#L63-L81
denpamusic/php-bitcoinrpc
src/Exceptions/Handler.php
Handler.handle
public function handle(Throwable $exception) : void { foreach ($this->handlers as $handler) { $result = $handler($exception); if ($result instanceof Throwable) { $exception = $result; } } throw $exception; }
php
public function handle(Throwable $exception) : void { foreach ($this->handlers as $handler) { $result = $handler($exception); if ($result instanceof Throwable) { $exception = $result; } } throw $exception; }
[ "public", "function", "handle", "(", "Throwable", "$", "exception", ")", ":", "void", "{", "foreach", "(", "$", "this", "->", "handlers", "as", "$", "handler", ")", "{", "$", "result", "=", "$", "handler", "(", "$", "exception", ")", ";", "if", "(", ...
Handles exception. @param \Throwable $exception @return void
[ "Handles", "exception", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Exceptions/Handler.php#L104-L115
denpamusic/php-bitcoinrpc
src/Config.php
Config.getCa
public function getCa() : ?string { if (isset($this->config['ca']) && is_file($this->config['ca'])) { return $this->config['ca']; } return null; }
php
public function getCa() : ?string { if (isset($this->config['ca']) && is_file($this->config['ca'])) { return $this->config['ca']; } return null; }
[ "public", "function", "getCa", "(", ")", ":", "?", "string", "{", "if", "(", "isset", "(", "$", "this", "->", "config", "[", "'ca'", "]", ")", "&&", "is_file", "(", "$", "this", "->", "config", "[", "'ca'", "]", ")", ")", "{", "return", "$", "t...
Gets CA file from config. @return string|null
[ "Gets", "CA", "file", "from", "config", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Config.php#L46-L53
denpamusic/php-bitcoinrpc
src/Config.php
Config.getDsn
public function getDsn() : string { $scheme = $this->config['scheme'] ?? 'http'; return $scheme.'://'. $this->config['host'].':'. $this->config['port']; }
php
public function getDsn() : string { $scheme = $this->config['scheme'] ?? 'http'; return $scheme.'://'. $this->config['host'].':'. $this->config['port']; }
[ "public", "function", "getDsn", "(", ")", ":", "string", "{", "$", "scheme", "=", "$", "this", "->", "config", "[", "'scheme'", "]", "??", "'http'", ";", "return", "$", "scheme", ".", "'://'", ".", "$", "this", "->", "config", "[", "'host'", "]", "...
Gets DSN string. @return string
[ "Gets", "DSN", "string", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Config.php#L73-L80
denpamusic/php-bitcoinrpc
src/Config.php
Config.set
public function set(array $config = []) : self { // use same var name as laravel-bitcoinrpc $config['password'] = $config['password'] ?? $config['pass'] ?? null; if (is_null($config['password'])) { // use default value from getDefaultConfig() unset($config['password'...
php
public function set(array $config = []) : self { // use same var name as laravel-bitcoinrpc $config['password'] = $config['password'] ?? $config['pass'] ?? null; if (is_null($config['password'])) { // use default value from getDefaultConfig() unset($config['password'...
[ "public", "function", "set", "(", "array", "$", "config", "=", "[", "]", ")", ":", "self", "{", "// use same var name as laravel-bitcoinrpc", "$", "config", "[", "'password'", "]", "=", "$", "config", "[", "'password'", "]", "??", "$", "config", "[", "'pas...
Merge config. @param array $config @return self
[ "Merge", "config", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Config.php#L89-L102
denpamusic/php-bitcoinrpc
src/Client.php
Client.request
public function request(string $method, ...$params) : ResponseInterface { try { $response = $this->client ->post($this->path, $this->makeJson($method, $params)); if ($response->hasError()) { // throw exception on error throw new BadRem...
php
public function request(string $method, ...$params) : ResponseInterface { try { $response = $this->client ->post($this->path, $this->makeJson($method, $params)); if ($response->hasError()) { // throw exception on error throw new BadRem...
[ "public", "function", "request", "(", "string", "$", "method", ",", "...", "$", "params", ")", ":", "ResponseInterface", "{", "try", "{", "$", "response", "=", "$", "this", "->", "client", "->", "post", "(", "$", "this", "->", "path", ",", "$", "this...
Makes request to Bitcoin Core. @param string $method @param mixed $params @return \Psr\Http\Message\ResponseInterface
[ "Makes", "request", "to", "Bitcoin", "Core", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Client.php#L148-L163
denpamusic/php-bitcoinrpc
src/Client.php
Client.requestAsync
public function requestAsync( string $method, $params = [], ?callable $fulfilled = null, ?callable $rejected = null) : Promise\Promise { $promise = $this->client ->postAsync($this->path, $this->makeJson($method, $params)); $promise->then(function ($respon...
php
public function requestAsync( string $method, $params = [], ?callable $fulfilled = null, ?callable $rejected = null) : Promise\Promise { $promise = $this->client ->postAsync($this->path, $this->makeJson($method, $params)); $promise->then(function ($respon...
[ "public", "function", "requestAsync", "(", "string", "$", "method", ",", "$", "params", "=", "[", "]", ",", "?", "callable", "$", "fulfilled", "=", "null", ",", "?", "callable", "$", "rejected", "=", "null", ")", ":", "Promise", "\\", "Promise", "{", ...
Makes async request to Bitcoin Core. @param string $method @param mixed $params @param callable|null $fulfilled @param callable|null $rejected @return \GuzzleHttp\Promise\Promise
[ "Makes", "async", "request", "to", "Bitcoin", "Core", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Client.php#L175-L199
denpamusic/php-bitcoinrpc
src/Client.php
Client.wait
public function wait() : void { if (!empty($this->promises)) { Promise\settle($this->promises)->wait(); } }
php
public function wait() : void { if (!empty($this->promises)) { Promise\settle($this->promises)->wait(); } }
[ "public", "function", "wait", "(", ")", ":", "void", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "promises", ")", ")", "{", "Promise", "\\", "settle", "(", "$", "this", "->", "promises", ")", "->", "wait", "(", ")", ";", "}", "}" ]
Settle all promises. @return void
[ "Settle", "all", "promises", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Client.php#L206-L211
denpamusic/php-bitcoinrpc
src/Client.php
Client.getHandler
protected function getHandler() : HandlerStack { $stack = HandlerStack::create(); $stack->push( Middleware::mapResponse(function (ResponseInterface $response) { $handler = $this->getResponseHandler(); return new $handler($response); }), ...
php
protected function getHandler() : HandlerStack { $stack = HandlerStack::create(); $stack->push( Middleware::mapResponse(function (ResponseInterface $response) { $handler = $this->getResponseHandler(); return new $handler($response); }), ...
[ "protected", "function", "getHandler", "(", ")", ":", "HandlerStack", "{", "$", "stack", "=", "HandlerStack", "::", "create", "(", ")", ";", "$", "stack", "->", "push", "(", "Middleware", "::", "mapResponse", "(", "function", "(", "ResponseInterface", "$", ...
Gets Guzzle handler stack. @return \GuzzleHttp\HandlerStack
[ "Gets", "Guzzle", "handler", "stack", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Client.php#L255-L269
denpamusic/php-bitcoinrpc
src/Client.php
Client.makeJson
protected function makeJson(string $method, $params = []) : array { return [ 'json' => [ 'method' => $this->config['preserve_case'] ? $method : strtolower($method), 'params' => (array) $params, 'id' => $this->rpcId++, ...
php
protected function makeJson(string $method, $params = []) : array { return [ 'json' => [ 'method' => $this->config['preserve_case'] ? $method : strtolower($method), 'params' => (array) $params, 'id' => $this->rpcId++, ...
[ "protected", "function", "makeJson", "(", "string", "$", "method", ",", "$", "params", "=", "[", "]", ")", ":", "array", "{", "return", "[", "'json'", "=>", "[", "'method'", "=>", "$", "this", "->", "config", "[", "'preserve_case'", "]", "?", "$", "m...
Construct json request. @param string $method @param mixed $params @return array
[ "Construct", "json", "request", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Client.php#L279-L289
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.get
public function get(?string $key = null) { $key = $this->constructKey($key); if (is_null($key)) { $array = $this->toArray(); return $this->count() == 1 ? end($array) : $array; } return $this->parseKey($key, function ($part, $result) { if (isset(...
php
public function get(?string $key = null) { $key = $this->constructKey($key); if (is_null($key)) { $array = $this->toArray(); return $this->count() == 1 ? end($array) : $array; } return $this->parseKey($key, function ($part, $result) { if (isset(...
[ "public", "function", "get", "(", "?", "string", "$", "key", "=", "null", ")", "{", "$", "key", "=", "$", "this", "->", "constructKey", "(", "$", "key", ")", ";", "if", "(", "is_null", "(", "$", "key", ")", ")", "{", "$", "array", "=", "$", "...
Gets data by using key with dotted notation. @param string|null $key @return mixed
[ "Gets", "data", "by", "using", "key", "with", "dotted", "notation", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L25-L40
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.exists
public function exists(?string $key = null) : bool { $key = $this->constructKey($key); return $this->parseKey($key, function ($part, $result) { return array_key_exists($part, $result); }); }
php
public function exists(?string $key = null) : bool { $key = $this->constructKey($key); return $this->parseKey($key, function ($part, $result) { return array_key_exists($part, $result); }); }
[ "public", "function", "exists", "(", "?", "string", "$", "key", "=", "null", ")", ":", "bool", "{", "$", "key", "=", "$", "this", "->", "constructKey", "(", "$", "key", ")", ";", "return", "$", "this", "->", "parseKey", "(", "$", "key", ",", "fun...
Checks if key exists. @param string|null $key @return bool
[ "Checks", "if", "key", "exists", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L49-L56
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.has
public function has(?string $key = null) : bool { $key = $this->constructKey($key); return $this->parseKey($key, function ($part, $result) { return isset($result[$part]); }); }
php
public function has(?string $key = null) : bool { $key = $this->constructKey($key); return $this->parseKey($key, function ($part, $result) { return isset($result[$part]); }); }
[ "public", "function", "has", "(", "?", "string", "$", "key", "=", "null", ")", ":", "bool", "{", "$", "key", "=", "$", "this", "->", "constructKey", "(", "$", "key", ")", ";", "return", "$", "this", "->", "parseKey", "(", "$", "key", ",", "functi...
Checks if key exists and not null. @param string|null $key @return bool
[ "Checks", "if", "key", "exists", "and", "not", "null", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L65-L72
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.first
public function first(?string $key = null) { $value = $this->get($key); if (is_array($value)) { return reset($value); } return $value; }
php
public function first(?string $key = null) { $value = $this->get($key); if (is_array($value)) { return reset($value); } return $value; }
[ "public", "function", "first", "(", "?", "string", "$", "key", "=", "null", ")", "{", "$", "value", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "return", "reset", "(", "$", ...
Gets first element. @param string|null $key @return mixed
[ "Gets", "first", "element", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L81-L90
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.last
public function last(?string $key = null) { $value = $this->get($key); if (is_array($value)) { return end($value); } return $value; }
php
public function last(?string $key = null) { $value = $this->get($key); if (is_array($value)) { return end($value); } return $value; }
[ "public", "function", "last", "(", "?", "string", "$", "key", "=", "null", ")", "{", "$", "value", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "return", "end", "(", "$", "...
Gets last element. @param string|null $key @return mixed
[ "Gets", "last", "element", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L99-L108
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.contains
public function contains($needle, ?string $key = null) : bool { $value = $this->get($key); if (!is_array($value)) { throw new InvalidArgumentException( 'method contains() should be called on array' ); } return in_array($needle, $value); }
php
public function contains($needle, ?string $key = null) : bool { $value = $this->get($key); if (!is_array($value)) { throw new InvalidArgumentException( 'method contains() should be called on array' ); } return in_array($needle, $value); }
[ "public", "function", "contains", "(", "$", "needle", ",", "?", "string", "$", "key", "=", "null", ")", ":", "bool", "{", "$", "value", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "!", "is_array", "(", "$", "value", ")"...
Checks if response contains value. @param mixed $needle @param string|null $key @return bool
[ "Checks", "if", "response", "contains", "value", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L118-L129
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.keys
public function keys(?string $key = null) : array { $value = $this->get($key); if (!is_array($value)) { throw new InvalidArgumentException( 'method keys() should be called on array' ); } return array_keys($value); }
php
public function keys(?string $key = null) : array { $value = $this->get($key); if (!is_array($value)) { throw new InvalidArgumentException( 'method keys() should be called on array' ); } return array_keys($value); }
[ "public", "function", "keys", "(", "?", "string", "$", "key", "=", "null", ")", ":", "array", "{", "$", "value", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "!", "is_array", "(", "$", "value", ")", ")", "{", "throw", ...
Gets response keys. @param string|null $key @return array
[ "Gets", "response", "keys", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L153-L164
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.values
public function values(?string $key = null) : array { $value = $this->get($key); if (!is_array($value)) { throw new InvalidArgumentException( 'method values() should be called on array' ); } return array_values($value); }
php
public function values(?string $key = null) : array { $value = $this->get($key); if (!is_array($value)) { throw new InvalidArgumentException( 'method values() should be called on array' ); } return array_values($value); }
[ "public", "function", "values", "(", "?", "string", "$", "key", "=", "null", ")", ":", "array", "{", "$", "value", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "!", "is_array", "(", "$", "value", ")", ")", "{", "throw", ...
Gets response values. @param string|null $key @return array
[ "Gets", "response", "values", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L173-L184
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.random
public function random(int $number = 1, ?string $key = null) { $value = $this->get($key); if (is_array($value)) { $keys = array_keys($value); $keysLength = count($keys); shuffle($keys); if ($number > $keysLength) { $number = $keysLen...
php
public function random(int $number = 1, ?string $key = null) { $value = $this->get($key); if (is_array($value)) { $keys = array_keys($value); $keysLength = count($keys); shuffle($keys); if ($number > $keysLength) { $number = $keysLen...
[ "public", "function", "random", "(", "int", "$", "number", "=", "1", ",", "?", "string", "$", "key", "=", "null", ")", "{", "$", "value", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "if", "(", "is_array", "(", "$", "value", ")", ...
Gets random value. @param int $number @param string|null $key @return mixed
[ "Gets", "random", "value", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L194-L216
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.count
public function count(?string $key = null) : int { if (is_null($this->constructKey($key))) { return count($this->toArray()); } $value = $this->get($key); if (!is_array($value)) { throw new InvalidArgumentException( 'method count() should be c...
php
public function count(?string $key = null) : int { if (is_null($this->constructKey($key))) { return count($this->toArray()); } $value = $this->get($key); if (!is_array($value)) { throw new InvalidArgumentException( 'method count() should be c...
[ "public", "function", "count", "(", "?", "string", "$", "key", "=", "null", ")", ":", "int", "{", "if", "(", "is_null", "(", "$", "this", "->", "constructKey", "(", "$", "key", ")", ")", ")", "{", "return", "count", "(", "$", "this", "->", "toArr...
Counts response items. @param string|null $key @return int
[ "Counts", "response", "items", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L225-L240
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.flatten
public function flatten(?string $key = null) : array { $array = new \RecursiveIteratorIterator( new \RecursiveArrayIterator((array) $this->get($key)) ); $tmp = []; foreach ($array as $value) { $tmp[] = $value; } return $tmp; }
php
public function flatten(?string $key = null) : array { $array = new \RecursiveIteratorIterator( new \RecursiveArrayIterator((array) $this->get($key)) ); $tmp = []; foreach ($array as $value) { $tmp[] = $value; } return $tmp; }
[ "public", "function", "flatten", "(", "?", "string", "$", "key", "=", "null", ")", ":", "array", "{", "$", "array", "=", "new", "\\", "RecursiveIteratorIterator", "(", "new", "\\", "RecursiveArrayIterator", "(", "(", "array", ")", "$", "this", "->", "get...
Flattens multi-dimensional array. @param string|null $key @return array
[ "Flattens", "multi", "-", "dimensional", "array", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L249-L261
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.constructKey
protected function constructKey(?string $key = null) : ?string { if (!is_null($key) && !is_null($this->current)) { return $this->current.'.'.$key; } if (is_null($key) && !is_null($this->current)) { return $this->current; } return $key; }
php
protected function constructKey(?string $key = null) : ?string { if (!is_null($key) && !is_null($this->current)) { return $this->current.'.'.$key; } if (is_null($key) && !is_null($this->current)) { return $this->current; } return $key; }
[ "protected", "function", "constructKey", "(", "?", "string", "$", "key", "=", "null", ")", ":", "?", "string", "{", "if", "(", "!", "is_null", "(", "$", "key", ")", "&&", "!", "is_null", "(", "$", "this", "->", "current", ")", ")", "{", "return", ...
Constructs full key. @param string|null $key @return string|null
[ "Constructs", "full", "key", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L310-L321
denpamusic/php-bitcoinrpc
src/Traits/Collection.php
Collection.parseKey
protected function parseKey($key, callable $callback, ?array $result = null) { $parts = is_array($key) ? $key : explode('.', trim($key, '.')); $result = $result ?: $this->toArray(); while (!is_null($part = array_shift($parts))) { if ($part == '*') { array_walk($r...
php
protected function parseKey($key, callable $callback, ?array $result = null) { $parts = is_array($key) ? $key : explode('.', trim($key, '.')); $result = $result ?: $this->toArray(); while (!is_null($part = array_shift($parts))) { if ($part == '*') { array_walk($r...
[ "protected", "function", "parseKey", "(", "$", "key", ",", "callable", "$", "callback", ",", "?", "array", "$", "result", "=", "null", ")", "{", "$", "parts", "=", "is_array", "(", "$", "key", ")", "?", "$", "key", ":", "explode", "(", "'.'", ",", ...
Parses dotted notation. @param array|string $key @param callable $callback @param array|null $result @return mixed
[ "Parses", "dotted", "notation", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Traits/Collection.php#L332-L354
denpamusic/php-bitcoinrpc
src/Responses/Response.php
Response.withStatus
public function withStatus($code, $reasonPhrase = '') : self { $new = clone $this; return $new->setResponse( $this->response->withStatus($code, $reasonPhrase) ); }
php
public function withStatus($code, $reasonPhrase = '') : self { $new = clone $this; return $new->setResponse( $this->response->withStatus($code, $reasonPhrase) ); }
[ "public", "function", "withStatus", "(", "$", "code", ",", "$", "reasonPhrase", "=", "''", ")", ":", "self", "{", "$", "new", "=", "clone", "$", "this", ";", "return", "$", "new", "->", "setResponse", "(", "$", "this", "->", "response", "->", "withSt...
Return an instance with the specified status code and, optionally, reason phrase. @param int $code @param string $reasonPhrase @return self
[ "Return", "an", "instance", "with", "the", "specified", "status", "code", "and", "optionally", "reason", "phrase", "." ]
train
https://github.com/denpamusic/php-bitcoinrpc/blob/bcee1d141196e196d0a274bab9feb3a28c9e4f9f/src/Responses/Response.php#L123-L130
superv/platform
src/Domains/Addon/Installer.php
Installer.install
public function install() { $this->ensureNotInstalledBefore(); if ($this->locator) { $this->path = $this->locator->locate($this->slug); } $this->validate(); $this->make(); $this->register(); $this->migrate(); $this->installSubAddons()...
php
public function install() { $this->ensureNotInstalledBefore(); if ($this->locator) { $this->path = $this->locator->locate($this->slug); } $this->validate(); $this->make(); $this->register(); $this->migrate(); $this->installSubAddons()...
[ "public", "function", "install", "(", ")", "{", "$", "this", "->", "ensureNotInstalledBefore", "(", ")", ";", "if", "(", "$", "this", "->", "locator", ")", "{", "$", "this", "->", "path", "=", "$", "this", "->", "locator", "->", "locate", "(", "$", ...
Install addon @throws \SuperV\Platform\Exceptions\PathNotFoundException
[ "Install", "addon" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Addon/Installer.php#L54-L75
superv/platform
src/Domains/Addon/Installer.php
Installer.validate
protected function validate() { $realPath = $this->realPath(); if (! $realPath) { throw new \InvalidArgumentException("Path can not be empty"); } if (! file_exists($realPath)) { throw new PathNotFoundException("Path does not exist: [{$realPath}]"); }...
php
protected function validate() { $realPath = $this->realPath(); if (! $realPath) { throw new \InvalidArgumentException("Path can not be empty"); } if (! file_exists($realPath)) { throw new PathNotFoundException("Path does not exist: [{$realPath}]"); }...
[ "protected", "function", "validate", "(", ")", "{", "$", "realPath", "=", "$", "this", "->", "realPath", "(", ")", ";", "if", "(", "!", "$", "realPath", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Path can not be empty\"", ")", ";",...
Validate addon parameters
[ "Validate", "addon", "parameters" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Addon/Installer.php#L179-L198
superv/platform
src/Domains/Addon/Installer.php
Installer.make
protected function make() { $entry = AddonModel::query()->create([ 'name' => $this->name(), 'vendor' => $this->vendor(), 'slug' => $this->slug, 'path' => $this->relativePath(), 'type' => $this->type(), 'namespace'...
php
protected function make() { $entry = AddonModel::query()->create([ 'name' => $this->name(), 'vendor' => $this->vendor(), 'slug' => $this->slug, 'path' => $this->relativePath(), 'type' => $this->type(), 'namespace'...
[ "protected", "function", "make", "(", ")", "{", "$", "entry", "=", "AddonModel", "::", "query", "(", ")", "->", "create", "(", "[", "'name'", "=>", "$", "this", "->", "name", "(", ")", ",", "'vendor'", "=>", "$", "this", "->", "vendor", "(", ")", ...
Make addon entry
[ "Make", "addon", "entry" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Addon/Installer.php#L203-L217
superv/platform
src/Domains/Addon/Installer.php
Installer.migrate
protected function migrate() { $this->console->call( 'migrate', ['--scope' => $this->addon->slug(), '--force' => true], $this->command ? $this->command->getOutput() : null ); }
php
protected function migrate() { $this->console->call( 'migrate', ['--scope' => $this->addon->slug(), '--force' => true], $this->command ? $this->command->getOutput() : null ); }
[ "protected", "function", "migrate", "(", ")", "{", "$", "this", "->", "console", "->", "call", "(", "'migrate'", ",", "[", "'--scope'", "=>", "$", "this", "->", "addon", "->", "slug", "(", ")", ",", "'--force'", "=>", "true", "]", ",", "$", "this", ...
Migrate addon migrations
[ "Migrate", "addon", "migrations" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Addon/Installer.php#L230-L237
superv/platform
src/Domains/Addon/Installer.php
Installer.installSubAddons
protected function installSubAddons() { if ($subAddons = $this->addon->installs()) { foreach ($subAddons as $slug => $path) { app(self::class)->setSlug($slug) ->setPath($this->path.'/'.$path) ->install(); ...
php
protected function installSubAddons() { if ($subAddons = $this->addon->installs()) { foreach ($subAddons as $slug => $path) { app(self::class)->setSlug($slug) ->setPath($this->path.'/'.$path) ->install(); ...
[ "protected", "function", "installSubAddons", "(", ")", "{", "if", "(", "$", "subAddons", "=", "$", "this", "->", "addon", "->", "installs", "(", ")", ")", "{", "foreach", "(", "$", "subAddons", "as", "$", "slug", "=>", "$", "path", ")", "{", "app", ...
Install sub addons
[ "Install", "sub", "addons" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Addon/Installer.php#L242-L251
superv/platform
src/Domains/Addon/Installer.php
Installer.composer
protected function composer($key = null) { if (! $this->composerJson) { $composerFile = $this->realPath().'/composer.json'; if (! file_exists($composerFile)) { return null; } $this->composerJson = json_decode(file_get_contents($composerFile), t...
php
protected function composer($key = null) { if (! $this->composerJson) { $composerFile = $this->realPath().'/composer.json'; if (! file_exists($composerFile)) { return null; } $this->composerJson = json_decode(file_get_contents($composerFile), t...
[ "protected", "function", "composer", "(", "$", "key", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "composerJson", ")", "{", "$", "composerFile", "=", "$", "this", "->", "realPath", "(", ")", ".", "'/composer.json'", ";", "if", "(", "!",...
Load composer config from addon path @param null $key @return array|string
[ "Load", "composer", "config", "from", "addon", "path" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Addon/Installer.php#L259-L270
superv/platform
src/Domains/Routing/UrlGenerator.php
UrlGenerator.current
public function current() { $port = Current::port(); if (! $port || ! $prefix = $port->prefix()) { return $this->to($this->request->getPathInfo()); } return $this->to($this->getPathInfo()); }
php
public function current() { $port = Current::port(); if (! $port || ! $prefix = $port->prefix()) { return $this->to($this->request->getPathInfo()); } return $this->to($this->getPathInfo()); }
[ "public", "function", "current", "(", ")", "{", "$", "port", "=", "Current", "::", "port", "(", ")", ";", "if", "(", "!", "$", "port", "||", "!", "$", "prefix", "=", "$", "port", "->", "prefix", "(", ")", ")", "{", "return", "$", "this", "->", ...
Get the current URL for the request. @return string
[ "Get", "the", "current", "URL", "for", "the", "request", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Routing/UrlGenerator.php#L14-L22
superv/platform
src/Domains/Routing/UrlGenerator.php
UrlGenerator.formatRoot
public function formatRoot($scheme, $root = null) { if (is_null($root)) { if (is_null($this->cachedRoot)) { $this->cachedRoot = $this->forcedRoot ?: $this->getRequestRoot(); } $root = $this->cachedRoot; } return parent::formatRoot($scheme...
php
public function formatRoot($scheme, $root = null) { if (is_null($root)) { if (is_null($this->cachedRoot)) { $this->cachedRoot = $this->forcedRoot ?: $this->getRequestRoot(); } $root = $this->cachedRoot; } return parent::formatRoot($scheme...
[ "public", "function", "formatRoot", "(", "$", "scheme", ",", "$", "root", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "root", ")", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "cachedRoot", ")", ")", "{", "$", "this", "->", ...
Get the base URL for the request. @param string $scheme @param string $root @return string
[ "Get", "the", "base", "URL", "for", "the", "request", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Routing/UrlGenerator.php#L31-L42
superv/platform
src/Domains/Auth/UserRegistrar.php
UserRegistrar.create
protected function create() { $this->user = app(\SuperV\Platform\Domains\Auth\Contracts\User::class)->create([ 'name' => $this->request['name'], 'email' => $this->request['email'], 'password' => bcrypt($this->request['password']), ]); return $this; ...
php
protected function create() { $this->user = app(\SuperV\Platform\Domains\Auth\Contracts\User::class)->create([ 'name' => $this->request['name'], 'email' => $this->request['email'], 'password' => bcrypt($this->request['password']), ]); return $this; ...
[ "protected", "function", "create", "(", ")", "{", "$", "this", "->", "user", "=", "app", "(", "\\", "SuperV", "\\", "Platform", "\\", "Domains", "\\", "Auth", "\\", "Contracts", "\\", "User", "::", "class", ")", "->", "create", "(", "[", "'name'", "=...
Create the user @return $this|\Illuminate\Database\Eloquent\Model
[ "Create", "the", "user" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Auth/UserRegistrar.php#L90-L99
superv/platform
src/Support/Concerns/HibernatableConcern.php
HibernatableConcern.hibernate
public function hibernate(): string { $url = sprintf('sv/wake/%s', uuid()); cache()->forever($url, serialize($this)); return $url; }
php
public function hibernate(): string { $url = sprintf('sv/wake/%s', uuid()); cache()->forever($url, serialize($this)); return $url; }
[ "public", "function", "hibernate", "(", ")", ":", "string", "{", "$", "url", "=", "sprintf", "(", "'sv/wake/%s'", ",", "uuid", "(", ")", ")", ";", "cache", "(", ")", "->", "forever", "(", "$", "url", ",", "serialize", "(", "$", "this", ")", ")", ...
Hibernate and return wakeup url @return string
[ "Hibernate", "and", "return", "wakeup", "url" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Support/Concerns/HibernatableConcern.php#L12-L19
superv/platform
src/Domains/Routing/RouteRegistrar.php
RouteRegistrar.register
public function register(array $routes): self { foreach ($routes as $uri => $action) { $this->registerRoute($uri, $action); } return $this; }
php
public function register(array $routes): self { foreach ($routes as $uri => $action) { $this->registerRoute($uri, $action); } return $this; }
[ "public", "function", "register", "(", "array", "$", "routes", ")", ":", "self", "{", "foreach", "(", "$", "routes", "as", "$", "uri", "=>", "$", "action", ")", "{", "$", "this", "->", "registerRoute", "(", "$", "uri", ",", "$", "action", ")", ";",...
Register multiple routes @param array $routes
[ "Register", "multiple", "routes" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Routing/RouteRegistrar.php#L47-L54
superv/platform
src/Domains/Routing/RouteRegistrar.php
RouteRegistrar.registerRoute
public function registerRoute($uri, $action) { /** Register this route for every port available */ if ($this->globally) { $ports = Hub::ports()->merge(new Port); } else { $ports = collect([$this->port]); } $ports->map(function ($port) use ($action, $u...
php
public function registerRoute($uri, $action) { /** Register this route for every port available */ if ($this->globally) { $ports = Hub::ports()->merge(new Port); } else { $ports = collect([$this->port]); } $ports->map(function ($port) use ($action, $u...
[ "public", "function", "registerRoute", "(", "$", "uri", ",", "$", "action", ")", "{", "/** Register this route for every port available */", "if", "(", "$", "this", "->", "globally", ")", "{", "$", "ports", "=", "Hub", "::", "ports", "(", ")", "->", "merge",...
Register a route @param $uri @param $action @return \Illuminate\Support\Collection
[ "Register", "a", "route" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Routing/RouteRegistrar.php#L63-L82
superv/platform
src/Http/Middleware/SetLocale.php
SetLocale.handle
public function handle($request, Closure $next) { if ($request->has('locale')) { $selectedLocale = $request->get('locale'); $request->session()->put('locale', $selectedLocale); app()->setLocale($selectedLocale); return redirect()->to($request->getPathInfo())...
php
public function handle($request, Closure $next) { if ($request->has('locale')) { $selectedLocale = $request->get('locale'); $request->session()->put('locale', $selectedLocale); app()->setLocale($selectedLocale); return redirect()->to($request->getPathInfo())...
[ "public", "function", "handle", "(", "$", "request", ",", "Closure", "$", "next", ")", "{", "if", "(", "$", "request", "->", "has", "(", "'locale'", ")", ")", "{", "$", "selectedLocale", "=", "$", "request", "->", "get", "(", "'locale'", ")", ";", ...
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @return mixed
[ "Handle", "an", "incoming", "request", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Http/Middleware/SetLocale.php#L16-L31
superv/platform
src/Domains/Resource/Model/Builder.php
Builder.getRelation
public function getRelation($name) { // We want to run a relationship query without any constrains so that we will // not have to remove these where clauses manually which gets really hacky // and error prone. We don't want constraints because we add eager ones. $relation = Relation:...
php
public function getRelation($name) { // We want to run a relationship query without any constrains so that we will // not have to remove these where clauses manually which gets really hacky // and error prone. We don't want constraints because we add eager ones. $relation = Relation:...
[ "public", "function", "getRelation", "(", "$", "name", ")", "{", "// We want to run a relationship query without any constrains so that we will", "// not have to remove these where clauses manually which gets really hacky", "// and error prone. We don't want constraints because we add eager ones...
Get the relation instance for the given relation name. @param string $name @return \Illuminate\Database\Eloquent\Relations\Relation
[ "Get", "the", "relation", "instance", "for", "the", "given", "relation", "name", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Resource/Model/Builder.php#L19-L47
superv/platform
src/Domains/Port/Hub.php
Hub.register
public function register($port) { if (is_string($port)) { $port = resolve($port); } $this->ports->push($port); return $port; }
php
public function register($port) { if (is_string($port)) { $port = resolve($port); } $this->ports->push($port); return $port; }
[ "public", "function", "register", "(", "$", "port", ")", "{", "if", "(", "is_string", "(", "$", "port", ")", ")", "{", "$", "port", "=", "resolve", "(", "$", "port", ")", ";", "}", "$", "this", "->", "ports", "->", "push", "(", "$", "port", ")"...
Register the port, resolve if class name is provided and return the resolved instance. @param \SuperV\Platform\Domains\Port\Port $port @return mixed
[ "Register", "the", "port", "resolve", "if", "class", "name", "is", "provided", "and", "return", "the", "resolved", "instance", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Port/Hub.php#L33-L42
superv/platform
src/Domains/Port/Hub.php
Hub.get
public function get($slug) { return $this->ports->first(function (Port $port) use ($slug) { return $port->slug() === $slug; }); }
php
public function get($slug) { return $this->ports->first(function (Port $port) use ($slug) { return $port->slug() === $slug; }); }
[ "public", "function", "get", "(", "$", "slug", ")", "{", "return", "$", "this", "->", "ports", "->", "first", "(", "function", "(", "Port", "$", "port", ")", "use", "(", "$", "slug", ")", "{", "return", "$", "port", "->", "slug", "(", ")", "===",...
Get port by slug @param $slug @return \SuperV\Platform\Domains\Port\Port
[ "Get", "port", "by", "slug" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Port/Hub.php#L73-L78
superv/platform
src/Domains/Resource/Http/Middleware/WatchActivity.php
WatchActivity.handle
public function handle($request, Closure $next) { if (! Current::port()) { return $next($request); } $uri = ltrim(Current::requestPath(), '/'); if (starts_with($uri, 'sv/res/')) { ResourceActivityEvent::dispatch($request); } return $next($re...
php
public function handle($request, Closure $next) { if (! Current::port()) { return $next($request); } $uri = ltrim(Current::requestPath(), '/'); if (starts_with($uri, 'sv/res/')) { ResourceActivityEvent::dispatch($request); } return $next($re...
[ "public", "function", "handle", "(", "$", "request", ",", "Closure", "$", "next", ")", "{", "if", "(", "!", "Current", "::", "port", "(", ")", ")", "{", "return", "$", "next", "(", "$", "request", ")", ";", "}", "$", "uri", "=", "ltrim", "(", "...
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @param string|null $guard @return mixed
[ "Handle", "an", "incoming", "request", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Resource/Http/Middleware/WatchActivity.php#L19-L32
superv/platform
src/Domains/Resource/Model/Restorable.php
Restorable.performDeleteOnModel
protected function performDeleteOnModel() { if (! $this->getResource()->isRestorable()) { return parent::performDeleteOnModel(); } if ($this->forceDeleting) { $this->exists = false; return $this->newModelQuery()->where($this->getKeyName(), $this->getKey()...
php
protected function performDeleteOnModel() { if (! $this->getResource()->isRestorable()) { return parent::performDeleteOnModel(); } if ($this->forceDeleting) { $this->exists = false; return $this->newModelQuery()->where($this->getKeyName(), $this->getKey()...
[ "protected", "function", "performDeleteOnModel", "(", ")", "{", "if", "(", "!", "$", "this", "->", "getResource", "(", ")", "->", "isRestorable", "(", ")", ")", "{", "return", "parent", "::", "performDeleteOnModel", "(", ")", ";", "}", "if", "(", "$", ...
Perform the actual delete query on this model instance. @return mixed
[ "Perform", "the", "actual", "delete", "query", "on", "this", "model", "instance", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Resource/Model/Restorable.php#L96-L108
superv/platform
src/Domains/Resource/Model/Restorable.php
Restorable.runSoftDelete
protected function runSoftDelete() { $query = $this->newModelQuery()->where($this->getKeyName(), $this->getKey()); $time = $this->freshTimestamp(); $columns = [ $this->getDeletedAtColumn() => $this->fromDateTime($time), $this->getDeletedByColumn() => auth()->id(), ...
php
protected function runSoftDelete() { $query = $this->newModelQuery()->where($this->getKeyName(), $this->getKey()); $time = $this->freshTimestamp(); $columns = [ $this->getDeletedAtColumn() => $this->fromDateTime($time), $this->getDeletedByColumn() => auth()->id(), ...
[ "protected", "function", "runSoftDelete", "(", ")", "{", "$", "query", "=", "$", "this", "->", "newModelQuery", "(", ")", "->", "where", "(", "$", "this", "->", "getKeyName", "(", ")", ",", "$", "this", "->", "getKey", "(", ")", ")", ";", "$", "tim...
Perform the actual delete query on this model instance. @return void
[ "Perform", "the", "actual", "delete", "query", "on", "this", "model", "instance", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Resource/Model/Restorable.php#L115-L135
superv/platform
src/Domains/Database/Schema/Blueprint.php
Blueprint.index
public function index($columns, $name = null, $algorithm = null) { $indexName = $name ?? md5(uniqid()); return $this->indexCommand('index', $columns, $indexName, $algorithm); }
php
public function index($columns, $name = null, $algorithm = null) { $indexName = $name ?? md5(uniqid()); return $this->indexCommand('index', $columns, $indexName, $algorithm); }
[ "public", "function", "index", "(", "$", "columns", ",", "$", "name", "=", "null", ",", "$", "algorithm", "=", "null", ")", "{", "$", "indexName", "=", "$", "name", "??", "md5", "(", "uniqid", "(", ")", ")", ";", "return", "$", "this", "->", "ind...
Specify an index for the table. @param string|array $columns @param string $name @param string|null $algorithm @return \Illuminate\Support\Fluent
[ "Specify", "an", "index", "for", "the", "table", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Database/Schema/Blueprint.php#L105-L110
superv/platform
src/Domains/Resource/Field/Field.php
Field.addClass
public function addClass(string $class): FieldContract { $previous = $this->getConfigValue('classes'); return $this->setConfigValue('classes', trim($class.' '.$previous)); }
php
public function addClass(string $class): FieldContract { $previous = $this->getConfigValue('classes'); return $this->setConfigValue('classes', trim($class.' '.$previous)); }
[ "public", "function", "addClass", "(", "string", "$", "class", ")", ":", "FieldContract", "{", "$", "previous", "=", "$", "this", "->", "getConfigValue", "(", "'classes'", ")", ";", "return", "$", "this", "->", "setConfigValue", "(", "'classes'", ",", "tri...
Add css class(es) @param string $class @return \SuperV\Platform\Domains\Resource\Field\Contracts\Field
[ "Add", "css", "class", "(", "es", ")" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Resource/Field/Field.php#L296-L301
superv/platform
src/Domains/Auth/PlatformUserProvider.php
PlatformUserProvider.retrieveByCredentials
public function retrieveByCredentials(array $credentials) { if (empty($credentials) || (count($credentials) === 1 && array_key_exists('password', $credentials))) { return null; } $model = $this->createModel(); $query = $model->newQuery(); ...
php
public function retrieveByCredentials(array $credentials) { if (empty($credentials) || (count($credentials) === 1 && array_key_exists('password', $credentials))) { return null; } $model = $this->createModel(); $query = $model->newQuery(); ...
[ "public", "function", "retrieveByCredentials", "(", "array", "$", "credentials", ")", "{", "if", "(", "empty", "(", "$", "credentials", ")", "||", "(", "count", "(", "$", "credentials", ")", "===", "1", "&&", "array_key_exists", "(", "'password'", ",", "$"...
Retrieve a user by the given credentials. @param array $credentials @return \Illuminate\Contracts\Auth\Authenticatable|null
[ "Retrieve", "a", "user", "by", "the", "given", "credentials", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Auth/PlatformUserProvider.php#L19-L39
superv/platform
src/Domains/Auth/PlatformUserProvider.php
PlatformUserProvider.retrieveById
public function retrieveById($identifier) { $model = $this->createModel(); $query = $model->newQuery(); $identifierName = $model->getAuthIdentifierName(); if (! $model instanceof UserContract) { $query->whereHas('user', function ($query) use ($identifier, $identifierName...
php
public function retrieveById($identifier) { $model = $this->createModel(); $query = $model->newQuery(); $identifierName = $model->getAuthIdentifierName(); if (! $model instanceof UserContract) { $query->whereHas('user', function ($query) use ($identifier, $identifierName...
[ "public", "function", "retrieveById", "(", "$", "identifier", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "query", "=", "$", "model", "->", "newQuery", "(", ")", ";", "$", "identifierName", "=", "$", "model", "-...
Retrieve a user by their unique identifier. @param mixed $identifier @return \Illuminate\Contracts\Auth\Authenticatable|null
[ "Retrieve", "a", "user", "by", "their", "unique", "identifier", "." ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Auth/PlatformUserProvider.php#L47-L62
superv/platform
src/Domains/Auth/Access/HasActions.php
HasActions.matchAction
protected function matchAction($action, $actions): bool { return in_array($action, $actions) || $this->matchWild($actions, $action); }
php
protected function matchAction($action, $actions): bool { return in_array($action, $actions) || $this->matchWild($actions, $action); }
[ "protected", "function", "matchAction", "(", "$", "action", ",", "$", "actions", ")", ":", "bool", "{", "return", "in_array", "(", "$", "action", ",", "$", "actions", ")", "||", "$", "this", "->", "matchWild", "(", "$", "actions", ",", "$", "action", ...
Determine if an action is valid for a given list of actions @param $action @param $actions @return bool
[ "Determine", "if", "an", "action", "is", "valid", "for", "a", "given", "list", "of", "actions" ]
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Auth/Access/HasActions.php#L143-L146
superv/platform
src/Domains/Auth/Access/HasActions.php
HasActions.matchWild
protected function matchWild($actions, $check) { foreach ($actions as $action) { /** * Wildcard check */ if (fnmatch($action, $check)) { return true; } /** * */ // if (starts_with(...
php
protected function matchWild($actions, $check) { foreach ($actions as $action) { /** * Wildcard check */ if (fnmatch($action, $check)) { return true; } /** * */ // if (starts_with(...
[ "protected", "function", "matchWild", "(", "$", "actions", ",", "$", "check", ")", "{", "foreach", "(", "$", "actions", "as", "$", "action", ")", "{", "/**\n * Wildcard check\n */", "if", "(", "fnmatch", "(", "$", "action", ",", "$", ...
Determine if an action comprises and action from a given list by checking : 1. wildcard: module.* 2. starts_with: module passes for anything starting with module @param $actions @param $check @return bool
[ "Determine", "if", "an", "action", "comprises", "and", "action", "from", "a", "given", "list", "by", "checking", ":", "1", ".", "wildcard", ":", "module", ".", "*", "2", ".", "starts_with", ":", "module", "passes", "for", "anything", "starting", "with", ...
train
https://github.com/superv/platform/blob/8576db3f0005ef18a83d5fd2142b3dc289584472/src/Domains/Auth/Access/HasActions.php#L158-L177