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 |
|---|---|---|---|---|---|---|---|---|---|---|
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Rules/TypeMapRule.php | TypeMapRule.appliesToContext | public function appliesToContext(ContextInterface $context): bool
{
if (!$context instanceof TypeContext && !$context instanceof PropertyContext) {
return false;
}
$type = $context->getType();
$typeExists = array_key_exists($type->getName(), $this->typeMap);
// T... | php | public function appliesToContext(ContextInterface $context): bool
{
if (!$context instanceof TypeContext && !$context instanceof PropertyContext) {
return false;
}
$type = $context->getType();
$typeExists = array_key_exists($type->getName(), $this->typeMap);
// T... | [
"public",
"function",
"appliesToContext",
"(",
"ContextInterface",
"$",
"context",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"context",
"instanceof",
"TypeContext",
"&&",
"!",
"$",
"context",
"instanceof",
"PropertyContext",
")",
"{",
"return",
"false",
";",... | @param ContextInterface $context
@return bool | [
"@param",
"ContextInterface",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Rules/TypeMapRule.php#L43-L63 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php | GenerateClassmapCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$io = new SymfonyStyle($input, $output);
$config = $this->getConfigHelper()->load($input);
$typeMap = TypeMap::fromMetadata(
$config->getT... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$io = new SymfonyStyle($input, $output);
$config = $this->getConfigHelper()->load($input);
$typeMap = TypeMap::fromMetadata(
$config->getT... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"input",
"=",
"$",
"input",
";",
"$",
"this",
"->",
"output",
"=",
"$",
"output",
";",
"$",
"io",
"=",
"new",
... | {@inheritdoc}
@throws \Phpro\SoapClient\Exception\InvalidArgumentException | [
"{"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php#L74-L95 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php | GenerateClassmapCommand.generateClassmap | protected function generateClassmap(FileGenerator $file, ClassMapGenerator $generator, TypeMap $typeMap, $path)
{
$code = $generator->generate($file, $typeMap);
$this->filesystem->putFileContents($path, $code);
} | php | protected function generateClassmap(FileGenerator $file, ClassMapGenerator $generator, TypeMap $typeMap, $path)
{
$code = $generator->generate($file, $typeMap);
$this->filesystem->putFileContents($path, $code);
} | [
"protected",
"function",
"generateClassmap",
"(",
"FileGenerator",
"$",
"file",
",",
"ClassMapGenerator",
"$",
"generator",
",",
"TypeMap",
"$",
"typeMap",
",",
"$",
"path",
")",
"{",
"$",
"code",
"=",
"$",
"generator",
"->",
"generate",
"(",
"$",
"file",
... | Generates one type class
@param FileGenerator $file
@param ClassMapGenerator $generator
@param TypeMap $typeMap
@param $path | [
"Generates",
"one",
"type",
"class"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php#L106-L110 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php | GenerateClassmapCommand.handleClassmap | protected function handleClassmap(ClassMapGenerator $generator, TypeMap $typeMap, $path): bool
{
// Handle existing class:
if ($this->filesystem->fileExists($path)) {
if ($this->handleExistingFile($generator, $typeMap, $path)) {
return true;
}
// ... | php | protected function handleClassmap(ClassMapGenerator $generator, TypeMap $typeMap, $path): bool
{
// Handle existing class:
if ($this->filesystem->fileExists($path)) {
if ($this->handleExistingFile($generator, $typeMap, $path)) {
return true;
}
// ... | [
"protected",
"function",
"handleClassmap",
"(",
"ClassMapGenerator",
"$",
"generator",
",",
"TypeMap",
"$",
"typeMap",
",",
"$",
"path",
")",
":",
"bool",
"{",
"// Handle existing class:",
"if",
"(",
"$",
"this",
"->",
"filesystem",
"->",
"fileExists",
"(",
"$... | Try to create a class for a type.
When a class exists: try to patch
If patching the old class does not work: ask for an overwrite
Create a class from an empty file
@param ClassMapGenerator $generator
@param TypeMap $typeMap
@param $path
@return bool | [
"Try",
"to",
"create",
"a",
"class",
"for",
"a",
"type",
".",
"When",
"a",
"class",
"exists",
":",
"try",
"to",
"patch",
"If",
"patching",
"the",
"old",
"class",
"does",
"not",
"work",
":",
"ask",
"for",
"an",
"overwrite",
"Create",
"a",
"class",
"fr... | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php#L123-L150 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php | GenerateClassmapCommand.handleExistingFile | protected function handleExistingFile(ClassMapGenerator $generator, TypeMap $typeMap, $path): bool
{
$this->output->write(sprintf('Type %s exists. Trying to patch ...', $path));
$patched = $this->patchExistingFile($generator, $typeMap, $path);
if ($patched) {
$this->output->writ... | php | protected function handleExistingFile(ClassMapGenerator $generator, TypeMap $typeMap, $path): bool
{
$this->output->write(sprintf('Type %s exists. Trying to patch ...', $path));
$patched = $this->patchExistingFile($generator, $typeMap, $path);
if ($patched) {
$this->output->writ... | [
"protected",
"function",
"handleExistingFile",
"(",
"ClassMapGenerator",
"$",
"generator",
",",
"TypeMap",
"$",
"typeMap",
",",
"$",
"path",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"output",
"->",
"write",
"(",
"sprintf",
"(",
"'Type %s exists. Trying to patch... | An existing file was found. Try to patch or ask if it can be overwritten.
@param ClassMapGenerator $generator
@param TypeMap $typeMap
@param string $path
@return bool | [
"An",
"existing",
"file",
"was",
"found",
".",
"Try",
"to",
"patch",
"or",
"ask",
"if",
"it",
"can",
"be",
"overwritten",
"."
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php#L160-L174 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php | GenerateClassmapCommand.patchExistingFile | protected function patchExistingFile(ClassMapGenerator $generator, TypeMap $typeMap, $path): bool
{
try {
$this->filesystem->createBackup($path);
$file = FileGenerator::fromReflectedFileName($path);
$this->generateClassmap($file, $generator, $typeMap, $path);
} ca... | php | protected function patchExistingFile(ClassMapGenerator $generator, TypeMap $typeMap, $path): bool
{
try {
$this->filesystem->createBackup($path);
$file = FileGenerator::fromReflectedFileName($path);
$this->generateClassmap($file, $generator, $typeMap, $path);
} ca... | [
"protected",
"function",
"patchExistingFile",
"(",
"ClassMapGenerator",
"$",
"generator",
",",
"TypeMap",
"$",
"typeMap",
",",
"$",
"path",
")",
":",
"bool",
"{",
"try",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"createBackup",
"(",
"$",
"path",
")",
";"... | This method tries to patch an existing type class.
@param ClassMapGenerator $generator
@param TypeMap $typeMap
@param string $path
@return bool
@internal param Type $type | [
"This",
"method",
"tries",
"to",
"patch",
"an",
"existing",
"type",
"class",
"."
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClassmapCommand.php#L185-L199 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Rules/PropertynameMatchesRule.php | PropertynameMatchesRule.appliesToContext | public function appliesToContext(ContextInterface $context): bool
{
if (!$context instanceof PropertyContext) {
return false;
}
$property = $context->getProperty();
if (!preg_match($this->regex, $property->getName())) {
return false;
}
return... | php | public function appliesToContext(ContextInterface $context): bool
{
if (!$context instanceof PropertyContext) {
return false;
}
$property = $context->getProperty();
if (!preg_match($this->regex, $property->getName())) {
return false;
}
return... | [
"public",
"function",
"appliesToContext",
"(",
"ContextInterface",
"$",
"context",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"context",
"instanceof",
"PropertyContext",
")",
"{",
"return",
"false",
";",
"}",
"$",
"property",
"=",
"$",
"context",
"->",
"g... | @param ContextInterface $context
@return bool | [
"@param",
"ContextInterface",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Rules/PropertynameMatchesRule.php#L42-L54 |
phpro/soap-client | src/Phpro/SoapClient/Soap/HttpBinding/Converter/Psr7Converter.php | Psr7Converter.convertSoapRequest | public function convertSoapRequest(SoapRequest $request): RequestInterface
{
$builder = new Psr7RequestBuilder($this->messageFactory, $this->streamFactory);
$request->isSOAP11() ? $builder->isSOAP11() : $builder->isSOAP12();
$builder->setEndpoint($request->getLocation());
$builder->... | php | public function convertSoapRequest(SoapRequest $request): RequestInterface
{
$builder = new Psr7RequestBuilder($this->messageFactory, $this->streamFactory);
$request->isSOAP11() ? $builder->isSOAP11() : $builder->isSOAP12();
$builder->setEndpoint($request->getLocation());
$builder->... | [
"public",
"function",
"convertSoapRequest",
"(",
"SoapRequest",
"$",
"request",
")",
":",
"RequestInterface",
"{",
"$",
"builder",
"=",
"new",
"Psr7RequestBuilder",
"(",
"$",
"this",
"->",
"messageFactory",
",",
"$",
"this",
"->",
"streamFactory",
")",
";",
"$... | @param SoapRequest $request
@throws \Phpro\SoapClient\Exception\RequestException
@return RequestInterface | [
"@param",
"SoapRequest",
"$request"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Soap/HttpBinding/Converter/Psr7Converter.php#L44-L54 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/ClassMapGenerator.php | ClassMapGenerator.generate | public function generate(FileGenerator $file, $typeMap): string
{
$this->ruleSet->applyRules(new ClassMapContext($file, $typeMap, $this->name, $this->namespace));
return $file->generate();
} | php | public function generate(FileGenerator $file, $typeMap): string
{
$this->ruleSet->applyRules(new ClassMapContext($file, $typeMap, $this->name, $this->namespace));
return $file->generate();
} | [
"public",
"function",
"generate",
"(",
"FileGenerator",
"$",
"file",
",",
"$",
"typeMap",
")",
":",
"string",
"{",
"$",
"this",
"->",
"ruleSet",
"->",
"applyRules",
"(",
"new",
"ClassMapContext",
"(",
"$",
"file",
",",
"$",
"typeMap",
",",
"$",
"this",
... | @param FileGenerator $file
@param TypeMap $typeMap
@return string | [
"@param",
"FileGenerator",
"$file",
"@param",
"TypeMap",
"$typeMap"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/ClassMapGenerator.php#L52-L57 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/TypeChecker.php | TypeChecker.isKnownType | public static function isKnownType(string $type): bool
{
return self::isInternalPhpType($type) || self::isClassType($type);
} | php | public static function isKnownType(string $type): bool
{
return self::isInternalPhpType($type) || self::isClassType($type);
} | [
"public",
"static",
"function",
"isKnownType",
"(",
"string",
"$",
"type",
")",
":",
"bool",
"{",
"return",
"self",
"::",
"isInternalPhpType",
"(",
"$",
"type",
")",
"||",
"self",
"::",
"isClassType",
"(",
"$",
"type",
")",
";",
"}"
] | @param $type
@return bool | [
"@param",
"$type"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/TypeChecker.php#L26-L29 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/TypeChecker.php | TypeChecker.isInternalPhpType | private static function isInternalPhpType(string $type): bool
{
return in_array(strtolower($type), self::$internalPhpTypes, true);
} | php | private static function isInternalPhpType(string $type): bool
{
return in_array(strtolower($type), self::$internalPhpTypes, true);
} | [
"private",
"static",
"function",
"isInternalPhpType",
"(",
"string",
"$",
"type",
")",
":",
"bool",
"{",
"return",
"in_array",
"(",
"strtolower",
"(",
"$",
"type",
")",
",",
"self",
"::",
"$",
"internalPhpTypes",
",",
"true",
")",
";",
"}"
] | @param string $type
@return bool | [
"@param",
"string",
"$type"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/TypeChecker.php#L36-L39 |
phpro/soap-client | src/Phpro/SoapClient/Wsdl/Provider/LocalWsdlProvider.php | LocalWsdlProvider.provide | public function provide(string $source): string
{
if (!$this->filesystem->fileExists($source)) {
throw WsdlException::notFound($source);
}
return $source;
} | php | public function provide(string $source): string
{
if (!$this->filesystem->fileExists($source)) {
throw WsdlException::notFound($source);
}
return $source;
} | [
"public",
"function",
"provide",
"(",
"string",
"$",
"source",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"filesystem",
"->",
"fileExists",
"(",
"$",
"source",
")",
")",
"{",
"throw",
"WsdlException",
"::",
"notFound",
"(",
"$",
"sourc... | @param string $source
@return string | [
"@param",
"string",
"$source"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Wsdl/Provider/LocalWsdlProvider.php#L43-L50 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/TypeGenerator.php | TypeGenerator.generate | public function generate(FileGenerator $file, $type): string
{
$class = $file->getClass() ?: new ClassGenerator();
$class->setNamespaceName($type->getNamespace());
$class->setName($type->getName());
$this->ruleSet->applyRules(new TypeContext($class, $type));
foreach ($type-... | php | public function generate(FileGenerator $file, $type): string
{
$class = $file->getClass() ?: new ClassGenerator();
$class->setNamespaceName($type->getNamespace());
$class->setName($type->getName());
$this->ruleSet->applyRules(new TypeContext($class, $type));
foreach ($type-... | [
"public",
"function",
"generate",
"(",
"FileGenerator",
"$",
"file",
",",
"$",
"type",
")",
":",
"string",
"{",
"$",
"class",
"=",
"$",
"file",
"->",
"getClass",
"(",
")",
"?",
":",
"new",
"ClassGenerator",
"(",
")",
";",
"$",
"class",
"->",
"setName... | @param FileGenerator $file
@param Type $type
@return string | [
"@param",
"FileGenerator",
"$file",
"@param",
"Type",
"$type"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/TypeGenerator.php#L40-L55 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php | ClientMethodAssembler.assemble | public function assemble(ContextInterface $context): bool
{
$class = $context->getClass();
$class->setExtendedClass(Client::class);
$method = $context->getMethod();
try {
$phpMethodName = Normalizer::normalizeMethodName($method->getMethodName());
$param = $thi... | php | public function assemble(ContextInterface $context): bool
{
$class = $context->getClass();
$class->setExtendedClass(Client::class);
$method = $context->getMethod();
try {
$phpMethodName = Normalizer::normalizeMethodName($method->getMethodName());
$param = $thi... | [
"public",
"function",
"assemble",
"(",
"ContextInterface",
"$",
"context",
")",
":",
"bool",
"{",
"$",
"class",
"=",
"$",
"context",
"->",
"getClass",
"(",
")",
";",
"$",
"class",
"->",
"setExtendedClass",
"(",
"Client",
"::",
"class",
")",
";",
"$",
"... | @param ContextInterface|ClientMethodContext $context
@return bool
@throws AssemblerException | [
"@param",
"ContextInterface|ClientMethodContext",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php#L36-L70 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php | ClientMethodAssembler.createParamsFromContext | private function createParamsFromContext(ClientMethodContext $context): ParameterGenerator
{
if (!$context->isMultiArgument()) {
$param = current($context->getMethod()->getParameters());
return ParameterGenerator::fromArray($param->toArray());
}
return ParameterGene... | php | private function createParamsFromContext(ClientMethodContext $context): ParameterGenerator
{
if (!$context->isMultiArgument()) {
$param = current($context->getMethod()->getParameters());
return ParameterGenerator::fromArray($param->toArray());
}
return ParameterGene... | [
"private",
"function",
"createParamsFromContext",
"(",
"ClientMethodContext",
"$",
"context",
")",
":",
"ParameterGenerator",
"{",
"if",
"(",
"!",
"$",
"context",
"->",
"isMultiArgument",
"(",
")",
")",
"{",
"$",
"param",
"=",
"current",
"(",
"$",
"context",
... | @param ClientMethodContext $context
@return ParameterGenerator | [
"@param",
"ClientMethodContext",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php#L77-L91 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php | ClientMethodAssembler.generateMultiArgumentDocblock | private function generateMultiArgumentDocblock(ClientMethodContext $context): DocBlockGenerator
{
$class = $context->getClass();
$method = $context->getMethod();
$description = ['MultiArgumentRequest with following params:'.PHP_EOL];
foreach ($context->getMethod()->getParameters() as... | php | private function generateMultiArgumentDocblock(ClientMethodContext $context): DocBlockGenerator
{
$class = $context->getClass();
$method = $context->getMethod();
$description = ['MultiArgumentRequest with following params:'.PHP_EOL];
foreach ($context->getMethod()->getParameters() as... | [
"private",
"function",
"generateMultiArgumentDocblock",
"(",
"ClientMethodContext",
"$",
"context",
")",
":",
"DocBlockGenerator",
"{",
"$",
"class",
"=",
"$",
"context",
"->",
"getClass",
"(",
")",
";",
"$",
"method",
"=",
"$",
"context",
"->",
"getMethod",
"... | @param ClientMethodContext $context
@return DocBlockGenerator | [
"@param",
"ClientMethodContext",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php#L98-L127 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php | ClientMethodAssembler.generateSingleArgumentDocblock | private function generateSingleArgumentDocblock(ClientMethodContext $context): DocBlockGenerator
{
$method = $context->getMethod();
$class = $context->getClass();
$param = current($method->getParameters());
return DocBlockGeneratorFactory::fromArray(
[
't... | php | private function generateSingleArgumentDocblock(ClientMethodContext $context): DocBlockGenerator
{
$method = $context->getMethod();
$class = $context->getClass();
$param = current($method->getParameters());
return DocBlockGeneratorFactory::fromArray(
[
't... | [
"private",
"function",
"generateSingleArgumentDocblock",
"(",
"ClientMethodContext",
"$",
"context",
")",
":",
"DocBlockGenerator",
"{",
"$",
"method",
"=",
"$",
"context",
"->",
"getMethod",
"(",
")",
";",
"$",
"class",
"=",
"$",
"context",
"->",
"getClass",
... | @param ClientMethodContext $context
@return DocBlockGenerator | [
"@param",
"ClientMethodContext",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php#L134-L175 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php | ClientMethodAssembler.generateClassNameAndAddImport | protected function generateClassNameAndAddImport(string $fqcn, ClassGenerator $class, $prefixed = false): string
{
$prefix = '';
$fqcn = ltrim($fqcn, '\\');
$parts = explode('\\', $fqcn);
$className = array_pop($parts);
if ($prefixed) {
$prefix = array_pop($parts)... | php | protected function generateClassNameAndAddImport(string $fqcn, ClassGenerator $class, $prefixed = false): string
{
$prefix = '';
$fqcn = ltrim($fqcn, '\\');
$parts = explode('\\', $fqcn);
$className = array_pop($parts);
if ($prefixed) {
$prefix = array_pop($parts)... | [
"protected",
"function",
"generateClassNameAndAddImport",
"(",
"string",
"$",
"fqcn",
",",
"ClassGenerator",
"$",
"class",
",",
"$",
"prefixed",
"=",
"false",
")",
":",
"string",
"{",
"$",
"prefix",
"=",
"''",
";",
"$",
"fqcn",
"=",
"ltrim",
"(",
"$",
"f... | @param string $fqcn Fully qualified class name.
@param ClassGenerator $class Class generator object.
@param bool $prefixed
@return string | [
"@param",
"string",
"$fqcn",
"Fully",
"qualified",
"class",
"name",
".",
"@param",
"ClassGenerator",
"$class",
"Class",
"generator",
"object",
".",
"@param",
"bool",
"$prefixed"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ClientMethodAssembler.php#L184-L204 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/IteratorAssembler.php | IteratorAssembler.implementGetIterator | private function implementGetIterator(ClassGenerator $class, Property $firstProperty)
{
$methodName = 'getIterator';
$class->removeMethod($methodName);
$class->addMethodFromGenerator(
MethodGenerator::fromArray([
'name' => $methodName,
'parameters'... | php | private function implementGetIterator(ClassGenerator $class, Property $firstProperty)
{
$methodName = 'getIterator';
$class->removeMethod($methodName);
$class->addMethodFromGenerator(
MethodGenerator::fromArray([
'name' => $methodName,
'parameters'... | [
"private",
"function",
"implementGetIterator",
"(",
"ClassGenerator",
"$",
"class",
",",
"Property",
"$",
"firstProperty",
")",
"{",
"$",
"methodName",
"=",
"'getIterator'",
";",
"$",
"class",
"->",
"removeMethod",
"(",
"$",
"methodName",
")",
";",
"$",
"class... | @param ClassGenerator $class
@param Property $firstProperty
@throws \Zend\Code\Generator\Exception\InvalidArgumentException | [
"@param",
"ClassGenerator",
"$class",
"@param",
"Property",
"$firstProperty"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/IteratorAssembler.php#L61-L84 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Rules/ClientMethodMatchesRule.php | ClientMethodMatchesRule.appliesToContext | public function appliesToContext(ContextInterface $context): bool
{
if (!$context instanceof ClientMethodContext) {
return false;
}
$method = $context->getMethod();
if (!preg_match($this->regex, $method->getMethodName())) {
return false;
}
re... | php | public function appliesToContext(ContextInterface $context): bool
{
if (!$context instanceof ClientMethodContext) {
return false;
}
$method = $context->getMethod();
if (!preg_match($this->regex, $method->getMethodName())) {
return false;
}
re... | [
"public",
"function",
"appliesToContext",
"(",
"ContextInterface",
"$",
"context",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"context",
"instanceof",
"ClientMethodContext",
")",
"{",
"return",
"false",
";",
"}",
"$",
"method",
"=",
"$",
"context",
"->",
... | @param ContextInterface $context
@return bool | [
"@param",
"ContextInterface",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Rules/ClientMethodMatchesRule.php#L42-L54 |
phpro/soap-client | src/Phpro/SoapClient/Exception/SoapException.php | SoapException.fromThrowable | public static function fromThrowable(\Throwable $throwable): self
{
return new self($throwable->getMessage(), (int)$throwable->getCode(), $throwable);
} | php | public static function fromThrowable(\Throwable $throwable): self
{
return new self($throwable->getMessage(), (int)$throwable->getCode(), $throwable);
} | [
"public",
"static",
"function",
"fromThrowable",
"(",
"\\",
"Throwable",
"$",
"throwable",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"$",
"throwable",
"->",
"getMessage",
"(",
")",
",",
"(",
"int",
")",
"$",
"throwable",
"->",
"getCode",
"(",
... | @param \Throwable $throwable
@return SoapException | [
"@param",
"\\",
"Throwable",
"$throwable"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Exception/SoapException.php#L17-L20 |
phpro/soap-client | spec/Phpro/SoapClient/Soap/Driver/ExtSoap/Metadata/MethodsParserSpec.php | MethodsParserSpec.mockAbusedClient | private function mockAbusedClient(array $functions): AbusedClient
{
return new class($functions) extends AbusedClient {
/** @var array */
private $functions;
public function __construct(array $functions)
{
$this->functions = $functions;
... | php | private function mockAbusedClient(array $functions): AbusedClient
{
return new class($functions) extends AbusedClient {
/** @var array */
private $functions;
public function __construct(array $functions)
{
$this->functions = $functions;
... | [
"private",
"function",
"mockAbusedClient",
"(",
"array",
"$",
"functions",
")",
":",
"AbusedClient",
"{",
"return",
"new",
"class",
"(",
"$",
"functions",
")",
"extends",
"AbusedClient",
"{",
"/** @var array */",
"private",
"$",
"functions",
";",
"public",
"func... | Phpspec cant mock the __getFunctions | [
"Phpspec",
"cant",
"mock",
"the",
"__getFunctions"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/spec/Phpro/SoapClient/Soap/Driver/ExtSoap/Metadata/MethodsParserSpec.php#L111-L127 |
phpro/soap-client | src/Phpro/SoapClient/Soap/Driver/ExtSoap/Handler/ExtSoapServerHandle.php | ExtSoapServerHandle.request | public function request(SoapRequest $request): SoapResponse
{
ob_start();
$this->server->handle($request->getRequest());
$responseBody = ob_get_contents();
ob_end_clean();
$this->lastRequestInfo = new LastRequestInfo(
'',
$request->getRequest(),
... | php | public function request(SoapRequest $request): SoapResponse
{
ob_start();
$this->server->handle($request->getRequest());
$responseBody = ob_get_contents();
ob_end_clean();
$this->lastRequestInfo = new LastRequestInfo(
'',
$request->getRequest(),
... | [
"public",
"function",
"request",
"(",
"SoapRequest",
"$",
"request",
")",
":",
"SoapResponse",
"{",
"ob_start",
"(",
")",
";",
"$",
"this",
"->",
"server",
"->",
"handle",
"(",
"$",
"request",
"->",
"getRequest",
"(",
")",
")",
";",
"$",
"responseBody",
... | @param SoapRequest $request
@return SoapResponse | [
"@param",
"SoapRequest",
"$request"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Soap/Driver/ExtSoap/Handler/ExtSoapServerHandle.php#L34-L49 |
phpro/soap-client | src/Phpro/SoapClient/Soap/TypeConverter/DateTypeConverter.php | DateTypeConverter.convertXmlToPhp | public function convertXmlToPhp(string $data)
{
$doc = new DOMDocument();
$doc->loadXML($data);
if ('' === $doc->textContent) {
return null;
}
return new DateTimeImmutable($doc->textContent);
} | php | public function convertXmlToPhp(string $data)
{
$doc = new DOMDocument();
$doc->loadXML($data);
if ('' === $doc->textContent) {
return null;
}
return new DateTimeImmutable($doc->textContent);
} | [
"public",
"function",
"convertXmlToPhp",
"(",
"string",
"$",
"data",
")",
"{",
"$",
"doc",
"=",
"new",
"DOMDocument",
"(",
")",
";",
"$",
"doc",
"->",
"loadXML",
"(",
"$",
"data",
")",
";",
"if",
"(",
"''",
"===",
"$",
"doc",
"->",
"textContent",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Soap/TypeConverter/DateTypeConverter.php#L37-L47 |
phpro/soap-client | src/Phpro/SoapClient/Soap/TypeConverter/DateTypeConverter.php | DateTypeConverter.convertPhpToXml | public function convertPhpToXml($php): string
{
if (!$php instanceof DateTimeInterface) {
return '';
}
return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $php->format('Y-m-d'));
} | php | public function convertPhpToXml($php): string
{
if (!$php instanceof DateTimeInterface) {
return '';
}
return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $php->format('Y-m-d'));
} | [
"public",
"function",
"convertPhpToXml",
"(",
"$",
"php",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"php",
"instanceof",
"DateTimeInterface",
")",
"{",
"return",
"''",
";",
"}",
"return",
"sprintf",
"(",
"'<%1$s>%2$s</%1$s>'",
",",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Soap/TypeConverter/DateTypeConverter.php#L52-L59 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Model/Type.php | Type.getFileInfo | public function getFileInfo(string $destination): SplFileInfo
{
$name = Normalizer::normalizeClassname($this->getName());
$path = rtrim($destination, '/\\').DIRECTORY_SEPARATOR.$name.'.php';
return new SplFileInfo($path);
} | php | public function getFileInfo(string $destination): SplFileInfo
{
$name = Normalizer::normalizeClassname($this->getName());
$path = rtrim($destination, '/\\').DIRECTORY_SEPARATOR.$name.'.php';
return new SplFileInfo($path);
} | [
"public",
"function",
"getFileInfo",
"(",
"string",
"$",
"destination",
")",
":",
"SplFileInfo",
"{",
"$",
"name",
"=",
"Normalizer",
"::",
"normalizeClassname",
"(",
"$",
"this",
"->",
"getName",
"(",
")",
")",
";",
"$",
"path",
"=",
"rtrim",
"(",
"$",
... | @param string $destination
@return SplFileInfo | [
"@param",
"string",
"$destination"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Model/Type.php#L99-L105 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Rules/TypenameMatchesRule.php | TypenameMatchesRule.appliesToContext | public function appliesToContext(ContextInterface $context): bool
{
if (!$context instanceof TypeContext && !$context instanceof PropertyContext) {
return false;
}
$type = $context->getType();
if (!preg_match($this->regex, $type->getName())) {
return false;
... | php | public function appliesToContext(ContextInterface $context): bool
{
if (!$context instanceof TypeContext && !$context instanceof PropertyContext) {
return false;
}
$type = $context->getType();
if (!preg_match($this->regex, $type->getName())) {
return false;
... | [
"public",
"function",
"appliesToContext",
"(",
"ContextInterface",
"$",
"context",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"context",
"instanceof",
"TypeContext",
"&&",
"!",
"$",
"context",
"instanceof",
"PropertyContext",
")",
"{",
"return",
"false",
";",... | @param ContextInterface $context
@return bool | [
"@param",
"ContextInterface",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Rules/TypenameMatchesRule.php#L43-L56 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/JsonSerializableAssembler.php | JsonSerializableAssembler.assemble | public function assemble(ContextInterface $context)
{
try {
$interfaceAssembler = new InterfaceAssembler(JsonSerializable::class);
if ($interfaceAssembler->canAssemble($context)) {
$interfaceAssembler->assemble($context);
}
$this->implementJso... | php | public function assemble(ContextInterface $context)
{
try {
$interfaceAssembler = new InterfaceAssembler(JsonSerializable::class);
if ($interfaceAssembler->canAssemble($context)) {
$interfaceAssembler->assemble($context);
}
$this->implementJso... | [
"public",
"function",
"assemble",
"(",
"ContextInterface",
"$",
"context",
")",
"{",
"try",
"{",
"$",
"interfaceAssembler",
"=",
"new",
"InterfaceAssembler",
"(",
"JsonSerializable",
"::",
"class",
")",
";",
"if",
"(",
"$",
"interfaceAssembler",
"->",
"canAssemb... | @param ContextInterface|TypeContext $context
@throws AssemblerException | [
"@param",
"ContextInterface|TypeContext",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/JsonSerializableAssembler.php#L34-L46 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/JsonSerializableAssembler.php | JsonSerializableAssembler.implementJsonSerialize | private function implementJsonSerialize(Type $type, ClassGenerator $class)
{
$methodName = 'jsonSerialize';
$class->removeMethod($methodName);
$class->addMethodFromGenerator(
MethodGenerator::fromArray([
'name' => $methodName,
'parameters' => [],
... | php | private function implementJsonSerialize(Type $type, ClassGenerator $class)
{
$methodName = 'jsonSerialize';
$class->removeMethod($methodName);
$class->addMethodFromGenerator(
MethodGenerator::fromArray([
'name' => $methodName,
'parameters' => [],
... | [
"private",
"function",
"implementJsonSerialize",
"(",
"Type",
"$",
"type",
",",
"ClassGenerator",
"$",
"class",
")",
"{",
"$",
"methodName",
"=",
"'jsonSerialize'",
";",
"$",
"class",
"->",
"removeMethod",
"(",
"$",
"methodName",
")",
";",
"$",
"class",
"->"... | @param Type $type
@param ClassGenerator $class
@throws \Zend\Code\Generator\Exception\InvalidArgumentException | [
"@param",
"Type",
"$type",
"@param",
"ClassGenerator",
"$class"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/JsonSerializableAssembler.php#L54-L74 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/JsonSerializableAssembler.php | JsonSerializableAssembler.generateJsonSerializeBody | private function generateJsonSerializeBody(Type $type, ClassGenerator $class): string
{
$lines = [];
$lines[] = 'return [';
foreach ($type->getProperties() as $property) {
$lines[] = sprintf('%1$s\'%2$s\' => $this->%2$s,', $class->getIndentation(), $property->getName());
... | php | private function generateJsonSerializeBody(Type $type, ClassGenerator $class): string
{
$lines = [];
$lines[] = 'return [';
foreach ($type->getProperties() as $property) {
$lines[] = sprintf('%1$s\'%2$s\' => $this->%2$s,', $class->getIndentation(), $property->getName());
... | [
"private",
"function",
"generateJsonSerializeBody",
"(",
"Type",
"$",
"type",
",",
"ClassGenerator",
"$",
"class",
")",
":",
"string",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"$",
"lines",
"[",
"]",
"=",
"'return ['",
";",
"foreach",
"(",
"$",
"type",
"... | @param Type $type
@param ClassGenerator $class
@return string | [
"@param",
"Type",
"$type",
"@param",
"ClassGenerator",
"$class"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/JsonSerializableAssembler.php#L82-L94 |
phpro/soap-client | src/Phpro/SoapClient/Exception/AssemblerException.php | AssemblerException.fromException | public static function fromException(\Exception $e): self
{
return new self($e->getMessage(), $e->getCode(), $e);
} | php | public static function fromException(\Exception $e): self
{
return new self($e->getMessage(), $e->getCode(), $e);
} | [
"public",
"static",
"function",
"fromException",
"(",
"\\",
"Exception",
"$",
"e",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"$",
"e",
"->",
"getCode",
"(",
")",
",",
"$",
"e",
")",
";",
"}"... | @param \Exception $e
@return AssemblerException | [
"@param",
"\\",
"Exception",
"$e"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Exception/AssemblerException.php#L18-L21 |
phpro/soap-client | src/Phpro/SoapClient/Console/Application.php | Application.getDefaultCommands | protected function getDefaultCommands(): array
{
$filesystem = new Filesystem();
$commands = parent::getDefaultCommands();
$commands[] = new Command\GenerateTypesCommand($filesystem);
$commands[] = new Command\GenerateClassmapCommand($filesystem);
$commands[] = new Command\Ge... | php | protected function getDefaultCommands(): array
{
$filesystem = new Filesystem();
$commands = parent::getDefaultCommands();
$commands[] = new Command\GenerateTypesCommand($filesystem);
$commands[] = new Command\GenerateClassmapCommand($filesystem);
$commands[] = new Command\Ge... | [
"protected",
"function",
"getDefaultCommands",
"(",
")",
":",
"array",
"{",
"$",
"filesystem",
"=",
"new",
"Filesystem",
"(",
")",
";",
"$",
"commands",
"=",
"parent",
"::",
"getDefaultCommands",
"(",
")",
";",
"$",
"commands",
"[",
"]",
"=",
"new",
"Com... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Application.php#L37-L49 |
phpro/soap-client | spec/Phpro/SoapClient/Soap/Driver/ExtSoap/Metadata/TypesParserSpec.php | TypesParserSpec.mockAbusedClient | private function mockAbusedClient(array $types): AbusedClient
{
return new class($types) extends AbusedClient {
/** @var array */
private $types;
public function __construct(array $types)
{
$this->types = $types;
}
pub... | php | private function mockAbusedClient(array $types): AbusedClient
{
return new class($types) extends AbusedClient {
/** @var array */
private $types;
public function __construct(array $types)
{
$this->types = $types;
}
pub... | [
"private",
"function",
"mockAbusedClient",
"(",
"array",
"$",
"types",
")",
":",
"AbusedClient",
"{",
"return",
"new",
"class",
"(",
"$",
"types",
")",
"extends",
"AbusedClient",
"{",
"/** @var array */",
"private",
"$",
"types",
";",
"public",
"function",
"__... | Phpspec cant mock the __getTypes() | [
"Phpspec",
"cant",
"mock",
"the",
"__getTypes",
"()"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/spec/Phpro/SoapClient/Soap/Driver/ExtSoap/Metadata/TypesParserSpec.php#L77-L93 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ConstructorAssembler.php | ConstructorAssembler.assembleConstructor | private function assembleConstructor(Type $type): MethodGenerator
{
$body = [];
$constructor = MethodGenerator::fromArray([
'name' => '__construct',
'visibility' => MethodGenerator::VISIBILITY_PUBLIC,
]);
$docblock = DocBlockGeneratorFactory::fromArray([
... | php | private function assembleConstructor(Type $type): MethodGenerator
{
$body = [];
$constructor = MethodGenerator::fromArray([
'name' => '__construct',
'visibility' => MethodGenerator::VISIBILITY_PUBLIC,
]);
$docblock = DocBlockGeneratorFactory::fromArray([
... | [
"private",
"function",
"assembleConstructor",
"(",
"Type",
"$",
"type",
")",
":",
"MethodGenerator",
"{",
"$",
"body",
"=",
"[",
"]",
";",
"$",
"constructor",
"=",
"MethodGenerator",
"::",
"fromArray",
"(",
"[",
"'name'",
"=>",
"'__construct'",
",",
"'visibi... | @param Type $type
@return MethodGenerator
@throws \Zend\Code\Generator\Exception\InvalidArgumentException | [
"@param",
"Type",
"$type"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ConstructorAssembler.php#L67-L101 |
phpro/soap-client | src/Phpro/SoapClient/Event/Subscriber/ValidatorSubscriber.php | ValidatorSubscriber.onClientRequest | public function onClientRequest(RequestEvent $event)
{
$errors = $this->validator->validate($event->getRequest());
if (count($errors)) {
throw new RequestException((string) $errors);
}
} | php | public function onClientRequest(RequestEvent $event)
{
$errors = $this->validator->validate($event->getRequest());
if (count($errors)) {
throw new RequestException((string) $errors);
}
} | [
"public",
"function",
"onClientRequest",
"(",
"RequestEvent",
"$",
"event",
")",
"{",
"$",
"errors",
"=",
"$",
"this",
"->",
"validator",
"->",
"validate",
"(",
"$",
"event",
"->",
"getRequest",
"(",
")",
")",
";",
"if",
"(",
"count",
"(",
"$",
"errors... | @param RequestEvent $event
@throws \Phpro\SoapClient\Exception\RequestException | [
"@param",
"RequestEvent",
"$event"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Event/Subscriber/ValidatorSubscriber.php#L33-L40 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php | Normalizer.normalizeReservedKeywords | private static function normalizeReservedKeywords(string $name, string $suffix): string
{
if (!\in_array(strtolower($name), self::$reservedKeywords, true)) {
return $name;
}
return $name.$suffix;
} | php | private static function normalizeReservedKeywords(string $name, string $suffix): string
{
if (!\in_array(strtolower($name), self::$reservedKeywords, true)) {
return $name;
}
return $name.$suffix;
} | [
"private",
"static",
"function",
"normalizeReservedKeywords",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"suffix",
")",
":",
"string",
"{",
"if",
"(",
"!",
"\\",
"in_array",
"(",
"strtolower",
"(",
"$",
"name",
")",
",",
"self",
"::",
"$",
"reserved... | @param string $name
@param string $suffix
@return string | [
"@param",
"string",
"$name",
"@param",
"string",
"$suffix"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php#L111-L118 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php | Normalizer.camelCase | private static function camelCase(string $word, string $regexp):string
{
$parts = array_filter(preg_split($regexp, $word));
$keepUnchanged = array_shift($parts);
$parts = array_map('ucfirst', $parts);
array_unshift($parts, $keepUnchanged);
return implode('', $parts);
} | php | private static function camelCase(string $word, string $regexp):string
{
$parts = array_filter(preg_split($regexp, $word));
$keepUnchanged = array_shift($parts);
$parts = array_map('ucfirst', $parts);
array_unshift($parts, $keepUnchanged);
return implode('', $parts);
} | [
"private",
"static",
"function",
"camelCase",
"(",
"string",
"$",
"word",
",",
"string",
"$",
"regexp",
")",
":",
"string",
"{",
"$",
"parts",
"=",
"array_filter",
"(",
"preg_split",
"(",
"$",
"regexp",
",",
"$",
"word",
")",
")",
";",
"$",
"keepUnchan... | Convert a word to camelCase or CamelCase (not changing first part!)
@param string $word
@param string $regexp
@return string | [
"Convert",
"a",
"word",
"to",
"camelCase",
"or",
"CamelCase",
"(",
"not",
"changing",
"first",
"part!",
")"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php#L138-L146 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php | Normalizer.normalizeMethodName | public static function normalizeMethodName(string $method): string
{
// Methods cant start with a number in PHP - move it after text
$method = preg_replace('{^([0-9]*)(.*)}', '$2$1', $method);
if (is_numeric($method)) {
$method = 'call' . $method;
}
// Methods ca... | php | public static function normalizeMethodName(string $method): string
{
// Methods cant start with a number in PHP - move it after text
$method = preg_replace('{^([0-9]*)(.*)}', '$2$1', $method);
if (is_numeric($method)) {
$method = 'call' . $method;
}
// Methods ca... | [
"public",
"static",
"function",
"normalizeMethodName",
"(",
"string",
"$",
"method",
")",
":",
"string",
"{",
"// Methods cant start with a number in PHP - move it after text",
"$",
"method",
"=",
"preg_replace",
"(",
"'{^([0-9]*)(.*)}'",
",",
"'$2$1'",
",",
"$",
"metho... | @param string $method
@return string | [
"@param",
"string",
"$method"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php#L153-L165 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php | Normalizer.normalizeClassname | public static function normalizeClassname(string $name): string
{
$name = self::normalizeReservedKeywords($name, 'Type');
return ucfirst(self::camelCase($name, '{[^a-z0-9]+}i'));
} | php | public static function normalizeClassname(string $name): string
{
$name = self::normalizeReservedKeywords($name, 'Type');
return ucfirst(self::camelCase($name, '{[^a-z0-9]+}i'));
} | [
"public",
"static",
"function",
"normalizeClassname",
"(",
"string",
"$",
"name",
")",
":",
"string",
"{",
"$",
"name",
"=",
"self",
"::",
"normalizeReservedKeywords",
"(",
"$",
"name",
",",
"'Type'",
")",
";",
"return",
"ucfirst",
"(",
"self",
"::",
"came... | @param string $name
@return string | [
"@param",
"string",
"$name"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php#L172-L177 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php | Normalizer.normalizeDataType | public static function normalizeDataType(string $type): string
{
$searchType = strtolower($type);
return array_key_exists($searchType, self::$normalizations) ? self::$normalizations[$searchType] : $type;
} | php | public static function normalizeDataType(string $type): string
{
$searchType = strtolower($type);
return array_key_exists($searchType, self::$normalizations) ? self::$normalizations[$searchType] : $type;
} | [
"public",
"static",
"function",
"normalizeDataType",
"(",
"string",
"$",
"type",
")",
":",
"string",
"{",
"$",
"searchType",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"searchType",
",",
"self",
"::",
"$",
"norma... | @param string $type
@return string | [
"@param",
"string",
"$type"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php#L205-L210 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php | Normalizer.generatePropertyMethod | public static function generatePropertyMethod(string $prefix, string $property): string
{
return strtolower($prefix).ucfirst(self::normalizeProperty($property));
} | php | public static function generatePropertyMethod(string $prefix, string $property): string
{
return strtolower($prefix).ucfirst(self::normalizeProperty($property));
} | [
"public",
"static",
"function",
"generatePropertyMethod",
"(",
"string",
"$",
"prefix",
",",
"string",
"$",
"property",
")",
":",
"string",
"{",
"return",
"strtolower",
"(",
"$",
"prefix",
")",
".",
"ucfirst",
"(",
"self",
"::",
"normalizeProperty",
"(",
"$"... | @param string $prefix
@param string $property
@return string | [
"@param",
"string",
"$prefix",
"@param",
"string",
"$property"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php#L223-L226 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php | Normalizer.getClassNameFromFQN | public static function getClassNameFromFQN(string $name): string
{
$arr = explode('\\', $name);
return (string)array_pop($arr);
} | php | public static function getClassNameFromFQN(string $name): string
{
$arr = explode('\\', $name);
return (string)array_pop($arr);
} | [
"public",
"static",
"function",
"getClassNameFromFQN",
"(",
"string",
"$",
"name",
")",
":",
"string",
"{",
"$",
"arr",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"name",
")",
";",
"return",
"(",
"string",
")",
"array_pop",
"(",
"$",
"arr",
")",
";",
"... | @param string $name
@return string | [
"@param",
"string",
"$name"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php#L233-L238 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php | Normalizer.getCompleteUseStatement | public static function getCompleteUseStatement(string $useName, string $useAlias = null): string
{
$use = $useName;
if (null !== $useAlias && $useAlias !== '') {
$use .= ' as '.$useAlias;
}
return $use;
} | php | public static function getCompleteUseStatement(string $useName, string $useAlias = null): string
{
$use = $useName;
if (null !== $useAlias && $useAlias !== '') {
$use .= ' as '.$useAlias;
}
return $use;
} | [
"public",
"static",
"function",
"getCompleteUseStatement",
"(",
"string",
"$",
"useName",
",",
"string",
"$",
"useAlias",
"=",
"null",
")",
":",
"string",
"{",
"$",
"use",
"=",
"$",
"useName",
";",
"if",
"(",
"null",
"!==",
"$",
"useAlias",
"&&",
"$",
... | @param string $useName
@param string|null $useAlias
@return string | [
"@param",
"string",
"$useName",
"@param",
"string|null",
"$useAlias"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Util/Normalizer.php#L246-L254 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/ClientGenerator.php | ClientGenerator.generate | public function generate(FileGenerator $file, $client): string
{
$class = $file->getClass() ?: new ClassGenerator();
$class->setNamespaceName($client->getNamespace());
$class->setName($client->getName());
$methods = $client->getMethodMap();
foreach ($methods->getMethods() as... | php | public function generate(FileGenerator $file, $client): string
{
$class = $file->getClass() ?: new ClassGenerator();
$class->setNamespaceName($client->getNamespace());
$class->setName($client->getName());
$methods = $client->getMethodMap();
foreach ($methods->getMethods() as... | [
"public",
"function",
"generate",
"(",
"FileGenerator",
"$",
"file",
",",
"$",
"client",
")",
":",
"string",
"{",
"$",
"class",
"=",
"$",
"file",
"->",
"getClass",
"(",
")",
"?",
":",
"new",
"ClassGenerator",
"(",
")",
";",
"$",
"class",
"->",
"setNa... | @param FileGenerator $file
@param Client $client
@return string | [
"@param",
"FileGenerator",
"$file",
"@param",
"Client",
"$client"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/ClientGenerator.php#L42-L56 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php | GenerateTypesCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$io = new SymfonyStyle($input, $output);
$config = $this->getConfigHelper()->load($input);
$typeMap = TypeMap::fromMetadata(
$config->getT... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$io = new SymfonyStyle($input, $output);
$config = $this->getConfigHelper()->load($input);
$typeMap = TypeMap::fromMetadata(
$config->getT... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"input",
"=",
"$",
"input",
";",
"$",
"this",
"->",
"output",
"=",
"$",
"output",
";",
"$",
"io",
"=",
"new",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php#L73-L96 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php | GenerateTypesCommand.handleType | protected function handleType(TypeGenerator $generator, Type $type, SplFileInfo $fileInfo): bool
{
// Generate type sub folders if needed
$this->filesystem->ensureDirectoryExists($fileInfo->getPath());
// Handle existing class:
if ($fileInfo->isFile()) {
if ($this->handle... | php | protected function handleType(TypeGenerator $generator, Type $type, SplFileInfo $fileInfo): bool
{
// Generate type sub folders if needed
$this->filesystem->ensureDirectoryExists($fileInfo->getPath());
// Handle existing class:
if ($fileInfo->isFile()) {
if ($this->handle... | [
"protected",
"function",
"handleType",
"(",
"TypeGenerator",
"$",
"generator",
",",
"Type",
"$",
"type",
",",
"SplFileInfo",
"$",
"fileInfo",
")",
":",
"bool",
"{",
"// Generate type sub folders if needed",
"$",
"this",
"->",
"filesystem",
"->",
"ensureDirectoryExis... | Try to create a class for a type.
When a class exists: try to patch
If patching the old class does not work: ask for an overwrite
Create a class from an empty file
@param TypeGenerator $generator
@param Type $type
@param SplFileInfo $fileInfo
@return bool | [
"Try",
"to",
"create",
"a",
"class",
"for",
"a",
"type",
".",
"When",
"a",
"class",
"exists",
":",
"try",
"to",
"patch",
"If",
"patching",
"the",
"old",
"class",
"does",
"not",
"work",
":",
"ask",
"for",
"an",
"overwrite",
"Create",
"a",
"class",
"fr... | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php#L109-L138 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php | GenerateTypesCommand.handleExistingFile | protected function handleExistingFile(TypeGenerator $generator, Type $type, SplFileInfo $fileInfo): bool
{
$this->output->write(sprintf('Type %s exists. Trying to patch ...', $type->getName()));
$patched = $this->patchExistingFile($generator, $type, $fileInfo);
if ($patched) {
$... | php | protected function handleExistingFile(TypeGenerator $generator, Type $type, SplFileInfo $fileInfo): bool
{
$this->output->write(sprintf('Type %s exists. Trying to patch ...', $type->getName()));
$patched = $this->patchExistingFile($generator, $type, $fileInfo);
if ($patched) {
$... | [
"protected",
"function",
"handleExistingFile",
"(",
"TypeGenerator",
"$",
"generator",
",",
"Type",
"$",
"type",
",",
"SplFileInfo",
"$",
"fileInfo",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"output",
"->",
"write",
"(",
"sprintf",
"(",
"'Type %s exists. Tryi... | An existing file was found. Try to patch or ask if it can be overwritten.
@param TypeGenerator $generator
@param Type $type
@param SplFileInfo $fileInfo
@return bool | [
"An",
"existing",
"file",
"was",
"found",
".",
"Try",
"to",
"patch",
"or",
"ask",
"if",
"it",
"can",
"be",
"overwritten",
"."
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php#L149-L163 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php | GenerateTypesCommand.patchExistingFile | protected function patchExistingFile(TypeGenerator $generator, Type $type, SplFileInfo $fileInfo): bool
{
try {
$this->filesystem->createBackup($fileInfo->getPathname());
$file = FileGenerator::fromReflectedFileName($fileInfo->getPathname());
$this->generateType($file, $g... | php | protected function patchExistingFile(TypeGenerator $generator, Type $type, SplFileInfo $fileInfo): bool
{
try {
$this->filesystem->createBackup($fileInfo->getPathname());
$file = FileGenerator::fromReflectedFileName($fileInfo->getPathname());
$this->generateType($file, $g... | [
"protected",
"function",
"patchExistingFile",
"(",
"TypeGenerator",
"$",
"generator",
",",
"Type",
"$",
"type",
",",
"SplFileInfo",
"$",
"fileInfo",
")",
":",
"bool",
"{",
"try",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"createBackup",
"(",
"$",
"fileInfo... | This method tries to patch an existing type class.
@param TypeGenerator $generator
@param Type $type
@param SplFileInfo $fileInfo
@return bool | [
"This",
"method",
"tries",
"to",
"patch",
"an",
"existing",
"type",
"class",
"."
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php#L173-L187 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php | GenerateTypesCommand.generateType | protected function generateType(FileGenerator $file, TypeGenerator $generator, Type $type, SplFileInfo $fileInfo)
{
$code = $generator->generate($file, $type);
$this->filesystem->putFileContents($fileInfo->getPathname(), $code);
} | php | protected function generateType(FileGenerator $file, TypeGenerator $generator, Type $type, SplFileInfo $fileInfo)
{
$code = $generator->generate($file, $type);
$this->filesystem->putFileContents($fileInfo->getPathname(), $code);
} | [
"protected",
"function",
"generateType",
"(",
"FileGenerator",
"$",
"file",
",",
"TypeGenerator",
"$",
"generator",
",",
"Type",
"$",
"type",
",",
"SplFileInfo",
"$",
"fileInfo",
")",
"{",
"$",
"code",
"=",
"$",
"generator",
"->",
"generate",
"(",
"$",
"fi... | Generates one type class
@param FileGenerator $file
@param TypeGenerator $generator
@param Type $type
@param SplFileInfo $fileInfo | [
"Generates",
"one",
"type",
"class"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateTypesCommand.php#L197-L201 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/FluentSetterAssembler.php | FluentSetterAssembler.getParameter | private function getParameter(Property $property): array
{
$type = $property->getType();
if (TypeChecker::isKnownType($type) && $this->options->useTypeHints()) {
return [
[
'name' => $property->getName(),
'type' => $type,
... | php | private function getParameter(Property $property): array
{
$type = $property->getType();
if (TypeChecker::isKnownType($type) && $this->options->useTypeHints()) {
return [
[
'name' => $property->getName(),
'type' => $type,
... | [
"private",
"function",
"getParameter",
"(",
"Property",
"$",
"property",
")",
":",
"array",
"{",
"$",
"type",
"=",
"$",
"property",
"->",
"getType",
"(",
")",
";",
"if",
"(",
"TypeChecker",
"::",
"isKnownType",
"(",
"$",
"type",
")",
"&&",
"$",
"this",... | @param Property $property
@return array | [
"@param",
"Property",
"$property"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/FluentSetterAssembler.php#L92-L105 |
phpro/soap-client | src/Phpro/SoapClient/Soap/TypeConverter/DateTimeTypeConverter.php | DateTimeTypeConverter.convertXmlToPhp | public function convertXmlToPhp(string $data)
{
$doc = new DOMDocument();
$doc->loadXML($data);
if ('' === $doc->textContent) {
return null;
}
$dateTime = new DateTimeImmutable($doc->textContent);
return $dateTime->setTimezone(new DateTimeZone(date_defa... | php | public function convertXmlToPhp(string $data)
{
$doc = new DOMDocument();
$doc->loadXML($data);
if ('' === $doc->textContent) {
return null;
}
$dateTime = new DateTimeImmutable($doc->textContent);
return $dateTime->setTimezone(new DateTimeZone(date_defa... | [
"public",
"function",
"convertXmlToPhp",
"(",
"string",
"$",
"data",
")",
"{",
"$",
"doc",
"=",
"new",
"DOMDocument",
"(",
")",
";",
"$",
"doc",
"->",
"loadXML",
"(",
"$",
"data",
")",
";",
"if",
"(",
"''",
"===",
"$",
"doc",
"->",
"textContent",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Soap/TypeConverter/DateTimeTypeConverter.php#L38-L50 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ClassMapAssembler.php | ClassMapAssembler.assemble | public function assemble(ContextInterface $context)
{
$class = ClassGenerator::fromArray(
[
'name' => $context->getName(),
]
);
$file = $context->getFile();
$file->setClass($class);
$file->setNamespace($context->getNamespace());
... | php | public function assemble(ContextInterface $context)
{
$class = ClassGenerator::fromArray(
[
'name' => $context->getName(),
]
);
$file = $context->getFile();
$file->setClass($class);
$file->setNamespace($context->getNamespace());
... | [
"public",
"function",
"assemble",
"(",
"ContextInterface",
"$",
"context",
")",
"{",
"$",
"class",
"=",
"ClassGenerator",
"::",
"fromArray",
"(",
"[",
"'name'",
"=>",
"$",
"context",
"->",
"getName",
"(",
")",
",",
"]",
")",
";",
"$",
"file",
"=",
"$",... | @param ClassMapContext|ContextInterface $context
@throws \Phpro\SoapClient\Exception\AssemblerException | [
"@param",
"ClassMapContext|ContextInterface",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ClassMapAssembler.php#L36-L69 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ClassMapAssembler.php | ClassMapAssembler.assembleClassMap | private function assembleClassMap(TypeMap $typeMap, string $linefeed, string $indentation): string
{
$classMap = [];
foreach ($typeMap->getTypes() as $type) {
$classMap[] = sprintf(
'%snew ClassMap(\'%s\', %s::class),',
$indentation,
$type-... | php | private function assembleClassMap(TypeMap $typeMap, string $linefeed, string $indentation): string
{
$classMap = [];
foreach ($typeMap->getTypes() as $type) {
$classMap[] = sprintf(
'%snew ClassMap(\'%s\', %s::class),',
$indentation,
$type-... | [
"private",
"function",
"assembleClassMap",
"(",
"TypeMap",
"$",
"typeMap",
",",
"string",
"$",
"linefeed",
",",
"string",
"$",
"indentation",
")",
":",
"string",
"{",
"$",
"classMap",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"typeMap",
"->",
"getTypes",
... | *
@param TypeMap $typeMap
@param string $linefeed
@param string $indentation
@return string | [
"*",
"@param",
"TypeMap",
"$typeMap",
"@param",
"string",
"$linefeed",
"@param",
"string",
"$indentation"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ClassMapAssembler.php#L78-L91 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ClassMapAssembler.php | ClassMapAssembler.assembleClassMapCollection | private function assembleClassMapCollection(string $classMap, string $linefeed): string
{
$code = [
'new ClassMapCollection([',
'%s',
']);',
];
return sprintf(implode($linefeed, $code), $classMap);
} | php | private function assembleClassMapCollection(string $classMap, string $linefeed): string
{
$code = [
'new ClassMapCollection([',
'%s',
']);',
];
return sprintf(implode($linefeed, $code), $classMap);
} | [
"private",
"function",
"assembleClassMapCollection",
"(",
"string",
"$",
"classMap",
",",
"string",
"$",
"linefeed",
")",
":",
"string",
"{",
"$",
"code",
"=",
"[",
"'new ClassMapCollection(['",
",",
"'%s'",
",",
"']);'",
",",
"]",
";",
"return",
"sprintf",
... | @param string $classMap
@param string $linefeed
@return string | [
"@param",
"string",
"$classMap",
"@param",
"string",
"$linefeed"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ClassMapAssembler.php#L99-L108 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClientFactoryCommand.php | GenerateClientFactoryCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$config = $this->getConfigHelper()->load($input);
$classmapContext = new ClassMapContext(
new FileGenerator(),
new TypeMap('', []),
$confi... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$config = $this->getConfigHelper()->load($input);
$classmapContext = new ClassMapContext(
new FileGenerator(),
new TypeMap('', []),
$confi... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"ge... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClientFactoryCommand.php#L58-L75 |
phpro/soap-client | src/Phpro/SoapClient/Exception/WsdlException.php | WsdlException.fromException | public static function fromException(\Throwable $exception): self
{
return new self(
$exception->getMessage(),
$exception->getCode(),
$exception
);
} | php | public static function fromException(\Throwable $exception): self
{
return new self(
$exception->getMessage(),
$exception->getCode(),
$exception
);
} | [
"public",
"static",
"function",
"fromException",
"(",
"\\",
"Throwable",
"$",
"exception",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"$",
"exception",
"->",
"getMessage",
"(",
")",
",",
"$",
"exception",
"->",
"getCode",
"(",
")",
",",
"$",
... | @param \Throwable $exception
@return WsdlException | [
"@param",
"\\",
"Throwable",
"$exception"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Exception/WsdlException.php#L29-L36 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/PropertyAssembler.php | PropertyAssembler.assemble | public function assemble(ContextInterface $context)
{
$class = $context->getClass();
$property = $context->getProperty();
try {
// It's not possible to overwrite a property in zend-code yet!
if ($class->hasProperty($property->getName())) {
return;
... | php | public function assemble(ContextInterface $context)
{
$class = $context->getClass();
$property = $context->getProperty();
try {
// It's not possible to overwrite a property in zend-code yet!
if ($class->hasProperty($property->getName())) {
return;
... | [
"public",
"function",
"assemble",
"(",
"ContextInterface",
"$",
"context",
")",
"{",
"$",
"class",
"=",
"$",
"context",
"->",
"getClass",
"(",
")",
";",
"$",
"property",
"=",
"$",
"context",
"->",
"getProperty",
"(",
")",
";",
"try",
"{",
"// It's not po... | @param ContextInterface|PropertyContext $context
@throws AssemblerException | [
"@param",
"ContextInterface|PropertyContext",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/PropertyAssembler.php#L45-L73 |
phpro/soap-client | src/Phpro/SoapClient/Client.php | Client.debugLastSoapRequest | public function debugLastSoapRequest(): array
{
$lastRequestInfo = $this->engine->collectLastRequestInfo();
return [
'request' => [
'headers' => trim($this->soapClient->__getLastRequestHeaders()),
'body' => XmlFormatter::format($this->soapClient->__getL... | php | public function debugLastSoapRequest(): array
{
$lastRequestInfo = $this->engine->collectLastRequestInfo();
return [
'request' => [
'headers' => trim($this->soapClient->__getLastRequestHeaders()),
'body' => XmlFormatter::format($this->soapClient->__getL... | [
"public",
"function",
"debugLastSoapRequest",
"(",
")",
":",
"array",
"{",
"$",
"lastRequestInfo",
"=",
"$",
"this",
"->",
"engine",
"->",
"collectLastRequestInfo",
"(",
")",
";",
"return",
"[",
"'request'",
"=>",
"[",
"'headers'",
"=>",
"trim",
"(",
"$",
... | Make it possible to debug the last request.
@return array | [
"Make",
"it",
"possible",
"to",
"debug",
"the",
"last",
"request",
"."
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Client.php#L44-L57 |
phpro/soap-client | src/Phpro/SoapClient/Client.php | Client.call | protected function call(string $method, RequestInterface $request): ResultInterface
{
$requestEvent = new Event\RequestEvent($this, $method, $request);
$this->dispatcher->dispatch(Events::REQUEST, $requestEvent);
try {
$arguments = ($request instanceof MultiArgumentRequestInterf... | php | protected function call(string $method, RequestInterface $request): ResultInterface
{
$requestEvent = new Event\RequestEvent($this, $method, $request);
$this->dispatcher->dispatch(Events::REQUEST, $requestEvent);
try {
$arguments = ($request instanceof MultiArgumentRequestInterf... | [
"protected",
"function",
"call",
"(",
"string",
"$",
"method",
",",
"RequestInterface",
"$",
"request",
")",
":",
"ResultInterface",
"{",
"$",
"requestEvent",
"=",
"new",
"Event",
"\\",
"RequestEvent",
"(",
"$",
"this",
",",
"$",
"method",
",",
"$",
"reque... | @param string $method
@param RequestInterface $request
@return ResultInterface
@throws SoapException | [
"@param",
"string",
"$method",
"@param",
"RequestInterface",
"$request"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Client.php#L66-L90 |
phpro/soap-client | src/Phpro/SoapClient/Xml/Xml.php | Xml.xpath | public function xpath(string $expression, \DOMNode $contextNode = null): \DOMNodeList
{
return $this->xpath->query($expression, $contextNode);
} | php | public function xpath(string $expression, \DOMNode $contextNode = null): \DOMNodeList
{
return $this->xpath->query($expression, $contextNode);
} | [
"public",
"function",
"xpath",
"(",
"string",
"$",
"expression",
",",
"\\",
"DOMNode",
"$",
"contextNode",
"=",
"null",
")",
":",
"\\",
"DOMNodeList",
"{",
"return",
"$",
"this",
"->",
"xpath",
"->",
"query",
"(",
"$",
"expression",
",",
"$",
"contextNod... | @param string $expression
@param DOMNode|null $contextNode
@return \DOMNodeList | [
"@param",
"string",
"$expression",
"@param",
"DOMNode|null",
"$contextNode"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Xml/Xml.php#L78-L81 |
phpro/soap-client | src/Phpro/SoapClient/Xml/Xml.php | Xml.fromStream | public static function fromStream(StreamInterface $stream): Xml
{
$xml = new DOMDocument();
$xml->loadXML($stream->getContents());
return new static($xml);
} | php | public static function fromStream(StreamInterface $stream): Xml
{
$xml = new DOMDocument();
$xml->loadXML($stream->getContents());
return new static($xml);
} | [
"public",
"static",
"function",
"fromStream",
"(",
"StreamInterface",
"$",
"stream",
")",
":",
"Xml",
"{",
"$",
"xml",
"=",
"new",
"DOMDocument",
"(",
")",
";",
"$",
"xml",
"->",
"loadXML",
"(",
"$",
"stream",
"->",
"getContents",
"(",
")",
")",
";",
... | @param StreamInterface $stream
@return Xml
@throws \RuntimeException | [
"@param",
"StreamInterface",
"$stream"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Xml/Xml.php#L89-L95 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ImmutableSetterAssembler.php | ImmutableSetterAssembler.assemble | public function assemble(ContextInterface $context)
{
$class = $context->getClass();
$property = $context->getProperty();
try {
$methodName = Normalizer::generatePropertyMethod('with', $property->getName());
$class->removeMethod($methodName);
$lines = [
... | php | public function assemble(ContextInterface $context)
{
$class = $context->getClass();
$property = $context->getProperty();
try {
$methodName = Normalizer::generatePropertyMethod('with', $property->getName());
$class->removeMethod($methodName);
$lines = [
... | [
"public",
"function",
"assemble",
"(",
"ContextInterface",
"$",
"context",
")",
"{",
"$",
"class",
"=",
"$",
"context",
"->",
"getClass",
"(",
")",
";",
"$",
"property",
"=",
"$",
"context",
"->",
"getProperty",
"(",
")",
";",
"try",
"{",
"$",
"methodN... | Assembles pieces of code.
@param ContextInterface|PropertyContext $context
@throws AssemblerException | [
"Assembles",
"pieces",
"of",
"code",
"."
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ImmutableSetterAssembler.php#L52-L94 |
phpro/soap-client | src/Phpro/SoapClient/Soap/ClassMap/ClassMapCollection.php | ClassMapCollection.add | public function add(ClassMapInterface $classMap): self
{
if ($this->has($classMap)) {
throw new InvalidArgumentException('The classmap already exists!');
}
return $this->set($classMap);
} | php | public function add(ClassMapInterface $classMap): self
{
if ($this->has($classMap)) {
throw new InvalidArgumentException('The classmap already exists!');
}
return $this->set($classMap);
} | [
"public",
"function",
"add",
"(",
"ClassMapInterface",
"$",
"classMap",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"classMap",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The classmap already exists!'",
")",
"... | @param ClassMapInterface $classMap
@return ClassMapCollection | [
"@param",
"ClassMapInterface",
"$classMap"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Soap/ClassMap/ClassMapCollection.php#L36-L43 |
phpro/soap-client | src/Phpro/SoapClient/Soap/ClassMap/ClassMapCollection.php | ClassMapCollection.set | public function set(ClassMapInterface $classMap): self
{
$this->classMaps[$classMap->getWsdlType()] = $classMap;
return $this;
} | php | public function set(ClassMapInterface $classMap): self
{
$this->classMaps[$classMap->getWsdlType()] = $classMap;
return $this;
} | [
"public",
"function",
"set",
"(",
"ClassMapInterface",
"$",
"classMap",
")",
":",
"self",
"{",
"$",
"this",
"->",
"classMaps",
"[",
"$",
"classMap",
"->",
"getWsdlType",
"(",
")",
"]",
"=",
"$",
"classMap",
";",
"return",
"$",
"this",
";",
"}"
] | @param ClassMapInterface $classMap
@return $this | [
"@param",
"ClassMapInterface",
"$classMap"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Soap/ClassMap/ClassMapCollection.php#L50-L55 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ResultProviderAssembler.php | ResultProviderAssembler.assemble | public function assemble(ContextInterface $context)
{
$class = $context->getClass();
$properties = $context->getType()->getProperties();
$firstProperty = count($properties) ? current($properties) : null;
try {
$interfaceAssembler = new InterfaceAssembler(ResultProviderIn... | php | public function assemble(ContextInterface $context)
{
$class = $context->getClass();
$properties = $context->getType()->getProperties();
$firstProperty = count($properties) ? current($properties) : null;
try {
$interfaceAssembler = new InterfaceAssembler(ResultProviderIn... | [
"public",
"function",
"assemble",
"(",
"ContextInterface",
"$",
"context",
")",
"{",
"$",
"class",
"=",
"$",
"context",
"->",
"getClass",
"(",
")",
";",
"$",
"properties",
"=",
"$",
"context",
"->",
"getType",
"(",
")",
"->",
"getProperties",
"(",
")",
... | @param ContextInterface|TypeContext $context
@throws AssemblerException | [
"@param",
"ContextInterface|TypeContext",
"$context"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ResultProviderAssembler.php#L51-L69 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ResultProviderAssembler.php | ResultProviderAssembler.implementGetResult | private function implementGetResult(ContextInterface $context, ClassGenerator $class, Property $property)
{
$useAssembler = new UseAssembler($this->wrapperClass ?: ResultInterface::class);
if ($useAssembler->canAssemble($context)) {
$useAssembler->assemble($context);
}
$... | php | private function implementGetResult(ContextInterface $context, ClassGenerator $class, Property $property)
{
$useAssembler = new UseAssembler($this->wrapperClass ?: ResultInterface::class);
if ($useAssembler->canAssemble($context)) {
$useAssembler->assemble($context);
}
$... | [
"private",
"function",
"implementGetResult",
"(",
"ContextInterface",
"$",
"context",
",",
"ClassGenerator",
"$",
"class",
",",
"Property",
"$",
"property",
")",
"{",
"$",
"useAssembler",
"=",
"new",
"UseAssembler",
"(",
"$",
"this",
"->",
"wrapperClass",
"?",
... | @param ContextInterface $context
@param ClassGenerator $class
@param Property $property
@throws \Zend\Code\Generator\Exception\InvalidArgumentException | [
"@param",
"ContextInterface",
"$context",
"@param",
"ClassGenerator",
"$class",
"@param",
"Property",
"$property"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ResultProviderAssembler.php#L78-L104 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ResultProviderAssembler.php | ResultProviderAssembler.generateGetResultBody | private function generateGetResultBody(Property $property): string
{
if ($this->wrapperClass === null) {
return sprintf('return $this->%s;', $property->getName());
}
return sprintf(
'return new %s($this->%s);',
Normalizer::getClassNameFromFQN($this->wrapp... | php | private function generateGetResultBody(Property $property): string
{
if ($this->wrapperClass === null) {
return sprintf('return $this->%s;', $property->getName());
}
return sprintf(
'return new %s($this->%s);',
Normalizer::getClassNameFromFQN($this->wrapp... | [
"private",
"function",
"generateGetResultBody",
"(",
"Property",
"$",
"property",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"wrapperClass",
"===",
"null",
")",
"{",
"return",
"sprintf",
"(",
"'return $this->%s;'",
",",
"$",
"property",
"->",
"ge... | @param Property $property
@return string | [
"@param",
"Property",
"$property"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ResultProviderAssembler.php#L111-L122 |
phpro/soap-client | src/Phpro/SoapClient/CodeGenerator/Assembler/ResultProviderAssembler.php | ResultProviderAssembler.generateGetResultReturnTag | private function generateGetResultReturnTag(Property $property): string
{
if ($this->wrapperClass === null) {
return $property->getType() . '|' . Normalizer::getClassNameFromFQN(ResultInterface::class);
}
return Normalizer::getClassNameFromFQN($this->wrapperClass);
} | php | private function generateGetResultReturnTag(Property $property): string
{
if ($this->wrapperClass === null) {
return $property->getType() . '|' . Normalizer::getClassNameFromFQN(ResultInterface::class);
}
return Normalizer::getClassNameFromFQN($this->wrapperClass);
} | [
"private",
"function",
"generateGetResultReturnTag",
"(",
"Property",
"$",
"property",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"wrapperClass",
"===",
"null",
")",
"{",
"return",
"$",
"property",
"->",
"getType",
"(",
")",
".",
"'|'",
".",
... | @param Property $property
@return string | [
"@param",
"Property",
"$property"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/CodeGenerator/Assembler/ResultProviderAssembler.php#L129-L136 |
phpro/soap-client | src/Phpro/SoapClient/Wsdl/Provider/HttPlugWsdlProvider.php | HttPlugWsdlProvider.provide | public function provide(string $source): string
{
$client = new PluginClient($this->client, $this->middlewares);
$location = $this->getLocation() ?: tempnam(sys_get_temp_dir(), 'phpro-soap-client-wsdl');
if (!$this->filesystem->fileExists($location)) {
throw WsdlException::notFo... | php | public function provide(string $source): string
{
$client = new PluginClient($this->client, $this->middlewares);
$location = $this->getLocation() ?: tempnam(sys_get_temp_dir(), 'phpro-soap-client-wsdl');
if (!$this->filesystem->fileExists($location)) {
throw WsdlException::notFo... | [
"public",
"function",
"provide",
"(",
"string",
"$",
"source",
")",
":",
"string",
"{",
"$",
"client",
"=",
"new",
"PluginClient",
"(",
"$",
"this",
"->",
"client",
",",
"$",
"this",
"->",
"middlewares",
")",
";",
"$",
"location",
"=",
"$",
"this",
"... | @param string $source
@return string
@throws \Phpro\SoapClient\Exception\WsdlException | [
"@param",
"string",
"$source"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Wsdl/Provider/HttPlugWsdlProvider.php#L76-L94 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php | GenerateClientCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$io = new SymfonyStyle($input, $output);
$config = $this->getConfigHelper()->load($input);
$destination = $config->getClientDestination().'/'.$config... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$io = new SymfonyStyle($input, $output);
$config = $this->getConfigHelper()->load($input);
$destination = $config->getClientDestination().'/'.$config... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"input",
"=",
"$",
"input",
";",
"$",
"this",
"->",
"output",
"=",
"$",
"output",
";",
"$",
"io",
"=",
"new",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php#L73-L98 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php | GenerateClientCommand.generateClient | protected function generateClient(FileGenerator $file, ClientGenerator $generator, Client $client, $path)
{
$code = $generator->generate($file, $client);
$this->filesystem->putFileContents($path, $code);
} | php | protected function generateClient(FileGenerator $file, ClientGenerator $generator, Client $client, $path)
{
$code = $generator->generate($file, $client);
$this->filesystem->putFileContents($path, $code);
} | [
"protected",
"function",
"generateClient",
"(",
"FileGenerator",
"$",
"file",
",",
"ClientGenerator",
"$",
"generator",
",",
"Client",
"$",
"client",
",",
"$",
"path",
")",
"{",
"$",
"code",
"=",
"$",
"generator",
"->",
"generate",
"(",
"$",
"file",
",",
... | Generates one type class
@param FileGenerator $file
@param ClientGenerator|TypeGenerator $generator
@param Client $client
@param string $path | [
"Generates",
"one",
"type",
"class"
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php#L108-L112 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php | GenerateClientCommand.handleClient | protected function handleClient(ClientGenerator $generator, Client $client, $path)
{
// Handle existing class:
if ($this->filesystem->fileExists($path)) {
if ($this->handleExistingFile($generator, $client, $path)) {
return true;
}
// Ask if a clas... | php | protected function handleClient(ClientGenerator $generator, Client $client, $path)
{
// Handle existing class:
if ($this->filesystem->fileExists($path)) {
if ($this->handleExistingFile($generator, $client, $path)) {
return true;
}
// Ask if a clas... | [
"protected",
"function",
"handleClient",
"(",
"ClientGenerator",
"$",
"generator",
",",
"Client",
"$",
"client",
",",
"$",
"path",
")",
"{",
"// Handle existing class:",
"if",
"(",
"$",
"this",
"->",
"filesystem",
"->",
"fileExists",
"(",
"$",
"path",
")",
"... | Try to create a class for a type.
When a class exists: try to patch
If patching the old class does not work: ask for an overwrite
Create a class from an empty file
@param ClientGenerator|TypeGenerator $generator
@param Client $client
@param string $path
@return bool | [
"Try",
"to",
"create",
"a",
"class",
"for",
"a",
"type",
".",
"When",
"a",
"class",
"exists",
":",
"try",
"to",
"patch",
"If",
"patching",
"the",
"old",
"class",
"does",
"not",
"work",
":",
"ask",
"for",
"an",
"overwrite",
"Create",
"a",
"class",
"fr... | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php#L125-L152 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php | GenerateClientCommand.handleExistingFile | protected function handleExistingFile(TypeGenerator $generator, Client $client, $path)
{
$this->output->write(sprintf('Type %s exists. Trying to patch ...', $client->getName()));
$patched = $this->patchExistingFile($generator, $client, $path);
if ($patched) {
$this->output->writ... | php | protected function handleExistingFile(TypeGenerator $generator, Client $client, $path)
{
$this->output->write(sprintf('Type %s exists. Trying to patch ...', $client->getName()));
$patched = $this->patchExistingFile($generator, $client, $path);
if ($patched) {
$this->output->writ... | [
"protected",
"function",
"handleExistingFile",
"(",
"TypeGenerator",
"$",
"generator",
",",
"Client",
"$",
"client",
",",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"write",
"(",
"sprintf",
"(",
"'Type %s exists. Trying to patch ...'",
",",
"$",
... | An existing file was found. Try to patch or ask if it can be overwritten.
@param TypeGenerator $generator
@param Client $client
@param string $path
@return bool | [
"An",
"existing",
"file",
"was",
"found",
".",
"Try",
"to",
"patch",
"or",
"ask",
"if",
"it",
"can",
"be",
"overwritten",
"."
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php#L162-L176 |
phpro/soap-client | src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php | GenerateClientCommand.patchExistingFile | protected function patchExistingFile(TypeGenerator $generator, Client $client, $path)
{
try {
$this->filesystem->createBackup($path);
$file = FileGenerator::fromReflectedFileName($path);
$this->generateClient($file, $generator, $client, $path);
} catch (\Exception... | php | protected function patchExistingFile(TypeGenerator $generator, Client $client, $path)
{
try {
$this->filesystem->createBackup($path);
$file = FileGenerator::fromReflectedFileName($path);
$this->generateClient($file, $generator, $client, $path);
} catch (\Exception... | [
"protected",
"function",
"patchExistingFile",
"(",
"TypeGenerator",
"$",
"generator",
",",
"Client",
"$",
"client",
",",
"$",
"path",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"createBackup",
"(",
"$",
"path",
")",
";",
"$",
"file",
"=... | This method tries to patch an existing type class.
@param TypeGenerator $generator
@param Client $client
@param string $path
@return bool
@internal param Type $type | [
"This",
"method",
"tries",
"to",
"patch",
"an",
"existing",
"type",
"class",
"."
] | train | https://github.com/phpro/soap-client/blob/5d963557b5e4a845000bb7558d2d2b0d78357e9b/src/Phpro/SoapClient/Console/Command/GenerateClientCommand.php#L187-L201 |
svenluijten/artisan-view | src/Commands/MakeView.php | MakeView.handle | public function handle()
{
$path = $this->getPath();
$generator = new Generator($this->getConfig(), $path);
$generator->generate(
(new BlockStack)->build($this->input, $path)
);
$this->info('View created successfully.');
} | php | public function handle()
{
$path = $this->getPath();
$generator = new Generator($this->getConfig(), $path);
$generator->generate(
(new BlockStack)->build($this->input, $path)
);
$this->info('View created successfully.');
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getPath",
"(",
")",
";",
"$",
"generator",
"=",
"new",
"Generator",
"(",
"$",
"this",
"->",
"getConfig",
"(",
")",
",",
"$",
"path",
")",
";",
"$",
"generator",
... | Execute the command. | [
"Execute",
"the",
"command",
"."
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/Commands/MakeView.php#L27-L38 |
svenluijten/artisan-view | src/PathHelper.php | PathHelper.removeFileName | public static function removeFileName($path)
{
$parts = explode(DIRECTORY_SEPARATOR, static::normalizePath($path));
array_pop($parts);
return implode(DIRECTORY_SEPARATOR, $parts);
} | php | public static function removeFileName($path)
{
$parts = explode(DIRECTORY_SEPARATOR, static::normalizePath($path));
array_pop($parts);
return implode(DIRECTORY_SEPARATOR, $parts);
} | [
"public",
"static",
"function",
"removeFileName",
"(",
"$",
"path",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"DIRECTORY_SEPARATOR",
",",
"static",
"::",
"normalizePath",
"(",
"$",
"path",
")",
")",
";",
"array_pop",
"(",
"$",
"parts",
")",
";",
"retu... | @param string $path
@return string | [
"@param",
"string",
"$path"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/PathHelper.php#L34-L41 |
svenluijten/artisan-view | src/Voters/YieldsFromParent.php | YieldsFromParent.run | public function run(InputInterface $input, BlockStack $blockStack)
{
preg_match_all(
'~(?<!\@)\@yield\((\'|\")(.+)\1\)~',
$this->file($input->getOption('extends')),
$matches
);
foreach ($matches[2] as $section) {
$blockStack->add(new Section($... | php | public function run(InputInterface $input, BlockStack $blockStack)
{
preg_match_all(
'~(?<!\@)\@yield\((\'|\")(.+)\1\)~',
$this->file($input->getOption('extends')),
$matches
);
foreach ($matches[2] as $section) {
$blockStack->add(new Section($... | [
"public",
"function",
"run",
"(",
"InputInterface",
"$",
"input",
",",
"BlockStack",
"$",
"blockStack",
")",
"{",
"preg_match_all",
"(",
"'~(?<!\\@)\\@yield\\((\\'|\\\")(.+)\\1\\)~'",
",",
"$",
"this",
"->",
"file",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'e... | {@inheritdoc} | [
"{"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/Voters/YieldsFromParent.php#L36-L47 |
svenluijten/artisan-view | src/Voters/YieldsFromParent.php | YieldsFromParent.file | protected function file($name)
{
$path = PathHelper::normalizePath(
$this->path.DIRECTORY_SEPARATOR.str_replace('.', '/', $name).'.blade.php'
);
return file_exists($path) ? file_get_contents($path) : '';
} | php | protected function file($name)
{
$path = PathHelper::normalizePath(
$this->path.DIRECTORY_SEPARATOR.str_replace('.', '/', $name).'.blade.php'
);
return file_exists($path) ? file_get_contents($path) : '';
} | [
"protected",
"function",
"file",
"(",
"$",
"name",
")",
"{",
"$",
"path",
"=",
"PathHelper",
"::",
"normalizePath",
"(",
"$",
"this",
"->",
"path",
".",
"DIRECTORY_SEPARATOR",
".",
"str_replace",
"(",
"'.'",
",",
"'/'",
",",
"$",
"name",
")",
".",
"'.b... | Get the contents of one of the view with the given name.
@param string $name
@return string | [
"Get",
"the",
"contents",
"of",
"one",
"of",
"the",
"view",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/Voters/YieldsFromParent.php#L56-L63 |
svenluijten/artisan-view | src/BlockBuilder.php | BlockBuilder.build | public static function build($blocks)
{
return array_reduce($blocks, function ($carry, Block $block) {
return $carry.$block->render();
}, '');
} | php | public static function build($blocks)
{
return array_reduce($blocks, function ($carry, Block $block) {
return $carry.$block->render();
}, '');
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"blocks",
")",
"{",
"return",
"array_reduce",
"(",
"$",
"blocks",
",",
"function",
"(",
"$",
"carry",
",",
"Block",
"$",
"block",
")",
"{",
"return",
"$",
"carry",
".",
"$",
"block",
"->",
"render",
... | @param \Sven\ArtisanView\Blocks\Block[] $blocks
@return string | [
"@param",
"\\",
"Sven",
"\\",
"ArtisanView",
"\\",
"Blocks",
"\\",
"Block",
"[]",
"$blocks"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/BlockBuilder.php#L14-L19 |
svenluijten/artisan-view | src/Voters/StacksFromParent.php | StacksFromParent.canHandle | public function canHandle(InputInterface $input)
{
return $input->hasOption('extends') && $input->getOption('extends')
&& $input->hasOption('with-stacks') && $input->getOption('with-stacks');
} | php | public function canHandle(InputInterface $input)
{
return $input->hasOption('extends') && $input->getOption('extends')
&& $input->hasOption('with-stacks') && $input->getOption('with-stacks');
} | [
"public",
"function",
"canHandle",
"(",
"InputInterface",
"$",
"input",
")",
"{",
"return",
"$",
"input",
"->",
"hasOption",
"(",
"'extends'",
")",
"&&",
"$",
"input",
"->",
"getOption",
"(",
"'extends'",
")",
"&&",
"$",
"input",
"->",
"hasOption",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/Voters/StacksFromParent.php#L20-L24 |
svenluijten/artisan-view | src/Voters/StacksFromParent.php | StacksFromParent.run | public function run(InputInterface $input, BlockStack $blockStack)
{
preg_match_all(
'~(?<!\@)\@stack\((\'|\")(.+)\1\)~',
$this->file($input->getOption('extends')),
$matches
);
foreach ($matches[2] as $stack) {
$blockStack->add(new Push($stack... | php | public function run(InputInterface $input, BlockStack $blockStack)
{
preg_match_all(
'~(?<!\@)\@stack\((\'|\")(.+)\1\)~',
$this->file($input->getOption('extends')),
$matches
);
foreach ($matches[2] as $stack) {
$blockStack->add(new Push($stack... | [
"public",
"function",
"run",
"(",
"InputInterface",
"$",
"input",
",",
"BlockStack",
"$",
"blockStack",
")",
"{",
"preg_match_all",
"(",
"'~(?<!\\@)\\@stack\\((\\'|\\\")(.+)\\1\\)~'",
",",
"$",
"this",
"->",
"file",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'e... | {@inheritdoc} | [
"{"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/Voters/StacksFromParent.php#L36-L47 |
svenluijten/artisan-view | src/Voters/ExtendsParent.php | ExtendsParent.run | public function run(InputInterface $input, BlockStack $blockStack)
{
$blockStack->add(new Extend($input->getOption('extends')));
} | php | public function run(InputInterface $input, BlockStack $blockStack)
{
$blockStack->add(new Extend($input->getOption('extends')));
} | [
"public",
"function",
"run",
"(",
"InputInterface",
"$",
"input",
",",
"BlockStack",
"$",
"blockStack",
")",
"{",
"$",
"blockStack",
"->",
"add",
"(",
"new",
"Extend",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'extends'",
")",
")",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/Voters/ExtendsParent.php#L34-L37 |
svenluijten/artisan-view | src/Commands/ScrapView.php | ScrapView.handle | public function handle()
{
$config = $this->getConfig();
if (! $config->isForce() && ! $this->confirm('Are you sure you want to scrap the view?')) {
$this->line('Alright, nothing happened.');
return;
}
(new Destroyer($config, $this->getPath()))->destroy();
... | php | public function handle()
{
$config = $this->getConfig();
if (! $config->isForce() && ! $this->confirm('Are you sure you want to scrap the view?')) {
$this->line('Alright, nothing happened.');
return;
}
(new Destroyer($config, $this->getPath()))->destroy();
... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"if",
"(",
"!",
"$",
"config",
"->",
"isForce",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"confirm",
"(",
"'Are you sure you want to scrap t... | Execute the command. | [
"Execute",
"the",
"command",
"."
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/Commands/ScrapView.php#L26-L39 |
svenluijten/artisan-view | src/Voters/SectionsInParent.php | SectionsInParent.run | public function run(InputInterface $input, BlockStack $blockStack)
{
foreach ((array) $input->getOption('section') as $section) {
if (str_contains($section, ':')) {
list($name, $title) = explode(':', $section);
$blockStack->add(new InlineSection($name, $title));
... | php | public function run(InputInterface $input, BlockStack $blockStack)
{
foreach ((array) $input->getOption('section') as $section) {
if (str_contains($section, ':')) {
list($name, $title) = explode(':', $section);
$blockStack->add(new InlineSection($name, $title));
... | [
"public",
"function",
"run",
"(",
"InputInterface",
"$",
"input",
",",
"BlockStack",
"$",
"blockStack",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"input",
"->",
"getOption",
"(",
"'section'",
")",
"as",
"$",
"section",
")",
"{",
"if",
"(",
"str... | {@inheritdoc} | [
"{"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/Voters/SectionsInParent.php#L35-L46 |
svenluijten/artisan-view | src/ViewActor.php | ViewActor.getViewNames | protected function getViewNames(array $names)
{
return array_map(function ($name) {
$name = str_replace('.', '/', $name);
return $name.$this->config->getExtension();
}, $names);
} | php | protected function getViewNames(array $names)
{
return array_map(function ($name) {
$name = str_replace('.', '/', $name);
return $name.$this->config->getExtension();
}, $names);
} | [
"protected",
"function",
"getViewNames",
"(",
"array",
"$",
"names",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"str_replace",
"(",
"'.'",
",",
"'/'",
",",
"$",
"name",
")",
";",
"return",
"$",
"na... | @param array $names
@return array | [
"@param",
"array",
"$names"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/ViewActor.php#L43-L50 |
svenluijten/artisan-view | src/Config.php | Config.setExtension | public function setExtension($extension)
{
if (! Str::startsWith($extension, '.')) {
$extension = ".$extension";
}
$this->extension = $extension;
return $this;
} | php | public function setExtension($extension)
{
if (! Str::startsWith($extension, '.')) {
$extension = ".$extension";
}
$this->extension = $extension;
return $this;
} | [
"public",
"function",
"setExtension",
"(",
"$",
"extension",
")",
"{",
"if",
"(",
"!",
"Str",
"::",
"startsWith",
"(",
"$",
"extension",
",",
"'.'",
")",
")",
"{",
"$",
"extension",
"=",
"\".$extension\"",
";",
"}",
"$",
"this",
"->",
"extension",
"=",... | @param string $extension
@return \Sven\ArtisanView\Config | [
"@param",
"string",
"$extension"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/Config.php#L64-L73 |
svenluijten/artisan-view | src/BlockStack.php | BlockStack.build | public function build(InputInterface $input, $path)
{
$voters = [
new ExtendsParent,
new YieldsFromParent,
new StacksFromParent,
new SectionsInParent,
];
/** @var \Sven\ArtisanView\Voters\Voter $voter */
foreach ($voters as $voter) {
... | php | public function build(InputInterface $input, $path)
{
$voters = [
new ExtendsParent,
new YieldsFromParent,
new StacksFromParent,
new SectionsInParent,
];
/** @var \Sven\ArtisanView\Voters\Voter $voter */
foreach ($voters as $voter) {
... | [
"public",
"function",
"build",
"(",
"InputInterface",
"$",
"input",
",",
"$",
"path",
")",
"{",
"$",
"voters",
"=",
"[",
"new",
"ExtendsParent",
",",
"new",
"YieldsFromParent",
",",
"new",
"StacksFromParent",
",",
"new",
"SectionsInParent",
",",
"]",
";",
... | @param \Symfony\Component\Console\Input\InputInterface $input
@param string $path
@return \Sven\ArtisanView\BlockStack | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Input",
"\\",
"InputInterface",
"$input",
"@param",
"string",
"$path"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/BlockStack.php#L25-L44 |
svenluijten/artisan-view | src/BlockStack.php | BlockStack.add | public function add(Block ...$blocks)
{
foreach ($blocks as $block) {
$this->blocks[] = $block;
}
return $this;
} | php | public function add(Block ...$blocks)
{
foreach ($blocks as $block) {
$this->blocks[] = $block;
}
return $this;
} | [
"public",
"function",
"add",
"(",
"Block",
"...",
"$",
"blocks",
")",
"{",
"foreach",
"(",
"$",
"blocks",
"as",
"$",
"block",
")",
"{",
"$",
"this",
"->",
"blocks",
"[",
"]",
"=",
"$",
"block",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | @param \Sven\ArtisanView\Blocks\Block[] ...$blocks
@return \Sven\ArtisanView\BlockStack | [
"@param",
"\\",
"Sven",
"\\",
"ArtisanView",
"\\",
"Blocks",
"\\",
"Block",
"[]",
"...",
"$blocks"
] | train | https://github.com/svenluijten/artisan-view/blob/701aaa0d1a14a0c5ef673b310ce37340f3f10d2b/src/BlockStack.php#L51-L58 |
silverstripe/silverstripe-cms | code/Forms/AnchorSelectorField.php | AnchorSelectorField.anchors | public function anchors(HTTPRequest $request)
{
$id = (int)$this->getRequest()->param('PageID');
$anchors = $this->getAnchorsInPage($id);
return json_encode($anchors);
} | php | public function anchors(HTTPRequest $request)
{
$id = (int)$this->getRequest()->param('PageID');
$anchors = $this->getAnchorsInPage($id);
return json_encode($anchors);
} | [
"public",
"function",
"anchors",
"(",
"HTTPRequest",
"$",
"request",
")",
"{",
"$",
"id",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"param",
"(",
"'PageID'",
")",
";",
"$",
"anchors",
"=",
"$",
"this",
"->",
"getAnchorsIn... | Find all anchors available on the given page.
@param HTTPRequest $request
@return array | [
"Find",
"all",
"anchors",
"available",
"on",
"the",
"given",
"page",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Forms/AnchorSelectorField.php#L37-L43 |
silverstripe/silverstripe-cms | code/Forms/AnchorSelectorField.php | AnchorSelectorField.getAnchorsInPage | protected function getAnchorsInPage($id)
{
$page = SiteTree::get()->byID($id);
if (!$page || !$page->canView()) {
return [];
}
return $page->getAnchorsOnPage();
} | php | protected function getAnchorsInPage($id)
{
$page = SiteTree::get()->byID($id);
if (!$page || !$page->canView()) {
return [];
}
return $page->getAnchorsOnPage();
} | [
"protected",
"function",
"getAnchorsInPage",
"(",
"$",
"id",
")",
"{",
"$",
"page",
"=",
"SiteTree",
"::",
"get",
"(",
")",
"->",
"byID",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"page",
"||",
"!",
"$",
"page",
"->",
"canView",
"(",
")",
... | Get anchors in the given page ID.
@param int $id
@return array | [
"Get",
"anchors",
"in",
"the",
"given",
"page",
"ID",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Forms/AnchorSelectorField.php#L51-L60 |
silverstripe/silverstripe-cms | code/Controllers/CMSSiteTreeFilter_StatusDraftPages.php | CMSSiteTreeFilter_StatusDraftPages.getFilteredPages | public function getFilteredPages()
{
$pages = Versioned::get_by_stage(SiteTree::class, 'Stage');
$pages = $this->applyDefaultFilters($pages);
$pages = $pages->filterByCallback(function (SiteTree $page) {
// If page exists on stage but not on live
return $page->isOnDra... | php | public function getFilteredPages()
{
$pages = Versioned::get_by_stage(SiteTree::class, 'Stage');
$pages = $this->applyDefaultFilters($pages);
$pages = $pages->filterByCallback(function (SiteTree $page) {
// If page exists on stage but not on live
return $page->isOnDra... | [
"public",
"function",
"getFilteredPages",
"(",
")",
"{",
"$",
"pages",
"=",
"Versioned",
"::",
"get_by_stage",
"(",
"SiteTree",
"::",
"class",
",",
"'Stage'",
")",
";",
"$",
"pages",
"=",
"$",
"this",
"->",
"applyDefaultFilters",
"(",
"$",
"pages",
")",
... | Filters out all pages who's status is set to "Draft".
@see {@link SiteTree::getStatusFlags()}
@return SS_List | [
"Filters",
"out",
"all",
"pages",
"who",
"s",
"status",
"is",
"set",
"to",
"Draft",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSSiteTreeFilter_StatusDraftPages.php#L26-L35 |
silverstripe/silverstripe-cms | code/Controllers/CMSPageEditController.php | CMSPageEditController.addtocampaign | public function addtocampaign($data, $form)
{
$id = $data['ID'];
$record = \Page::get()->byID($id);
$handler = AddToCampaignHandler::create($this, $record);
$results = $handler->addToCampaign($record, $data);
if (is_null($results)) {
return null;
}
... | php | public function addtocampaign($data, $form)
{
$id = $data['ID'];
$record = \Page::get()->byID($id);
$handler = AddToCampaignHandler::create($this, $record);
$results = $handler->addToCampaign($record, $data);
if (is_null($results)) {
return null;
}
... | [
"public",
"function",
"addtocampaign",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"$",
"id",
"=",
"$",
"data",
"[",
"'ID'",
"]",
";",
"$",
"record",
"=",
"\\",
"Page",
"::",
"get",
"(",
")",
"->",
"byID",
"(",
"$",
"id",
")",
";",
"$",
"ha... | Action handler for adding pages to a campaign
@param array $data
@param Form $form
@return DBHTMLText|HTTPResponse | [
"Action",
"handler",
"for",
"adding",
"pages",
"to",
"a",
"campaign"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSPageEditController.php#L61-L80 |
silverstripe/silverstripe-cms | code/Controllers/CMSPageEditController.php | CMSPageEditController.AddToCampaignForm | public function AddToCampaignForm($request)
{
// Get ID either from posted back value, or url parameter
$id = $request->param('ID') ?: $request->postVar('ID');
return $this->getAddToCampaignForm($id);
} | php | public function AddToCampaignForm($request)
{
// Get ID either from posted back value, or url parameter
$id = $request->param('ID') ?: $request->postVar('ID');
return $this->getAddToCampaignForm($id);
} | [
"public",
"function",
"AddToCampaignForm",
"(",
"$",
"request",
")",
"{",
"// Get ID either from posted back value, or url parameter",
"$",
"id",
"=",
"$",
"request",
"->",
"param",
"(",
"'ID'",
")",
"?",
":",
"$",
"request",
"->",
"postVar",
"(",
"'ID'",
")",
... | Url handler for add to campaign form
@param HTTPRequest $request
@return Form | [
"Url",
"handler",
"for",
"add",
"to",
"campaign",
"form"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Controllers/CMSPageEditController.php#L88-L93 |
silverstripe/silverstripe-cms | code/Search/ContentControllerSearchExtension.php | ContentControllerSearchExtension.SearchForm | public function SearchForm()
{
$searchText = '';
if ($this->owner->getRequest() && $this->owner->getRequest()->getVar('Search')) {
$searchText = $this->owner->getRequest()->getVar('Search');
}
$placeholder = _t('SilverStripe\\CMS\\Search\\SearchForm.SEARCH', 'Search');
... | php | public function SearchForm()
{
$searchText = '';
if ($this->owner->getRequest() && $this->owner->getRequest()->getVar('Search')) {
$searchText = $this->owner->getRequest()->getVar('Search');
}
$placeholder = _t('SilverStripe\\CMS\\Search\\SearchForm.SEARCH', 'Search');
... | [
"public",
"function",
"SearchForm",
"(",
")",
"{",
"$",
"searchText",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"getRequest",
"(",
")",
"&&",
"$",
"this",
"->",
"owner",
"->",
"getRequest",
"(",
")",
"->",
"getVar",
"(",
"'Search'"... | Site search form
@return SearchForm | [
"Site",
"search",
"form"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Search/ContentControllerSearchExtension.php#L27-L46 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.get_by_link | public static function get_by_link($link, $cache = true)
{
if (trim($link, '/')) {
$link = trim(Director::makeRelative($link), '/');
} else {
$link = RootURLController::get_homepage_link();
}
$parts = preg_split('|/+|', $link);
// Grab the initial ro... | php | public static function get_by_link($link, $cache = true)
{
if (trim($link, '/')) {
$link = trim(Director::makeRelative($link), '/');
} else {
$link = RootURLController::get_homepage_link();
}
$parts = preg_split('|/+|', $link);
// Grab the initial ro... | [
"public",
"static",
"function",
"get_by_link",
"(",
"$",
"link",
",",
"$",
"cache",
"=",
"true",
")",
"{",
"if",
"(",
"trim",
"(",
"$",
"link",
",",
"'/'",
")",
")",
"{",
"$",
"link",
"=",
"trim",
"(",
"Director",
"::",
"makeRelative",
"(",
"$",
... | Fetches the {@link SiteTree} object that maps to a link.
If you have enabled {@link SiteTree::config()->nested_urls} on this site, then you can use a nested link such as
"about-us/staff/", and this function will traverse down the URL chain and grab the appropriate link.
Note that if no model can be found, this method... | [
"Fetches",
"the",
"{",
"@link",
"SiteTree",
"}",
"object",
"that",
"maps",
"to",
"a",
"link",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L396-L479 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.page_type_classes | public static function page_type_classes()
{
$classes = ClassInfo::getValidSubClasses();
$baseClassIndex = array_search(self::class, $classes);
if ($baseClassIndex !== false) {
unset($classes[$baseClassIndex]);
}
$kill_ancestors = array();
// figure out... | php | public static function page_type_classes()
{
$classes = ClassInfo::getValidSubClasses();
$baseClassIndex = array_search(self::class, $classes);
if ($baseClassIndex !== false) {
unset($classes[$baseClassIndex]);
}
$kill_ancestors = array();
// figure out... | [
"public",
"static",
"function",
"page_type_classes",
"(",
")",
"{",
"$",
"classes",
"=",
"ClassInfo",
"::",
"getValidSubClasses",
"(",
")",
";",
"$",
"baseClassIndex",
"=",
"array_search",
"(",
"self",
"::",
"class",
",",
"$",
"classes",
")",
";",
"if",
"(... | Return a subclass map of SiteTree that shouldn't be hidden through {@link SiteTree::$hide_ancestor}
@return array | [
"Return",
"a",
"subclass",
"map",
"of",
"SiteTree",
"that",
"shouldn",
"t",
"be",
"hidden",
"through",
"{",
"@link",
"SiteTree",
"::",
"$hide_ancestor",
"}"
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L486-L522 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.link_shortcode_handler | public static function link_shortcode_handler($arguments, $content = null, $parser = null)
{
if (!isset($arguments['id']) || !is_numeric($arguments['id'])) {
return null;
}
/** @var SiteTree $page */
if (!($page = DataObject::get_by_id(self::class, $arguments['id'])) ... | php | public static function link_shortcode_handler($arguments, $content = null, $parser = null)
{
if (!isset($arguments['id']) || !is_numeric($arguments['id'])) {
return null;
}
/** @var SiteTree $page */
if (!($page = DataObject::get_by_id(self::class, $arguments['id'])) ... | [
"public",
"static",
"function",
"link_shortcode_handler",
"(",
"$",
"arguments",
",",
"$",
"content",
"=",
"null",
",",
"$",
"parser",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"arguments",
"[",
"'id'",
"]",
")",
"||",
"!",
"is_numeric"... | Replace a "[sitetree_link id=n]" shortcode with a link to the page with the corresponding ID.
@param array $arguments
@param string $content
@param ShortcodeParser $parser
@return string | [
"Replace",
"a",
"[",
"sitetree_link",
"id",
"=",
"n",
"]",
"shortcode",
"with",
"a",
"link",
"to",
"the",
"page",
"with",
"the",
"corresponding",
"ID",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L532-L553 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.PreviewLink | public function PreviewLink($action = null)
{
if ($this->hasMethod('alternatePreviewLink')) {
Deprecation::notice('5.0', 'Use updatePreviewLink or override PreviewLink method');
return $this->alternatePreviewLink($action);
}
$link = $this->AbsoluteLink($action);
... | php | public function PreviewLink($action = null)
{
if ($this->hasMethod('alternatePreviewLink')) {
Deprecation::notice('5.0', 'Use updatePreviewLink or override PreviewLink method');
return $this->alternatePreviewLink($action);
}
$link = $this->AbsoluteLink($action);
... | [
"public",
"function",
"PreviewLink",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasMethod",
"(",
"'alternatePreviewLink'",
")",
")",
"{",
"Deprecation",
"::",
"notice",
"(",
"'5.0'",
",",
"'Use updatePreviewLink or override Preview... | Base link used for previewing. Defaults to absolute URL, in order to account for domain changes, e.g. on multi
site setups. Does not contain hints about the stage, see {@link SilverStripeNavigator} for details.
@param string $action See {@link Link()}
@return string | [
"Base",
"link",
"used",
"for",
"previewing",
".",
"Defaults",
"to",
"absolute",
"URL",
"in",
"order",
"to",
"account",
"for",
"domain",
"changes",
"e",
".",
"g",
".",
"on",
"multi",
"site",
"setups",
".",
"Does",
"not",
"contain",
"hints",
"about",
"the"... | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L594-L604 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.RelativeLink | public function RelativeLink($action = null)
{
if ($this->ParentID && self::config()->get('nested_urls')) {
$parent = $this->Parent();
// If page is removed select parent from version history (for archive page view)
if ((!$parent || !$parent->exists()) && !$this->isOnDraf... | php | public function RelativeLink($action = null)
{
if ($this->ParentID && self::config()->get('nested_urls')) {
$parent = $this->Parent();
// If page is removed select parent from version history (for archive page view)
if ((!$parent || !$parent->exists()) && !$this->isOnDraf... | [
"public",
"function",
"RelativeLink",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ParentID",
"&&",
"self",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'nested_urls'",
")",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"-... | Return the link for this {@link SiteTree} object relative to the SilverStripe root.
By default, if this page is the current home page, and there is no action specified then this will return a link
to the root of the site. However, if you set the $action parameter to TRUE then the link will not be rewritten
and returne... | [
"Return",
"the",
"link",
"for",
"this",
"{",
"@link",
"SiteTree",
"}",
"object",
"relative",
"to",
"the",
"SilverStripe",
"root",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L623-L650 |
silverstripe/silverstripe-cms | code/Model/SiteTree.php | SiteTree.getAbsoluteLiveLink | public function getAbsoluteLiveLink($includeStageEqualsLive = true)
{
$oldReadingMode = Versioned::get_reading_mode();
Versioned::set_stage(Versioned::LIVE);
/** @var SiteTree $live */
$live = Versioned::get_one_by_stage(self::class, Versioned::LIVE, array(
'"SiteTree"."I... | php | public function getAbsoluteLiveLink($includeStageEqualsLive = true)
{
$oldReadingMode = Versioned::get_reading_mode();
Versioned::set_stage(Versioned::LIVE);
/** @var SiteTree $live */
$live = Versioned::get_one_by_stage(self::class, Versioned::LIVE, array(
'"SiteTree"."I... | [
"public",
"function",
"getAbsoluteLiveLink",
"(",
"$",
"includeStageEqualsLive",
"=",
"true",
")",
"{",
"$",
"oldReadingMode",
"=",
"Versioned",
"::",
"get_reading_mode",
"(",
")",
";",
"Versioned",
"::",
"set_stage",
"(",
"Versioned",
"::",
"LIVE",
")",
";",
... | Get the absolute URL for this page on the Live site.
@param bool $includeStageEqualsLive Whether to append the URL with ?stage=Live to force Live mode
@return string | [
"Get",
"the",
"absolute",
"URL",
"for",
"this",
"page",
"on",
"the",
"Live",
"site",
"."
] | train | https://github.com/silverstripe/silverstripe-cms/blob/7ccf37a467d2eb46a8a1aae44dd745469f4347e7/code/Model/SiteTree.php#L658-L677 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.