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 |
|---|---|---|---|---|---|---|---|---|---|---|
ongr-io/ElasticsearchBundle | DependencyInjection/Configuration.php | Configuration.getAnalysisNode | private function getAnalysisNode()
{
$builder = new TreeBuilder();
$node = $builder->root('analysis');
$node
->info('Defines analyzers, normalizers, tokenizers and filters')
->addDefaultsIfNotSet()
->children()
->arrayNode('tokenizer')
->defaultValue([])
->prototype('variable')->end()
->end()
->arrayNode('filter')
->defaultValue([])
->prototype('variable')->end()
->end()
->arrayNode('analyzer')
->defaultValue([])
->prototype('variable')->end()
->end()
->arrayNode('normalizer')
->defaultValue([])
->prototype('variable')->end()
->end()
->arrayNode('char_filter')
->defaultValue([])
->prototype('variable')->end()
->end()
->end();
return $node;
} | php | private function getAnalysisNode()
{
$builder = new TreeBuilder();
$node = $builder->root('analysis');
$node
->info('Defines analyzers, normalizers, tokenizers and filters')
->addDefaultsIfNotSet()
->children()
->arrayNode('tokenizer')
->defaultValue([])
->prototype('variable')->end()
->end()
->arrayNode('filter')
->defaultValue([])
->prototype('variable')->end()
->end()
->arrayNode('analyzer')
->defaultValue([])
->prototype('variable')->end()
->end()
->arrayNode('normalizer')
->defaultValue([])
->prototype('variable')->end()
->end()
->arrayNode('char_filter')
->defaultValue([])
->prototype('variable')->end()
->end()
->end();
return $node;
} | [
"private",
"function",
"getAnalysisNode",
"(",
")",
"{",
"$",
"builder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"node",
"=",
"$",
"builder",
"->",
"root",
"(",
"'analysis'",
")",
";",
"$",
"node",
"->",
"info",
"(",
"'Defines analyzers, normalizers, tokenizers and filters'",
")",
"->",
"addDefaultsIfNotSet",
"(",
")",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
"'tokenizer'",
")",
"->",
"defaultValue",
"(",
"[",
"]",
")",
"->",
"prototype",
"(",
"'variable'",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"arrayNode",
"(",
"'filter'",
")",
"->",
"defaultValue",
"(",
"[",
"]",
")",
"->",
"prototype",
"(",
"'variable'",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"arrayNode",
"(",
"'analyzer'",
")",
"->",
"defaultValue",
"(",
"[",
"]",
")",
"->",
"prototype",
"(",
"'variable'",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"arrayNode",
"(",
"'normalizer'",
")",
"->",
"defaultValue",
"(",
"[",
"]",
")",
"->",
"prototype",
"(",
"'variable'",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"arrayNode",
"(",
"'char_filter'",
")",
"->",
"defaultValue",
"(",
"[",
"]",
")",
"->",
"prototype",
"(",
"'variable'",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
";",
"return",
"$",
"node",
";",
"}"
] | Analysis configuration node.
@return \Symfony\Component\Config\Definition\Builder\NodeDefinition | [
"Analysis",
"configuration",
"node",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/DependencyInjection/Configuration.php#L57-L89 |
ongr-io/ElasticsearchBundle | DependencyInjection/Configuration.php | Configuration.getManagersNode | private function getManagersNode()
{
$builder = new TreeBuilder();
$node = $builder->root('managers');
$node
->isRequired()
->requiresAtLeastOneElement()
->useAttributeAsKey('name')
->info('Maps managers to connections and bundles')
->prototype('array')
->children()
->arrayNode('index')
->children()
->scalarNode('index_name')
->isRequired()
->info('Sets index name for connection.')
->end()
->arrayNode('hosts')
->info('Defines hosts to connect to.')
->defaultValue(['127.0.0.1:9200'])
->prototype('scalar')
->end()
->end()
->arrayNode('settings')
->defaultValue(
[
'number_of_replicas' => 0,
'number_of_shards' => 1,
'refresh_interval' => -1,
]
)
->info('Sets index settings for connection.')
->prototype('variable')->end()
->end()
->end()
->end()
->integerNode('bulk_size')
->min(0)
->defaultValue(100)
->info(
'Maximum documents size in the bulk container. ' .
'When the limit is reached it will auto-commit.'
)
->end()
->enumNode('commit_mode')
->values(['refresh', 'flush', 'none'])
->defaultValue('refresh')
->info(
'The default type of commit for bulk queries.'
)
->end()
->arrayNode('logger')
->info('Enables elasticsearch queries logging')
->addDefaultsIfNotSet()
->beforeNormalization()
->ifTrue(
function ($v) {
return is_bool($v);
}
)
->then(
function ($v) {
return ['enabled' => $v];
}
)
->end()
->children()
->booleanNode('enabled')
->info('enables logging')
->defaultFalse()
->end()
->scalarNode('level')
->info('Sets PSR logging level.')
->defaultValue(LogLevel::WARNING)
->validate()
->ifNotInArray((new \ReflectionClass('Psr\Log\LogLevel'))->getConstants())
->thenInvalid('Invalid PSR log level.')
->end()
->end()
->scalarNode('log_file_name')
->info('Log filename. By default it is a manager name.')
->defaultValue(null)
->end()
->end()
->end()
->arrayNode('mappings')
->info('Maps manager to the bundles. f.e. AppBundle')
->prototype('variable')->end()
->end()
->booleanNode('force_commit')
->info('Forces commit to the elasticsearch on kernel terminate event.')
->defaultTrue()
->end()
->end()
->end();
return $node;
} | php | private function getManagersNode()
{
$builder = new TreeBuilder();
$node = $builder->root('managers');
$node
->isRequired()
->requiresAtLeastOneElement()
->useAttributeAsKey('name')
->info('Maps managers to connections and bundles')
->prototype('array')
->children()
->arrayNode('index')
->children()
->scalarNode('index_name')
->isRequired()
->info('Sets index name for connection.')
->end()
->arrayNode('hosts')
->info('Defines hosts to connect to.')
->defaultValue(['127.0.0.1:9200'])
->prototype('scalar')
->end()
->end()
->arrayNode('settings')
->defaultValue(
[
'number_of_replicas' => 0,
'number_of_shards' => 1,
'refresh_interval' => -1,
]
)
->info('Sets index settings for connection.')
->prototype('variable')->end()
->end()
->end()
->end()
->integerNode('bulk_size')
->min(0)
->defaultValue(100)
->info(
'Maximum documents size in the bulk container. ' .
'When the limit is reached it will auto-commit.'
)
->end()
->enumNode('commit_mode')
->values(['refresh', 'flush', 'none'])
->defaultValue('refresh')
->info(
'The default type of commit for bulk queries.'
)
->end()
->arrayNode('logger')
->info('Enables elasticsearch queries logging')
->addDefaultsIfNotSet()
->beforeNormalization()
->ifTrue(
function ($v) {
return is_bool($v);
}
)
->then(
function ($v) {
return ['enabled' => $v];
}
)
->end()
->children()
->booleanNode('enabled')
->info('enables logging')
->defaultFalse()
->end()
->scalarNode('level')
->info('Sets PSR logging level.')
->defaultValue(LogLevel::WARNING)
->validate()
->ifNotInArray((new \ReflectionClass('Psr\Log\LogLevel'))->getConstants())
->thenInvalid('Invalid PSR log level.')
->end()
->end()
->scalarNode('log_file_name')
->info('Log filename. By default it is a manager name.')
->defaultValue(null)
->end()
->end()
->end()
->arrayNode('mappings')
->info('Maps manager to the bundles. f.e. AppBundle')
->prototype('variable')->end()
->end()
->booleanNode('force_commit')
->info('Forces commit to the elasticsearch on kernel terminate event.')
->defaultTrue()
->end()
->end()
->end();
return $node;
} | [
"private",
"function",
"getManagersNode",
"(",
")",
"{",
"$",
"builder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"node",
"=",
"$",
"builder",
"->",
"root",
"(",
"'managers'",
")",
";",
"$",
"node",
"->",
"isRequired",
"(",
")",
"->",
"requiresAtLeastOneElement",
"(",
")",
"->",
"useAttributeAsKey",
"(",
"'name'",
")",
"->",
"info",
"(",
"'Maps managers to connections and bundles'",
")",
"->",
"prototype",
"(",
"'array'",
")",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
"'index'",
")",
"->",
"children",
"(",
")",
"->",
"scalarNode",
"(",
"'index_name'",
")",
"->",
"isRequired",
"(",
")",
"->",
"info",
"(",
"'Sets index name for connection.'",
")",
"->",
"end",
"(",
")",
"->",
"arrayNode",
"(",
"'hosts'",
")",
"->",
"info",
"(",
"'Defines hosts to connect to.'",
")",
"->",
"defaultValue",
"(",
"[",
"'127.0.0.1:9200'",
"]",
")",
"->",
"prototype",
"(",
"'scalar'",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"arrayNode",
"(",
"'settings'",
")",
"->",
"defaultValue",
"(",
"[",
"'number_of_replicas'",
"=>",
"0",
",",
"'number_of_shards'",
"=>",
"1",
",",
"'refresh_interval'",
"=>",
"-",
"1",
",",
"]",
")",
"->",
"info",
"(",
"'Sets index settings for connection.'",
")",
"->",
"prototype",
"(",
"'variable'",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"integerNode",
"(",
"'bulk_size'",
")",
"->",
"min",
"(",
"0",
")",
"->",
"defaultValue",
"(",
"100",
")",
"->",
"info",
"(",
"'Maximum documents size in the bulk container. '",
".",
"'When the limit is reached it will auto-commit.'",
")",
"->",
"end",
"(",
")",
"->",
"enumNode",
"(",
"'commit_mode'",
")",
"->",
"values",
"(",
"[",
"'refresh'",
",",
"'flush'",
",",
"'none'",
"]",
")",
"->",
"defaultValue",
"(",
"'refresh'",
")",
"->",
"info",
"(",
"'The default type of commit for bulk queries.'",
")",
"->",
"end",
"(",
")",
"->",
"arrayNode",
"(",
"'logger'",
")",
"->",
"info",
"(",
"'Enables elasticsearch queries logging'",
")",
"->",
"addDefaultsIfNotSet",
"(",
")",
"->",
"beforeNormalization",
"(",
")",
"->",
"ifTrue",
"(",
"function",
"(",
"$",
"v",
")",
"{",
"return",
"is_bool",
"(",
"$",
"v",
")",
";",
"}",
")",
"->",
"then",
"(",
"function",
"(",
"$",
"v",
")",
"{",
"return",
"[",
"'enabled'",
"=>",
"$",
"v",
"]",
";",
"}",
")",
"->",
"end",
"(",
")",
"->",
"children",
"(",
")",
"->",
"booleanNode",
"(",
"'enabled'",
")",
"->",
"info",
"(",
"'enables logging'",
")",
"->",
"defaultFalse",
"(",
")",
"->",
"end",
"(",
")",
"->",
"scalarNode",
"(",
"'level'",
")",
"->",
"info",
"(",
"'Sets PSR logging level.'",
")",
"->",
"defaultValue",
"(",
"LogLevel",
"::",
"WARNING",
")",
"->",
"validate",
"(",
")",
"->",
"ifNotInArray",
"(",
"(",
"new",
"\\",
"ReflectionClass",
"(",
"'Psr\\Log\\LogLevel'",
")",
")",
"->",
"getConstants",
"(",
")",
")",
"->",
"thenInvalid",
"(",
"'Invalid PSR log level.'",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"scalarNode",
"(",
"'log_file_name'",
")",
"->",
"info",
"(",
"'Log filename. By default it is a manager name.'",
")",
"->",
"defaultValue",
"(",
"null",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"arrayNode",
"(",
"'mappings'",
")",
"->",
"info",
"(",
"'Maps manager to the bundles. f.e. AppBundle'",
")",
"->",
"prototype",
"(",
"'variable'",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"booleanNode",
"(",
"'force_commit'",
")",
"->",
"info",
"(",
"'Forces commit to the elasticsearch on kernel terminate event.'",
")",
"->",
"defaultTrue",
"(",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
"->",
"end",
"(",
")",
";",
"return",
"$",
"node",
";",
"}"
] | Managers configuration node.
@return \Symfony\Component\Config\Definition\Builder\NodeDefinition | [
"Managers",
"configuration",
"node",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/DependencyInjection/Configuration.php#L96-L194 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.parse | public function parse(\ReflectionClass $class)
{
$className = $class->getName();
if ($class->isTrait()) {
return false;
}
if (!isset($this->documents[$className])) {
/** @var Document $document */
$document = $this->reader->getClassAnnotation($class, self::DOCUMENT_ANNOTATION);
if ($document === null) {
throw new MissingDocumentAnnotationException(
sprintf(
'"%s" class cannot be parsed as document because @Document annotation is missing.',
$class->getName()
)
);
}
$fields = [];
$aliases = $this->getAliases($class, $fields);
$this->documents[$className] = [
'type' => $document->type ?: Caser::snake($class->getShortName()),
'properties' => $this->getProperties($class),
'fields' => array_filter(
array_merge(
$document->dump(),
$fields
)
),
'aliases' => $aliases,
'analyzers' => $this->getAnalyzers($class),
'objects' => $this->getObjects(),
'namespace' => $class->getName(),
'class' => $class->getShortName(),
];
}
return $this->documents[$className];
} | php | public function parse(\ReflectionClass $class)
{
$className = $class->getName();
if ($class->isTrait()) {
return false;
}
if (!isset($this->documents[$className])) {
/** @var Document $document */
$document = $this->reader->getClassAnnotation($class, self::DOCUMENT_ANNOTATION);
if ($document === null) {
throw new MissingDocumentAnnotationException(
sprintf(
'"%s" class cannot be parsed as document because @Document annotation is missing.',
$class->getName()
)
);
}
$fields = [];
$aliases = $this->getAliases($class, $fields);
$this->documents[$className] = [
'type' => $document->type ?: Caser::snake($class->getShortName()),
'properties' => $this->getProperties($class),
'fields' => array_filter(
array_merge(
$document->dump(),
$fields
)
),
'aliases' => $aliases,
'analyzers' => $this->getAnalyzers($class),
'objects' => $this->getObjects(),
'namespace' => $class->getName(),
'class' => $class->getShortName(),
];
}
return $this->documents[$className];
} | [
"public",
"function",
"parse",
"(",
"\\",
"ReflectionClass",
"$",
"class",
")",
"{",
"$",
"className",
"=",
"$",
"class",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"$",
"class",
"->",
"isTrait",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"documents",
"[",
"$",
"className",
"]",
")",
")",
"{",
"/** @var Document $document */",
"$",
"document",
"=",
"$",
"this",
"->",
"reader",
"->",
"getClassAnnotation",
"(",
"$",
"class",
",",
"self",
"::",
"DOCUMENT_ANNOTATION",
")",
";",
"if",
"(",
"$",
"document",
"===",
"null",
")",
"{",
"throw",
"new",
"MissingDocumentAnnotationException",
"(",
"sprintf",
"(",
"'\"%s\" class cannot be parsed as document because @Document annotation is missing.'",
",",
"$",
"class",
"->",
"getName",
"(",
")",
")",
")",
";",
"}",
"$",
"fields",
"=",
"[",
"]",
";",
"$",
"aliases",
"=",
"$",
"this",
"->",
"getAliases",
"(",
"$",
"class",
",",
"$",
"fields",
")",
";",
"$",
"this",
"->",
"documents",
"[",
"$",
"className",
"]",
"=",
"[",
"'type'",
"=>",
"$",
"document",
"->",
"type",
"?",
":",
"Caser",
"::",
"snake",
"(",
"$",
"class",
"->",
"getShortName",
"(",
")",
")",
",",
"'properties'",
"=>",
"$",
"this",
"->",
"getProperties",
"(",
"$",
"class",
")",
",",
"'fields'",
"=>",
"array_filter",
"(",
"array_merge",
"(",
"$",
"document",
"->",
"dump",
"(",
")",
",",
"$",
"fields",
")",
")",
",",
"'aliases'",
"=>",
"$",
"aliases",
",",
"'analyzers'",
"=>",
"$",
"this",
"->",
"getAnalyzers",
"(",
"$",
"class",
")",
",",
"'objects'",
"=>",
"$",
"this",
"->",
"getObjects",
"(",
")",
",",
"'namespace'",
"=>",
"$",
"class",
"->",
"getName",
"(",
")",
",",
"'class'",
"=>",
"$",
"class",
"->",
"getShortName",
"(",
")",
",",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"documents",
"[",
"$",
"className",
"]",
";",
"}"
] | Parses documents by used annotations and returns mapping for elasticsearch with some extra metadata.
@param \ReflectionClass $class
@return array|null
@throws MissingDocumentAnnotationException | [
"Parses",
"documents",
"by",
"used",
"annotations",
"and",
"returns",
"mapping",
"for",
"elasticsearch",
"with",
"some",
"extra",
"metadata",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L92-L133 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getPropertyAnnotationData | private function getPropertyAnnotationData(\ReflectionProperty $property)
{
$result = $this->reader->getPropertyAnnotation($property, self::PROPERTY_ANNOTATION);
if ($result !== null && $result->name === null) {
$result->name = Caser::snake($property->getName());
}
return $result;
} | php | private function getPropertyAnnotationData(\ReflectionProperty $property)
{
$result = $this->reader->getPropertyAnnotation($property, self::PROPERTY_ANNOTATION);
if ($result !== null && $result->name === null) {
$result->name = Caser::snake($property->getName());
}
return $result;
} | [
"private",
"function",
"getPropertyAnnotationData",
"(",
"\\",
"ReflectionProperty",
"$",
"property",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"reader",
"->",
"getPropertyAnnotation",
"(",
"$",
"property",
",",
"self",
"::",
"PROPERTY_ANNOTATION",
")",
";",
"if",
"(",
"$",
"result",
"!==",
"null",
"&&",
"$",
"result",
"->",
"name",
"===",
"null",
")",
"{",
"$",
"result",
"->",
"name",
"=",
"Caser",
"::",
"snake",
"(",
"$",
"property",
"->",
"getName",
"(",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | Returns property annotation data from reader.
@param \ReflectionProperty $property
@return Property|object|null | [
"Returns",
"property",
"annotation",
"data",
"from",
"reader",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L154-L163 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getEmbeddedAnnotationData | private function getEmbeddedAnnotationData(\ReflectionProperty $property)
{
$result = $this->reader->getPropertyAnnotation($property, self::EMBEDDED_ANNOTATION);
if ($result !== null && $result->name === null) {
$result->name = Caser::snake($property->getName());
}
return $result;
} | php | private function getEmbeddedAnnotationData(\ReflectionProperty $property)
{
$result = $this->reader->getPropertyAnnotation($property, self::EMBEDDED_ANNOTATION);
if ($result !== null && $result->name === null) {
$result->name = Caser::snake($property->getName());
}
return $result;
} | [
"private",
"function",
"getEmbeddedAnnotationData",
"(",
"\\",
"ReflectionProperty",
"$",
"property",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"reader",
"->",
"getPropertyAnnotation",
"(",
"$",
"property",
",",
"self",
"::",
"EMBEDDED_ANNOTATION",
")",
";",
"if",
"(",
"$",
"result",
"!==",
"null",
"&&",
"$",
"result",
"->",
"name",
"===",
"null",
")",
"{",
"$",
"result",
"->",
"name",
"=",
"Caser",
"::",
"snake",
"(",
"$",
"property",
"->",
"getName",
"(",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | Returns Embedded annotation data from reader.
@param \ReflectionProperty $property
@return Embedded|object|null | [
"Returns",
"Embedded",
"annotation",
"data",
"from",
"reader",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L172-L181 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getHashMapAnnotationData | private function getHashMapAnnotationData(\ReflectionProperty $property)
{
$result = $this->reader->getPropertyAnnotation($property, self::HASH_MAP_ANNOTATION);
if ($result !== null && $result->name === null) {
$result->name = Caser::snake($property->getName());
}
return $result;
} | php | private function getHashMapAnnotationData(\ReflectionProperty $property)
{
$result = $this->reader->getPropertyAnnotation($property, self::HASH_MAP_ANNOTATION);
if ($result !== null && $result->name === null) {
$result->name = Caser::snake($property->getName());
}
return $result;
} | [
"private",
"function",
"getHashMapAnnotationData",
"(",
"\\",
"ReflectionProperty",
"$",
"property",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"reader",
"->",
"getPropertyAnnotation",
"(",
"$",
"property",
",",
"self",
"::",
"HASH_MAP_ANNOTATION",
")",
";",
"if",
"(",
"$",
"result",
"!==",
"null",
"&&",
"$",
"result",
"->",
"name",
"===",
"null",
")",
"{",
"$",
"result",
"->",
"name",
"=",
"Caser",
"::",
"snake",
"(",
"$",
"property",
"->",
"getName",
"(",
")",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | Returns HashMap annotation data from reader.
@param \ReflectionProperty $property
@return HashMap|object|null | [
"Returns",
"HashMap",
"annotation",
"data",
"from",
"reader",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L190-L199 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getMetaFieldAnnotationData | private function getMetaFieldAnnotationData($property, $directory)
{
/** @var MetaField $annotation */
$annotation = $this->reader->getPropertyAnnotation($property, self::ID_ANNOTATION);
$annotation = $annotation ?: $this->reader->getPropertyAnnotation($property, self::PARENT_ANNOTATION);
$annotation = $annotation ?: $this->reader->getPropertyAnnotation($property, self::ROUTING_ANNOTATION);
$annotation = $annotation ?: $this->reader->getPropertyAnnotation($property, self::VERSION_ANNOTATION);
if ($annotation === null) {
return null;
}
$data = [
'name' => $annotation->getName(),
'settings' => $annotation->getSettings(),
];
if ($annotation instanceof ParentDocument) {
$data['settings']['type'] = $this->getDocumentType($annotation->class, $directory);
}
return $data;
} | php | private function getMetaFieldAnnotationData($property, $directory)
{
/** @var MetaField $annotation */
$annotation = $this->reader->getPropertyAnnotation($property, self::ID_ANNOTATION);
$annotation = $annotation ?: $this->reader->getPropertyAnnotation($property, self::PARENT_ANNOTATION);
$annotation = $annotation ?: $this->reader->getPropertyAnnotation($property, self::ROUTING_ANNOTATION);
$annotation = $annotation ?: $this->reader->getPropertyAnnotation($property, self::VERSION_ANNOTATION);
if ($annotation === null) {
return null;
}
$data = [
'name' => $annotation->getName(),
'settings' => $annotation->getSettings(),
];
if ($annotation instanceof ParentDocument) {
$data['settings']['type'] = $this->getDocumentType($annotation->class, $directory);
}
return $data;
} | [
"private",
"function",
"getMetaFieldAnnotationData",
"(",
"$",
"property",
",",
"$",
"directory",
")",
"{",
"/** @var MetaField $annotation */",
"$",
"annotation",
"=",
"$",
"this",
"->",
"reader",
"->",
"getPropertyAnnotation",
"(",
"$",
"property",
",",
"self",
"::",
"ID_ANNOTATION",
")",
";",
"$",
"annotation",
"=",
"$",
"annotation",
"?",
":",
"$",
"this",
"->",
"reader",
"->",
"getPropertyAnnotation",
"(",
"$",
"property",
",",
"self",
"::",
"PARENT_ANNOTATION",
")",
";",
"$",
"annotation",
"=",
"$",
"annotation",
"?",
":",
"$",
"this",
"->",
"reader",
"->",
"getPropertyAnnotation",
"(",
"$",
"property",
",",
"self",
"::",
"ROUTING_ANNOTATION",
")",
";",
"$",
"annotation",
"=",
"$",
"annotation",
"?",
":",
"$",
"this",
"->",
"reader",
"->",
"getPropertyAnnotation",
"(",
"$",
"property",
",",
"self",
"::",
"VERSION_ANNOTATION",
")",
";",
"if",
"(",
"$",
"annotation",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"$",
"data",
"=",
"[",
"'name'",
"=>",
"$",
"annotation",
"->",
"getName",
"(",
")",
",",
"'settings'",
"=>",
"$",
"annotation",
"->",
"getSettings",
"(",
")",
",",
"]",
";",
"if",
"(",
"$",
"annotation",
"instanceof",
"ParentDocument",
")",
"{",
"$",
"data",
"[",
"'settings'",
"]",
"[",
"'type'",
"]",
"=",
"$",
"this",
"->",
"getDocumentType",
"(",
"$",
"annotation",
"->",
"class",
",",
"$",
"directory",
")",
";",
"}",
"return",
"$",
"data",
";",
"}"
] | Returns meta field annotation data from reader.
@param \ReflectionProperty $property
@param string $directory The name of the Document directory in the bundle
@return array | [
"Returns",
"meta",
"field",
"annotation",
"data",
"from",
"reader",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L209-L231 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getAliases | private function getAliases(\ReflectionClass $reflectionClass, array &$metaFields = null)
{
$reflectionName = $reflectionClass->getName();
// We skip cache in case $metaFields is given. This should not affect performance
// because for each document this method is called only once. For objects it might
// be called few times.
if ($metaFields === null && array_key_exists($reflectionName, $this->aliases)) {
return $this->aliases[$reflectionName];
}
$alias = [];
/** @var \ReflectionProperty[] $properties */
$properties = $this->getDocumentPropertiesReflection($reflectionClass);
foreach ($properties as $name => $property) {
$directory = $this->guessDirName($property->getDeclaringClass());
$type = $this->getPropertyAnnotationData($property);
$type = $type !== null ? $type : $this->getEmbeddedAnnotationData($property);
$type = $type !== null ? $type : $this->getHashMapAnnotationData($property);
if ($type === null && $metaFields !== null
&& ($metaData = $this->getMetaFieldAnnotationData($property, $directory)) !== null) {
$metaFields[$metaData['name']] = $metaData['settings'];
$type = new \stdClass();
$type->name = $metaData['name'];
}
if ($type !== null) {
$alias[$type->name] = [
'propertyName' => $name,
];
if ($type instanceof Property) {
$alias[$type->name]['type'] = $type->type;
}
if ($type instanceof HashMap) {
$alias[$type->name]['type'] = HashMap::NAME;
}
$alias[$type->name][HashMap::NAME] = $type instanceof HashMap;
switch (true) {
case $property->isPublic():
$propertyType = 'public';
break;
case $property->isProtected():
case $property->isPrivate():
$propertyType = 'private';
$alias[$type->name]['methods'] = $this->getMutatorMethods(
$reflectionClass,
$name,
$type instanceof Property ? $type->type : null
);
break;
default:
$message = sprintf(
'Wrong property %s type of %s class types cannot '.
'be static or abstract.',
$name,
$reflectionName
);
throw new \LogicException($message);
}
$alias[$type->name]['propertyType'] = $propertyType;
if ($type instanceof Embedded) {
$child = new \ReflectionClass($this->finder->getNamespace($type->class, $directory));
$alias[$type->name] = array_merge(
$alias[$type->name],
[
'type' => $this->getObjectMapping($type->class, $directory)['type'],
'multiple' => $type->multiple,
'aliases' => $this->getAliases($child, $metaFields),
'namespace' => $child->getName(),
]
);
}
}
}
$this->aliases[$reflectionName] = $alias;
return $this->aliases[$reflectionName];
} | php | private function getAliases(\ReflectionClass $reflectionClass, array &$metaFields = null)
{
$reflectionName = $reflectionClass->getName();
// We skip cache in case $metaFields is given. This should not affect performance
// because for each document this method is called only once. For objects it might
// be called few times.
if ($metaFields === null && array_key_exists($reflectionName, $this->aliases)) {
return $this->aliases[$reflectionName];
}
$alias = [];
/** @var \ReflectionProperty[] $properties */
$properties = $this->getDocumentPropertiesReflection($reflectionClass);
foreach ($properties as $name => $property) {
$directory = $this->guessDirName($property->getDeclaringClass());
$type = $this->getPropertyAnnotationData($property);
$type = $type !== null ? $type : $this->getEmbeddedAnnotationData($property);
$type = $type !== null ? $type : $this->getHashMapAnnotationData($property);
if ($type === null && $metaFields !== null
&& ($metaData = $this->getMetaFieldAnnotationData($property, $directory)) !== null) {
$metaFields[$metaData['name']] = $metaData['settings'];
$type = new \stdClass();
$type->name = $metaData['name'];
}
if ($type !== null) {
$alias[$type->name] = [
'propertyName' => $name,
];
if ($type instanceof Property) {
$alias[$type->name]['type'] = $type->type;
}
if ($type instanceof HashMap) {
$alias[$type->name]['type'] = HashMap::NAME;
}
$alias[$type->name][HashMap::NAME] = $type instanceof HashMap;
switch (true) {
case $property->isPublic():
$propertyType = 'public';
break;
case $property->isProtected():
case $property->isPrivate():
$propertyType = 'private';
$alias[$type->name]['methods'] = $this->getMutatorMethods(
$reflectionClass,
$name,
$type instanceof Property ? $type->type : null
);
break;
default:
$message = sprintf(
'Wrong property %s type of %s class types cannot '.
'be static or abstract.',
$name,
$reflectionName
);
throw new \LogicException($message);
}
$alias[$type->name]['propertyType'] = $propertyType;
if ($type instanceof Embedded) {
$child = new \ReflectionClass($this->finder->getNamespace($type->class, $directory));
$alias[$type->name] = array_merge(
$alias[$type->name],
[
'type' => $this->getObjectMapping($type->class, $directory)['type'],
'multiple' => $type->multiple,
'aliases' => $this->getAliases($child, $metaFields),
'namespace' => $child->getName(),
]
);
}
}
}
$this->aliases[$reflectionName] = $alias;
return $this->aliases[$reflectionName];
} | [
"private",
"function",
"getAliases",
"(",
"\\",
"ReflectionClass",
"$",
"reflectionClass",
",",
"array",
"&",
"$",
"metaFields",
"=",
"null",
")",
"{",
"$",
"reflectionName",
"=",
"$",
"reflectionClass",
"->",
"getName",
"(",
")",
";",
"// We skip cache in case $metaFields is given. This should not affect performance",
"// because for each document this method is called only once. For objects it might",
"// be called few times.",
"if",
"(",
"$",
"metaFields",
"===",
"null",
"&&",
"array_key_exists",
"(",
"$",
"reflectionName",
",",
"$",
"this",
"->",
"aliases",
")",
")",
"{",
"return",
"$",
"this",
"->",
"aliases",
"[",
"$",
"reflectionName",
"]",
";",
"}",
"$",
"alias",
"=",
"[",
"]",
";",
"/** @var \\ReflectionProperty[] $properties */",
"$",
"properties",
"=",
"$",
"this",
"->",
"getDocumentPropertiesReflection",
"(",
"$",
"reflectionClass",
")",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"name",
"=>",
"$",
"property",
")",
"{",
"$",
"directory",
"=",
"$",
"this",
"->",
"guessDirName",
"(",
"$",
"property",
"->",
"getDeclaringClass",
"(",
")",
")",
";",
"$",
"type",
"=",
"$",
"this",
"->",
"getPropertyAnnotationData",
"(",
"$",
"property",
")",
";",
"$",
"type",
"=",
"$",
"type",
"!==",
"null",
"?",
"$",
"type",
":",
"$",
"this",
"->",
"getEmbeddedAnnotationData",
"(",
"$",
"property",
")",
";",
"$",
"type",
"=",
"$",
"type",
"!==",
"null",
"?",
"$",
"type",
":",
"$",
"this",
"->",
"getHashMapAnnotationData",
"(",
"$",
"property",
")",
";",
"if",
"(",
"$",
"type",
"===",
"null",
"&&",
"$",
"metaFields",
"!==",
"null",
"&&",
"(",
"$",
"metaData",
"=",
"$",
"this",
"->",
"getMetaFieldAnnotationData",
"(",
"$",
"property",
",",
"$",
"directory",
")",
")",
"!==",
"null",
")",
"{",
"$",
"metaFields",
"[",
"$",
"metaData",
"[",
"'name'",
"]",
"]",
"=",
"$",
"metaData",
"[",
"'settings'",
"]",
";",
"$",
"type",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"type",
"->",
"name",
"=",
"$",
"metaData",
"[",
"'name'",
"]",
";",
"}",
"if",
"(",
"$",
"type",
"!==",
"null",
")",
"{",
"$",
"alias",
"[",
"$",
"type",
"->",
"name",
"]",
"=",
"[",
"'propertyName'",
"=>",
"$",
"name",
",",
"]",
";",
"if",
"(",
"$",
"type",
"instanceof",
"Property",
")",
"{",
"$",
"alias",
"[",
"$",
"type",
"->",
"name",
"]",
"[",
"'type'",
"]",
"=",
"$",
"type",
"->",
"type",
";",
"}",
"if",
"(",
"$",
"type",
"instanceof",
"HashMap",
")",
"{",
"$",
"alias",
"[",
"$",
"type",
"->",
"name",
"]",
"[",
"'type'",
"]",
"=",
"HashMap",
"::",
"NAME",
";",
"}",
"$",
"alias",
"[",
"$",
"type",
"->",
"name",
"]",
"[",
"HashMap",
"::",
"NAME",
"]",
"=",
"$",
"type",
"instanceof",
"HashMap",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"$",
"property",
"->",
"isPublic",
"(",
")",
":",
"$",
"propertyType",
"=",
"'public'",
";",
"break",
";",
"case",
"$",
"property",
"->",
"isProtected",
"(",
")",
":",
"case",
"$",
"property",
"->",
"isPrivate",
"(",
")",
":",
"$",
"propertyType",
"=",
"'private'",
";",
"$",
"alias",
"[",
"$",
"type",
"->",
"name",
"]",
"[",
"'methods'",
"]",
"=",
"$",
"this",
"->",
"getMutatorMethods",
"(",
"$",
"reflectionClass",
",",
"$",
"name",
",",
"$",
"type",
"instanceof",
"Property",
"?",
"$",
"type",
"->",
"type",
":",
"null",
")",
";",
"break",
";",
"default",
":",
"$",
"message",
"=",
"sprintf",
"(",
"'Wrong property %s type of %s class types cannot '",
".",
"'be static or abstract.'",
",",
"$",
"name",
",",
"$",
"reflectionName",
")",
";",
"throw",
"new",
"\\",
"LogicException",
"(",
"$",
"message",
")",
";",
"}",
"$",
"alias",
"[",
"$",
"type",
"->",
"name",
"]",
"[",
"'propertyType'",
"]",
"=",
"$",
"propertyType",
";",
"if",
"(",
"$",
"type",
"instanceof",
"Embedded",
")",
"{",
"$",
"child",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
"->",
"finder",
"->",
"getNamespace",
"(",
"$",
"type",
"->",
"class",
",",
"$",
"directory",
")",
")",
";",
"$",
"alias",
"[",
"$",
"type",
"->",
"name",
"]",
"=",
"array_merge",
"(",
"$",
"alias",
"[",
"$",
"type",
"->",
"name",
"]",
",",
"[",
"'type'",
"=>",
"$",
"this",
"->",
"getObjectMapping",
"(",
"$",
"type",
"->",
"class",
",",
"$",
"directory",
")",
"[",
"'type'",
"]",
",",
"'multiple'",
"=>",
"$",
"type",
"->",
"multiple",
",",
"'aliases'",
"=>",
"$",
"this",
"->",
"getAliases",
"(",
"$",
"child",
",",
"$",
"metaFields",
")",
",",
"'namespace'",
"=>",
"$",
"child",
"->",
"getName",
"(",
")",
",",
"]",
")",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"aliases",
"[",
"$",
"reflectionName",
"]",
"=",
"$",
"alias",
";",
"return",
"$",
"this",
"->",
"aliases",
"[",
"$",
"reflectionName",
"]",
";",
"}"
] | Finds aliases for every property used in document including parent classes.
@param \ReflectionClass $reflectionClass
@param array $metaFields
@return array | [
"Finds",
"aliases",
"for",
"every",
"property",
"used",
"in",
"document",
"including",
"parent",
"classes",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L251-L337 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getMutatorMethods | private function getMutatorMethods(\ReflectionClass $reflectionClass, $property, $propertyType)
{
$camelCaseName = ucfirst(Caser::camel($property));
$setterName = 'set'.$camelCaseName;
if (!$reflectionClass->hasMethod($setterName)) {
$message = sprintf(
'Missing %s() method in %s class. Add it, or change property to public.',
$setterName,
$reflectionClass->getName()
);
throw new \LogicException($message);
}
if ($reflectionClass->hasMethod('get'.$camelCaseName)) {
return [
'getter' => 'get' . $camelCaseName,
'setter' => $setterName
];
}
if ($propertyType === 'boolean') {
if ($reflectionClass->hasMethod('is' . $camelCaseName)) {
return [
'getter' => 'is' . $camelCaseName,
'setter' => $setterName
];
}
$message = sprintf(
'Missing %s() or %s() method in %s class. Add it, or change property to public.',
'get'.$camelCaseName,
'is'.$camelCaseName,
$reflectionClass->getName()
);
throw new \LogicException($message);
}
$message = sprintf(
'Missing %s() method in %s class. Add it, or change property to public.',
'get'.$camelCaseName,
$reflectionClass->getName()
);
throw new \LogicException($message);
} | php | private function getMutatorMethods(\ReflectionClass $reflectionClass, $property, $propertyType)
{
$camelCaseName = ucfirst(Caser::camel($property));
$setterName = 'set'.$camelCaseName;
if (!$reflectionClass->hasMethod($setterName)) {
$message = sprintf(
'Missing %s() method in %s class. Add it, or change property to public.',
$setterName,
$reflectionClass->getName()
);
throw new \LogicException($message);
}
if ($reflectionClass->hasMethod('get'.$camelCaseName)) {
return [
'getter' => 'get' . $camelCaseName,
'setter' => $setterName
];
}
if ($propertyType === 'boolean') {
if ($reflectionClass->hasMethod('is' . $camelCaseName)) {
return [
'getter' => 'is' . $camelCaseName,
'setter' => $setterName
];
}
$message = sprintf(
'Missing %s() or %s() method in %s class. Add it, or change property to public.',
'get'.$camelCaseName,
'is'.$camelCaseName,
$reflectionClass->getName()
);
throw new \LogicException($message);
}
$message = sprintf(
'Missing %s() method in %s class. Add it, or change property to public.',
'get'.$camelCaseName,
$reflectionClass->getName()
);
throw new \LogicException($message);
} | [
"private",
"function",
"getMutatorMethods",
"(",
"\\",
"ReflectionClass",
"$",
"reflectionClass",
",",
"$",
"property",
",",
"$",
"propertyType",
")",
"{",
"$",
"camelCaseName",
"=",
"ucfirst",
"(",
"Caser",
"::",
"camel",
"(",
"$",
"property",
")",
")",
";",
"$",
"setterName",
"=",
"'set'",
".",
"$",
"camelCaseName",
";",
"if",
"(",
"!",
"$",
"reflectionClass",
"->",
"hasMethod",
"(",
"$",
"setterName",
")",
")",
"{",
"$",
"message",
"=",
"sprintf",
"(",
"'Missing %s() method in %s class. Add it, or change property to public.'",
",",
"$",
"setterName",
",",
"$",
"reflectionClass",
"->",
"getName",
"(",
")",
")",
";",
"throw",
"new",
"\\",
"LogicException",
"(",
"$",
"message",
")",
";",
"}",
"if",
"(",
"$",
"reflectionClass",
"->",
"hasMethod",
"(",
"'get'",
".",
"$",
"camelCaseName",
")",
")",
"{",
"return",
"[",
"'getter'",
"=>",
"'get'",
".",
"$",
"camelCaseName",
",",
"'setter'",
"=>",
"$",
"setterName",
"]",
";",
"}",
"if",
"(",
"$",
"propertyType",
"===",
"'boolean'",
")",
"{",
"if",
"(",
"$",
"reflectionClass",
"->",
"hasMethod",
"(",
"'is'",
".",
"$",
"camelCaseName",
")",
")",
"{",
"return",
"[",
"'getter'",
"=>",
"'is'",
".",
"$",
"camelCaseName",
",",
"'setter'",
"=>",
"$",
"setterName",
"]",
";",
"}",
"$",
"message",
"=",
"sprintf",
"(",
"'Missing %s() or %s() method in %s class. Add it, or change property to public.'",
",",
"'get'",
".",
"$",
"camelCaseName",
",",
"'is'",
".",
"$",
"camelCaseName",
",",
"$",
"reflectionClass",
"->",
"getName",
"(",
")",
")",
";",
"throw",
"new",
"\\",
"LogicException",
"(",
"$",
"message",
")",
";",
"}",
"$",
"message",
"=",
"sprintf",
"(",
"'Missing %s() method in %s class. Add it, or change property to public.'",
",",
"'get'",
".",
"$",
"camelCaseName",
",",
"$",
"reflectionClass",
"->",
"getName",
"(",
")",
")",
";",
"throw",
"new",
"\\",
"LogicException",
"(",
"$",
"message",
")",
";",
"}"
] | Checks if class have setter and getter, and returns them in array.
@param \ReflectionClass $reflectionClass
@param string $property
@return array | [
"Checks",
"if",
"class",
"have",
"setter",
"and",
"getter",
"and",
"returns",
"them",
"in",
"array",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L347-L390 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.registerAnnotations | private function registerAnnotations()
{
$annotations = [
'Document',
'Property',
'Embedded',
'ObjectType',
'Nested',
'Id',
'ParentDocument',
'Routing',
'Version',
'HashMap',
];
foreach ($annotations as $annotation) {
AnnotationRegistry::registerFile(__DIR__ . "/../Annotation/{$annotation}.php");
}
if (version_compare(PHP_VERSION, '7.2.0') < 0) {
AnnotationRegistry::registerFile(__DIR__ . "/../Annotation/Object.php");
}
} | php | private function registerAnnotations()
{
$annotations = [
'Document',
'Property',
'Embedded',
'ObjectType',
'Nested',
'Id',
'ParentDocument',
'Routing',
'Version',
'HashMap',
];
foreach ($annotations as $annotation) {
AnnotationRegistry::registerFile(__DIR__ . "/../Annotation/{$annotation}.php");
}
if (version_compare(PHP_VERSION, '7.2.0') < 0) {
AnnotationRegistry::registerFile(__DIR__ . "/../Annotation/Object.php");
}
} | [
"private",
"function",
"registerAnnotations",
"(",
")",
"{",
"$",
"annotations",
"=",
"[",
"'Document'",
",",
"'Property'",
",",
"'Embedded'",
",",
"'ObjectType'",
",",
"'Nested'",
",",
"'Id'",
",",
"'ParentDocument'",
",",
"'Routing'",
",",
"'Version'",
",",
"'HashMap'",
",",
"]",
";",
"foreach",
"(",
"$",
"annotations",
"as",
"$",
"annotation",
")",
"{",
"AnnotationRegistry",
"::",
"registerFile",
"(",
"__DIR__",
".",
"\"/../Annotation/{$annotation}.php\"",
")",
";",
"}",
"if",
"(",
"version_compare",
"(",
"PHP_VERSION",
",",
"'7.2.0'",
")",
"<",
"0",
")",
"{",
"AnnotationRegistry",
"::",
"registerFile",
"(",
"__DIR__",
".",
"\"/../Annotation/Object.php\"",
")",
";",
"}",
"}"
] | Registers annotations to registry so that it could be used by reader. | [
"Registers",
"annotations",
"to",
"registry",
"so",
"that",
"it",
"could",
"be",
"used",
"by",
"reader",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L395-L417 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getDocumentType | private function getDocumentType($document, $directory)
{
$namespace = $this->finder->getNamespace($document, $directory);
$reflectionClass = new \ReflectionClass($namespace);
$document = $this->getDocumentAnnotationData($reflectionClass);
return empty($document->type) ? Caser::snake($reflectionClass->getShortName()) : $document->type;
} | php | private function getDocumentType($document, $directory)
{
$namespace = $this->finder->getNamespace($document, $directory);
$reflectionClass = new \ReflectionClass($namespace);
$document = $this->getDocumentAnnotationData($reflectionClass);
return empty($document->type) ? Caser::snake($reflectionClass->getShortName()) : $document->type;
} | [
"private",
"function",
"getDocumentType",
"(",
"$",
"document",
",",
"$",
"directory",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"finder",
"->",
"getNamespace",
"(",
"$",
"document",
",",
"$",
"directory",
")",
";",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"namespace",
")",
";",
"$",
"document",
"=",
"$",
"this",
"->",
"getDocumentAnnotationData",
"(",
"$",
"reflectionClass",
")",
";",
"return",
"empty",
"(",
"$",
"document",
"->",
"type",
")",
"?",
"Caser",
"::",
"snake",
"(",
"$",
"reflectionClass",
"->",
"getShortName",
"(",
")",
")",
":",
"$",
"document",
"->",
"type",
";",
"}"
] | Returns document type.
@param string $document Format must be like AcmeBundle:Document.
@param string $directory The Document directory name of the bundle.
@return string | [
"Returns",
"document",
"type",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L427-L434 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getDocumentPropertiesReflection | private function getDocumentPropertiesReflection(\ReflectionClass $reflectionClass)
{
if (in_array($reflectionClass->getName(), $this->properties)) {
return $this->properties[$reflectionClass->getName()];
}
$properties = [];
foreach ($reflectionClass->getProperties() as $property) {
if (!in_array($property->getName(), $properties)) {
$properties[$property->getName()] = $property;
}
}
$parentReflection = $reflectionClass->getParentClass();
if ($parentReflection !== false) {
$properties = array_merge(
$properties,
array_diff_key($this->getDocumentPropertiesReflection($parentReflection), $properties)
);
}
$this->properties[$reflectionClass->getName()] = $properties;
return $properties;
} | php | private function getDocumentPropertiesReflection(\ReflectionClass $reflectionClass)
{
if (in_array($reflectionClass->getName(), $this->properties)) {
return $this->properties[$reflectionClass->getName()];
}
$properties = [];
foreach ($reflectionClass->getProperties() as $property) {
if (!in_array($property->getName(), $properties)) {
$properties[$property->getName()] = $property;
}
}
$parentReflection = $reflectionClass->getParentClass();
if ($parentReflection !== false) {
$properties = array_merge(
$properties,
array_diff_key($this->getDocumentPropertiesReflection($parentReflection), $properties)
);
}
$this->properties[$reflectionClass->getName()] = $properties;
return $properties;
} | [
"private",
"function",
"getDocumentPropertiesReflection",
"(",
"\\",
"ReflectionClass",
"$",
"reflectionClass",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"reflectionClass",
"->",
"getName",
"(",
")",
",",
"$",
"this",
"->",
"properties",
")",
")",
"{",
"return",
"$",
"this",
"->",
"properties",
"[",
"$",
"reflectionClass",
"->",
"getName",
"(",
")",
"]",
";",
"}",
"$",
"properties",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"reflectionClass",
"->",
"getProperties",
"(",
")",
"as",
"$",
"property",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"property",
"->",
"getName",
"(",
")",
",",
"$",
"properties",
")",
")",
"{",
"$",
"properties",
"[",
"$",
"property",
"->",
"getName",
"(",
")",
"]",
"=",
"$",
"property",
";",
"}",
"}",
"$",
"parentReflection",
"=",
"$",
"reflectionClass",
"->",
"getParentClass",
"(",
")",
";",
"if",
"(",
"$",
"parentReflection",
"!==",
"false",
")",
"{",
"$",
"properties",
"=",
"array_merge",
"(",
"$",
"properties",
",",
"array_diff_key",
"(",
"$",
"this",
"->",
"getDocumentPropertiesReflection",
"(",
"$",
"parentReflection",
")",
",",
"$",
"properties",
")",
")",
";",
"}",
"$",
"this",
"->",
"properties",
"[",
"$",
"reflectionClass",
"->",
"getName",
"(",
")",
"]",
"=",
"$",
"properties",
";",
"return",
"$",
"properties",
";",
"}"
] | Returns all defined properties including private from parents.
@param \ReflectionClass $reflectionClass
@return array | [
"Returns",
"all",
"defined",
"properties",
"including",
"private",
"from",
"parents",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L443-L468 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getAnalyzers | private function getAnalyzers(\ReflectionClass $reflectionClass)
{
$analyzers = [];
foreach ($this->getDocumentPropertiesReflection($reflectionClass) as $name => $property) {
$directory = $this->guessDirName($property->getDeclaringClass());
$type = $this->getPropertyAnnotationData($property);
$type = $type !== null ? $type : $this->getEmbeddedAnnotationData($property);
if ($type instanceof Embedded) {
$analyzers = array_merge(
$analyzers,
$this->getAnalyzers(new \ReflectionClass($this->finder->getNamespace($type->class, $directory)))
);
}
if ($type instanceof Property) {
if (isset($type->options['analyzer'])) {
$analyzers[] = $type->options['analyzer'];
}
if (isset($type->options['search_analyzer'])) {
$analyzers[] = $type->options['search_analyzer'];
}
if (isset($type->options['fields'])) {
foreach ($type->options['fields'] as $field) {
if (isset($field['analyzer'])) {
$analyzers[] = $field['analyzer'];
}
if (isset($field['search_analyzer'])) {
$analyzers[] = $field['search_analyzer'];
}
}
}
}
}
return array_unique($analyzers);
} | php | private function getAnalyzers(\ReflectionClass $reflectionClass)
{
$analyzers = [];
foreach ($this->getDocumentPropertiesReflection($reflectionClass) as $name => $property) {
$directory = $this->guessDirName($property->getDeclaringClass());
$type = $this->getPropertyAnnotationData($property);
$type = $type !== null ? $type : $this->getEmbeddedAnnotationData($property);
if ($type instanceof Embedded) {
$analyzers = array_merge(
$analyzers,
$this->getAnalyzers(new \ReflectionClass($this->finder->getNamespace($type->class, $directory)))
);
}
if ($type instanceof Property) {
if (isset($type->options['analyzer'])) {
$analyzers[] = $type->options['analyzer'];
}
if (isset($type->options['search_analyzer'])) {
$analyzers[] = $type->options['search_analyzer'];
}
if (isset($type->options['fields'])) {
foreach ($type->options['fields'] as $field) {
if (isset($field['analyzer'])) {
$analyzers[] = $field['analyzer'];
}
if (isset($field['search_analyzer'])) {
$analyzers[] = $field['search_analyzer'];
}
}
}
}
}
return array_unique($analyzers);
} | [
"private",
"function",
"getAnalyzers",
"(",
"\\",
"ReflectionClass",
"$",
"reflectionClass",
")",
"{",
"$",
"analyzers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getDocumentPropertiesReflection",
"(",
"$",
"reflectionClass",
")",
"as",
"$",
"name",
"=>",
"$",
"property",
")",
"{",
"$",
"directory",
"=",
"$",
"this",
"->",
"guessDirName",
"(",
"$",
"property",
"->",
"getDeclaringClass",
"(",
")",
")",
";",
"$",
"type",
"=",
"$",
"this",
"->",
"getPropertyAnnotationData",
"(",
"$",
"property",
")",
";",
"$",
"type",
"=",
"$",
"type",
"!==",
"null",
"?",
"$",
"type",
":",
"$",
"this",
"->",
"getEmbeddedAnnotationData",
"(",
"$",
"property",
")",
";",
"if",
"(",
"$",
"type",
"instanceof",
"Embedded",
")",
"{",
"$",
"analyzers",
"=",
"array_merge",
"(",
"$",
"analyzers",
",",
"$",
"this",
"->",
"getAnalyzers",
"(",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
"->",
"finder",
"->",
"getNamespace",
"(",
"$",
"type",
"->",
"class",
",",
"$",
"directory",
")",
")",
")",
")",
";",
"}",
"if",
"(",
"$",
"type",
"instanceof",
"Property",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"type",
"->",
"options",
"[",
"'analyzer'",
"]",
")",
")",
"{",
"$",
"analyzers",
"[",
"]",
"=",
"$",
"type",
"->",
"options",
"[",
"'analyzer'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"type",
"->",
"options",
"[",
"'search_analyzer'",
"]",
")",
")",
"{",
"$",
"analyzers",
"[",
"]",
"=",
"$",
"type",
"->",
"options",
"[",
"'search_analyzer'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"type",
"->",
"options",
"[",
"'fields'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"type",
"->",
"options",
"[",
"'fields'",
"]",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"field",
"[",
"'analyzer'",
"]",
")",
")",
"{",
"$",
"analyzers",
"[",
"]",
"=",
"$",
"field",
"[",
"'analyzer'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"field",
"[",
"'search_analyzer'",
"]",
")",
")",
"{",
"$",
"analyzers",
"[",
"]",
"=",
"$",
"field",
"[",
"'search_analyzer'",
"]",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"array_unique",
"(",
"$",
"analyzers",
")",
";",
"}"
] | Parses analyzers list from document mapping.
@param \ReflectionClass $reflectionClass
@return array | [
"Parses",
"analyzers",
"list",
"from",
"document",
"mapping",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L476-L514 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getProperties | private function getProperties(\ReflectionClass $reflectionClass, $properties = [], $flag = false)
{
$mapping = [];
/** @var \ReflectionProperty $property */
foreach ($this->getDocumentPropertiesReflection($reflectionClass) as $name => $property) {
$directory = $this->guessDirName($property->getDeclaringClass());
$type = $this->getPropertyAnnotationData($property);
$type = $type !== null ? $type : $this->getEmbeddedAnnotationData($property);
$type = $type !== null ? $type : $this->getHashMapAnnotationData($property);
if ((in_array($name, $properties) && !$flag)
|| (!in_array($name, $properties) && $flag)
|| empty($type)
) {
continue;
}
$map = $type->dump();
// Inner object
if ($type instanceof Embedded) {
$map = array_replace_recursive($map, $this->getObjectMapping($type->class, $directory));
}
// HashMap object
if ($type instanceof HashMap) {
$map = array_replace_recursive($map, [
'type' => Nested::NAME,
'dynamic' => true,
]);
}
// If there is set some Raw options, it will override current ones.
if (isset($map['options'])) {
$options = $map['options'];
unset($map['options']);
$map = array_merge($map, $options);
}
$mapping[$type->name] = $map;
}
return $mapping;
} | php | private function getProperties(\ReflectionClass $reflectionClass, $properties = [], $flag = false)
{
$mapping = [];
/** @var \ReflectionProperty $property */
foreach ($this->getDocumentPropertiesReflection($reflectionClass) as $name => $property) {
$directory = $this->guessDirName($property->getDeclaringClass());
$type = $this->getPropertyAnnotationData($property);
$type = $type !== null ? $type : $this->getEmbeddedAnnotationData($property);
$type = $type !== null ? $type : $this->getHashMapAnnotationData($property);
if ((in_array($name, $properties) && !$flag)
|| (!in_array($name, $properties) && $flag)
|| empty($type)
) {
continue;
}
$map = $type->dump();
// Inner object
if ($type instanceof Embedded) {
$map = array_replace_recursive($map, $this->getObjectMapping($type->class, $directory));
}
// HashMap object
if ($type instanceof HashMap) {
$map = array_replace_recursive($map, [
'type' => Nested::NAME,
'dynamic' => true,
]);
}
// If there is set some Raw options, it will override current ones.
if (isset($map['options'])) {
$options = $map['options'];
unset($map['options']);
$map = array_merge($map, $options);
}
$mapping[$type->name] = $map;
}
return $mapping;
} | [
"private",
"function",
"getProperties",
"(",
"\\",
"ReflectionClass",
"$",
"reflectionClass",
",",
"$",
"properties",
"=",
"[",
"]",
",",
"$",
"flag",
"=",
"false",
")",
"{",
"$",
"mapping",
"=",
"[",
"]",
";",
"/** @var \\ReflectionProperty $property */",
"foreach",
"(",
"$",
"this",
"->",
"getDocumentPropertiesReflection",
"(",
"$",
"reflectionClass",
")",
"as",
"$",
"name",
"=>",
"$",
"property",
")",
"{",
"$",
"directory",
"=",
"$",
"this",
"->",
"guessDirName",
"(",
"$",
"property",
"->",
"getDeclaringClass",
"(",
")",
")",
";",
"$",
"type",
"=",
"$",
"this",
"->",
"getPropertyAnnotationData",
"(",
"$",
"property",
")",
";",
"$",
"type",
"=",
"$",
"type",
"!==",
"null",
"?",
"$",
"type",
":",
"$",
"this",
"->",
"getEmbeddedAnnotationData",
"(",
"$",
"property",
")",
";",
"$",
"type",
"=",
"$",
"type",
"!==",
"null",
"?",
"$",
"type",
":",
"$",
"this",
"->",
"getHashMapAnnotationData",
"(",
"$",
"property",
")",
";",
"if",
"(",
"(",
"in_array",
"(",
"$",
"name",
",",
"$",
"properties",
")",
"&&",
"!",
"$",
"flag",
")",
"||",
"(",
"!",
"in_array",
"(",
"$",
"name",
",",
"$",
"properties",
")",
"&&",
"$",
"flag",
")",
"||",
"empty",
"(",
"$",
"type",
")",
")",
"{",
"continue",
";",
"}",
"$",
"map",
"=",
"$",
"type",
"->",
"dump",
"(",
")",
";",
"// Inner object",
"if",
"(",
"$",
"type",
"instanceof",
"Embedded",
")",
"{",
"$",
"map",
"=",
"array_replace_recursive",
"(",
"$",
"map",
",",
"$",
"this",
"->",
"getObjectMapping",
"(",
"$",
"type",
"->",
"class",
",",
"$",
"directory",
")",
")",
";",
"}",
"// HashMap object",
"if",
"(",
"$",
"type",
"instanceof",
"HashMap",
")",
"{",
"$",
"map",
"=",
"array_replace_recursive",
"(",
"$",
"map",
",",
"[",
"'type'",
"=>",
"Nested",
"::",
"NAME",
",",
"'dynamic'",
"=>",
"true",
",",
"]",
")",
";",
"}",
"// If there is set some Raw options, it will override current ones.",
"if",
"(",
"isset",
"(",
"$",
"map",
"[",
"'options'",
"]",
")",
")",
"{",
"$",
"options",
"=",
"$",
"map",
"[",
"'options'",
"]",
";",
"unset",
"(",
"$",
"map",
"[",
"'options'",
"]",
")",
";",
"$",
"map",
"=",
"array_merge",
"(",
"$",
"map",
",",
"$",
"options",
")",
";",
"}",
"$",
"mapping",
"[",
"$",
"type",
"->",
"name",
"]",
"=",
"$",
"map",
";",
"}",
"return",
"$",
"mapping",
";",
"}"
] | Returns properties of reflection class.
@param \ReflectionClass $reflectionClass Class to read properties from.
@param array $properties Properties to skip.
@param bool $flag If false exludes properties, true only includes properties.
@return array | [
"Returns",
"properties",
"of",
"reflection",
"class",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L525-L570 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.getObjectMapping | private function getObjectMapping($className, $directory)
{
$namespace = $this->finder->getNamespace($className, $directory);
if (array_key_exists($namespace, $this->objects)) {
return $this->objects[$namespace];
}
$reflectionClass = new \ReflectionClass($namespace);
switch (true) {
case $this->reader->getClassAnnotation($reflectionClass, self::OBJECT_ANNOTATION):
$type = 'object';
break;
case $this->reader->getClassAnnotation($reflectionClass, self::NESTED_ANNOTATION):
$type = 'nested';
break;
default:
throw new \LogicException(
sprintf(
'%s should have @ObjectType or @Nested annotation to be used as embeddable object.',
$className
)
);
}
$this->objects[$namespace] = [
'type' => $type,
'properties' => $this->getProperties($reflectionClass),
];
return $this->objects[$namespace];
} | php | private function getObjectMapping($className, $directory)
{
$namespace = $this->finder->getNamespace($className, $directory);
if (array_key_exists($namespace, $this->objects)) {
return $this->objects[$namespace];
}
$reflectionClass = new \ReflectionClass($namespace);
switch (true) {
case $this->reader->getClassAnnotation($reflectionClass, self::OBJECT_ANNOTATION):
$type = 'object';
break;
case $this->reader->getClassAnnotation($reflectionClass, self::NESTED_ANNOTATION):
$type = 'nested';
break;
default:
throw new \LogicException(
sprintf(
'%s should have @ObjectType or @Nested annotation to be used as embeddable object.',
$className
)
);
}
$this->objects[$namespace] = [
'type' => $type,
'properties' => $this->getProperties($reflectionClass),
];
return $this->objects[$namespace];
} | [
"private",
"function",
"getObjectMapping",
"(",
"$",
"className",
",",
"$",
"directory",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"finder",
"->",
"getNamespace",
"(",
"$",
"className",
",",
"$",
"directory",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"namespace",
",",
"$",
"this",
"->",
"objects",
")",
")",
"{",
"return",
"$",
"this",
"->",
"objects",
"[",
"$",
"namespace",
"]",
";",
"}",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"namespace",
")",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"$",
"this",
"->",
"reader",
"->",
"getClassAnnotation",
"(",
"$",
"reflectionClass",
",",
"self",
"::",
"OBJECT_ANNOTATION",
")",
":",
"$",
"type",
"=",
"'object'",
";",
"break",
";",
"case",
"$",
"this",
"->",
"reader",
"->",
"getClassAnnotation",
"(",
"$",
"reflectionClass",
",",
"self",
"::",
"NESTED_ANNOTATION",
")",
":",
"$",
"type",
"=",
"'nested'",
";",
"break",
";",
"default",
":",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'%s should have @ObjectType or @Nested annotation to be used as embeddable object.'",
",",
"$",
"className",
")",
")",
";",
"}",
"$",
"this",
"->",
"objects",
"[",
"$",
"namespace",
"]",
"=",
"[",
"'type'",
"=>",
"$",
"type",
",",
"'properties'",
"=>",
"$",
"this",
"->",
"getProperties",
"(",
"$",
"reflectionClass",
")",
",",
"]",
";",
"return",
"$",
"this",
"->",
"objects",
"[",
"$",
"namespace",
"]",
";",
"}"
] | Returns object mapping.
Loads from cache if it's already loaded.
@param string $className
@param string $directory Name of the directory where the Document is
@return array | [
"Returns",
"object",
"mapping",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L582-L614 |
ongr-io/ElasticsearchBundle | Mapping/DocumentParser.php | DocumentParser.guessDirName | private function guessDirName(\ReflectionClass $reflection)
{
return substr(
$directory = $reflection->getName(),
$start = strpos($directory, '\\') + 1,
strrpos($directory, '\\') - $start
);
} | php | private function guessDirName(\ReflectionClass $reflection)
{
return substr(
$directory = $reflection->getName(),
$start = strpos($directory, '\\') + 1,
strrpos($directory, '\\') - $start
);
} | [
"private",
"function",
"guessDirName",
"(",
"\\",
"ReflectionClass",
"$",
"reflection",
")",
"{",
"return",
"substr",
"(",
"$",
"directory",
"=",
"$",
"reflection",
"->",
"getName",
"(",
")",
",",
"$",
"start",
"=",
"strpos",
"(",
"$",
"directory",
",",
"'\\\\'",
")",
"+",
"1",
",",
"strrpos",
"(",
"$",
"directory",
",",
"'\\\\'",
")",
"-",
"$",
"start",
")",
";",
"}"
] | @param \ReflectionClass $reflection
@return string | [
"@param",
"\\",
"ReflectionClass",
"$reflection"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentParser.php#L621-L628 |
slimphp/Slim-Flash | src/Messages.php | Messages.addMessage | public function addMessage($key, $message)
{
// Create Array for this key
if (!isset($this->storage[$this->storageKey][$key])) {
$this->storage[$this->storageKey][$key] = [];
}
// Push onto the array
$this->storage[$this->storageKey][$key][] = $message;
} | php | public function addMessage($key, $message)
{
// Create Array for this key
if (!isset($this->storage[$this->storageKey][$key])) {
$this->storage[$this->storageKey][$key] = [];
}
// Push onto the array
$this->storage[$this->storageKey][$key][] = $message;
} | [
"public",
"function",
"addMessage",
"(",
"$",
"key",
",",
"$",
"message",
")",
"{",
"// Create Array for this key",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"storage",
"[",
"$",
"this",
"->",
"storageKey",
"]",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"this",
"->",
"storage",
"[",
"$",
"this",
"->",
"storageKey",
"]",
"[",
"$",
"key",
"]",
"=",
"[",
"]",
";",
"}",
"// Push onto the array",
"$",
"this",
"->",
"storage",
"[",
"$",
"this",
"->",
"storageKey",
"]",
"[",
"$",
"key",
"]",
"[",
"]",
"=",
"$",
"message",
";",
"}"
] | Add flash message for the next request
@param string $key The key to store the message under
@param mixed $message Message to show on next request | [
"Add",
"flash",
"message",
"for",
"the",
"next",
"request"
] | train | https://github.com/slimphp/Slim-Flash/blob/3fa6e614ed7e399fa6234c7f709bdf56be877c99/src/Messages.php#L86-L95 |
slimphp/Slim-Flash | src/Messages.php | Messages.addMessageNow | public function addMessageNow($key, $message)
{
// Create Array for this key
if (!isset($this->forNow[$key])) {
$this->forNow[$key] = [];
}
// Push onto the array
$this->forNow[$key][] = $message;
} | php | public function addMessageNow($key, $message)
{
// Create Array for this key
if (!isset($this->forNow[$key])) {
$this->forNow[$key] = [];
}
// Push onto the array
$this->forNow[$key][] = $message;
} | [
"public",
"function",
"addMessageNow",
"(",
"$",
"key",
",",
"$",
"message",
")",
"{",
"// Create Array for this key",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"forNow",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"this",
"->",
"forNow",
"[",
"$",
"key",
"]",
"=",
"[",
"]",
";",
"}",
"// Push onto the array",
"$",
"this",
"->",
"forNow",
"[",
"$",
"key",
"]",
"[",
"]",
"=",
"$",
"message",
";",
"}"
] | Add flash message for current request
@param string $key The key to store the message under
@param mixed $message Message to show for the current request | [
"Add",
"flash",
"message",
"for",
"current",
"request"
] | train | https://github.com/slimphp/Slim-Flash/blob/3fa6e614ed7e399fa6234c7f709bdf56be877c99/src/Messages.php#L103-L112 |
slimphp/Slim-Flash | src/Messages.php | Messages.getMessages | public function getMessages()
{
$messages = $this->fromPrevious;
foreach ($this->forNow as $key => $values) {
if (!isset($messages[$key])) {
$messages[$key] = [];
}
foreach ($values as $value) {
array_push($messages[$key], $value);
}
}
return $messages;
} | php | public function getMessages()
{
$messages = $this->fromPrevious;
foreach ($this->forNow as $key => $values) {
if (!isset($messages[$key])) {
$messages[$key] = [];
}
foreach ($values as $value) {
array_push($messages[$key], $value);
}
}
return $messages;
} | [
"public",
"function",
"getMessages",
"(",
")",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"fromPrevious",
";",
"foreach",
"(",
"$",
"this",
"->",
"forNow",
"as",
"$",
"key",
"=>",
"$",
"values",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"messages",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"messages",
"[",
"$",
"key",
"]",
"=",
"[",
"]",
";",
"}",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"array_push",
"(",
"$",
"messages",
"[",
"$",
"key",
"]",
",",
"$",
"value",
")",
";",
"}",
"}",
"return",
"$",
"messages",
";",
"}"
] | Get flash messages
@return array Messages to show for current request | [
"Get",
"flash",
"messages"
] | train | https://github.com/slimphp/Slim-Flash/blob/3fa6e614ed7e399fa6234c7f709bdf56be877c99/src/Messages.php#L119-L134 |
slimphp/Slim-Flash | src/Messages.php | Messages.getMessage | public function getMessage($key)
{
$messages = $this->getMessages();
// If the key exists then return all messages or null
return (isset($messages[$key])) ? $messages[$key] : null;
} | php | public function getMessage($key)
{
$messages = $this->getMessages();
// If the key exists then return all messages or null
return (isset($messages[$key])) ? $messages[$key] : null;
} | [
"public",
"function",
"getMessage",
"(",
"$",
"key",
")",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"getMessages",
"(",
")",
";",
"// If the key exists then return all messages or null",
"return",
"(",
"isset",
"(",
"$",
"messages",
"[",
"$",
"key",
"]",
")",
")",
"?",
"$",
"messages",
"[",
"$",
"key",
"]",
":",
"null",
";",
"}"
] | Get Flash Message
@param string $key The key to get the message from
@return mixed|null Returns the message | [
"Get",
"Flash",
"Message"
] | train | https://github.com/slimphp/Slim-Flash/blob/3fa6e614ed7e399fa6234c7f709bdf56be877c99/src/Messages.php#L142-L148 |
slimphp/Slim-Flash | src/Messages.php | Messages.getFirstMessage | public function getFirstMessage($key, $default = null)
{
$messages = self::getMessage($key);
if (is_array($messages) && count($messages) > 0) {
return $messages[0];
}
return $default;
} | php | public function getFirstMessage($key, $default = null)
{
$messages = self::getMessage($key);
if (is_array($messages) && count($messages) > 0) {
return $messages[0];
}
return $default;
} | [
"public",
"function",
"getFirstMessage",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"messages",
"=",
"self",
"::",
"getMessage",
"(",
"$",
"key",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"messages",
")",
"&&",
"count",
"(",
"$",
"messages",
")",
">",
"0",
")",
"{",
"return",
"$",
"messages",
"[",
"0",
"]",
";",
"}",
"return",
"$",
"default",
";",
"}"
] | Get the first Flash message
@param string $key The key to get the message from
@param string $default Default value if key doesn't exist
@return mixed Returns the message | [
"Get",
"the",
"first",
"Flash",
"message"
] | train | https://github.com/slimphp/Slim-Flash/blob/3fa6e614ed7e399fa6234c7f709bdf56be877c99/src/Messages.php#L157-L165 |
slimphp/Slim-Flash | src/Messages.php | Messages.clearMessages | public function clearMessages()
{
if (isset($this->storage[$this->storageKey])) {
$this->storage[$this->storageKey] = [];
}
$this->fromPrevious = [];
$this->forNow = [];
} | php | public function clearMessages()
{
if (isset($this->storage[$this->storageKey])) {
$this->storage[$this->storageKey] = [];
}
$this->fromPrevious = [];
$this->forNow = [];
} | [
"public",
"function",
"clearMessages",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"storage",
"[",
"$",
"this",
"->",
"storageKey",
"]",
")",
")",
"{",
"$",
"this",
"->",
"storage",
"[",
"$",
"this",
"->",
"storageKey",
"]",
"=",
"[",
"]",
";",
"}",
"$",
"this",
"->",
"fromPrevious",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"forNow",
"=",
"[",
"]",
";",
"}"
] | Clear all messages
@return void | [
"Clear",
"all",
"messages"
] | train | https://github.com/slimphp/Slim-Flash/blob/3fa6e614ed7e399fa6234c7f709bdf56be877c99/src/Messages.php#L184-L192 |
slimphp/Slim-Flash | src/Messages.php | Messages.clearMessage | public function clearMessage($key)
{
if (isset($this->storage[$this->storageKey][$key])) {
unset($this->storage[$this->storageKey][$key]);
}
if (isset($this->fromPrevious[$key])) {
unset($this->fromPrevious[$key]);
}
if (isset($this->forNow[$key])) {
unset($this->forNow[$key]);
}
} | php | public function clearMessage($key)
{
if (isset($this->storage[$this->storageKey][$key])) {
unset($this->storage[$this->storageKey][$key]);
}
if (isset($this->fromPrevious[$key])) {
unset($this->fromPrevious[$key]);
}
if (isset($this->forNow[$key])) {
unset($this->forNow[$key]);
}
} | [
"public",
"function",
"clearMessage",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"storage",
"[",
"$",
"this",
"->",
"storageKey",
"]",
"[",
"$",
"key",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"storage",
"[",
"$",
"this",
"->",
"storageKey",
"]",
"[",
"$",
"key",
"]",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fromPrevious",
"[",
"$",
"key",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"fromPrevious",
"[",
"$",
"key",
"]",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"forNow",
"[",
"$",
"key",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"forNow",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}"
] | Clear specific message
@param String $key The key to clear
@return void | [
"Clear",
"specific",
"message"
] | train | https://github.com/slimphp/Slim-Flash/blob/3fa6e614ed7e399fa6234c7f709bdf56be877c99/src/Messages.php#L200-L213 |
Petschko/dhl-php-sdk | includes/IdentCheck.php | IdentCheck.getIdentClass_v2 | public function getIdentClass_v2() {
$class = new StdClass;
$class->surname = $this->getLastName();
$class->givenName = $this->getFirstName();
$class->dateOfBirth = $this->getBirthday();
$class->minimumAge = $this->getMinimumAge();
return $class;
} | php | public function getIdentClass_v2() {
$class = new StdClass;
$class->surname = $this->getLastName();
$class->givenName = $this->getFirstName();
$class->dateOfBirth = $this->getBirthday();
$class->minimumAge = $this->getMinimumAge();
return $class;
} | [
"public",
"function",
"getIdentClass_v2",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"surname",
"=",
"$",
"this",
"->",
"getLastName",
"(",
")",
";",
"$",
"class",
"->",
"givenName",
"=",
"$",
"this",
"->",
"getFirstName",
"(",
")",
";",
"$",
"class",
"->",
"dateOfBirth",
"=",
"$",
"this",
"->",
"getBirthday",
"(",
")",
";",
"$",
"class",
"->",
"minimumAge",
"=",
"$",
"this",
"->",
"getMinimumAge",
"(",
")",
";",
"return",
"$",
"class",
";",
"}"
] | Get the Ident-DHL-Class
@return StdClass - Ident-DHL-Class | [
"Get",
"the",
"Ident",
"-",
"DHL",
"-",
"Class"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/IdentCheck.php#L170-L178 |
Petschko/dhl-php-sdk | includes/Response.php | Response.getLabelData | public function getLabelData($index = null) {
if($index === null)
return $this->labelData;
else
return $this->labelData[$index];
} | php | public function getLabelData($index = null) {
if($index === null)
return $this->labelData;
else
return $this->labelData[$index];
} | [
"public",
"function",
"getLabelData",
"(",
"$",
"index",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"index",
"===",
"null",
")",
"return",
"$",
"this",
"->",
"labelData",
";",
"else",
"return",
"$",
"this",
"->",
"labelData",
"[",
"$",
"index",
"]",
";",
"}"
] | Getter for LabelData-Objects
@param null|int $index - Index of the LabelData-Object or null for the array
@return LabelData[]|LabelData - LabelData-Object(-Array) | [
"Getter",
"for",
"LabelData",
"-",
"Objects"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Response.php#L291-L296 |
Petschko/dhl-php-sdk | includes/Response.php | Response.validateStatusCode | private function validateStatusCode() {
if($this->getStatusCode() === self::DHL_ERROR_NO_ERROR && $this->getStatusText() !== 'ok')
$this->setStatusCode(self::DHL_ERROR_WEAK_WARNING);
// Fix the DHL-Error Weak-Warning-Bug
if($this->countLabelData() === 1) {
// ALWAYS uses the Shipment-Response when only 1
$this->setStatusCode($this->getLabelData(0)->getStatusCode());
$this->setStatusText($this->getLabelData(0)->getStatusText());
$this->setStatusMessage($this->getLabelData(0)->getStatusMessage());
} else if($this->getStatusCode() === self::DHL_ERROR_WEAK_WARNING) {
$noError = true;
// Search in all shipments if an error/warning exists
foreach($this->getLabelData() as &$labelData) {
/**
* @var LabelData $labelData
*/
if($labelData->getStatusCode() !== self::DHL_ERROR_NO_ERROR) {
$noError = false;
break;
}
}
if($noError) {
$this->setStatusCode(self::DHL_ERROR_NO_ERROR);
$this->setStatusText('ok');
$this->setStatusMessage('Der Webservice wurde ohne Fehler ausgeführt.');
}
}
} | php | private function validateStatusCode() {
if($this->getStatusCode() === self::DHL_ERROR_NO_ERROR && $this->getStatusText() !== 'ok')
$this->setStatusCode(self::DHL_ERROR_WEAK_WARNING);
// Fix the DHL-Error Weak-Warning-Bug
if($this->countLabelData() === 1) {
// ALWAYS uses the Shipment-Response when only 1
$this->setStatusCode($this->getLabelData(0)->getStatusCode());
$this->setStatusText($this->getLabelData(0)->getStatusText());
$this->setStatusMessage($this->getLabelData(0)->getStatusMessage());
} else if($this->getStatusCode() === self::DHL_ERROR_WEAK_WARNING) {
$noError = true;
// Search in all shipments if an error/warning exists
foreach($this->getLabelData() as &$labelData) {
/**
* @var LabelData $labelData
*/
if($labelData->getStatusCode() !== self::DHL_ERROR_NO_ERROR) {
$noError = false;
break;
}
}
if($noError) {
$this->setStatusCode(self::DHL_ERROR_NO_ERROR);
$this->setStatusText('ok');
$this->setStatusMessage('Der Webservice wurde ohne Fehler ausgeführt.');
}
}
} | [
"private",
"function",
"validateStatusCode",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getStatusCode",
"(",
")",
"===",
"self",
"::",
"DHL_ERROR_NO_ERROR",
"&&",
"$",
"this",
"->",
"getStatusText",
"(",
")",
"!==",
"'ok'",
")",
"$",
"this",
"->",
"setStatusCode",
"(",
"self",
"::",
"DHL_ERROR_WEAK_WARNING",
")",
";",
"// Fix the DHL-Error Weak-Warning-Bug",
"if",
"(",
"$",
"this",
"->",
"countLabelData",
"(",
")",
"===",
"1",
")",
"{",
"// ALWAYS uses the Shipment-Response when only 1",
"$",
"this",
"->",
"setStatusCode",
"(",
"$",
"this",
"->",
"getLabelData",
"(",
"0",
")",
"->",
"getStatusCode",
"(",
")",
")",
";",
"$",
"this",
"->",
"setStatusText",
"(",
"$",
"this",
"->",
"getLabelData",
"(",
"0",
")",
"->",
"getStatusText",
"(",
")",
")",
";",
"$",
"this",
"->",
"setStatusMessage",
"(",
"$",
"this",
"->",
"getLabelData",
"(",
"0",
")",
"->",
"getStatusMessage",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"getStatusCode",
"(",
")",
"===",
"self",
"::",
"DHL_ERROR_WEAK_WARNING",
")",
"{",
"$",
"noError",
"=",
"true",
";",
"// Search in all shipments if an error/warning exists",
"foreach",
"(",
"$",
"this",
"->",
"getLabelData",
"(",
")",
"as",
"&",
"$",
"labelData",
")",
"{",
"/**\n\t\t\t\t * @var LabelData $labelData\n\t\t\t\t */",
"if",
"(",
"$",
"labelData",
"->",
"getStatusCode",
"(",
")",
"!==",
"self",
"::",
"DHL_ERROR_NO_ERROR",
")",
"{",
"$",
"noError",
"=",
"false",
";",
"break",
";",
"}",
"}",
"if",
"(",
"$",
"noError",
")",
"{",
"$",
"this",
"->",
"setStatusCode",
"(",
"self",
"::",
"DHL_ERROR_NO_ERROR",
")",
";",
"$",
"this",
"->",
"setStatusText",
"(",
"'ok'",
")",
";",
"$",
"this",
"->",
"setStatusMessage",
"(",
"'Der Webservice wurde ohne Fehler ausgeführt.')",
";",
"",
"}",
"}",
"}"
] | Check if the current Status-Code is correct and set the correct one if not | [
"Check",
"if",
"the",
"current",
"Status",
"-",
"Code",
"is",
"correct",
"and",
"set",
"the",
"correct",
"one",
"if",
"not"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Response.php#L319-L349 |
Petschko/dhl-php-sdk | includes/Response.php | Response.handleMultiShipments | private function handleMultiShipments($possibleMultiLabelObject) {
if(is_array($possibleMultiLabelObject)) {
$multiLabelArray = $possibleMultiLabelObject;
foreach($multiLabelArray as &$singleLabel)
$this->addLabelData(new LabelData($this->getVersion(), $singleLabel));
} else
$this->addLabelData(new LabelData($this->getVersion(), $possibleMultiLabelObject));
} | php | private function handleMultiShipments($possibleMultiLabelObject) {
if(is_array($possibleMultiLabelObject)) {
$multiLabelArray = $possibleMultiLabelObject;
foreach($multiLabelArray as &$singleLabel)
$this->addLabelData(new LabelData($this->getVersion(), $singleLabel));
} else
$this->addLabelData(new LabelData($this->getVersion(), $possibleMultiLabelObject));
} | [
"private",
"function",
"handleMultiShipments",
"(",
"$",
"possibleMultiLabelObject",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"possibleMultiLabelObject",
")",
")",
"{",
"$",
"multiLabelArray",
"=",
"$",
"possibleMultiLabelObject",
";",
"foreach",
"(",
"$",
"multiLabelArray",
"as",
"&",
"$",
"singleLabel",
")",
"$",
"this",
"->",
"addLabelData",
"(",
"new",
"LabelData",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"singleLabel",
")",
")",
";",
"}",
"else",
"$",
"this",
"->",
"addLabelData",
"(",
"new",
"LabelData",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"possibleMultiLabelObject",
")",
")",
";",
"}"
] | Handles all Multi-Shipment Object/Arrays and add them to Label-Data
@param Object|array $possibleMultiLabelObject - Object or array, which should be added to LabelData | [
"Handles",
"all",
"Multi",
"-",
"Shipment",
"Object",
"/",
"Arrays",
"and",
"add",
"them",
"to",
"Label",
"-",
"Data"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Response.php#L368-L376 |
Petschko/dhl-php-sdk | includes/Response.php | Response.loadResponse_v2 | private function loadResponse_v2($response) {
// Set global Status-Values first
if(isset($response->Status)) {
if(isset($response->Status->statusCode))
$this->setStatusCode((int) $response->Status->statusCode);
if(isset($response->Status->statusText)) {
if(is_array($response->Status->statusText))
$this->setStatusText(implode(';', $response->Status->statusText));
else
$this->setStatusText($response->Status->statusText);
}
if(isset($response->Status->statusMessage)) {
if(is_array($response->Status->statusMessage))
$this->setStatusMessage(implode(';', $response->Status->statusMessage));
else
$this->setStatusMessage($response->Status->statusMessage);
}
}
// Set Manifest if exists (getManifest)
if(isset($response->manifestData)) {
$this->setManifestData($response->manifestData);
return;
}
/*
* Handle Shipment(s) | Calls on:
* 1 -> createShipmentOrder
* 2 -> deleteShipmentOrder
* 3 -> updateShipmentOrder [Only Single]
* 3 -> getLabel
* 4 -> validateShipment
* 5 -> getExportDoc
* 6 -> doManifest
*/
if(isset($response->CreationState)) // 1
$this->handleMultiShipments($response->CreationState);
else if(isset($response->DeletionState)) // 2
$this->handleMultiShipments($response->DeletionState);
else if(isset($response->LabelData)) // 3
$this->handleMultiShipments($response->LabelData);
else if(isset($response->ValidationState)) // 4
$this->handleMultiShipments($response->ValidationState);
else if(isset($response->ExportDocData)) // 5
$this->handleMultiShipments($response->ExportDocData);
else if(isset($response->ManifestState)) // 6
$this->handleMultiShipments($response->ManifestState);
// Validate the status to fix errors on the Main-Status and show weak-warnings
if($this->getStatusCode() !== self::DHL_ERROR_NOT_SET)
$this->validateStatusCode();
} | php | private function loadResponse_v2($response) {
// Set global Status-Values first
if(isset($response->Status)) {
if(isset($response->Status->statusCode))
$this->setStatusCode((int) $response->Status->statusCode);
if(isset($response->Status->statusText)) {
if(is_array($response->Status->statusText))
$this->setStatusText(implode(';', $response->Status->statusText));
else
$this->setStatusText($response->Status->statusText);
}
if(isset($response->Status->statusMessage)) {
if(is_array($response->Status->statusMessage))
$this->setStatusMessage(implode(';', $response->Status->statusMessage));
else
$this->setStatusMessage($response->Status->statusMessage);
}
}
// Set Manifest if exists (getManifest)
if(isset($response->manifestData)) {
$this->setManifestData($response->manifestData);
return;
}
/*
* Handle Shipment(s) | Calls on:
* 1 -> createShipmentOrder
* 2 -> deleteShipmentOrder
* 3 -> updateShipmentOrder [Only Single]
* 3 -> getLabel
* 4 -> validateShipment
* 5 -> getExportDoc
* 6 -> doManifest
*/
if(isset($response->CreationState)) // 1
$this->handleMultiShipments($response->CreationState);
else if(isset($response->DeletionState)) // 2
$this->handleMultiShipments($response->DeletionState);
else if(isset($response->LabelData)) // 3
$this->handleMultiShipments($response->LabelData);
else if(isset($response->ValidationState)) // 4
$this->handleMultiShipments($response->ValidationState);
else if(isset($response->ExportDocData)) // 5
$this->handleMultiShipments($response->ExportDocData);
else if(isset($response->ManifestState)) // 6
$this->handleMultiShipments($response->ManifestState);
// Validate the status to fix errors on the Main-Status and show weak-warnings
if($this->getStatusCode() !== self::DHL_ERROR_NOT_SET)
$this->validateStatusCode();
} | [
"private",
"function",
"loadResponse_v2",
"(",
"$",
"response",
")",
"{",
"// Set global Status-Values first",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"Status",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"Status",
"->",
"statusCode",
")",
")",
"$",
"this",
"->",
"setStatusCode",
"(",
"(",
"int",
")",
"$",
"response",
"->",
"Status",
"->",
"statusCode",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"Status",
"->",
"statusText",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"response",
"->",
"Status",
"->",
"statusText",
")",
")",
"$",
"this",
"->",
"setStatusText",
"(",
"implode",
"(",
"';'",
",",
"$",
"response",
"->",
"Status",
"->",
"statusText",
")",
")",
";",
"else",
"$",
"this",
"->",
"setStatusText",
"(",
"$",
"response",
"->",
"Status",
"->",
"statusText",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"Status",
"->",
"statusMessage",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"response",
"->",
"Status",
"->",
"statusMessage",
")",
")",
"$",
"this",
"->",
"setStatusMessage",
"(",
"implode",
"(",
"';'",
",",
"$",
"response",
"->",
"Status",
"->",
"statusMessage",
")",
")",
";",
"else",
"$",
"this",
"->",
"setStatusMessage",
"(",
"$",
"response",
"->",
"Status",
"->",
"statusMessage",
")",
";",
"}",
"}",
"// Set Manifest if exists (getManifest)",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"manifestData",
")",
")",
"{",
"$",
"this",
"->",
"setManifestData",
"(",
"$",
"response",
"->",
"manifestData",
")",
";",
"return",
";",
"}",
"/*\n\t\t * Handle Shipment(s) | Calls on:\n\t\t * 1 -> createShipmentOrder\n\t\t * 2 -> deleteShipmentOrder\n\t\t * 3 -> updateShipmentOrder [Only Single]\n\t\t * 3 -> getLabel\n\t\t * 4 -> validateShipment\n\t\t * 5 -> getExportDoc\n\t\t * 6 -> doManifest\n\t\t */",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"CreationState",
")",
")",
"// 1",
"$",
"this",
"->",
"handleMultiShipments",
"(",
"$",
"response",
"->",
"CreationState",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"DeletionState",
")",
")",
"// 2",
"$",
"this",
"->",
"handleMultiShipments",
"(",
"$",
"response",
"->",
"DeletionState",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"LabelData",
")",
")",
"// 3",
"$",
"this",
"->",
"handleMultiShipments",
"(",
"$",
"response",
"->",
"LabelData",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"ValidationState",
")",
")",
"// 4",
"$",
"this",
"->",
"handleMultiShipments",
"(",
"$",
"response",
"->",
"ValidationState",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"ExportDocData",
")",
")",
"// 5",
"$",
"this",
"->",
"handleMultiShipments",
"(",
"$",
"response",
"->",
"ExportDocData",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"ManifestState",
")",
")",
"// 6",
"$",
"this",
"->",
"handleMultiShipments",
"(",
"$",
"response",
"->",
"ManifestState",
")",
";",
"// Validate the status to fix errors on the Main-Status and show weak-warnings",
"if",
"(",
"$",
"this",
"->",
"getStatusCode",
"(",
")",
"!==",
"self",
"::",
"DHL_ERROR_NOT_SET",
")",
"$",
"this",
"->",
"validateStatusCode",
"(",
")",
";",
"}"
] | Loads a DHL-Response into this Object
@param Object $response - DHL-Response | [
"Loads",
"a",
"DHL",
"-",
"Response",
"into",
"this",
"Object"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Response.php#L383-L435 |
Petschko/dhl-php-sdk | includes/Version.php | Version.setVersion | protected function setVersion($version) {
$this->version = $version;
$numbers = explode('.', $version);
// Update Mayor and Minor-Version-Numbers
$this->setMayor((int) $numbers[0]);
$this->setMinor((int) $numbers[1]);
} | php | protected function setVersion($version) {
$this->version = $version;
$numbers = explode('.', $version);
// Update Mayor and Minor-Version-Numbers
$this->setMayor((int) $numbers[0]);
$this->setMinor((int) $numbers[1]);
} | [
"protected",
"function",
"setVersion",
"(",
"$",
"version",
")",
"{",
"$",
"this",
"->",
"version",
"=",
"$",
"version",
";",
"$",
"numbers",
"=",
"explode",
"(",
"'.'",
",",
"$",
"version",
")",
";",
"// Update Mayor and Minor-Version-Numbers",
"$",
"this",
"->",
"setMayor",
"(",
"(",
"int",
")",
"$",
"numbers",
"[",
"0",
"]",
")",
";",
"$",
"this",
"->",
"setMinor",
"(",
"(",
"int",
")",
"$",
"numbers",
"[",
"1",
"]",
")",
";",
"}"
] | Set/Change the Version and also Update Mayor and Minor-Fields
@param string $version - Version | [
"Set",
"/",
"Change",
"the",
"Version",
"and",
"also",
"Update",
"Mayor",
"and",
"Minor",
"-",
"Fields"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Version.php#L75-L83 |
Petschko/dhl-php-sdk | includes/ReturnReceiver.php | ReturnReceiver.getClass_v2 | public function getClass_v2() {
$class = new StdClass;
// Name
$class->Name = new StdClass;
$class->Name->name1 = $this->getName();
if($this->getName2() !== null)
$class->Name->name2 = $this->getName2();
if($this->getName3() !== null)
$class->Name->name3 = $this->getName3();
// Address
$class->Address = new StdClass;
$class->Address->streetName = $this->getStreetName();
$class->Address->streetNumber = $this->getStreetNumber();
if($this->getAddressAddition() !== null)
$class->Address->addressAddition = $this->getAddressAddition();
if($this->getDispatchingInfo() !== null)
$class->Address->dispatchingInformation = $this->getDispatchingInfo();
$class->Address->zip = $this->getZip();
$class->Address->city = $this->getLocation();
// Origin
if($this->getCountryISOCode() !== null) {
$class->Address->Origin = new StdClass;
if($this->getCountry() !== null)
$class->Address->Origin->country = $this->getCountry();
$class->Address->Origin->countryISOCode = $this->getCountryISOCode();
if($this->getState() !== null)
$class->Address->Origin->state = $this->getState();
}
// Communication
$class->Communication = new StdClass;
if($this->getPhone() !== null)
$class->Communication->phone = $this->getPhone();
if($this->getEmail() !== null)
$class->Communication->email = $this->getEmail();
if($this->getContactPerson() !== null)
$class->Communication->contactPerson = $this->getContactPerson();
return $class;
} | php | public function getClass_v2() {
$class = new StdClass;
// Name
$class->Name = new StdClass;
$class->Name->name1 = $this->getName();
if($this->getName2() !== null)
$class->Name->name2 = $this->getName2();
if($this->getName3() !== null)
$class->Name->name3 = $this->getName3();
// Address
$class->Address = new StdClass;
$class->Address->streetName = $this->getStreetName();
$class->Address->streetNumber = $this->getStreetNumber();
if($this->getAddressAddition() !== null)
$class->Address->addressAddition = $this->getAddressAddition();
if($this->getDispatchingInfo() !== null)
$class->Address->dispatchingInformation = $this->getDispatchingInfo();
$class->Address->zip = $this->getZip();
$class->Address->city = $this->getLocation();
// Origin
if($this->getCountryISOCode() !== null) {
$class->Address->Origin = new StdClass;
if($this->getCountry() !== null)
$class->Address->Origin->country = $this->getCountry();
$class->Address->Origin->countryISOCode = $this->getCountryISOCode();
if($this->getState() !== null)
$class->Address->Origin->state = $this->getState();
}
// Communication
$class->Communication = new StdClass;
if($this->getPhone() !== null)
$class->Communication->phone = $this->getPhone();
if($this->getEmail() !== null)
$class->Communication->email = $this->getEmail();
if($this->getContactPerson() !== null)
$class->Communication->contactPerson = $this->getContactPerson();
return $class;
} | [
"public",
"function",
"getClass_v2",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"StdClass",
";",
"// Name",
"$",
"class",
"->",
"Name",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"Name",
"->",
"name1",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getName2",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Name",
"->",
"name2",
"=",
"$",
"this",
"->",
"getName2",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getName3",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Name",
"->",
"name3",
"=",
"$",
"this",
"->",
"getName3",
"(",
")",
";",
"// Address",
"$",
"class",
"->",
"Address",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"Address",
"->",
"streetName",
"=",
"$",
"this",
"->",
"getStreetName",
"(",
")",
";",
"$",
"class",
"->",
"Address",
"->",
"streetNumber",
"=",
"$",
"this",
"->",
"getStreetNumber",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getAddressAddition",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Address",
"->",
"addressAddition",
"=",
"$",
"this",
"->",
"getAddressAddition",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getDispatchingInfo",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Address",
"->",
"dispatchingInformation",
"=",
"$",
"this",
"->",
"getDispatchingInfo",
"(",
")",
";",
"$",
"class",
"->",
"Address",
"->",
"zip",
"=",
"$",
"this",
"->",
"getZip",
"(",
")",
";",
"$",
"class",
"->",
"Address",
"->",
"city",
"=",
"$",
"this",
"->",
"getLocation",
"(",
")",
";",
"// Origin",
"if",
"(",
"$",
"this",
"->",
"getCountryISOCode",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"Address",
"->",
"Origin",
"=",
"new",
"StdClass",
";",
"if",
"(",
"$",
"this",
"->",
"getCountry",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Address",
"->",
"Origin",
"->",
"country",
"=",
"$",
"this",
"->",
"getCountry",
"(",
")",
";",
"$",
"class",
"->",
"Address",
"->",
"Origin",
"->",
"countryISOCode",
"=",
"$",
"this",
"->",
"getCountryISOCode",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getState",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Address",
"->",
"Origin",
"->",
"state",
"=",
"$",
"this",
"->",
"getState",
"(",
")",
";",
"}",
"// Communication",
"$",
"class",
"->",
"Communication",
"=",
"new",
"StdClass",
";",
"if",
"(",
"$",
"this",
"->",
"getPhone",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Communication",
"->",
"phone",
"=",
"$",
"this",
"->",
"getPhone",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getEmail",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Communication",
"->",
"email",
"=",
"$",
"this",
"->",
"getEmail",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getContactPerson",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Communication",
"->",
"contactPerson",
"=",
"$",
"this",
"->",
"getContactPerson",
"(",
")",
";",
"return",
"$",
"class",
";",
"}"
] | Returns a Class for the DHL-SendPerson
@return StdClass - DHL-SendPerson-class | [
"Returns",
"a",
"Class",
"for",
"the",
"DHL",
"-",
"SendPerson"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ReturnReceiver.php#L29-L71 |
Petschko/dhl-php-sdk | includes/ExportDocPosition.php | ExportDocPosition.getExportDocPositionClass_v2 | public function getExportDocPositionClass_v2() {
$class = new StdClass;
$class->description = $this->getDescription();
$class->countryCodeOrigin = $this->getCountryCodeOrigin();
$class->customsTariffNumber = $this->getCustomsTariffNumber();
$class->amount = $this->getAmount();
$class->netWeightInKG = $this->getNetWeightInKG();
$class->customsValue = $this->getCustomsValue();
return $class;
} | php | public function getExportDocPositionClass_v2() {
$class = new StdClass;
$class->description = $this->getDescription();
$class->countryCodeOrigin = $this->getCountryCodeOrigin();
$class->customsTariffNumber = $this->getCustomsTariffNumber();
$class->amount = $this->getAmount();
$class->netWeightInKG = $this->getNetWeightInKG();
$class->customsValue = $this->getCustomsValue();
return $class;
} | [
"public",
"function",
"getExportDocPositionClass_v2",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"description",
"=",
"$",
"this",
"->",
"getDescription",
"(",
")",
";",
"$",
"class",
"->",
"countryCodeOrigin",
"=",
"$",
"this",
"->",
"getCountryCodeOrigin",
"(",
")",
";",
"$",
"class",
"->",
"customsTariffNumber",
"=",
"$",
"this",
"->",
"getCustomsTariffNumber",
"(",
")",
";",
"$",
"class",
"->",
"amount",
"=",
"$",
"this",
"->",
"getAmount",
"(",
")",
";",
"$",
"class",
"->",
"netWeightInKG",
"=",
"$",
"this",
"->",
"getNetWeightInKG",
"(",
")",
";",
"$",
"class",
"->",
"customsValue",
"=",
"$",
"this",
"->",
"getCustomsValue",
"(",
")",
";",
"return",
"$",
"class",
";",
"}"
] | Returns a Class for ExportDocPosition
@return StdClass - DHL-ExportDocPosition-Class | [
"Returns",
"a",
"Class",
"for",
"ExportDocPosition"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ExportDocPosition.php#L245-L256 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.getAPIUrl | protected function getAPIUrl() {
// Use own API-URL if set
if($this->getCustomAPIURL() !== null)
return $this->getCustomAPIURL();
return self::DHL_WSDL_LIB_URL . $this->getVersion() . '/geschaeftskundenversand-api-' . $this->getVersion() . '.wsdl';
} | php | protected function getAPIUrl() {
// Use own API-URL if set
if($this->getCustomAPIURL() !== null)
return $this->getCustomAPIURL();
return self::DHL_WSDL_LIB_URL . $this->getVersion() . '/geschaeftskundenversand-api-' . $this->getVersion() . '.wsdl';
} | [
"protected",
"function",
"getAPIUrl",
"(",
")",
"{",
"// Use own API-URL if set",
"if",
"(",
"$",
"this",
"->",
"getCustomAPIURL",
"(",
")",
"!==",
"null",
")",
"return",
"$",
"this",
"->",
"getCustomAPIURL",
"(",
")",
";",
"return",
"self",
"::",
"DHL_WSDL_LIB_URL",
".",
"$",
"this",
"->",
"getVersion",
"(",
")",
".",
"'/geschaeftskundenversand-api-'",
".",
"$",
"this",
"->",
"getVersion",
"(",
")",
".",
"'.wsdl'",
";",
"}"
] | Get the Business-API-URL for this Version
@return string - Business-API-URL | [
"Get",
"the",
"Business",
"-",
"API",
"-",
"URL",
"for",
"this",
"Version"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L300-L306 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.setShipmentOrders | public function setShipmentOrders($shipmentOrders) {
if(! is_array($shipmentOrders)) {
trigger_error(
'[DHL-PHP-SDK]: The type of $shipmentOrders is NOT an array, but is required to set as array! Called method ' .
__METHOD__ . ' in class ' . __CLASS__,
E_USER_ERROR
);
$this->addError(__METHOD__ . ': Non-Array value given');
return;
}
$this->shipmentOrders = $shipmentOrders;
} | php | public function setShipmentOrders($shipmentOrders) {
if(! is_array($shipmentOrders)) {
trigger_error(
'[DHL-PHP-SDK]: The type of $shipmentOrders is NOT an array, but is required to set as array! Called method ' .
__METHOD__ . ' in class ' . __CLASS__,
E_USER_ERROR
);
$this->addError(__METHOD__ . ': Non-Array value given');
return;
}
$this->shipmentOrders = $shipmentOrders;
} | [
"public",
"function",
"setShipmentOrders",
"(",
"$",
"shipmentOrders",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"shipmentOrders",
")",
")",
"{",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: The type of $shipmentOrders is NOT an array, but is required to set as array! Called method '",
".",
"__METHOD__",
".",
"' in class '",
".",
"__CLASS__",
",",
"E_USER_ERROR",
")",
";",
"$",
"this",
"->",
"addError",
"(",
"__METHOD__",
".",
"': Non-Array value given'",
")",
";",
"return",
";",
"}",
"$",
"this",
"->",
"shipmentOrders",
"=",
"$",
"shipmentOrders",
";",
"}"
] | Set the list with all Shipment-Orders Objects
@param ShipmentOrder[]|ShipmentOrder $shipmentOrders - Shipment-Order Object-Array or a Single Shipment-Order Object | [
"Set",
"the",
"list",
"with",
"all",
"Shipment",
"-",
"Orders",
"Objects"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L842-L855 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.checkRequestCount | private function checkRequestCount($array, $action, $maxReq = self::MAX_DHL_REQUESTS) {
$count = count($array);
if($count > self::MAX_DHL_REQUESTS)
$this->addError('There are only ' . $maxReq . ' Request/s for one call allowed for the action "'
. $action . '"! You tried to request ' . $count . ' ones');
} | php | private function checkRequestCount($array, $action, $maxReq = self::MAX_DHL_REQUESTS) {
$count = count($array);
if($count > self::MAX_DHL_REQUESTS)
$this->addError('There are only ' . $maxReq . ' Request/s for one call allowed for the action "'
. $action . '"! You tried to request ' . $count . ' ones');
} | [
"private",
"function",
"checkRequestCount",
"(",
"$",
"array",
",",
"$",
"action",
",",
"$",
"maxReq",
"=",
"self",
"::",
"MAX_DHL_REQUESTS",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"array",
")",
";",
"if",
"(",
"$",
"count",
">",
"self",
"::",
"MAX_DHL_REQUESTS",
")",
"$",
"this",
"->",
"addError",
"(",
"'There are only '",
".",
"$",
"maxReq",
".",
"' Request/s for one call allowed for the action \"'",
".",
"$",
"action",
".",
"'\"! You tried to request '",
".",
"$",
"count",
".",
"' ones'",
")",
";",
"}"
] | Check if the request-Array is to long
@param array $array - Array to check
@param string $action - Action of the request
@param int $maxReq - Maximum-Requests - Default: self::MAX_DHL_REQUESTS | [
"Check",
"if",
"the",
"request",
"-",
"Array",
"is",
"to",
"long"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L907-L913 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.buildAuthHeader | private function buildAuthHeader() {
$auth_params = array(
'user' => $this->getCredentials()->getUser(),
'signature' => $this->getCredentials()->getSignature(),
'type' => 0
);
return new SoapHeader(self::DHL_SOAP_HEADER_URI, 'Authentification', $auth_params);
} | php | private function buildAuthHeader() {
$auth_params = array(
'user' => $this->getCredentials()->getUser(),
'signature' => $this->getCredentials()->getSignature(),
'type' => 0
);
return new SoapHeader(self::DHL_SOAP_HEADER_URI, 'Authentification', $auth_params);
} | [
"private",
"function",
"buildAuthHeader",
"(",
")",
"{",
"$",
"auth_params",
"=",
"array",
"(",
"'user'",
"=>",
"$",
"this",
"->",
"getCredentials",
"(",
")",
"->",
"getUser",
"(",
")",
",",
"'signature'",
"=>",
"$",
"this",
"->",
"getCredentials",
"(",
")",
"->",
"getSignature",
"(",
")",
",",
"'type'",
"=>",
"0",
")",
";",
"return",
"new",
"SoapHeader",
"(",
"self",
"::",
"DHL_SOAP_HEADER_URI",
",",
"'Authentification'",
",",
"$",
"auth_params",
")",
";",
"}"
] | Build SOAP-Auth-Header
@return SoapHeader - Soap-Auth-Header | [
"Build",
"SOAP",
"-",
"Auth",
"-",
"Header"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L920-L928 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.buildSoapClient | private function buildSoapClient() {
$header = $this->buildAuthHeader();
if($this->isTest())
$location = self::DHL_SANDBOX_URL;
else
$location = self::DHL_PRODUCTION_URL;
$auth_params = array(
'login' => $this->getCredentials()->getApiUser(),
'password' => $this->getCredentials()->getApiPassword(),
'location' => $location,
'trace' => 1
);
$this->setSoapClient(new SoapClient($this->getAPIUrl(), $auth_params));
$this->getSoapClient()->__setSoapHeaders($header);
} | php | private function buildSoapClient() {
$header = $this->buildAuthHeader();
if($this->isTest())
$location = self::DHL_SANDBOX_URL;
else
$location = self::DHL_PRODUCTION_URL;
$auth_params = array(
'login' => $this->getCredentials()->getApiUser(),
'password' => $this->getCredentials()->getApiPassword(),
'location' => $location,
'trace' => 1
);
$this->setSoapClient(new SoapClient($this->getAPIUrl(), $auth_params));
$this->getSoapClient()->__setSoapHeaders($header);
} | [
"private",
"function",
"buildSoapClient",
"(",
")",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"buildAuthHeader",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isTest",
"(",
")",
")",
"$",
"location",
"=",
"self",
"::",
"DHL_SANDBOX_URL",
";",
"else",
"$",
"location",
"=",
"self",
"::",
"DHL_PRODUCTION_URL",
";",
"$",
"auth_params",
"=",
"array",
"(",
"'login'",
"=>",
"$",
"this",
"->",
"getCredentials",
"(",
")",
"->",
"getApiUser",
"(",
")",
",",
"'password'",
"=>",
"$",
"this",
"->",
"getCredentials",
"(",
")",
"->",
"getApiPassword",
"(",
")",
",",
"'location'",
"=>",
"$",
"location",
",",
"'trace'",
"=>",
"1",
")",
";",
"$",
"this",
"->",
"setSoapClient",
"(",
"new",
"SoapClient",
"(",
"$",
"this",
"->",
"getAPIUrl",
"(",
")",
",",
"$",
"auth_params",
")",
")",
";",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"__setSoapHeaders",
"(",
"$",
"header",
")",
";",
"}"
] | Builds the Soap-Client | [
"Builds",
"the",
"Soap",
"-",
"Client"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L933-L950 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.getVersion | public function getVersion($viaSOAP = false, $getBuildNumber = false, $returnAsArray = false) {
if(! $viaSOAP) {
if($returnAsArray)
return array(
'mayor' => parent::getMayor(),
'minor' => parent::getMinor()
);
else
return parent::getVersion();
}
switch($this->getMayor()) {
case 1:
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$this->addError('Version 1 SOAP-Method "' . __METHOD__ . '" is not implemented or removed!');
return false;
case 2:
default:
$data = $this->getVersionClass();
}
try {
$response = $this->sendGetVersionRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else {
if($returnAsArray)
return array(
'mayor' => $response->Version->majorRelease,
'minor' => $response->Version->minorRelease,
'build' => $response->Version->build
);
else
return $response->Version->majorRelease . '.' . $response->Version->minorRelease .
(($getBuildNumber) ? '.' . $response->Version->build : '');
}
} | php | public function getVersion($viaSOAP = false, $getBuildNumber = false, $returnAsArray = false) {
if(! $viaSOAP) {
if($returnAsArray)
return array(
'mayor' => parent::getMayor(),
'minor' => parent::getMinor()
);
else
return parent::getVersion();
}
switch($this->getMayor()) {
case 1:
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$this->addError('Version 1 SOAP-Method "' . __METHOD__ . '" is not implemented or removed!');
return false;
case 2:
default:
$data = $this->getVersionClass();
}
try {
$response = $this->sendGetVersionRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else {
if($returnAsArray)
return array(
'mayor' => $response->Version->majorRelease,
'minor' => $response->Version->minorRelease,
'build' => $response->Version->build
);
else
return $response->Version->majorRelease . '.' . $response->Version->minorRelease .
(($getBuildNumber) ? '.' . $response->Version->build : '');
}
} | [
"public",
"function",
"getVersion",
"(",
"$",
"viaSOAP",
"=",
"false",
",",
"$",
"getBuildNumber",
"=",
"false",
",",
"$",
"returnAsArray",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"viaSOAP",
")",
"{",
"if",
"(",
"$",
"returnAsArray",
")",
"return",
"array",
"(",
"'mayor'",
"=>",
"parent",
"::",
"getMayor",
"(",
")",
",",
"'minor'",
"=>",
"parent",
"::",
"getMinor",
"(",
")",
")",
";",
"else",
"return",
"parent",
"::",
"getVersion",
"(",
")",
";",
"}",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Called Version 1 Method: '",
".",
"__METHOD__",
".",
"' is incomplete (does nothing)!'",
",",
"E_USER_WARNING",
")",
";",
"$",
"this",
"->",
"addError",
"(",
"'Version 1 SOAP-Method \"'",
".",
"__METHOD__",
".",
"'\" is not implemented or removed!'",
")",
";",
"return",
"false",
";",
"case",
"2",
":",
"default",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"getVersionClass",
"(",
")",
";",
"}",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendGetVersionRequest",
"(",
"$",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"is_soap_fault",
"(",
"$",
"response",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"response",
"->",
"faultstring",
")",
";",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"returnAsArray",
")",
"return",
"array",
"(",
"'mayor'",
"=>",
"$",
"response",
"->",
"Version",
"->",
"majorRelease",
",",
"'minor'",
"=>",
"$",
"response",
"->",
"Version",
"->",
"minorRelease",
",",
"'build'",
"=>",
"$",
"response",
"->",
"Version",
"->",
"build",
")",
";",
"else",
"return",
"$",
"response",
"->",
"Version",
"->",
"majorRelease",
".",
"'.'",
".",
"$",
"response",
"->",
"Version",
"->",
"minorRelease",
".",
"(",
"(",
"$",
"getBuildNumber",
")",
"?",
"'.'",
".",
"$",
"response",
"->",
"Version",
"->",
"build",
":",
"''",
")",
";",
"}",
"}"
] | Gets the current (local)-Version or Request it via SOAP from DHL
@param bool $viaSOAP - Request the Version from DHL (Default: false - get local-version as string)
@param bool $getBuildNumber - Return the Build number as well (String look then like this: 2.2.12) Only possible via SOAP - Default false
@param bool $returnAsArray - Return the Version as Array - Default: false
@return bool|array|string - Returns the Version as String|array or false on error | [
"Gets",
"the",
"current",
"(",
"local",
")",
"-",
"Version",
"or",
"Request",
"it",
"via",
"SOAP",
"from",
"DHL"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L960-L1005 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.sendDoManifestRequest | private function sendDoManifestRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->DoManifestTD($data);
case 2:
default:
return $this->getSoapClient()->doManifest($data);
}
} | php | private function sendDoManifestRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->DoManifestTD($data);
case 2:
default:
return $this->getSoapClient()->doManifest($data);
}
} | [
"private",
"function",
"sendDoManifestRequest",
"(",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"DoManifestTD",
"(",
"$",
"data",
")",
";",
"case",
"2",
":",
"default",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"doManifest",
"(",
"$",
"data",
")",
";",
"}",
"}"
] | Creates the doManifest-Request via SOAP
@param Object|array $data - Manifest-Data
@return Object - DHL-Response | [
"Creates",
"the",
"doManifest",
"-",
"Request",
"via",
"SOAP"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1023-L1031 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.doManifest | public function doManifest($shipmentNumbers) {
switch($this->getMayor()) {
case 1:
$data = $this->createDoManifestClass_v1($shipmentNumbers);
break;
case 2:
default:
$data = $this->createDoManifestClass_v2($shipmentNumbers);
}
try {
$response = $this->sendDoManifestRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | php | public function doManifest($shipmentNumbers) {
switch($this->getMayor()) {
case 1:
$data = $this->createDoManifestClass_v1($shipmentNumbers);
break;
case 2:
default:
$data = $this->createDoManifestClass_v2($shipmentNumbers);
}
try {
$response = $this->sendDoManifestRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | [
"public",
"function",
"doManifest",
"(",
"$",
"shipmentNumbers",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"createDoManifestClass_v1",
"(",
"$",
"shipmentNumbers",
")",
";",
"break",
";",
"case",
"2",
":",
"default",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"createDoManifestClass_v2",
"(",
"$",
"shipmentNumbers",
")",
";",
"}",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendDoManifestRequest",
"(",
"$",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"is_soap_fault",
"(",
"$",
"response",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"response",
"->",
"faultstring",
")",
";",
"return",
"false",
";",
"}",
"else",
"return",
"new",
"Response",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"response",
")",
";",
"}"
] | Creates the doManifest-Request
@param string|string[] $shipmentNumbers - Shipment-Number(s) for Manifest (up to 30 Numbers)
@return bool|Response - false on error or DHL-Response Object | [
"Creates",
"the",
"doManifest",
"-",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1039-L1063 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.createDoManifestClass_v1 | private function createDoManifestClass_v1($shipmentNumbers) {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | php | private function createDoManifestClass_v1($shipmentNumbers) {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | [
"private",
"function",
"createDoManifestClass_v1",
"(",
"$",
"shipmentNumbers",
")",
"{",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method '",
".",
"__METHOD__",
".",
"')!'",
",",
"E_USER_DEPRECATED",
")",
";",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Called Version 1 Method: '",
".",
"__METHOD__",
".",
"' is incomplete (does nothing)!'",
",",
"E_USER_WARNING",
")",
";",
"$",
"data",
"=",
"new",
"StdClass",
";",
"return",
"$",
"data",
";",
"}"
] | Creates the Data-Object for Manifest
@param string|string[] $shipmentNumbers - Shipment-Number(s) for the Manifest (up to 30 Numbers)
@return StdClass - Data-Object
@deprecated - DHL-API-Version 1 Method | [
"Creates",
"the",
"Data",
"-",
"Object",
"for",
"Manifest"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1073-L1080 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.getManifest | public function getManifest($manifestDate, $useIntTime = false) {
if($useIntTime) {
// Convert to Date-Format for DHL
$oldDate = $manifestDate;
$manifestDate = date('Y-m-d', $manifestDate);
if($manifestDate === false) {
$this->addError('Could not convert given time() value "' . $oldDate . '" to YYYY-MM-DD... Called method: ' . __METHOD__);
return false;
}
unset($oldDate);
}
switch($this->getMayor()) {
case 1:
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$this->addError('Version 1 Method "' . __METHOD__ . '" is not implemented or removed!');
return false;
case 2:
default:
$data = $this->createGetManifestClass_v2($manifestDate);
}
try {
$response = $this->sendGetManifestRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | php | public function getManifest($manifestDate, $useIntTime = false) {
if($useIntTime) {
// Convert to Date-Format for DHL
$oldDate = $manifestDate;
$manifestDate = date('Y-m-d', $manifestDate);
if($manifestDate === false) {
$this->addError('Could not convert given time() value "' . $oldDate . '" to YYYY-MM-DD... Called method: ' . __METHOD__);
return false;
}
unset($oldDate);
}
switch($this->getMayor()) {
case 1:
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$this->addError('Version 1 Method "' . __METHOD__ . '" is not implemented or removed!');
return false;
case 2:
default:
$data = $this->createGetManifestClass_v2($manifestDate);
}
try {
$response = $this->sendGetManifestRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | [
"public",
"function",
"getManifest",
"(",
"$",
"manifestDate",
",",
"$",
"useIntTime",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"useIntTime",
")",
"{",
"// Convert to Date-Format for DHL",
"$",
"oldDate",
"=",
"$",
"manifestDate",
";",
"$",
"manifestDate",
"=",
"date",
"(",
"'Y-m-d'",
",",
"$",
"manifestDate",
")",
";",
"if",
"(",
"$",
"manifestDate",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"'Could not convert given time() value \"'",
".",
"$",
"oldDate",
".",
"'\" to YYYY-MM-DD... Called method: '",
".",
"__METHOD__",
")",
";",
"return",
"false",
";",
"}",
"unset",
"(",
"$",
"oldDate",
")",
";",
"}",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Called Version 1 Method: '",
".",
"__METHOD__",
".",
"' is incomplete (does nothing)!'",
",",
"E_USER_WARNING",
")",
";",
"$",
"this",
"->",
"addError",
"(",
"'Version 1 Method \"'",
".",
"__METHOD__",
".",
"'\" is not implemented or removed!'",
")",
";",
"return",
"false",
";",
"case",
"2",
":",
"default",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"createGetManifestClass_v2",
"(",
"$",
"manifestDate",
")",
";",
"}",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendGetManifestRequest",
"(",
"$",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"is_soap_fault",
"(",
"$",
"response",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"response",
"->",
"faultstring",
")",
";",
"return",
"false",
";",
"}",
"else",
"return",
"new",
"Response",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"response",
")",
";",
"}"
] | Creates the getManifest-Request
@param string|int $manifestDate - Manifest-Date as String (YYYY-MM-DD) or the int time() value of the date
@param bool $useIntTime - Use the int Time Value instead of a String
@return bool|Response - false on error or DHL-Response Object | [
"Creates",
"the",
"getManifest",
"-",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1111-L1151 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.createGetManifestClass_v2 | private function createGetManifestClass_v2($manifestDate) {
$data = new StdClass;
if(is_array($manifestDate))
$this->addError('You can only request 1 date on getManifest - multiple requests in 1 call are not allowed here');
$data->Version = $this->getVersionClass();
$data->manifestDate = $manifestDate;
return $data;
} | php | private function createGetManifestClass_v2($manifestDate) {
$data = new StdClass;
if(is_array($manifestDate))
$this->addError('You can only request 1 date on getManifest - multiple requests in 1 call are not allowed here');
$data->Version = $this->getVersionClass();
$data->manifestDate = $manifestDate;
return $data;
} | [
"private",
"function",
"createGetManifestClass_v2",
"(",
"$",
"manifestDate",
")",
"{",
"$",
"data",
"=",
"new",
"StdClass",
";",
"if",
"(",
"is_array",
"(",
"$",
"manifestDate",
")",
")",
"$",
"this",
"->",
"addError",
"(",
"'You can only request 1 date on getManifest - multiple requests in 1 call are not allowed here'",
")",
";",
"$",
"data",
"->",
"Version",
"=",
"$",
"this",
"->",
"getVersionClass",
"(",
")",
";",
"$",
"data",
"->",
"manifestDate",
"=",
"$",
"manifestDate",
";",
"return",
"$",
"data",
";",
"}"
] | Creates the Data-Object for getManifest
@param string $manifestDate - Manifest Date (String-Format: YYYY-MM-DD)
@return StdClass - Data-Object | [
"Creates",
"the",
"Data",
"-",
"Object",
"for",
"getManifest"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1159-L1169 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.sendCreateRequest | private function sendCreateRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->CreateShipmentDD($data);
case 2:
default:
return $this->getSoapClient()->createShipmentOrder($data);
}
} | php | private function sendCreateRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->CreateShipmentDD($data);
case 2:
default:
return $this->getSoapClient()->createShipmentOrder($data);
}
} | [
"private",
"function",
"sendCreateRequest",
"(",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"CreateShipmentDD",
"(",
"$",
"data",
")",
";",
"case",
"2",
":",
"default",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"createShipmentOrder",
"(",
"$",
"data",
")",
";",
"}",
"}"
] | Creates the Shipment-Order Request via SOAP
@param Object|array $data - Shipment-Data
@return Object - DHL-Response | [
"Creates",
"the",
"Shipment",
"-",
"Order",
"Request",
"via",
"SOAP"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1187-L1195 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.createShipmentOrder | public function createShipmentOrder() {
switch($this->getMayor()) {
case 1:
$data = $this->createShipmentClass_v1();
break;
case 2:
default:
if($this->countShipmentOrders() < 1)
$data = $this->createShipmentClass_v2_legacy();
else
$data = $this->createShipmentClass_v2();
}
$response = null;
// Create Shipment
try {
$response = $this->sendCreateRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | php | public function createShipmentOrder() {
switch($this->getMayor()) {
case 1:
$data = $this->createShipmentClass_v1();
break;
case 2:
default:
if($this->countShipmentOrders() < 1)
$data = $this->createShipmentClass_v2_legacy();
else
$data = $this->createShipmentClass_v2();
}
$response = null;
// Create Shipment
try {
$response = $this->sendCreateRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | [
"public",
"function",
"createShipmentOrder",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"createShipmentClass_v1",
"(",
")",
";",
"break",
";",
"case",
"2",
":",
"default",
":",
"if",
"(",
"$",
"this",
"->",
"countShipmentOrders",
"(",
")",
"<",
"1",
")",
"$",
"data",
"=",
"$",
"this",
"->",
"createShipmentClass_v2_legacy",
"(",
")",
";",
"else",
"$",
"data",
"=",
"$",
"this",
"->",
"createShipmentClass_v2",
"(",
")",
";",
"}",
"$",
"response",
"=",
"null",
";",
"// Create Shipment",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendCreateRequest",
"(",
"$",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"is_soap_fault",
"(",
"$",
"response",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"response",
"->",
"faultstring",
")",
";",
"return",
"false",
";",
"}",
"else",
"return",
"new",
"Response",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"response",
")",
";",
"}"
] | Creates the Shipment-Request
@return bool|Response - false on error or DHL-Response Object | [
"Creates",
"the",
"Shipment",
"-",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1213-L1243 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.createShipmentClass_v1 | private function createShipmentClass_v1() {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | php | private function createShipmentClass_v1() {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | [
"private",
"function",
"createShipmentClass_v1",
"(",
")",
"{",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method '",
".",
"__METHOD__",
".",
"')!'",
",",
"E_USER_DEPRECATED",
")",
";",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Called Version 1 Method: '",
".",
"__METHOD__",
".",
"' is incomplete (does nothing)!'",
",",
"E_USER_WARNING",
")",
";",
"$",
"data",
"=",
"new",
"StdClass",
";",
"return",
"$",
"data",
";",
"}"
] | Creates the Data-Object for the Request
@return StdClass - Data-Object
@deprecated - DHL-API-Version 1 Method | [
"Creates",
"the",
"Data",
"-",
"Object",
"for",
"the",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1252-L1259 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.createShipmentClass_v2 | private function createShipmentClass_v2($shipmentNumber = null) {
$shipmentOrders = $this->getShipmentOrders();
$this->checkRequestCount($shipmentOrders, 'createShipmentClass');
$data = new StdClass;
$data->Version = $this->getVersionClass();
if($shipmentNumber !== null)
$data->shipmentNumber = (string) $shipmentNumber;
foreach($shipmentOrders as $key => &$shipmentOrder) {
/**
* @var ShipmentOrder $shipmentOrder
*/
// Set global response-type if none is defined in shipment
if($shipmentOrder->getLabelResponseType() === null && $this->getLabelResponseType() !== null)
$shipmentOrder->setLabelResponseType($this->getLabelResponseType());
$data->ShipmentOrder[$key] = $shipmentOrder->getShipmentOrderClass_v2();
}
return $data;
} | php | private function createShipmentClass_v2($shipmentNumber = null) {
$shipmentOrders = $this->getShipmentOrders();
$this->checkRequestCount($shipmentOrders, 'createShipmentClass');
$data = new StdClass;
$data->Version = $this->getVersionClass();
if($shipmentNumber !== null)
$data->shipmentNumber = (string) $shipmentNumber;
foreach($shipmentOrders as $key => &$shipmentOrder) {
/**
* @var ShipmentOrder $shipmentOrder
*/
// Set global response-type if none is defined in shipment
if($shipmentOrder->getLabelResponseType() === null && $this->getLabelResponseType() !== null)
$shipmentOrder->setLabelResponseType($this->getLabelResponseType());
$data->ShipmentOrder[$key] = $shipmentOrder->getShipmentOrderClass_v2();
}
return $data;
} | [
"private",
"function",
"createShipmentClass_v2",
"(",
"$",
"shipmentNumber",
"=",
"null",
")",
"{",
"$",
"shipmentOrders",
"=",
"$",
"this",
"->",
"getShipmentOrders",
"(",
")",
";",
"$",
"this",
"->",
"checkRequestCount",
"(",
"$",
"shipmentOrders",
",",
"'createShipmentClass'",
")",
";",
"$",
"data",
"=",
"new",
"StdClass",
";",
"$",
"data",
"->",
"Version",
"=",
"$",
"this",
"->",
"getVersionClass",
"(",
")",
";",
"if",
"(",
"$",
"shipmentNumber",
"!==",
"null",
")",
"$",
"data",
"->",
"shipmentNumber",
"=",
"(",
"string",
")",
"$",
"shipmentNumber",
";",
"foreach",
"(",
"$",
"shipmentOrders",
"as",
"$",
"key",
"=>",
"&",
"$",
"shipmentOrder",
")",
"{",
"/**\n\t\t\t * @var ShipmentOrder $shipmentOrder\n\t\t\t */",
"// Set global response-type if none is defined in shipment",
"if",
"(",
"$",
"shipmentOrder",
"->",
"getLabelResponseType",
"(",
")",
"===",
"null",
"&&",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
"!==",
"null",
")",
"$",
"shipmentOrder",
"->",
"setLabelResponseType",
"(",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
")",
";",
"$",
"data",
"->",
"ShipmentOrder",
"[",
"$",
"key",
"]",
"=",
"$",
"shipmentOrder",
"->",
"getShipmentOrderClass_v2",
"(",
")",
";",
"}",
"return",
"$",
"data",
";",
"}"
] | Creates the Data-Object for the Request
@param null|string $shipmentNumber - Shipment Number which should be included or null for none
@return StdClass - Data-Object | [
"Creates",
"the",
"Data",
"-",
"Object",
"for",
"the",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1267-L1290 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.createShipmentClass_v2_legacy | private function createShipmentClass_v2_legacy($shipmentNumber = null) {
trigger_error(
'[DHL-PHP-SDK]: ' . __CLASS__ . '->' . __METHOD__ .
' This method was called for Backward-Compatibility, please create `ShipmentOrder` Objects' .
' and assign them with `addShipmentOrder($shipmentOrder)` on this instance.',
E_USER_DEPRECATED
);
// Set old values
$this->getShipmentDetails()->setService($this->getService());
$this->getShipmentDetails()->setBank($this->getBank());
// Create class
$data = new StdClass;
$data->Version = $this->getVersionClass();
if($shipmentNumber !== null)
$data->shipmentNumber = (string) $shipmentNumber;
$data->ShipmentOrder = new StdClass;
$data->ShipmentOrder->sequenceNumber = $this->getSequenceNumber();
// Shipment
$data->ShipmentOrder->Shipment = new StdClass;
$data->ShipmentOrder->Shipment->ShipmentDetails = $this->getShipmentDetails()->getShipmentDetailsClass_v2();
// Notification
$email = null; // Check for backward compatibility
if($this->getShipmentDetails()->getNotificationEmail() === null && $this->receiverEmail !== null)
$email = $this->getReceiverEmail(); // Use old E-Mail implementation for BC
if($email !== null) {
$data->ShipmentOrder->Shipment->ShipmentDetails->Notification = new StdClass;
$data->ShipmentOrder->Shipment->ShipmentDetails->Notification->recipientEmailAddress = $email;
}
// Shipper
$data->ShipmentOrder->Shipment->Shipper = $this->getSender()->getClass_v2();
// Receiver
$data->ShipmentOrder->Shipment->Receiver = $this->getReceiver()->getClass_v2();
// Return-Receiver
if($this->getReturnReceiver() !== null)
$data->ShipmentOrder->Shipment->ReturnReceiver = $this->getReturnReceiver()->getClass_v2();
// Export-Document
if($this->getExportDocument() !== null) {
try {
$data->ShipmentOrder->Shipment->ExportDocument = $this->getExportDocument()->getExportDocumentClass_v2();
} catch(Exception $e) {
$this->addError($e->getMessage());
}
}
// Other Settings
if($this->getPrintOnlyIfReceiverIsValid() !== null) {
$data->ShipmentOrder->PrintOnlyIfCodeable = new StdClass;
$data->ShipmentOrder->PrintOnlyIfCodeable->active = (int) $this->getPrintOnlyIfReceiverIsValid();
}
if($this->getLabelResponseType() !== null)
$data->ShipmentOrder->labelResponseType = $this->getLabelResponseType();
return $data;
} | php | private function createShipmentClass_v2_legacy($shipmentNumber = null) {
trigger_error(
'[DHL-PHP-SDK]: ' . __CLASS__ . '->' . __METHOD__ .
' This method was called for Backward-Compatibility, please create `ShipmentOrder` Objects' .
' and assign them with `addShipmentOrder($shipmentOrder)` on this instance.',
E_USER_DEPRECATED
);
// Set old values
$this->getShipmentDetails()->setService($this->getService());
$this->getShipmentDetails()->setBank($this->getBank());
// Create class
$data = new StdClass;
$data->Version = $this->getVersionClass();
if($shipmentNumber !== null)
$data->shipmentNumber = (string) $shipmentNumber;
$data->ShipmentOrder = new StdClass;
$data->ShipmentOrder->sequenceNumber = $this->getSequenceNumber();
// Shipment
$data->ShipmentOrder->Shipment = new StdClass;
$data->ShipmentOrder->Shipment->ShipmentDetails = $this->getShipmentDetails()->getShipmentDetailsClass_v2();
// Notification
$email = null; // Check for backward compatibility
if($this->getShipmentDetails()->getNotificationEmail() === null && $this->receiverEmail !== null)
$email = $this->getReceiverEmail(); // Use old E-Mail implementation for BC
if($email !== null) {
$data->ShipmentOrder->Shipment->ShipmentDetails->Notification = new StdClass;
$data->ShipmentOrder->Shipment->ShipmentDetails->Notification->recipientEmailAddress = $email;
}
// Shipper
$data->ShipmentOrder->Shipment->Shipper = $this->getSender()->getClass_v2();
// Receiver
$data->ShipmentOrder->Shipment->Receiver = $this->getReceiver()->getClass_v2();
// Return-Receiver
if($this->getReturnReceiver() !== null)
$data->ShipmentOrder->Shipment->ReturnReceiver = $this->getReturnReceiver()->getClass_v2();
// Export-Document
if($this->getExportDocument() !== null) {
try {
$data->ShipmentOrder->Shipment->ExportDocument = $this->getExportDocument()->getExportDocumentClass_v2();
} catch(Exception $e) {
$this->addError($e->getMessage());
}
}
// Other Settings
if($this->getPrintOnlyIfReceiverIsValid() !== null) {
$data->ShipmentOrder->PrintOnlyIfCodeable = new StdClass;
$data->ShipmentOrder->PrintOnlyIfCodeable->active = (int) $this->getPrintOnlyIfReceiverIsValid();
}
if($this->getLabelResponseType() !== null)
$data->ShipmentOrder->labelResponseType = $this->getLabelResponseType();
return $data;
} | [
"private",
"function",
"createShipmentClass_v2_legacy",
"(",
"$",
"shipmentNumber",
"=",
"null",
")",
"{",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: '",
".",
"__CLASS__",
".",
"'->'",
".",
"__METHOD__",
".",
"' This method was called for Backward-Compatibility, please create `ShipmentOrder` Objects'",
".",
"' and assign them with `addShipmentOrder($shipmentOrder)` on this instance.'",
",",
"E_USER_DEPRECATED",
")",
";",
"// Set old values",
"$",
"this",
"->",
"getShipmentDetails",
"(",
")",
"->",
"setService",
"(",
"$",
"this",
"->",
"getService",
"(",
")",
")",
";",
"$",
"this",
"->",
"getShipmentDetails",
"(",
")",
"->",
"setBank",
"(",
"$",
"this",
"->",
"getBank",
"(",
")",
")",
";",
"// Create class",
"$",
"data",
"=",
"new",
"StdClass",
";",
"$",
"data",
"->",
"Version",
"=",
"$",
"this",
"->",
"getVersionClass",
"(",
")",
";",
"if",
"(",
"$",
"shipmentNumber",
"!==",
"null",
")",
"$",
"data",
"->",
"shipmentNumber",
"=",
"(",
"string",
")",
"$",
"shipmentNumber",
";",
"$",
"data",
"->",
"ShipmentOrder",
"=",
"new",
"StdClass",
";",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"sequenceNumber",
"=",
"$",
"this",
"->",
"getSequenceNumber",
"(",
")",
";",
"// Shipment",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"Shipment",
"=",
"new",
"StdClass",
";",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"Shipment",
"->",
"ShipmentDetails",
"=",
"$",
"this",
"->",
"getShipmentDetails",
"(",
")",
"->",
"getShipmentDetailsClass_v2",
"(",
")",
";",
"// Notification",
"$",
"email",
"=",
"null",
";",
"// Check for backward compatibility",
"if",
"(",
"$",
"this",
"->",
"getShipmentDetails",
"(",
")",
"->",
"getNotificationEmail",
"(",
")",
"===",
"null",
"&&",
"$",
"this",
"->",
"receiverEmail",
"!==",
"null",
")",
"$",
"email",
"=",
"$",
"this",
"->",
"getReceiverEmail",
"(",
")",
";",
"// Use old E-Mail implementation for BC",
"if",
"(",
"$",
"email",
"!==",
"null",
")",
"{",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"Shipment",
"->",
"ShipmentDetails",
"->",
"Notification",
"=",
"new",
"StdClass",
";",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"Shipment",
"->",
"ShipmentDetails",
"->",
"Notification",
"->",
"recipientEmailAddress",
"=",
"$",
"email",
";",
"}",
"// Shipper",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"Shipment",
"->",
"Shipper",
"=",
"$",
"this",
"->",
"getSender",
"(",
")",
"->",
"getClass_v2",
"(",
")",
";",
"// Receiver",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"Shipment",
"->",
"Receiver",
"=",
"$",
"this",
"->",
"getReceiver",
"(",
")",
"->",
"getClass_v2",
"(",
")",
";",
"// Return-Receiver",
"if",
"(",
"$",
"this",
"->",
"getReturnReceiver",
"(",
")",
"!==",
"null",
")",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"Shipment",
"->",
"ReturnReceiver",
"=",
"$",
"this",
"->",
"getReturnReceiver",
"(",
")",
"->",
"getClass_v2",
"(",
")",
";",
"// Export-Document",
"if",
"(",
"$",
"this",
"->",
"getExportDocument",
"(",
")",
"!==",
"null",
")",
"{",
"try",
"{",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"Shipment",
"->",
"ExportDocument",
"=",
"$",
"this",
"->",
"getExportDocument",
"(",
")",
"->",
"getExportDocumentClass_v2",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"// Other Settings",
"if",
"(",
"$",
"this",
"->",
"getPrintOnlyIfReceiverIsValid",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"PrintOnlyIfCodeable",
"=",
"new",
"StdClass",
";",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"PrintOnlyIfCodeable",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getPrintOnlyIfReceiverIsValid",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
"!==",
"null",
")",
"$",
"data",
"->",
"ShipmentOrder",
"->",
"labelResponseType",
"=",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
";",
"return",
"$",
"data",
";",
"}"
] | Creates the Data-Object for the Request
@param null|string $shipmentNumber - Shipment Number which should be included or null for none
@return StdClass - Data-Object
@deprecated - Old Shipment creation class (Supports only 1 Shipment) | [
"Creates",
"the",
"Data",
"-",
"Object",
"for",
"the",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1300-L1364 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.sendDeleteRequest | private function sendDeleteRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->DeleteShipmentDD($data);
case 2:
default:
return $this->getSoapClient()->deleteShipmentOrder($data);
}
} | php | private function sendDeleteRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->DeleteShipmentDD($data);
case 2:
default:
return $this->getSoapClient()->deleteShipmentOrder($data);
}
} | [
"private",
"function",
"sendDeleteRequest",
"(",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"DeleteShipmentDD",
"(",
"$",
"data",
")",
";",
"case",
"2",
":",
"default",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"deleteShipmentOrder",
"(",
"$",
"data",
")",
";",
"}",
"}"
] | Creates the Shipment-Order-Delete Request via SOAP
@param Object|array $data - Delete-Data
@return Object - DHL-Response | [
"Creates",
"the",
"Shipment",
"-",
"Order",
"-",
"Delete",
"Request",
"via",
"SOAP"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1372-L1380 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.deleteShipmentOrder | public function deleteShipmentOrder($shipmentNumbers) {
switch($this->getMayor()) {
case 1:
$data = $this->createDeleteClass_v1($shipmentNumbers);
break;
case 2:
default:
$data = $this->createDeleteClass_v2($shipmentNumbers);
}
try {
$response = $this->sendDeleteRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | php | public function deleteShipmentOrder($shipmentNumbers) {
switch($this->getMayor()) {
case 1:
$data = $this->createDeleteClass_v1($shipmentNumbers);
break;
case 2:
default:
$data = $this->createDeleteClass_v2($shipmentNumbers);
}
try {
$response = $this->sendDeleteRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | [
"public",
"function",
"deleteShipmentOrder",
"(",
"$",
"shipmentNumbers",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"createDeleteClass_v1",
"(",
"$",
"shipmentNumbers",
")",
";",
"break",
";",
"case",
"2",
":",
"default",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"createDeleteClass_v2",
"(",
"$",
"shipmentNumbers",
")",
";",
"}",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendDeleteRequest",
"(",
"$",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"is_soap_fault",
"(",
"$",
"response",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"response",
"->",
"faultstring",
")",
";",
"return",
"false",
";",
"}",
"else",
"return",
"new",
"Response",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"response",
")",
";",
"}"
] | Deletes a Shipment
@param string|string[] $shipmentNumbers - Shipment-Number(s) of the Shipment(s) to delete (up to 30 Numbers)
@return bool|Response - Response | [
"Deletes",
"a",
"Shipment"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1400-L1424 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.createDeleteClass_v1 | private function createDeleteClass_v1($shipmentNumbers) {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | php | private function createDeleteClass_v1($shipmentNumbers) {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | [
"private",
"function",
"createDeleteClass_v1",
"(",
"$",
"shipmentNumbers",
")",
"{",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method '",
".",
"__METHOD__",
".",
"')!'",
",",
"E_USER_DEPRECATED",
")",
";",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Called Version 1 Method: '",
".",
"__METHOD__",
".",
"' is incomplete (does nothing)!'",
",",
"E_USER_WARNING",
")",
";",
"$",
"data",
"=",
"new",
"StdClass",
";",
"return",
"$",
"data",
";",
"}"
] | Creates Data-Object for Deletion
@param string|string[] $shipmentNumbers - Shipment-Number(s) of the Shipment(s) to delete (up to 30 Numbers)
@return StdClass - Data-Object
@deprecated - DHL-API-Version 1 Method | [
"Creates",
"Data",
"-",
"Object",
"for",
"Deletion"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1434-L1441 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.createDeleteClass_v2 | private function createDeleteClass_v2($shipmentNumbers) {
$data = new StdClass;
$data->Version = $this->getVersionClass();
if(is_array($shipmentNumbers)) {
$this->checkRequestCount($shipmentNumbers, 'deleteShipmentOrder');
foreach($shipmentNumbers as $key => &$number)
$data->shipmentNumber[$key] = $number;
} else
$data->shipmentNumber = $shipmentNumbers;
return $data;
} | php | private function createDeleteClass_v2($shipmentNumbers) {
$data = new StdClass;
$data->Version = $this->getVersionClass();
if(is_array($shipmentNumbers)) {
$this->checkRequestCount($shipmentNumbers, 'deleteShipmentOrder');
foreach($shipmentNumbers as $key => &$number)
$data->shipmentNumber[$key] = $number;
} else
$data->shipmentNumber = $shipmentNumbers;
return $data;
} | [
"private",
"function",
"createDeleteClass_v2",
"(",
"$",
"shipmentNumbers",
")",
"{",
"$",
"data",
"=",
"new",
"StdClass",
";",
"$",
"data",
"->",
"Version",
"=",
"$",
"this",
"->",
"getVersionClass",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"shipmentNumbers",
")",
")",
"{",
"$",
"this",
"->",
"checkRequestCount",
"(",
"$",
"shipmentNumbers",
",",
"'deleteShipmentOrder'",
")",
";",
"foreach",
"(",
"$",
"shipmentNumbers",
"as",
"$",
"key",
"=>",
"&",
"$",
"number",
")",
"$",
"data",
"->",
"shipmentNumber",
"[",
"$",
"key",
"]",
"=",
"$",
"number",
";",
"}",
"else",
"$",
"data",
"->",
"shipmentNumber",
"=",
"$",
"shipmentNumbers",
";",
"return",
"$",
"data",
";",
"}"
] | Creates Data-Object for Deletion
@param string|string[] $shipmentNumbers - Shipment-Number(s) of the Shipment(s) to delete (up to 30 Numbers)
@return StdClass - Data-Object | [
"Creates",
"Data",
"-",
"Object",
"for",
"Deletion"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1449-L1463 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.sendGetLabelRequest | private function sendGetLabelRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->getLabelDD($data);
case 2:
default:
return $this->getSoapClient()->getLabel($data);
}
} | php | private function sendGetLabelRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->getLabelDD($data);
case 2:
default:
return $this->getSoapClient()->getLabel($data);
}
} | [
"private",
"function",
"sendGetLabelRequest",
"(",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"getLabelDD",
"(",
"$",
"data",
")",
";",
"case",
"2",
":",
"default",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"getLabel",
"(",
"$",
"data",
")",
";",
"}",
"}"
] | Requests a Label again via SOAP
@param Object $data - Label-Data
@return Object - DHL-Response | [
"Requests",
"a",
"Label",
"again",
"via",
"SOAP"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1471-L1479 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.getLabel | public function getLabel($shipmentNumbers) {
switch($this->getMayor()) {
case 1:
$data = $this->getLabelClass_v1($shipmentNumbers);
break;
case 2:
default:
$data = $this->getLabelClass_v2($shipmentNumbers);
}
try {
$response = $this->sendGetLabelRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | php | public function getLabel($shipmentNumbers) {
switch($this->getMayor()) {
case 1:
$data = $this->getLabelClass_v1($shipmentNumbers);
break;
case 2:
default:
$data = $this->getLabelClass_v2($shipmentNumbers);
}
try {
$response = $this->sendGetLabelRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | [
"public",
"function",
"getLabel",
"(",
"$",
"shipmentNumbers",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"getLabelClass_v1",
"(",
"$",
"shipmentNumbers",
")",
";",
"break",
";",
"case",
"2",
":",
"default",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"getLabelClass_v2",
"(",
"$",
"shipmentNumbers",
")",
";",
"}",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendGetLabelRequest",
"(",
"$",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"is_soap_fault",
"(",
"$",
"response",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"response",
"->",
"faultstring",
")",
";",
"return",
"false",
";",
"}",
"else",
"return",
"new",
"Response",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"response",
")",
";",
"}"
] | Requests a Shipment-Label again
@param string|string[] $shipmentNumbers - Shipment-Number(s) of the Label(s) (up to 30 Numbers)
@return bool|Response - Response or false on error | [
"Requests",
"a",
"Shipment",
"-",
"Label",
"again"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1499-L1523 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.getLabelClass_v1 | private function getLabelClass_v1($shipmentNumbers) {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | php | private function getLabelClass_v1($shipmentNumbers) {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | [
"private",
"function",
"getLabelClass_v1",
"(",
"$",
"shipmentNumbers",
")",
"{",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method '",
".",
"__METHOD__",
".",
"')!'",
",",
"E_USER_DEPRECATED",
")",
";",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Called Version 1 Method: '",
".",
"__METHOD__",
".",
"' is incomplete (does nothing)!'",
",",
"E_USER_WARNING",
")",
";",
"$",
"data",
"=",
"new",
"StdClass",
";",
"return",
"$",
"data",
";",
"}"
] | Creates Data-Object for Label-Request
@param string|string[] $shipmentNumbers - Number(s) of the Shipment(s) (up to 30 Numbers)
@return StdClass - Data-Object
@deprecated - DHL-API-Version 1 Method | [
"Creates",
"Data",
"-",
"Object",
"for",
"Label",
"-",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1533-L1540 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.getLabelClass_v2 | private function getLabelClass_v2($shipmentNumbers) {
$data = new StdClass;
$data->Version = $this->getVersionClass();
if(is_array($shipmentNumbers)) {
$this->checkRequestCount($shipmentNumbers, 'getLabel');
foreach($shipmentNumbers as $key => &$number)
$data->shipmentNumber[$key] = $number;
} else
$data->shipmentNumber = $shipmentNumbers;
if($this->getLabelResponseType() !== null)
$data->labelResponseType = $this->getLabelResponseType();
return $data;
} | php | private function getLabelClass_v2($shipmentNumbers) {
$data = new StdClass;
$data->Version = $this->getVersionClass();
if(is_array($shipmentNumbers)) {
$this->checkRequestCount($shipmentNumbers, 'getLabel');
foreach($shipmentNumbers as $key => &$number)
$data->shipmentNumber[$key] = $number;
} else
$data->shipmentNumber = $shipmentNumbers;
if($this->getLabelResponseType() !== null)
$data->labelResponseType = $this->getLabelResponseType();
return $data;
} | [
"private",
"function",
"getLabelClass_v2",
"(",
"$",
"shipmentNumbers",
")",
"{",
"$",
"data",
"=",
"new",
"StdClass",
";",
"$",
"data",
"->",
"Version",
"=",
"$",
"this",
"->",
"getVersionClass",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"shipmentNumbers",
")",
")",
"{",
"$",
"this",
"->",
"checkRequestCount",
"(",
"$",
"shipmentNumbers",
",",
"'getLabel'",
")",
";",
"foreach",
"(",
"$",
"shipmentNumbers",
"as",
"$",
"key",
"=>",
"&",
"$",
"number",
")",
"$",
"data",
"->",
"shipmentNumber",
"[",
"$",
"key",
"]",
"=",
"$",
"number",
";",
"}",
"else",
"$",
"data",
"->",
"shipmentNumber",
"=",
"$",
"shipmentNumbers",
";",
"if",
"(",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
"!==",
"null",
")",
"$",
"data",
"->",
"labelResponseType",
"=",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
";",
"return",
"$",
"data",
";",
"}"
] | Creates Data-Object for Label-Request
@param string|string[] $shipmentNumbers - Number(s) of the Shipment(s) (up to 30 Numbers)
@return StdClass - Data-Object | [
"Creates",
"Data",
"-",
"Object",
"for",
"Label",
"-",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1548-L1565 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.sendGetExportDocRequest | private function sendGetExportDocRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->getExportDocDD($data);
case 2:
default:
return $this->getSoapClient()->getExportDoc($data);
}
} | php | private function sendGetExportDocRequest($data) {
switch($this->getMayor()) {
case 1:
return $this->getSoapClient()->getExportDocDD($data);
case 2:
default:
return $this->getSoapClient()->getExportDoc($data);
}
} | [
"private",
"function",
"sendGetExportDocRequest",
"(",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"getExportDocDD",
"(",
"$",
"data",
")",
";",
"case",
"2",
":",
"default",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"getExportDoc",
"(",
"$",
"data",
")",
";",
"}",
"}"
] | Requests the Export-Document again via SOAP
@param Object $data - Export-Doc-Data
@return Object - DHL-Response | [
"Requests",
"the",
"Export",
"-",
"Document",
"again",
"via",
"SOAP"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1573-L1581 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.getExportDoc | public function getExportDoc($shipmentNumbers) {
switch($this->getMayor()) {
case 1:
$data = $this->getExportDocClass_v1($shipmentNumbers);
break;
case 2:
default:
$data = $this->getExportDocClass_v2($shipmentNumbers);
}
try {
$response = $this->sendGetExportDocRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | php | public function getExportDoc($shipmentNumbers) {
switch($this->getMayor()) {
case 1:
$data = $this->getExportDocClass_v1($shipmentNumbers);
break;
case 2:
default:
$data = $this->getExportDocClass_v2($shipmentNumbers);
}
try {
$response = $this->sendGetExportDocRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | [
"public",
"function",
"getExportDoc",
"(",
"$",
"shipmentNumbers",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"getExportDocClass_v1",
"(",
"$",
"shipmentNumbers",
")",
";",
"break",
";",
"case",
"2",
":",
"default",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"getExportDocClass_v2",
"(",
"$",
"shipmentNumbers",
")",
";",
"}",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendGetExportDocRequest",
"(",
"$",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"is_soap_fault",
"(",
"$",
"response",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"response",
"->",
"faultstring",
")",
";",
"return",
"false",
";",
"}",
"else",
"return",
"new",
"Response",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"response",
")",
";",
"}"
] | Requests a Export-Document again
@param string|string[] $shipmentNumbers - Shipment-Number(s) of the Export-Document(s) (up to 30 Numbers)
@return bool|Response - Response or false on error | [
"Requests",
"a",
"Export",
"-",
"Document",
"again"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1589-L1613 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.getExportDocClass_v1 | private function getExportDocClass_v1($shipmentNumbers) {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | php | private function getExportDocClass_v1($shipmentNumbers) {
trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
$data = new StdClass;
return $data;
} | [
"private",
"function",
"getExportDocClass_v1",
"(",
"$",
"shipmentNumbers",
")",
"{",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method '",
".",
"__METHOD__",
".",
"')!'",
",",
"E_USER_DEPRECATED",
")",
";",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Called Version 1 Method: '",
".",
"__METHOD__",
".",
"' is incomplete (does nothing)!'",
",",
"E_USER_WARNING",
")",
";",
"$",
"data",
"=",
"new",
"StdClass",
";",
"return",
"$",
"data",
";",
"}"
] | Creates Data-Object for Export-Document-Request
@param string|string[] $shipmentNumbers - Number(s) of the Shipment(s) (up to 30 Numbers)
@return StdClass - Data-Object
@deprecated - DHL-API-Version 1 Method | [
"Creates",
"Data",
"-",
"Object",
"for",
"Export",
"-",
"Document",
"-",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1623-L1630 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.getExportDocClass_v2 | private function getExportDocClass_v2($shipmentNumbers) {
$data = new StdClass;
$data->Version = $this->getVersionClass();
if(is_array($shipmentNumbers)) {
$this->checkRequestCount($shipmentNumbers, 'getExportDoc');
foreach($shipmentNumbers as $key => &$number)
$data->shipmentNumber[$key] = $number;
} else
$data->shipmentNumber = $shipmentNumbers;
if($this->getLabelResponseType() !== null)
$data->exportDocResponseType = $this->getLabelResponseType();
return $data;
} | php | private function getExportDocClass_v2($shipmentNumbers) {
$data = new StdClass;
$data->Version = $this->getVersionClass();
if(is_array($shipmentNumbers)) {
$this->checkRequestCount($shipmentNumbers, 'getExportDoc');
foreach($shipmentNumbers as $key => &$number)
$data->shipmentNumber[$key] = $number;
} else
$data->shipmentNumber = $shipmentNumbers;
if($this->getLabelResponseType() !== null)
$data->exportDocResponseType = $this->getLabelResponseType();
return $data;
} | [
"private",
"function",
"getExportDocClass_v2",
"(",
"$",
"shipmentNumbers",
")",
"{",
"$",
"data",
"=",
"new",
"StdClass",
";",
"$",
"data",
"->",
"Version",
"=",
"$",
"this",
"->",
"getVersionClass",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"shipmentNumbers",
")",
")",
"{",
"$",
"this",
"->",
"checkRequestCount",
"(",
"$",
"shipmentNumbers",
",",
"'getExportDoc'",
")",
";",
"foreach",
"(",
"$",
"shipmentNumbers",
"as",
"$",
"key",
"=>",
"&",
"$",
"number",
")",
"$",
"data",
"->",
"shipmentNumber",
"[",
"$",
"key",
"]",
"=",
"$",
"number",
";",
"}",
"else",
"$",
"data",
"->",
"shipmentNumber",
"=",
"$",
"shipmentNumbers",
";",
"if",
"(",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
"!==",
"null",
")",
"$",
"data",
"->",
"exportDocResponseType",
"=",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
";",
"return",
"$",
"data",
";",
"}"
] | Creates Data-Object for Export-Document-Request
@param string|string[] $shipmentNumbers - Number(s) of the Shipment(s) (up to 30 Numbers)
@return StdClass - Data-Object | [
"Creates",
"Data",
"-",
"Object",
"for",
"Export",
"-",
"Document",
"-",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1638-L1655 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.validateShipment | public function validateShipment() {
switch($this->getMayor()) {
case 1:
$data = null;
break;
case 2:
default:
$data = $this->createShipmentClass_v2();
}
try {
$response = $this->sendValidateShipmentRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | php | public function validateShipment() {
switch($this->getMayor()) {
case 1:
$data = null;
break;
case 2:
default:
$data = $this->createShipmentClass_v2();
}
try {
$response = $this->sendValidateShipmentRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | [
"public",
"function",
"validateShipment",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"$",
"data",
"=",
"null",
";",
"break",
";",
"case",
"2",
":",
"default",
":",
"$",
"data",
"=",
"$",
"this",
"->",
"createShipmentClass_v2",
"(",
")",
";",
"}",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendValidateShipmentRequest",
"(",
"$",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"is_soap_fault",
"(",
"$",
"response",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"response",
"->",
"faultstring",
")",
";",
"return",
"false",
";",
"}",
"else",
"return",
"new",
"Response",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"response",
")",
";",
"}"
] | Validates a Shipment
@return bool|Response - Response or false on error | [
"Validates",
"a",
"Shipment"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1662-L1686 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.sendValidateShipmentRequest | private function sendValidateShipmentRequest($data) {
switch($this->getMayor()) {
case 1:
throw new Exception(__FUNCTION__ . ': Method doesn\'t exists for Version 1!');
case 2:
default:
return $this->getSoapClient()->validateShipment($data);
}
} | php | private function sendValidateShipmentRequest($data) {
switch($this->getMayor()) {
case 1:
throw new Exception(__FUNCTION__ . ': Method doesn\'t exists for Version 1!');
case 2:
default:
return $this->getSoapClient()->validateShipment($data);
}
} | [
"private",
"function",
"sendValidateShipmentRequest",
"(",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"throw",
"new",
"Exception",
"(",
"__FUNCTION__",
".",
"': Method doesn\\'t exists for Version 1!'",
")",
";",
"case",
"2",
":",
"default",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"validateShipment",
"(",
"$",
"data",
")",
";",
"}",
"}"
] | Requests the Validation of a Shipment via SOAP
@param Object|array $data - Shipment-Data
@return Object - DHL-Response
@throws Exception - Method doesn't exists for Version | [
"Requests",
"the",
"Validation",
"of",
"a",
"Shipment",
"via",
"SOAP"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1695-L1703 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.updateShipmentOrder | public function updateShipmentOrder($shipmentNumber) {
if(is_array($shipmentNumber) || $this->countShipmentOrders() > 1) {
$this->addError(__FUNCTION__ . ': Updating Shipments is a Single-Operation only!');
return false;
}
switch($this->getMayor()) {
case 1:
$data = null;
break;
case 2:
default:
if($this->countShipmentOrders() < 1)
$data = $this->createShipmentClass_v2_legacy($shipmentNumber);
else
$data = $this->createShipmentClass_v2($shipmentNumber);
}
$response = null;
// Create Shipment
try {
$response = $this->sendUpdateRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | php | public function updateShipmentOrder($shipmentNumber) {
if(is_array($shipmentNumber) || $this->countShipmentOrders() > 1) {
$this->addError(__FUNCTION__ . ': Updating Shipments is a Single-Operation only!');
return false;
}
switch($this->getMayor()) {
case 1:
$data = null;
break;
case 2:
default:
if($this->countShipmentOrders() < 1)
$data = $this->createShipmentClass_v2_legacy($shipmentNumber);
else
$data = $this->createShipmentClass_v2($shipmentNumber);
}
$response = null;
// Create Shipment
try {
$response = $this->sendUpdateRequest($data);
} catch(Exception $e) {
$this->addError($e->getMessage());
return false;
}
if(is_soap_fault($response)) {
$this->addError($response->faultstring);
return false;
} else
return new Response($this->getVersion(), $response);
} | [
"public",
"function",
"updateShipmentOrder",
"(",
"$",
"shipmentNumber",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"shipmentNumber",
")",
"||",
"$",
"this",
"->",
"countShipmentOrders",
"(",
")",
">",
"1",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"__FUNCTION__",
".",
"': Updating Shipments is a Single-Operation only!'",
")",
";",
"return",
"false",
";",
"}",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"$",
"data",
"=",
"null",
";",
"break",
";",
"case",
"2",
":",
"default",
":",
"if",
"(",
"$",
"this",
"->",
"countShipmentOrders",
"(",
")",
"<",
"1",
")",
"$",
"data",
"=",
"$",
"this",
"->",
"createShipmentClass_v2_legacy",
"(",
"$",
"shipmentNumber",
")",
";",
"else",
"$",
"data",
"=",
"$",
"this",
"->",
"createShipmentClass_v2",
"(",
"$",
"shipmentNumber",
")",
";",
"}",
"$",
"response",
"=",
"null",
";",
"// Create Shipment",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"sendUpdateRequest",
"(",
"$",
"data",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"is_soap_fault",
"(",
"$",
"response",
")",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"response",
"->",
"faultstring",
")",
";",
"return",
"false",
";",
"}",
"else",
"return",
"new",
"Response",
"(",
"$",
"this",
"->",
"getVersion",
"(",
")",
",",
"$",
"response",
")",
";",
"}"
] | Updates the Shipment-Request
@param string $shipmentNumber - Number of the Shipment, which should be updated
@return bool|Response - false on error or DHL-Response Object | [
"Updates",
"the",
"Shipment",
"-",
"Request"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1711-L1747 |
Petschko/dhl-php-sdk | includes/BusinessShipment.php | BusinessShipment.sendUpdateRequest | private function sendUpdateRequest($data) {
switch($this->getMayor()) {
case 1:
throw new Exception(__FUNCTION__ . ': Method doesn\'t exists for Version 1!');
case 2:
default:
return $this->getSoapClient()->updateShipmentOrder($data);
}
} | php | private function sendUpdateRequest($data) {
switch($this->getMayor()) {
case 1:
throw new Exception(__FUNCTION__ . ': Method doesn\'t exists for Version 1!');
case 2:
default:
return $this->getSoapClient()->updateShipmentOrder($data);
}
} | [
"private",
"function",
"sendUpdateRequest",
"(",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getMayor",
"(",
")",
")",
"{",
"case",
"1",
":",
"throw",
"new",
"Exception",
"(",
"__FUNCTION__",
".",
"': Method doesn\\'t exists for Version 1!'",
")",
";",
"case",
"2",
":",
"default",
":",
"return",
"$",
"this",
"->",
"getSoapClient",
"(",
")",
"->",
"updateShipmentOrder",
"(",
"$",
"data",
")",
";",
"}",
"}"
] | Requests the Update of a Shipment via SOAP
@param Object|array $data - Shipment-Data
@return Object - DHL-Response
@throws Exception - Method doesn't exists for Version | [
"Requests",
"the",
"Update",
"of",
"a",
"Shipment",
"via",
"SOAP"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BusinessShipment.php#L1756-L1764 |
Petschko/dhl-php-sdk | includes/ProductInfo.php | ProductInfo.init | private static function init() {
self::setInit(true);
// Initiates Products
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_NATIONAL_PACKAGE);
$obj->setName('DHL Paket');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'preferredLocationEnabled',
'visualCheckOfAgeEnabled',
'personalHandover',
'namedPersonOnly',
'identCheckEnabled',
'preferredDayEnabled',
'preferredTimeEnabled',
'disableNeighbourDelivery',
'goGreen',
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled',
'individualSenderRequiredmentsEnabled',
'packagingReturn',
'noticeNonDeliverability'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_NATIONAL_PACKAGE_PRIO);
$obj->setName('DHL Paket PRIO');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'preferredLocationEnabled',
'visualCheckOfAgeEnabled',
'namedPersonOnly',
'identCheckEnabled',
'preferredDayEnabled',
'preferredTimeEnabled',
'disableNeighbourDelivery',
'goGreen',
'additionalInsuranceEnabled',
'cashOnDeliveryEnabled',
'individualSenderRequiredmentsEnabled',
'packagingReturn',
'noticeNonDeliverability'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_SAME_DAY_PACKAGE);
$obj->setName('DHL Paket Taggleich');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'preferredLocationEnabled',
'visualCheckOfAgeEnabled',
'namedPersonOnly',
'identCheckEnabled',
'preferredDayEnabled',
'preferredTimeEnabled',
'disableNeighbourDelivery',
'goGreen',
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled',
'individualSenderRequiredmentsEnabled',
'packagingReturn',
'noticeNonDeliverability',
'returnImmediatlyIfShipmentFailed'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_INTERNATIONAL_PACKAGE);
$obj->setName('DHL Paket International');
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(1);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'endorsementEnabled',
'returnReceipt',
'goGreen',
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled',
'premium'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_EUROPA_PACKAGE);
$obj->setName('DHL Europapaket');
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(3.5);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'goGreen',
'additionalInsuranceEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_PACKED_CONNECT);
$obj->setName('DHL Paket Connect');
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(3.5);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'goGreen',
'additionalInsuranceEnabled',
'bulkyGoods'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER);
$obj->setName('DHL Kurier Taggleich');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'visualCheckOfAgeEnabled',
'endorsementEnabled',
'goGreen',
'dayOfDeliveryEnabled',
'deliveryTimeframeEnabled',
'shipmentHandlingEnabled',
'perishables',
'individualSenderRequiredmentsEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER);
$obj->setName('DHL Kurier Wunschzeit');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'visualCheckOfAgeEnabled',
'endorsementEnabled',
'goGreen',
'dayOfDeliveryEnabled',
'deliveryTimeframeEnabled',
'shipmentHandlingEnabled',
'perishables',
'individualSenderRequiredmentsEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_AUSTRIA_PACKAGE);
$obj->setName('DHL Paket Austria');
$obj->setAustria(true);
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(1);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_CONNECT_PACKAGE);
$obj->setName('DHL Paket Connect');
$obj->setAustria(true);
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(3.5);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_AUSTRIA_INTERNATIONAL_PACKAGE);
$obj->setName('DHL Paket International');
$obj->setAustria(true);
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(1);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled'
));
self::addProduct($obj);
} | php | private static function init() {
self::setInit(true);
// Initiates Products
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_NATIONAL_PACKAGE);
$obj->setName('DHL Paket');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'preferredLocationEnabled',
'visualCheckOfAgeEnabled',
'personalHandover',
'namedPersonOnly',
'identCheckEnabled',
'preferredDayEnabled',
'preferredTimeEnabled',
'disableNeighbourDelivery',
'goGreen',
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled',
'individualSenderRequiredmentsEnabled',
'packagingReturn',
'noticeNonDeliverability'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_NATIONAL_PACKAGE_PRIO);
$obj->setName('DHL Paket PRIO');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'preferredLocationEnabled',
'visualCheckOfAgeEnabled',
'namedPersonOnly',
'identCheckEnabled',
'preferredDayEnabled',
'preferredTimeEnabled',
'disableNeighbourDelivery',
'goGreen',
'additionalInsuranceEnabled',
'cashOnDeliveryEnabled',
'individualSenderRequiredmentsEnabled',
'packagingReturn',
'noticeNonDeliverability'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_SAME_DAY_PACKAGE);
$obj->setName('DHL Paket Taggleich');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'preferredLocationEnabled',
'visualCheckOfAgeEnabled',
'namedPersonOnly',
'identCheckEnabled',
'preferredDayEnabled',
'preferredTimeEnabled',
'disableNeighbourDelivery',
'goGreen',
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled',
'individualSenderRequiredmentsEnabled',
'packagingReturn',
'noticeNonDeliverability',
'returnImmediatlyIfShipmentFailed'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_INTERNATIONAL_PACKAGE);
$obj->setName('DHL Paket International');
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(1);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'endorsementEnabled',
'returnReceipt',
'goGreen',
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled',
'premium'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_EUROPA_PACKAGE);
$obj->setName('DHL Europapaket');
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(3.5);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'goGreen',
'additionalInsuranceEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_PACKED_CONNECT);
$obj->setName('DHL Paket Connect');
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(3.5);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'goGreen',
'additionalInsuranceEnabled',
'bulkyGoods'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER);
$obj->setName('DHL Kurier Taggleich');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'visualCheckOfAgeEnabled',
'endorsementEnabled',
'goGreen',
'dayOfDeliveryEnabled',
'deliveryTimeframeEnabled',
'shipmentHandlingEnabled',
'perishables',
'individualSenderRequiredmentsEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER);
$obj->setName('DHL Kurier Wunschzeit');
$obj->setMinLength(15);
$obj->setMaxLength(200);
$obj->setMinWidth(11);
$obj->setMaxWidth(200);
$obj->setMinHeight(1);
$obj->setMaxHeight(200);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'preferredNeighbourEnabled',
'visualCheckOfAgeEnabled',
'endorsementEnabled',
'goGreen',
'dayOfDeliveryEnabled',
'deliveryTimeframeEnabled',
'shipmentHandlingEnabled',
'perishables',
'individualSenderRequiredmentsEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_AUSTRIA_PACKAGE);
$obj->setName('DHL Paket Austria');
$obj->setAustria(true);
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(1);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_CONNECT_PACKAGE);
$obj->setName('DHL Paket Connect');
$obj->setAustria(true);
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(3.5);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled'
));
self::addProduct($obj);
$obj = new Product(ShipmentDetails::PRODUCT_TYPE_AUSTRIA_INTERNATIONAL_PACKAGE);
$obj->setName('DHL Paket International');
$obj->setAustria(true);
$obj->setMinLength(15);
$obj->setMaxLength(120);
$obj->setMinWidth(11);
$obj->setMaxWidth(60);
$obj->setMinHeight(1);
$obj->setMaxHeight(60);
$obj->setMaxWeight(31.5);
$obj->setServices(array(
'additionalInsuranceEnabled',
'bulkyGoods',
'cashOnDeliveryEnabled'
));
self::addProduct($obj);
} | [
"private",
"static",
"function",
"init",
"(",
")",
"{",
"self",
"::",
"setInit",
"(",
"true",
")",
";",
"// Initiates Products",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_NATIONAL_PACKAGE",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Paket'",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"1",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'preferredNeighbourEnabled'",
",",
"'preferredLocationEnabled'",
",",
"'visualCheckOfAgeEnabled'",
",",
"'personalHandover'",
",",
"'namedPersonOnly'",
",",
"'identCheckEnabled'",
",",
"'preferredDayEnabled'",
",",
"'preferredTimeEnabled'",
",",
"'disableNeighbourDelivery'",
",",
"'goGreen'",
",",
"'additionalInsuranceEnabled'",
",",
"'bulkyGoods'",
",",
"'cashOnDeliveryEnabled'",
",",
"'individualSenderRequiredmentsEnabled'",
",",
"'packagingReturn'",
",",
"'noticeNonDeliverability'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_NATIONAL_PACKAGE_PRIO",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Paket PRIO'",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"1",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'preferredNeighbourEnabled'",
",",
"'preferredLocationEnabled'",
",",
"'visualCheckOfAgeEnabled'",
",",
"'namedPersonOnly'",
",",
"'identCheckEnabled'",
",",
"'preferredDayEnabled'",
",",
"'preferredTimeEnabled'",
",",
"'disableNeighbourDelivery'",
",",
"'goGreen'",
",",
"'additionalInsuranceEnabled'",
",",
"'cashOnDeliveryEnabled'",
",",
"'individualSenderRequiredmentsEnabled'",
",",
"'packagingReturn'",
",",
"'noticeNonDeliverability'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_SAME_DAY_PACKAGE",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Paket Taggleich'",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"1",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'preferredNeighbourEnabled'",
",",
"'preferredLocationEnabled'",
",",
"'visualCheckOfAgeEnabled'",
",",
"'namedPersonOnly'",
",",
"'identCheckEnabled'",
",",
"'preferredDayEnabled'",
",",
"'preferredTimeEnabled'",
",",
"'disableNeighbourDelivery'",
",",
"'goGreen'",
",",
"'additionalInsuranceEnabled'",
",",
"'bulkyGoods'",
",",
"'cashOnDeliveryEnabled'",
",",
"'individualSenderRequiredmentsEnabled'",
",",
"'packagingReturn'",
",",
"'noticeNonDeliverability'",
",",
"'returnImmediatlyIfShipmentFailed'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_INTERNATIONAL_PACKAGE",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Paket International'",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"120",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"1",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'endorsementEnabled'",
",",
"'returnReceipt'",
",",
"'goGreen'",
",",
"'additionalInsuranceEnabled'",
",",
"'bulkyGoods'",
",",
"'cashOnDeliveryEnabled'",
",",
"'premium'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_EUROPA_PACKAGE",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Europapaket'",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"120",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"3.5",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'goGreen'",
",",
"'additionalInsuranceEnabled'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_PACKED_CONNECT",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Paket Connect'",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"120",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"3.5",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'goGreen'",
",",
"'additionalInsuranceEnabled'",
",",
"'bulkyGoods'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_SAME_DAY_MESSENGER",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Kurier Taggleich'",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"1",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'preferredNeighbourEnabled'",
",",
"'visualCheckOfAgeEnabled'",
",",
"'endorsementEnabled'",
",",
"'goGreen'",
",",
"'dayOfDeliveryEnabled'",
",",
"'deliveryTimeframeEnabled'",
",",
"'shipmentHandlingEnabled'",
",",
"'perishables'",
",",
"'individualSenderRequiredmentsEnabled'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_WISH_TIME_MESSENGER",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Kurier Wunschzeit'",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"1",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"200",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'preferredNeighbourEnabled'",
",",
"'visualCheckOfAgeEnabled'",
",",
"'endorsementEnabled'",
",",
"'goGreen'",
",",
"'dayOfDeliveryEnabled'",
",",
"'deliveryTimeframeEnabled'",
",",
"'shipmentHandlingEnabled'",
",",
"'perishables'",
",",
"'individualSenderRequiredmentsEnabled'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_AUSTRIA_PACKAGE",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Paket Austria'",
")",
";",
"$",
"obj",
"->",
"setAustria",
"(",
"true",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"120",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"1",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'additionalInsuranceEnabled'",
",",
"'bulkyGoods'",
",",
"'cashOnDeliveryEnabled'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_CONNECT_PACKAGE",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Paket Connect'",
")",
";",
"$",
"obj",
"->",
"setAustria",
"(",
"true",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"120",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"3.5",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'additionalInsuranceEnabled'",
",",
"'bulkyGoods'",
",",
"'cashOnDeliveryEnabled'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"$",
"obj",
"=",
"new",
"Product",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_AUSTRIA_INTERNATIONAL_PACKAGE",
")",
";",
"$",
"obj",
"->",
"setName",
"(",
"'DHL Paket International'",
")",
";",
"$",
"obj",
"->",
"setAustria",
"(",
"true",
")",
";",
"$",
"obj",
"->",
"setMinLength",
"(",
"15",
")",
";",
"$",
"obj",
"->",
"setMaxLength",
"(",
"120",
")",
";",
"$",
"obj",
"->",
"setMinWidth",
"(",
"11",
")",
";",
"$",
"obj",
"->",
"setMaxWidth",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMinHeight",
"(",
"1",
")",
";",
"$",
"obj",
"->",
"setMaxHeight",
"(",
"60",
")",
";",
"$",
"obj",
"->",
"setMaxWeight",
"(",
"31.5",
")",
";",
"$",
"obj",
"->",
"setServices",
"(",
"array",
"(",
"'additionalInsuranceEnabled'",
",",
"'bulkyGoods'",
",",
"'cashOnDeliveryEnabled'",
")",
")",
";",
"self",
"::",
"addProduct",
"(",
"$",
"obj",
")",
";",
"}"
] | Initiates the Class | [
"Initiates",
"the",
"Class"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ProductInfo.php#L80-L314 |
Petschko/dhl-php-sdk | includes/ProductInfo.php | ProductInfo.getInfo | public static function getInfo($productType) {
if(! self::isInit())
self::init();
if(! array_key_exists($productType, self::$dhlProducts))
return null;
return self::$dhlProducts[$productType];
} | php | public static function getInfo($productType) {
if(! self::isInit())
self::init();
if(! array_key_exists($productType, self::$dhlProducts))
return null;
return self::$dhlProducts[$productType];
} | [
"public",
"static",
"function",
"getInfo",
"(",
"$",
"productType",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isInit",
"(",
")",
")",
"self",
"::",
"init",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"productType",
",",
"self",
"::",
"$",
"dhlProducts",
")",
")",
"return",
"null",
";",
"return",
"self",
"::",
"$",
"dhlProducts",
"[",
"$",
"productType",
"]",
";",
"}"
] | Get the Product-Object by Type
@param string $productType - ProductType
@return Product|null - DHL-Product Object or null if not exists in Info-Class | [
"Get",
"the",
"Product",
"-",
"Object",
"by",
"Type"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ProductInfo.php#L361-L369 |
Petschko/dhl-php-sdk | includes/ExportDocument.php | ExportDocument.addExportDocPosition | public function addExportDocPosition($exportDocPosition) {
if($this->getExportDocPosition() === null)
$this->setExportDocPosition($exportDocPosition);
else if(is_array($this->getExportDocPosition()))
$this->exportDocPosition[] = $exportDocPosition;
else {
// Convert the first existing entry to an array
$this->setExportDocPosition(array($this->getExportDocPosition(), $exportDocPosition));
}
} | php | public function addExportDocPosition($exportDocPosition) {
if($this->getExportDocPosition() === null)
$this->setExportDocPosition($exportDocPosition);
else if(is_array($this->getExportDocPosition()))
$this->exportDocPosition[] = $exportDocPosition;
else {
// Convert the first existing entry to an array
$this->setExportDocPosition(array($this->getExportDocPosition(), $exportDocPosition));
}
} | [
"public",
"function",
"addExportDocPosition",
"(",
"$",
"exportDocPosition",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getExportDocPosition",
"(",
")",
"===",
"null",
")",
"$",
"this",
"->",
"setExportDocPosition",
"(",
"$",
"exportDocPosition",
")",
";",
"else",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"getExportDocPosition",
"(",
")",
")",
")",
"$",
"this",
"->",
"exportDocPosition",
"[",
"]",
"=",
"$",
"exportDocPosition",
";",
"else",
"{",
"// Convert the first existing entry to an array",
"$",
"this",
"->",
"setExportDocPosition",
"(",
"array",
"(",
"$",
"this",
"->",
"getExportDocPosition",
"(",
")",
",",
"$",
"exportDocPosition",
")",
")",
";",
"}",
"}"
] | Adds an ExportDocPosition-Object to the current Object
If the ExportDocPosition was null before, then it will add the entry normal (backwards compatibility)
If the ExportDocPosition was an array before, it just add it to the array
If the ExportDocPosition was just 1 entry before, it will converted to an array with both entries
@param ExportDocPosition $exportDocPosition - Object to add | [
"Adds",
"an",
"ExportDocPosition",
"-",
"Object",
"to",
"the",
"current",
"Object"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ExportDocument.php#L366-L375 |
Petschko/dhl-php-sdk | includes/ExportDocument.php | ExportDocument.getExportDocumentClass_v2 | public function getExportDocumentClass_v2() {
$class = new StdClass;
// Standard-Export-Stuff
if($this->getInvoiceNumber() !== null)
$class->invoiceNumber = $this->getInvoiceNumber();
$class->exportType = $this->getExportType();
if($this->getExportTypeDescription() !== null)
$class->exportTypeDescription = $this->getExportTypeDescription();
else if($this->getExportType() === self::EXPORT_TYPE_OTHER)
throw new Exception('ExportTypeDescription must filled out if Export-Type is OTHER! - ' .
'Export-Class will not generated now');
if($this->getTermsOfTrade() !== null)
$class->termsOfTrade = $this->getTermsOfTrade();
$class->placeOfCommital = $this->getPlaceOfCommittal();
$class->additionalFee = $this->getAdditionalFee();
if($this->getPermitNumber() !== null)
$class->permitNumber = $this->getPermitNumber();
if($this->getAttestationNumber() !== null)
$class->attestationNumber = $this->getAttestationNumber();
// Add rest (Elements)
if($this->getWithElectronicExportNotification() !== null) {
$class->WithElectronicExportNtfctn = new StdClass;
$class->WithElectronicExportNtfctn->active = (int) $this->getWithElectronicExportNotification();
}
// Check if child-class is being used
if($this->getExportDocPosition() !== null) {
// Handle non-arrays... (Backward compatibility)
if(! is_array($this->getExportDocPosition()))
$class->ExportDocPosition = $this->getExportDocPosition()->getExportDocPositionClass_v2();
else {
$pos = $this->getExportDocPosition();
foreach($pos as $key => &$exportDoc)
$class->ExportDocPosition[$key] = $exportDoc->getExportDocPositionClass_v2();
}
}
return $class;
} | php | public function getExportDocumentClass_v2() {
$class = new StdClass;
// Standard-Export-Stuff
if($this->getInvoiceNumber() !== null)
$class->invoiceNumber = $this->getInvoiceNumber();
$class->exportType = $this->getExportType();
if($this->getExportTypeDescription() !== null)
$class->exportTypeDescription = $this->getExportTypeDescription();
else if($this->getExportType() === self::EXPORT_TYPE_OTHER)
throw new Exception('ExportTypeDescription must filled out if Export-Type is OTHER! - ' .
'Export-Class will not generated now');
if($this->getTermsOfTrade() !== null)
$class->termsOfTrade = $this->getTermsOfTrade();
$class->placeOfCommital = $this->getPlaceOfCommittal();
$class->additionalFee = $this->getAdditionalFee();
if($this->getPermitNumber() !== null)
$class->permitNumber = $this->getPermitNumber();
if($this->getAttestationNumber() !== null)
$class->attestationNumber = $this->getAttestationNumber();
// Add rest (Elements)
if($this->getWithElectronicExportNotification() !== null) {
$class->WithElectronicExportNtfctn = new StdClass;
$class->WithElectronicExportNtfctn->active = (int) $this->getWithElectronicExportNotification();
}
// Check if child-class is being used
if($this->getExportDocPosition() !== null) {
// Handle non-arrays... (Backward compatibility)
if(! is_array($this->getExportDocPosition()))
$class->ExportDocPosition = $this->getExportDocPosition()->getExportDocPositionClass_v2();
else {
$pos = $this->getExportDocPosition();
foreach($pos as $key => &$exportDoc)
$class->ExportDocPosition[$key] = $exportDoc->getExportDocPositionClass_v2();
}
}
return $class;
} | [
"public",
"function",
"getExportDocumentClass_v2",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"StdClass",
";",
"// Standard-Export-Stuff",
"if",
"(",
"$",
"this",
"->",
"getInvoiceNumber",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"invoiceNumber",
"=",
"$",
"this",
"->",
"getInvoiceNumber",
"(",
")",
";",
"$",
"class",
"->",
"exportType",
"=",
"$",
"this",
"->",
"getExportType",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getExportTypeDescription",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"exportTypeDescription",
"=",
"$",
"this",
"->",
"getExportTypeDescription",
"(",
")",
";",
"else",
"if",
"(",
"$",
"this",
"->",
"getExportType",
"(",
")",
"===",
"self",
"::",
"EXPORT_TYPE_OTHER",
")",
"throw",
"new",
"Exception",
"(",
"'ExportTypeDescription must filled out if Export-Type is OTHER! - '",
".",
"'Export-Class will not generated now'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getTermsOfTrade",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"termsOfTrade",
"=",
"$",
"this",
"->",
"getTermsOfTrade",
"(",
")",
";",
"$",
"class",
"->",
"placeOfCommital",
"=",
"$",
"this",
"->",
"getPlaceOfCommittal",
"(",
")",
";",
"$",
"class",
"->",
"additionalFee",
"=",
"$",
"this",
"->",
"getAdditionalFee",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getPermitNumber",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"permitNumber",
"=",
"$",
"this",
"->",
"getPermitNumber",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getAttestationNumber",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"attestationNumber",
"=",
"$",
"this",
"->",
"getAttestationNumber",
"(",
")",
";",
"// Add rest (Elements)",
"if",
"(",
"$",
"this",
"->",
"getWithElectronicExportNotification",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"WithElectronicExportNtfctn",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"WithElectronicExportNtfctn",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getWithElectronicExportNotification",
"(",
")",
";",
"}",
"// Check if child-class is being used",
"if",
"(",
"$",
"this",
"->",
"getExportDocPosition",
"(",
")",
"!==",
"null",
")",
"{",
"// Handle non-arrays... (Backward compatibility)",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"getExportDocPosition",
"(",
")",
")",
")",
"$",
"class",
"->",
"ExportDocPosition",
"=",
"$",
"this",
"->",
"getExportDocPosition",
"(",
")",
"->",
"getExportDocPositionClass_v2",
"(",
")",
";",
"else",
"{",
"$",
"pos",
"=",
"$",
"this",
"->",
"getExportDocPosition",
"(",
")",
";",
"foreach",
"(",
"$",
"pos",
"as",
"$",
"key",
"=>",
"&",
"$",
"exportDoc",
")",
"$",
"class",
"->",
"ExportDocPosition",
"[",
"$",
"key",
"]",
"=",
"$",
"exportDoc",
"->",
"getExportDocPositionClass_v2",
"(",
")",
";",
"}",
"}",
"return",
"$",
"class",
";",
"}"
] | Returns a Class for Export-Document
@return StdClass - DHL-ExportDocument-Class
@throws Exception - Invalid Data-Exception | [
"Returns",
"a",
"Class",
"for",
"Export",
"-",
"Document"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ExportDocument.php#L399-L445 |
Petschko/dhl-php-sdk | includes/ShipmentOrder.php | ShipmentOrder.getShipmentOrderClass_v2 | public function getShipmentOrderClass_v2() {
$class = new StdClass;
$class->sequenceNumber = $this->getSequenceNumber();
// Shipment
$class->Shipment = new StdClass;
$class->Shipment->ShipmentDetails = $this->getShipmentDetails()->getShipmentDetailsClass_v2();
// Shipper
$class->Shipment->Shipper = $this->getSender()->getClass_v2();
// Receiver
$class->Shipment->Receiver = $this->getReceiver()->getClass_v2();
// Return-Receiver
if($this->getReturnReceiver() !== null)
$class->Shipment->ReturnReceiver = $this->getReturnReceiver()->getClass_v2();
// Export-Document
if($this->getExportDocument() !== null) {
try {
$class->Shipment->ExportDocument = $this->getExportDocument()->getExportDocumentClass_v2();
} catch(Exception $e) {
trigger_error('[DHL-PHP-SDK]: Exception in method ' . __METHOD__ . ':' . $e->getMessage(), E_USER_WARNING);
}
}
// Other Settings
if($this->getPrintOnlyIfReceiverIsValid() !== null) {
$class->PrintOnlyIfCodeable = new StdClass;
$class->PrintOnlyIfCodeable->active = (int) $this->getPrintOnlyIfReceiverIsValid();
}
if($this->getLabelResponseType() !== null)
$class->labelResponseType = $this->getLabelResponseType();
return $class;
} | php | public function getShipmentOrderClass_v2() {
$class = new StdClass;
$class->sequenceNumber = $this->getSequenceNumber();
// Shipment
$class->Shipment = new StdClass;
$class->Shipment->ShipmentDetails = $this->getShipmentDetails()->getShipmentDetailsClass_v2();
// Shipper
$class->Shipment->Shipper = $this->getSender()->getClass_v2();
// Receiver
$class->Shipment->Receiver = $this->getReceiver()->getClass_v2();
// Return-Receiver
if($this->getReturnReceiver() !== null)
$class->Shipment->ReturnReceiver = $this->getReturnReceiver()->getClass_v2();
// Export-Document
if($this->getExportDocument() !== null) {
try {
$class->Shipment->ExportDocument = $this->getExportDocument()->getExportDocumentClass_v2();
} catch(Exception $e) {
trigger_error('[DHL-PHP-SDK]: Exception in method ' . __METHOD__ . ':' . $e->getMessage(), E_USER_WARNING);
}
}
// Other Settings
if($this->getPrintOnlyIfReceiverIsValid() !== null) {
$class->PrintOnlyIfCodeable = new StdClass;
$class->PrintOnlyIfCodeable->active = (int) $this->getPrintOnlyIfReceiverIsValid();
}
if($this->getLabelResponseType() !== null)
$class->labelResponseType = $this->getLabelResponseType();
return $class;
} | [
"public",
"function",
"getShipmentOrderClass_v2",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"sequenceNumber",
"=",
"$",
"this",
"->",
"getSequenceNumber",
"(",
")",
";",
"// Shipment",
"$",
"class",
"->",
"Shipment",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"Shipment",
"->",
"ShipmentDetails",
"=",
"$",
"this",
"->",
"getShipmentDetails",
"(",
")",
"->",
"getShipmentDetailsClass_v2",
"(",
")",
";",
"// Shipper",
"$",
"class",
"->",
"Shipment",
"->",
"Shipper",
"=",
"$",
"this",
"->",
"getSender",
"(",
")",
"->",
"getClass_v2",
"(",
")",
";",
"// Receiver",
"$",
"class",
"->",
"Shipment",
"->",
"Receiver",
"=",
"$",
"this",
"->",
"getReceiver",
"(",
")",
"->",
"getClass_v2",
"(",
")",
";",
"// Return-Receiver",
"if",
"(",
"$",
"this",
"->",
"getReturnReceiver",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Shipment",
"->",
"ReturnReceiver",
"=",
"$",
"this",
"->",
"getReturnReceiver",
"(",
")",
"->",
"getClass_v2",
"(",
")",
";",
"// Export-Document",
"if",
"(",
"$",
"this",
"->",
"getExportDocument",
"(",
")",
"!==",
"null",
")",
"{",
"try",
"{",
"$",
"class",
"->",
"Shipment",
"->",
"ExportDocument",
"=",
"$",
"this",
"->",
"getExportDocument",
"(",
")",
"->",
"getExportDocumentClass_v2",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Exception in method '",
".",
"__METHOD__",
".",
"':'",
".",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"E_USER_WARNING",
")",
";",
"}",
"}",
"// Other Settings",
"if",
"(",
"$",
"this",
"->",
"getPrintOnlyIfReceiverIsValid",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"PrintOnlyIfCodeable",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"PrintOnlyIfCodeable",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getPrintOnlyIfReceiverIsValid",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"labelResponseType",
"=",
"$",
"this",
"->",
"getLabelResponseType",
"(",
")",
";",
"return",
"$",
"class",
";",
"}"
] | Returns an DHL-Class of this Object for DHL-Shipment Order
@return stdClass - DHL-ShipmentOrder-Class | [
"Returns",
"an",
"DHL",
"-",
"Class",
"of",
"this",
"Object",
"for",
"DHL",
"-",
"Shipment",
"Order"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ShipmentOrder.php#L264-L300 |
Petschko/dhl-php-sdk | includes/Address.php | Address.setCountry | public final function setCountry($country) {
if($country !== null)
$this->country = mb_strtolower($country);
else
$this->country = null;
} | php | public final function setCountry($country) {
if($country !== null)
$this->country = mb_strtolower($country);
else
$this->country = null;
} | [
"public",
"final",
"function",
"setCountry",
"(",
"$",
"country",
")",
"{",
"if",
"(",
"$",
"country",
"!==",
"null",
")",
"$",
"this",
"->",
"country",
"=",
"mb_strtolower",
"(",
"$",
"country",
")",
";",
"else",
"$",
"this",
"->",
"country",
"=",
"null",
";",
"}"
] | Set the Country
@param string|null $country - Country or null for none | [
"Set",
"the",
"Country"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Address.php#L279-L284 |
Petschko/dhl-php-sdk | includes/Address.php | Address.setCountryISOCode | public final function setCountryISOCode($countryISOCode) {
if($countryISOCode !== null)
$this->countryISOCode = mb_strtoupper($countryISOCode);
else
$this->countryISOCode = null;
} | php | public final function setCountryISOCode($countryISOCode) {
if($countryISOCode !== null)
$this->countryISOCode = mb_strtoupper($countryISOCode);
else
$this->countryISOCode = null;
} | [
"public",
"final",
"function",
"setCountryISOCode",
"(",
"$",
"countryISOCode",
")",
"{",
"if",
"(",
"$",
"countryISOCode",
"!==",
"null",
")",
"$",
"this",
"->",
"countryISOCode",
"=",
"mb_strtoupper",
"(",
"$",
"countryISOCode",
")",
";",
"else",
"$",
"this",
"->",
"countryISOCode",
"=",
"null",
";",
"}"
] | Set the Country-ISO-Code
@param string|null $countryISOCode - Country-ISO-Code or null for none | [
"Set",
"the",
"Country",
"-",
"ISO",
"-",
"Code"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Address.php#L300-L305 |
Petschko/dhl-php-sdk | includes/Address.php | Address.setFullStreet | public final function setFullStreet($street) {
trigger_error('[DHL-PHP-SDK]: Called deprecated method ' . __METHOD__ . ': Buggy on some addresses, please separate the number and street by yourself. This method will removed in the future!', E_USER_DEPRECATED);
$match = array();
preg_match('/^([^\d]*[^\d\s]) *(\d.*)$/', $street, $match);
if(count($match) == 0) return;
$this->setStreetName($match[1]);
$this->setStreetNumber($match[2]);
} | php | public final function setFullStreet($street) {
trigger_error('[DHL-PHP-SDK]: Called deprecated method ' . __METHOD__ . ': Buggy on some addresses, please separate the number and street by yourself. This method will removed in the future!', E_USER_DEPRECATED);
$match = array();
preg_match('/^([^\d]*[^\d\s]) *(\d.*)$/', $street, $match);
if(count($match) == 0) return;
$this->setStreetName($match[1]);
$this->setStreetNumber($match[2]);
} | [
"public",
"final",
"function",
"setFullStreet",
"(",
"$",
"street",
")",
"{",
"trigger_error",
"(",
"'[DHL-PHP-SDK]: Called deprecated method '",
".",
"__METHOD__",
".",
"': Buggy on some addresses, please separate the number and street by yourself. This method will removed in the future!'",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"match",
"=",
"array",
"(",
")",
";",
"preg_match",
"(",
"'/^([^\\d]*[^\\d\\s]) *(\\d.*)$/'",
",",
"$",
"street",
",",
"$",
"match",
")",
";",
"if",
"(",
"count",
"(",
"$",
"match",
")",
"==",
"0",
")",
"return",
";",
"$",
"this",
"->",
"setStreetName",
"(",
"$",
"match",
"[",
"1",
"]",
")",
";",
"$",
"this",
"->",
"setStreetNumber",
"(",
"$",
"match",
"[",
"2",
"]",
")",
";",
"}"
] | Sets Street-Name and Number by Address String
Found here: https://www.tricd.de/php/php-strassenname-und-hausnummer-mit-php-parsen/
@param string $street - Address (Street plus number)
@deprecated - Buggy on some addresses, please separate the number and street by yourself | [
"Sets",
"Street",
"-",
"Name",
"and",
"Number",
"by",
"Address",
"String"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Address.php#L334-L345 |
Petschko/dhl-php-sdk | includes/PackStation.php | PackStation.getClass_v2 | public function getClass_v2() {
$class = new StdClass;
$class->name1 = $this->getName();
$class->Communication = new StdClass;
if($this->getPhone() !== null)
$class->Communication->phone = $this->getPhone();
if($this->getEmail() !== null)
$class->Communication->email = $this->getEmail();
if($this->getContactPerson() !== null)
$class->Communication->contactPerson = $this->getContactPerson();
$class->Packstation = new StdClass;
$class->Packstation->postNumber = $this->getPostNumber();
$class->Packstation->packstationNumber = $this->getPackStationNumber();
$class->Packstation->zip = $this->getZip();
$class->Packstation->city = $this->getLocation();
if($this->getCountryISOCode() !== null) {
$class->Packstation->Origin = new StdClass;
if($this->getCountry() !== null)
$class->Packstation->Origin->country = $this->getCountry();
$class->Packstation->Origin->countryISOCode = $this->getCountryISOCode();
if($this->getState() !== null)
$class->Packstation->Origin->state = $this->getState();
}
return $class;
} | php | public function getClass_v2() {
$class = new StdClass;
$class->name1 = $this->getName();
$class->Communication = new StdClass;
if($this->getPhone() !== null)
$class->Communication->phone = $this->getPhone();
if($this->getEmail() !== null)
$class->Communication->email = $this->getEmail();
if($this->getContactPerson() !== null)
$class->Communication->contactPerson = $this->getContactPerson();
$class->Packstation = new StdClass;
$class->Packstation->postNumber = $this->getPostNumber();
$class->Packstation->packstationNumber = $this->getPackStationNumber();
$class->Packstation->zip = $this->getZip();
$class->Packstation->city = $this->getLocation();
if($this->getCountryISOCode() !== null) {
$class->Packstation->Origin = new StdClass;
if($this->getCountry() !== null)
$class->Packstation->Origin->country = $this->getCountry();
$class->Packstation->Origin->countryISOCode = $this->getCountryISOCode();
if($this->getState() !== null)
$class->Packstation->Origin->state = $this->getState();
}
return $class;
} | [
"public",
"function",
"getClass_v2",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"name1",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"class",
"->",
"Communication",
"=",
"new",
"StdClass",
";",
"if",
"(",
"$",
"this",
"->",
"getPhone",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Communication",
"->",
"phone",
"=",
"$",
"this",
"->",
"getPhone",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getEmail",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Communication",
"->",
"email",
"=",
"$",
"this",
"->",
"getEmail",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getContactPerson",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Communication",
"->",
"contactPerson",
"=",
"$",
"this",
"->",
"getContactPerson",
"(",
")",
";",
"$",
"class",
"->",
"Packstation",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"Packstation",
"->",
"postNumber",
"=",
"$",
"this",
"->",
"getPostNumber",
"(",
")",
";",
"$",
"class",
"->",
"Packstation",
"->",
"packstationNumber",
"=",
"$",
"this",
"->",
"getPackStationNumber",
"(",
")",
";",
"$",
"class",
"->",
"Packstation",
"->",
"zip",
"=",
"$",
"this",
"->",
"getZip",
"(",
")",
";",
"$",
"class",
"->",
"Packstation",
"->",
"city",
"=",
"$",
"this",
"->",
"getLocation",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getCountryISOCode",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"Packstation",
"->",
"Origin",
"=",
"new",
"StdClass",
";",
"if",
"(",
"$",
"this",
"->",
"getCountry",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Packstation",
"->",
"Origin",
"->",
"country",
"=",
"$",
"this",
"->",
"getCountry",
"(",
")",
";",
"$",
"class",
"->",
"Packstation",
"->",
"Origin",
"->",
"countryISOCode",
"=",
"$",
"this",
"->",
"getCountryISOCode",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getState",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Packstation",
"->",
"Origin",
"->",
"state",
"=",
"$",
"this",
"->",
"getState",
"(",
")",
";",
"}",
"return",
"$",
"class",
";",
"}"
] | Returns a Class for the DHL-SendPerson
@return StdClass - DHL-SendPerson-class | [
"Returns",
"a",
"Class",
"for",
"the",
"DHL",
"-",
"SendPerson"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/PackStation.php#L94-L125 |
Petschko/dhl-php-sdk | includes/Service.php | Service.setDayOfDeliveryDate | public function setDayOfDeliveryDate($dayOfDeliveryDate, $useIntTime = false) {
if($useIntTime) {
$dayOfDeliveryDate = date('Y-m-d', $dayOfDeliveryDate);
if($dayOfDeliveryDate === false)
$dayOfDeliveryDate = null;
}
$this->dayOfDeliveryDate = $dayOfDeliveryDate;
} | php | public function setDayOfDeliveryDate($dayOfDeliveryDate, $useIntTime = false) {
if($useIntTime) {
$dayOfDeliveryDate = date('Y-m-d', $dayOfDeliveryDate);
if($dayOfDeliveryDate === false)
$dayOfDeliveryDate = null;
}
$this->dayOfDeliveryDate = $dayOfDeliveryDate;
} | [
"public",
"function",
"setDayOfDeliveryDate",
"(",
"$",
"dayOfDeliveryDate",
",",
"$",
"useIntTime",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"useIntTime",
")",
"{",
"$",
"dayOfDeliveryDate",
"=",
"date",
"(",
"'Y-m-d'",
",",
"$",
"dayOfDeliveryDate",
")",
";",
"if",
"(",
"$",
"dayOfDeliveryDate",
"===",
"false",
")",
"$",
"dayOfDeliveryDate",
"=",
"null",
";",
"}",
"$",
"this",
"->",
"dayOfDeliveryDate",
"=",
"$",
"dayOfDeliveryDate",
";",
"}"
] | Set the Date for the Service "DayOfDelivery"
@param null|int|string $dayOfDeliveryDate - The Day of Delivery as ISO-Date-Format (YYYY-MM-DD), the day as time() int value or null for none
@param bool $useIntTime - Use the int Time Value instead of a String | [
"Set",
"the",
"Date",
"for",
"the",
"Service",
"DayOfDelivery"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Service.php#L557-L566 |
Petschko/dhl-php-sdk | includes/Service.php | Service.getServiceClass_v2 | public function getServiceClass_v2($productType) {
$class = new StdClass;
if($this->getDayOfDeliveryEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER,
ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER
))) {
$class->DayOfDelivery = new StdClass;
$class->DayOfDelivery->active = (int) $this->getDayOfDeliveryEnabled();
$class->DayOfDelivery->details = $this->getDayOfDeliveryDate();
}
if($this->getDeliveryTimeframeEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER,
ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER
))) {
$class->DeliveryTimeframe = new StdClass;
$class->DeliveryTimeframe->active = (int) $this->getDeliveryTimeframeEnabled();
$class->DeliveryTimeframe->type = $this->getDeliveryTimeframe();
}
if($this->getPreferredTimeEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_NATIONAL_PACKAGE,
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_PACKAGE
))) {
$class->PreferredTime = new StdClass;
$class->PreferredTime->active = (int) $this->getPreferredTimeEnabled();
$class->PreferredTime->type = $this->getPreferredTime();
}
if($this->getIndividualSenderRequirementsEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER,
ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER
))) {
$class->IndividualSenderRequirement = new StdClass;
$class->IndividualSenderRequirement->active = (int) $this->getIndividualSenderRequirementsEnabled();
$class->IndividualSenderRequirement->details = $this->getIndividualSenderRequirementsText();
}
if($this->getPackagingReturn() !== null) {
$class->PackagingReturn = new StdClass;
$class->PackagingReturn->active = (int) $this->getPackagingReturn();
}
if($this->getReturnImmediatelyIfShipmentFailed() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_PACKAGE
))) {
$class->ReturnImmediately = new StdClass;
$class->ReturnImmediately->active = (int) $this->getReturnImmediatelyIfShipmentFailed();
}
if($this->getNoticeOnNonDeliverable() !== null) {
$class->NoticeOfNonDeliverability = new StdClass;
$class->NoticeOfNonDeliverability->active = (int) $this->getNoticeOnNonDeliverable();
}
if($this->getShipmentHandlingEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER,
ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER
))) {
$class->ShipmentHandling = new StdClass;
$class->ShipmentHandling->active = (int) $this->getShipmentHandlingEnabled();
$class->ShipmentHandling->type = $this->getShipmentHandlingType();
}
if($this->getEndorsementEnabled() !== null) {
$class->Endorsement = new StdClass;
$class->Endorsement->active = (int) $this->getEndorsementEnabled();
$class->Endorsement->type = $this->getEndorsementType();
}
if($this->getVisualCheckOfAgeEnabled() !== null) {
$class->VisualCheckOfAge = new StdClass;
$class->VisualCheckOfAge->active = (int) $this->getVisualCheckOfAgeEnabled();
$class->VisualCheckOfAge->type = $this->getVisualCheckOfAgeType();
}
if($this->getPreferredLocationEnabled() !== null) {
$class->PreferredLocation = new StdClass;
$class->PreferredLocation->active = (int) $this->getPreferredLocationEnabled();
$class->PreferredLocation->details = $this->getPreferredLocationDetails();
}
if($this->getPreferredNeighbourEnabled() !== null) {
$class->PreferredNeighbour = new StdClass;
$class->PreferredNeighbour->active = (int) $this->getPreferredNeighbourEnabled();
$class->PreferredNeighbour->details = $this->getPreferredNeighbourText();
}
if($this->getPreferredDayEnabled() !== null) {
$class->PreferredDay = new StdClass;
$class->PreferredDay->active = (int) $this->getPreferredDayEnabled();
$class->PreferredDay->details = $this->getPreferredDayText();
}
if($this->getPerishables() !== null) {
$class->Perishables = new StdClass;
$class->Perishables->active = (int) $this->getPerishables();
}
if($this->getDisableNeighbourDelivery() !== null) {
$class->NoNeighbourDelivery = new StdClass;
$class->NoNeighbourDelivery->active = (int) $this->getDisableNeighbourDelivery();
}
if($this->getNamedPersonOnly() !== null) {
$class->NamedPersonOnly = new StdClass;
$class->NamedPersonOnly->active = (int) $this->getNamedPersonOnly();
}
if($this->getReturnReceipt() !== null) {
$class->ReturnReceipt = new StdClass;
$class->ReturnReceipt->active = (int) $this->getReturnReceipt();
}
if($this->getPremium() !== null) {
$class->Premium = new StdClass;
$class->Premium->active = (int) $this->getPremium();
}
if($this->getCashOnDeliveryEnabled() !== null) {
$class->CashOnDelivery = new StdClass;
$class->CashOnDelivery->active = (int) $this->getCashOnDeliveryEnabled();
if($this->getCashOnDeliveryAddFee() !== null)
$class->CashOnDelivery->addFee = $this->getCashOnDeliveryAddFee();
$class->CashOnDelivery->codAmount = $this->getCashOnDeliveryAmount();
}
if($this->getAdditionalInsuranceEnabled() !== null) {
$class->AdditionalInsurance = new StdClass;
$class->AdditionalInsurance->active = (int) $this->getAdditionalInsuranceEnabled();
$class->AdditionalInsurance->insuranceAmount = $this->getAdditionalInsuranceAmount();
}
if($this->getBulkyGoods() !== null) {
$class->BulkyGoods = new StdClass;
$class->BulkyGoods->active = (int) $this->getBulkyGoods();
}
if($this->getIdentCheckEnabled() !== null) {
$class->IdentCheck = new StdClass;
$class->IdentCheck->active = (int) $this->getIdentCheckEnabled();
$class->IdentCheck->Ident = $this->getIdentCheckObj()->getIdentClass_v2();
}
return $class;
} | php | public function getServiceClass_v2($productType) {
$class = new StdClass;
if($this->getDayOfDeliveryEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER,
ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER
))) {
$class->DayOfDelivery = new StdClass;
$class->DayOfDelivery->active = (int) $this->getDayOfDeliveryEnabled();
$class->DayOfDelivery->details = $this->getDayOfDeliveryDate();
}
if($this->getDeliveryTimeframeEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER,
ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER
))) {
$class->DeliveryTimeframe = new StdClass;
$class->DeliveryTimeframe->active = (int) $this->getDeliveryTimeframeEnabled();
$class->DeliveryTimeframe->type = $this->getDeliveryTimeframe();
}
if($this->getPreferredTimeEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_NATIONAL_PACKAGE,
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_PACKAGE
))) {
$class->PreferredTime = new StdClass;
$class->PreferredTime->active = (int) $this->getPreferredTimeEnabled();
$class->PreferredTime->type = $this->getPreferredTime();
}
if($this->getIndividualSenderRequirementsEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER,
ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER
))) {
$class->IndividualSenderRequirement = new StdClass;
$class->IndividualSenderRequirement->active = (int) $this->getIndividualSenderRequirementsEnabled();
$class->IndividualSenderRequirement->details = $this->getIndividualSenderRequirementsText();
}
if($this->getPackagingReturn() !== null) {
$class->PackagingReturn = new StdClass;
$class->PackagingReturn->active = (int) $this->getPackagingReturn();
}
if($this->getReturnImmediatelyIfShipmentFailed() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_PACKAGE
))) {
$class->ReturnImmediately = new StdClass;
$class->ReturnImmediately->active = (int) $this->getReturnImmediatelyIfShipmentFailed();
}
if($this->getNoticeOnNonDeliverable() !== null) {
$class->NoticeOfNonDeliverability = new StdClass;
$class->NoticeOfNonDeliverability->active = (int) $this->getNoticeOnNonDeliverable();
}
if($this->getShipmentHandlingEnabled() !== null && in_array(
$productType,
array(
ShipmentDetails::PRODUCT_TYPE_SAME_DAY_MESSENGER,
ShipmentDetails::PRODUCT_TYPE_WISH_TIME_MESSENGER
))) {
$class->ShipmentHandling = new StdClass;
$class->ShipmentHandling->active = (int) $this->getShipmentHandlingEnabled();
$class->ShipmentHandling->type = $this->getShipmentHandlingType();
}
if($this->getEndorsementEnabled() !== null) {
$class->Endorsement = new StdClass;
$class->Endorsement->active = (int) $this->getEndorsementEnabled();
$class->Endorsement->type = $this->getEndorsementType();
}
if($this->getVisualCheckOfAgeEnabled() !== null) {
$class->VisualCheckOfAge = new StdClass;
$class->VisualCheckOfAge->active = (int) $this->getVisualCheckOfAgeEnabled();
$class->VisualCheckOfAge->type = $this->getVisualCheckOfAgeType();
}
if($this->getPreferredLocationEnabled() !== null) {
$class->PreferredLocation = new StdClass;
$class->PreferredLocation->active = (int) $this->getPreferredLocationEnabled();
$class->PreferredLocation->details = $this->getPreferredLocationDetails();
}
if($this->getPreferredNeighbourEnabled() !== null) {
$class->PreferredNeighbour = new StdClass;
$class->PreferredNeighbour->active = (int) $this->getPreferredNeighbourEnabled();
$class->PreferredNeighbour->details = $this->getPreferredNeighbourText();
}
if($this->getPreferredDayEnabled() !== null) {
$class->PreferredDay = new StdClass;
$class->PreferredDay->active = (int) $this->getPreferredDayEnabled();
$class->PreferredDay->details = $this->getPreferredDayText();
}
if($this->getPerishables() !== null) {
$class->Perishables = new StdClass;
$class->Perishables->active = (int) $this->getPerishables();
}
if($this->getDisableNeighbourDelivery() !== null) {
$class->NoNeighbourDelivery = new StdClass;
$class->NoNeighbourDelivery->active = (int) $this->getDisableNeighbourDelivery();
}
if($this->getNamedPersonOnly() !== null) {
$class->NamedPersonOnly = new StdClass;
$class->NamedPersonOnly->active = (int) $this->getNamedPersonOnly();
}
if($this->getReturnReceipt() !== null) {
$class->ReturnReceipt = new StdClass;
$class->ReturnReceipt->active = (int) $this->getReturnReceipt();
}
if($this->getPremium() !== null) {
$class->Premium = new StdClass;
$class->Premium->active = (int) $this->getPremium();
}
if($this->getCashOnDeliveryEnabled() !== null) {
$class->CashOnDelivery = new StdClass;
$class->CashOnDelivery->active = (int) $this->getCashOnDeliveryEnabled();
if($this->getCashOnDeliveryAddFee() !== null)
$class->CashOnDelivery->addFee = $this->getCashOnDeliveryAddFee();
$class->CashOnDelivery->codAmount = $this->getCashOnDeliveryAmount();
}
if($this->getAdditionalInsuranceEnabled() !== null) {
$class->AdditionalInsurance = new StdClass;
$class->AdditionalInsurance->active = (int) $this->getAdditionalInsuranceEnabled();
$class->AdditionalInsurance->insuranceAmount = $this->getAdditionalInsuranceAmount();
}
if($this->getBulkyGoods() !== null) {
$class->BulkyGoods = new StdClass;
$class->BulkyGoods->active = (int) $this->getBulkyGoods();
}
if($this->getIdentCheckEnabled() !== null) {
$class->IdentCheck = new StdClass;
$class->IdentCheck->active = (int) $this->getIdentCheckEnabled();
$class->IdentCheck->Ident = $this->getIdentCheckObj()->getIdentClass_v2();
}
return $class;
} | [
"public",
"function",
"getServiceClass_v2",
"(",
"$",
"productType",
")",
"{",
"$",
"class",
"=",
"new",
"StdClass",
";",
"if",
"(",
"$",
"this",
"->",
"getDayOfDeliveryEnabled",
"(",
")",
"!==",
"null",
"&&",
"in_array",
"(",
"$",
"productType",
",",
"array",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_SAME_DAY_MESSENGER",
",",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_WISH_TIME_MESSENGER",
")",
")",
")",
"{",
"$",
"class",
"->",
"DayOfDelivery",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"DayOfDelivery",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getDayOfDeliveryEnabled",
"(",
")",
";",
"$",
"class",
"->",
"DayOfDelivery",
"->",
"details",
"=",
"$",
"this",
"->",
"getDayOfDeliveryDate",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getDeliveryTimeframeEnabled",
"(",
")",
"!==",
"null",
"&&",
"in_array",
"(",
"$",
"productType",
",",
"array",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_SAME_DAY_MESSENGER",
",",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_WISH_TIME_MESSENGER",
")",
")",
")",
"{",
"$",
"class",
"->",
"DeliveryTimeframe",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"DeliveryTimeframe",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getDeliveryTimeframeEnabled",
"(",
")",
";",
"$",
"class",
"->",
"DeliveryTimeframe",
"->",
"type",
"=",
"$",
"this",
"->",
"getDeliveryTimeframe",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getPreferredTimeEnabled",
"(",
")",
"!==",
"null",
"&&",
"in_array",
"(",
"$",
"productType",
",",
"array",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_NATIONAL_PACKAGE",
",",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_SAME_DAY_PACKAGE",
")",
")",
")",
"{",
"$",
"class",
"->",
"PreferredTime",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"PreferredTime",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getPreferredTimeEnabled",
"(",
")",
";",
"$",
"class",
"->",
"PreferredTime",
"->",
"type",
"=",
"$",
"this",
"->",
"getPreferredTime",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getIndividualSenderRequirementsEnabled",
"(",
")",
"!==",
"null",
"&&",
"in_array",
"(",
"$",
"productType",
",",
"array",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_SAME_DAY_MESSENGER",
",",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_WISH_TIME_MESSENGER",
")",
")",
")",
"{",
"$",
"class",
"->",
"IndividualSenderRequirement",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"IndividualSenderRequirement",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getIndividualSenderRequirementsEnabled",
"(",
")",
";",
"$",
"class",
"->",
"IndividualSenderRequirement",
"->",
"details",
"=",
"$",
"this",
"->",
"getIndividualSenderRequirementsText",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getPackagingReturn",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"PackagingReturn",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"PackagingReturn",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getPackagingReturn",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getReturnImmediatelyIfShipmentFailed",
"(",
")",
"!==",
"null",
"&&",
"in_array",
"(",
"$",
"productType",
",",
"array",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_SAME_DAY_PACKAGE",
")",
")",
")",
"{",
"$",
"class",
"->",
"ReturnImmediately",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"ReturnImmediately",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getReturnImmediatelyIfShipmentFailed",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getNoticeOnNonDeliverable",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"NoticeOfNonDeliverability",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"NoticeOfNonDeliverability",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getNoticeOnNonDeliverable",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getShipmentHandlingEnabled",
"(",
")",
"!==",
"null",
"&&",
"in_array",
"(",
"$",
"productType",
",",
"array",
"(",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_SAME_DAY_MESSENGER",
",",
"ShipmentDetails",
"::",
"PRODUCT_TYPE_WISH_TIME_MESSENGER",
")",
")",
")",
"{",
"$",
"class",
"->",
"ShipmentHandling",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"ShipmentHandling",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getShipmentHandlingEnabled",
"(",
")",
";",
"$",
"class",
"->",
"ShipmentHandling",
"->",
"type",
"=",
"$",
"this",
"->",
"getShipmentHandlingType",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getEndorsementEnabled",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"Endorsement",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"Endorsement",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getEndorsementEnabled",
"(",
")",
";",
"$",
"class",
"->",
"Endorsement",
"->",
"type",
"=",
"$",
"this",
"->",
"getEndorsementType",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getVisualCheckOfAgeEnabled",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"VisualCheckOfAge",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"VisualCheckOfAge",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getVisualCheckOfAgeEnabled",
"(",
")",
";",
"$",
"class",
"->",
"VisualCheckOfAge",
"->",
"type",
"=",
"$",
"this",
"->",
"getVisualCheckOfAgeType",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getPreferredLocationEnabled",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"PreferredLocation",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"PreferredLocation",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getPreferredLocationEnabled",
"(",
")",
";",
"$",
"class",
"->",
"PreferredLocation",
"->",
"details",
"=",
"$",
"this",
"->",
"getPreferredLocationDetails",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getPreferredNeighbourEnabled",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"PreferredNeighbour",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"PreferredNeighbour",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getPreferredNeighbourEnabled",
"(",
")",
";",
"$",
"class",
"->",
"PreferredNeighbour",
"->",
"details",
"=",
"$",
"this",
"->",
"getPreferredNeighbourText",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getPreferredDayEnabled",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"PreferredDay",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"PreferredDay",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getPreferredDayEnabled",
"(",
")",
";",
"$",
"class",
"->",
"PreferredDay",
"->",
"details",
"=",
"$",
"this",
"->",
"getPreferredDayText",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getPerishables",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"Perishables",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"Perishables",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getPerishables",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getDisableNeighbourDelivery",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"NoNeighbourDelivery",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"NoNeighbourDelivery",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getDisableNeighbourDelivery",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getNamedPersonOnly",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"NamedPersonOnly",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"NamedPersonOnly",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getNamedPersonOnly",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getReturnReceipt",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"ReturnReceipt",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"ReturnReceipt",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getReturnReceipt",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getPremium",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"Premium",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"Premium",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getPremium",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getCashOnDeliveryEnabled",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"CashOnDelivery",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"CashOnDelivery",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getCashOnDeliveryEnabled",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getCashOnDeliveryAddFee",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"CashOnDelivery",
"->",
"addFee",
"=",
"$",
"this",
"->",
"getCashOnDeliveryAddFee",
"(",
")",
";",
"$",
"class",
"->",
"CashOnDelivery",
"->",
"codAmount",
"=",
"$",
"this",
"->",
"getCashOnDeliveryAmount",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getAdditionalInsuranceEnabled",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"AdditionalInsurance",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"AdditionalInsurance",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getAdditionalInsuranceEnabled",
"(",
")",
";",
"$",
"class",
"->",
"AdditionalInsurance",
"->",
"insuranceAmount",
"=",
"$",
"this",
"->",
"getAdditionalInsuranceAmount",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getBulkyGoods",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"BulkyGoods",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"BulkyGoods",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getBulkyGoods",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getIdentCheckEnabled",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"IdentCheck",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"IdentCheck",
"->",
"active",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getIdentCheckEnabled",
"(",
")",
";",
"$",
"class",
"->",
"IdentCheck",
"->",
"Ident",
"=",
"$",
"this",
"->",
"getIdentCheckObj",
"(",
")",
"->",
"getIdentClass_v2",
"(",
")",
";",
"}",
"return",
"$",
"class",
";",
"}"
] | Get the Class of this Service-Object
@param string $productType - Type of the Product
@return StdClass - Service-DHL-Class | [
"Get",
"the",
"Class",
"of",
"this",
"Service",
"-",
"Object"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/Service.php#L1451-L1588 |
Petschko/dhl-php-sdk | includes/LabelData.php | LabelData.loadLabelData_v2 | private function loadLabelData_v2($response) {
$labelResponse = $response;
// Check if the tree is correct (and may reconfigure it)
if(isset($response->LabelData))
$labelResponse = $response->LabelData;
// Get Sequence-Number
if(isset($response->sequenceNumber))
$this->setSequenceNumber((string) $response->sequenceNumber);
else if(isset($labelResponse->sequenceNumber))
$this->setSequenceNumber((string) $labelResponse->sequenceNumber);
// Get Status
if(isset($labelResponse->Status)) {
if(isset($labelResponse->Status->statusCode))
$this->setStatusCode((int) $labelResponse->Status->statusCode);
if(isset($labelResponse->Status->statusText)) {
if(is_array($labelResponse->Status->statusText))
$this->setStatusText(implode(';', $labelResponse->Status->statusText));
else
$this->setStatusText($labelResponse->Status->statusText);
}
if(isset($labelResponse->Status->statusMessage)) {
if(is_array($labelResponse->Status->statusMessage))
$this->setStatusMessage(implode(';', $labelResponse->Status->statusMessage));
else
$this->setStatusMessage($labelResponse->Status->statusMessage);
}
$this->validateStatusCode();
}
// Get Shipment-Number
if(isset($labelResponse->shipmentNumber))
$this->setShipmentNumber((string) $labelResponse->shipmentNumber);
// Get Label-Data
if(isset($labelResponse->labelUrl))
$this->setLabel($labelResponse->labelUrl);
else if(isset($labelResponse->labelData))
$this->setLabel($labelResponse->labelData);
// Get Return-Label
if(isset($labelResponse->returnLabelUrl))
$this->setReturnLabel($labelResponse->returnLabelUrl);
else if(isset($labelResponse->returnLabelData))
$this->setReturnLabel($labelResponse->returnLabelData);
// Get Export-Doc
if(isset($labelResponse->exportLabelUrl))
$this->setExportDoc($labelResponse->exportLabelUrl);
else if(isset($labelResponse->exportLabelData))
$this->setExportDoc($labelResponse->exportLabelData);
else if(isset($labelResponse->exportDocURL))
$this->setExportDoc($labelResponse->exportDocURL);
else if(isset($labelResponse->exportDocData))
$this->setExportDoc($labelResponse->exportDocData);
if(isset($labelResponse->codLabelUrl))
$this->setCodLabel($labelResponse->codLabelUrl);
else if(isset($labelResponse->codLabelData))
$this->setCodLabel($labelResponse->codLabelData);
} | php | private function loadLabelData_v2($response) {
$labelResponse = $response;
// Check if the tree is correct (and may reconfigure it)
if(isset($response->LabelData))
$labelResponse = $response->LabelData;
// Get Sequence-Number
if(isset($response->sequenceNumber))
$this->setSequenceNumber((string) $response->sequenceNumber);
else if(isset($labelResponse->sequenceNumber))
$this->setSequenceNumber((string) $labelResponse->sequenceNumber);
// Get Status
if(isset($labelResponse->Status)) {
if(isset($labelResponse->Status->statusCode))
$this->setStatusCode((int) $labelResponse->Status->statusCode);
if(isset($labelResponse->Status->statusText)) {
if(is_array($labelResponse->Status->statusText))
$this->setStatusText(implode(';', $labelResponse->Status->statusText));
else
$this->setStatusText($labelResponse->Status->statusText);
}
if(isset($labelResponse->Status->statusMessage)) {
if(is_array($labelResponse->Status->statusMessage))
$this->setStatusMessage(implode(';', $labelResponse->Status->statusMessage));
else
$this->setStatusMessage($labelResponse->Status->statusMessage);
}
$this->validateStatusCode();
}
// Get Shipment-Number
if(isset($labelResponse->shipmentNumber))
$this->setShipmentNumber((string) $labelResponse->shipmentNumber);
// Get Label-Data
if(isset($labelResponse->labelUrl))
$this->setLabel($labelResponse->labelUrl);
else if(isset($labelResponse->labelData))
$this->setLabel($labelResponse->labelData);
// Get Return-Label
if(isset($labelResponse->returnLabelUrl))
$this->setReturnLabel($labelResponse->returnLabelUrl);
else if(isset($labelResponse->returnLabelData))
$this->setReturnLabel($labelResponse->returnLabelData);
// Get Export-Doc
if(isset($labelResponse->exportLabelUrl))
$this->setExportDoc($labelResponse->exportLabelUrl);
else if(isset($labelResponse->exportLabelData))
$this->setExportDoc($labelResponse->exportLabelData);
else if(isset($labelResponse->exportDocURL))
$this->setExportDoc($labelResponse->exportDocURL);
else if(isset($labelResponse->exportDocData))
$this->setExportDoc($labelResponse->exportDocData);
if(isset($labelResponse->codLabelUrl))
$this->setCodLabel($labelResponse->codLabelUrl);
else if(isset($labelResponse->codLabelData))
$this->setCodLabel($labelResponse->codLabelData);
} | [
"private",
"function",
"loadLabelData_v2",
"(",
"$",
"response",
")",
"{",
"$",
"labelResponse",
"=",
"$",
"response",
";",
"// Check if the tree is correct (and may reconfigure it)",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"LabelData",
")",
")",
"$",
"labelResponse",
"=",
"$",
"response",
"->",
"LabelData",
";",
"// Get Sequence-Number",
"if",
"(",
"isset",
"(",
"$",
"response",
"->",
"sequenceNumber",
")",
")",
"$",
"this",
"->",
"setSequenceNumber",
"(",
"(",
"string",
")",
"$",
"response",
"->",
"sequenceNumber",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"sequenceNumber",
")",
")",
"$",
"this",
"->",
"setSequenceNumber",
"(",
"(",
"string",
")",
"$",
"labelResponse",
"->",
"sequenceNumber",
")",
";",
"// Get Status",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"Status",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusCode",
")",
")",
"$",
"this",
"->",
"setStatusCode",
"(",
"(",
"int",
")",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusCode",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusText",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusText",
")",
")",
"$",
"this",
"->",
"setStatusText",
"(",
"implode",
"(",
"';'",
",",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusText",
")",
")",
";",
"else",
"$",
"this",
"->",
"setStatusText",
"(",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusText",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusMessage",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusMessage",
")",
")",
"$",
"this",
"->",
"setStatusMessage",
"(",
"implode",
"(",
"';'",
",",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusMessage",
")",
")",
";",
"else",
"$",
"this",
"->",
"setStatusMessage",
"(",
"$",
"labelResponse",
"->",
"Status",
"->",
"statusMessage",
")",
";",
"}",
"$",
"this",
"->",
"validateStatusCode",
"(",
")",
";",
"}",
"// Get Shipment-Number",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"shipmentNumber",
")",
")",
"$",
"this",
"->",
"setShipmentNumber",
"(",
"(",
"string",
")",
"$",
"labelResponse",
"->",
"shipmentNumber",
")",
";",
"// Get Label-Data",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"labelUrl",
")",
")",
"$",
"this",
"->",
"setLabel",
"(",
"$",
"labelResponse",
"->",
"labelUrl",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"labelData",
")",
")",
"$",
"this",
"->",
"setLabel",
"(",
"$",
"labelResponse",
"->",
"labelData",
")",
";",
"// Get Return-Label",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"returnLabelUrl",
")",
")",
"$",
"this",
"->",
"setReturnLabel",
"(",
"$",
"labelResponse",
"->",
"returnLabelUrl",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"returnLabelData",
")",
")",
"$",
"this",
"->",
"setReturnLabel",
"(",
"$",
"labelResponse",
"->",
"returnLabelData",
")",
";",
"// Get Export-Doc",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"exportLabelUrl",
")",
")",
"$",
"this",
"->",
"setExportDoc",
"(",
"$",
"labelResponse",
"->",
"exportLabelUrl",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"exportLabelData",
")",
")",
"$",
"this",
"->",
"setExportDoc",
"(",
"$",
"labelResponse",
"->",
"exportLabelData",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"exportDocURL",
")",
")",
"$",
"this",
"->",
"setExportDoc",
"(",
"$",
"labelResponse",
"->",
"exportDocURL",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"exportDocData",
")",
")",
"$",
"this",
"->",
"setExportDoc",
"(",
"$",
"labelResponse",
"->",
"exportDocData",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"codLabelUrl",
")",
")",
"$",
"this",
"->",
"setCodLabel",
"(",
"$",
"labelResponse",
"->",
"codLabelUrl",
")",
";",
"else",
"if",
"(",
"isset",
"(",
"$",
"labelResponse",
"->",
"codLabelData",
")",
")",
"$",
"this",
"->",
"setCodLabel",
"(",
"$",
"labelResponse",
"->",
"codLabelData",
")",
";",
"}"
] | Set all Values of the LabelResponse to this Object
@param Object $response - LabelData-Response | [
"Set",
"all",
"Values",
"of",
"the",
"LabelResponse",
"to",
"this",
"Object"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/LabelData.php#L323-L385 |
Petschko/dhl-php-sdk | includes/BankData.php | BankData.getBankClass_v2 | public function getBankClass_v2() {
$class = new StdClass;
$class->accountOwner = $this->getAccountOwnerName();
$class->bankName = $this->getBankName();
$class->iban = $this->getIban();
if($this->getNote1() !== null)
$class->note1 = $this->getNote1();
if($this->getNote2() !== null)
$class->note2 = $this->getNote2();
if($this->getBic() !== null)
$class->bic = $this->getBic();
if($this->getAccountReference() !== null)
$class->accountreference = $this->getAccountReference();
return $class;
} | php | public function getBankClass_v2() {
$class = new StdClass;
$class->accountOwner = $this->getAccountOwnerName();
$class->bankName = $this->getBankName();
$class->iban = $this->getIban();
if($this->getNote1() !== null)
$class->note1 = $this->getNote1();
if($this->getNote2() !== null)
$class->note2 = $this->getNote2();
if($this->getBic() !== null)
$class->bic = $this->getBic();
if($this->getAccountReference() !== null)
$class->accountreference = $this->getAccountReference();
return $class;
} | [
"public",
"function",
"getBankClass_v2",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"accountOwner",
"=",
"$",
"this",
"->",
"getAccountOwnerName",
"(",
")",
";",
"$",
"class",
"->",
"bankName",
"=",
"$",
"this",
"->",
"getBankName",
"(",
")",
";",
"$",
"class",
"->",
"iban",
"=",
"$",
"this",
"->",
"getIban",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getNote1",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"note1",
"=",
"$",
"this",
"->",
"getNote1",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getNote2",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"note2",
"=",
"$",
"this",
"->",
"getNote2",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getBic",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"bic",
"=",
"$",
"this",
"->",
"getBic",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getAccountReference",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"accountreference",
"=",
"$",
"this",
"->",
"getAccountReference",
"(",
")",
";",
"return",
"$",
"class",
";",
"}"
] | Returns a DHL-Bank-Class for API v2
@return StdClass - DHL-Bank-Class | [
"Returns",
"a",
"DHL",
"-",
"Bank",
"-",
"Class",
"for",
"API",
"v2"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/BankData.php#L263-L279 |
Petschko/dhl-php-sdk | includes/ShipmentDetails.php | ShipmentDetails.getShipmentDate | public function getShipmentDate() {
if($this->shipmentDate === null)
$this->setShipmentDate($this->createDefaultShipmentDate());
return $this->shipmentDate;
} | php | public function getShipmentDate() {
if($this->shipmentDate === null)
$this->setShipmentDate($this->createDefaultShipmentDate());
return $this->shipmentDate;
} | [
"public",
"function",
"getShipmentDate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shipmentDate",
"===",
"null",
")",
"$",
"this",
"->",
"setShipmentDate",
"(",
"$",
"this",
"->",
"createDefaultShipmentDate",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"shipmentDate",
";",
"}"
] | Get the Shipment-Date (and set the default one -today- if none was set)
@return string - Shipment-Date as ISO-Date String YYYY-MM-DD | [
"Get",
"the",
"Shipment",
"-",
"Date",
"(",
"and",
"set",
"the",
"default",
"one",
"-",
"today",
"-",
"if",
"none",
"was",
"set",
")"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ShipmentDetails.php#L347-L352 |
Petschko/dhl-php-sdk | includes/ShipmentDetails.php | ShipmentDetails.setShipmentDate | public function setShipmentDate($shipmentDate, $useIntTime = false) {
if($useIntTime) {
// Convert Time-Stamp to Date
$shipmentDate = date('Y-m-d', $shipmentDate);
if($shipmentDate === false)
$shipmentDate = null;
}
$this->shipmentDate = $shipmentDate;
} | php | public function setShipmentDate($shipmentDate, $useIntTime = false) {
if($useIntTime) {
// Convert Time-Stamp to Date
$shipmentDate = date('Y-m-d', $shipmentDate);
if($shipmentDate === false)
$shipmentDate = null;
}
$this->shipmentDate = $shipmentDate;
} | [
"public",
"function",
"setShipmentDate",
"(",
"$",
"shipmentDate",
",",
"$",
"useIntTime",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"useIntTime",
")",
"{",
"// Convert Time-Stamp to Date",
"$",
"shipmentDate",
"=",
"date",
"(",
"'Y-m-d'",
",",
"$",
"shipmentDate",
")",
";",
"if",
"(",
"$",
"shipmentDate",
"===",
"false",
")",
"$",
"shipmentDate",
"=",
"null",
";",
"}",
"$",
"this",
"->",
"shipmentDate",
"=",
"$",
"shipmentDate",
";",
"}"
] | Set the Shipment-Date
@param string|int|null $shipmentDate - Shipment-Date as String YYYY-MM-DD or the int value time() of the date | null for today (+1 Day on Sunday)
@param bool $useIntTime - Use the int Time Value instead of a String | [
"Set",
"the",
"Shipment",
"-",
"Date"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ShipmentDetails.php#L360-L370 |
Petschko/dhl-php-sdk | includes/ShipmentDetails.php | ShipmentDetails.createDefaultShipmentDate | private function createDefaultShipmentDate() {
$now = time();
$weekDay = date('w', $now);
if($weekDay === 0)
$now += 86400; // Increase Day by 1 if Sunday
return date('Y-m-d', $now);
} | php | private function createDefaultShipmentDate() {
$now = time();
$weekDay = date('w', $now);
if($weekDay === 0)
$now += 86400; // Increase Day by 1 if Sunday
return date('Y-m-d', $now);
} | [
"private",
"function",
"createDefaultShipmentDate",
"(",
")",
"{",
"$",
"now",
"=",
"time",
"(",
")",
";",
"$",
"weekDay",
"=",
"date",
"(",
"'w'",
",",
"$",
"now",
")",
";",
"if",
"(",
"$",
"weekDay",
"===",
"0",
")",
"$",
"now",
"+=",
"86400",
";",
"// Increase Day by 1 if Sunday",
"return",
"date",
"(",
"'Y-m-d'",
",",
"$",
"now",
")",
";",
"}"
] | Creates a Default Shipment-Date (Today or if Sunday the next Day)
@return string - Default-Date as ISO-Date String | [
"Creates",
"a",
"Default",
"Shipment",
"-",
"Date",
"(",
"Today",
"or",
"if",
"Sunday",
"the",
"next",
"Day",
")"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ShipmentDetails.php#L573-L581 |
Petschko/dhl-php-sdk | includes/ShipmentDetails.php | ShipmentDetails.getShipmentDetailsClass_v2 | public function getShipmentDetailsClass_v2() {
$class = new StdClass;
$class->product = $this->getProduct();
$class->accountNumber = $this->getAccountNumber();
if($this->getCustomerReference() !== null)
$class->customerReference = $this->getCustomerReference();
$class->shipmentDate = $this->getShipmentDate();
if($this->getReturnAccountNumber() !== null)
$class->returnShipmentAccountNumber = $this->getReturnAccountNumber();
if($this->getReturnReference() !== null)
$class->returnShipmentReference = $this->getReturnReference();
$class->ShipmentItem = new StdClass;
$class->ShipmentItem->weightInKG = $this->getWeight();
if($this->getLength() !== null)
$class->ShipmentItem->lengthInCM = $this->getLength();
if($this->getWidth() !== null)
$class->ShipmentItem->widthInCM = $this->getWidth();
if($this->getHeight() !== null)
$class->ShipmentItem->heightInCM = $this->getHeight();
if($this->getService() !== null)
$class->Service = $this->getService()->getServiceClass_v2($this->getProduct());
if($this->getNotificationEmail() !== null) {
$class->Notification = new StdClass;
$class->Notification->recipientEmailAddress = $this->getNotificationEmail();
}
if($this->getBank() !== null)
$class->BankData = $this->getBank()->getBankClass_v2();
return $class;
} | php | public function getShipmentDetailsClass_v2() {
$class = new StdClass;
$class->product = $this->getProduct();
$class->accountNumber = $this->getAccountNumber();
if($this->getCustomerReference() !== null)
$class->customerReference = $this->getCustomerReference();
$class->shipmentDate = $this->getShipmentDate();
if($this->getReturnAccountNumber() !== null)
$class->returnShipmentAccountNumber = $this->getReturnAccountNumber();
if($this->getReturnReference() !== null)
$class->returnShipmentReference = $this->getReturnReference();
$class->ShipmentItem = new StdClass;
$class->ShipmentItem->weightInKG = $this->getWeight();
if($this->getLength() !== null)
$class->ShipmentItem->lengthInCM = $this->getLength();
if($this->getWidth() !== null)
$class->ShipmentItem->widthInCM = $this->getWidth();
if($this->getHeight() !== null)
$class->ShipmentItem->heightInCM = $this->getHeight();
if($this->getService() !== null)
$class->Service = $this->getService()->getServiceClass_v2($this->getProduct());
if($this->getNotificationEmail() !== null) {
$class->Notification = new StdClass;
$class->Notification->recipientEmailAddress = $this->getNotificationEmail();
}
if($this->getBank() !== null)
$class->BankData = $this->getBank()->getBankClass_v2();
return $class;
} | [
"public",
"function",
"getShipmentDetailsClass_v2",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"product",
"=",
"$",
"this",
"->",
"getProduct",
"(",
")",
";",
"$",
"class",
"->",
"accountNumber",
"=",
"$",
"this",
"->",
"getAccountNumber",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getCustomerReference",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"customerReference",
"=",
"$",
"this",
"->",
"getCustomerReference",
"(",
")",
";",
"$",
"class",
"->",
"shipmentDate",
"=",
"$",
"this",
"->",
"getShipmentDate",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getReturnAccountNumber",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"returnShipmentAccountNumber",
"=",
"$",
"this",
"->",
"getReturnAccountNumber",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getReturnReference",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"returnShipmentReference",
"=",
"$",
"this",
"->",
"getReturnReference",
"(",
")",
";",
"$",
"class",
"->",
"ShipmentItem",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"ShipmentItem",
"->",
"weightInKG",
"=",
"$",
"this",
"->",
"getWeight",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getLength",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"ShipmentItem",
"->",
"lengthInCM",
"=",
"$",
"this",
"->",
"getLength",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getWidth",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"ShipmentItem",
"->",
"widthInCM",
"=",
"$",
"this",
"->",
"getWidth",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getHeight",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"ShipmentItem",
"->",
"heightInCM",
"=",
"$",
"this",
"->",
"getHeight",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getService",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"Service",
"=",
"$",
"this",
"->",
"getService",
"(",
")",
"->",
"getServiceClass_v2",
"(",
"$",
"this",
"->",
"getProduct",
"(",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getNotificationEmail",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"class",
"->",
"Notification",
"=",
"new",
"StdClass",
";",
"$",
"class",
"->",
"Notification",
"->",
"recipientEmailAddress",
"=",
"$",
"this",
"->",
"getNotificationEmail",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getBank",
"(",
")",
"!==",
"null",
")",
"$",
"class",
"->",
"BankData",
"=",
"$",
"this",
"->",
"getBank",
"(",
")",
"->",
"getBankClass_v2",
"(",
")",
";",
"return",
"$",
"class",
";",
"}"
] | Returns an DHL-Class of this Object for DHL-Shipment Details
@return StdClass - DHL-ShipmentDetails-Class | [
"Returns",
"an",
"DHL",
"-",
"Class",
"of",
"this",
"Object",
"for",
"DHL",
"-",
"Shipment",
"Details"
] | train | https://github.com/Petschko/dhl-php-sdk/blob/a78ea297246a18c280902ec5c78cc60a4858025f/includes/ShipmentDetails.php#L602-L636 |
xPaw/SteamID.php | SteamID.php | SteamID.RenderSteam2 | public function RenderSteam2()
{
switch( $this->GetAccountType() )
{
case self::TypeInvalid:
case self::TypeIndividual:
{
$Universe = $this->GetAccountUniverse();
$AccountID = $this->GetAccountID();
return 'STEAM_' . $Universe . ':' . ( $AccountID & 1 ) . ':' .
( $AccountID >> 1 );
}
default:
{
return $this->ConvertToUInt64();
}
}
} | php | public function RenderSteam2()
{
switch( $this->GetAccountType() )
{
case self::TypeInvalid:
case self::TypeIndividual:
{
$Universe = $this->GetAccountUniverse();
$AccountID = $this->GetAccountID();
return 'STEAM_' . $Universe . ':' . ( $AccountID & 1 ) . ':' .
( $AccountID >> 1 );
}
default:
{
return $this->ConvertToUInt64();
}
}
} | [
"public",
"function",
"RenderSteam2",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"GetAccountType",
"(",
")",
")",
"{",
"case",
"self",
"::",
"TypeInvalid",
":",
"case",
"self",
"::",
"TypeIndividual",
":",
"{",
"$",
"Universe",
"=",
"$",
"this",
"->",
"GetAccountUniverse",
"(",
")",
";",
"$",
"AccountID",
"=",
"$",
"this",
"->",
"GetAccountID",
"(",
")",
";",
"return",
"'STEAM_'",
".",
"$",
"Universe",
".",
"':'",
".",
"(",
"$",
"AccountID",
"&",
"1",
")",
".",
"':'",
".",
"(",
"$",
"AccountID",
">>",
"1",
")",
";",
"}",
"default",
":",
"{",
"return",
"$",
"this",
"->",
"ConvertToUInt64",
"(",
")",
";",
"}",
"}",
"}"
] | Renders this instance into it's Steam2 "STEAM_" representation.
@return string A string Steam2 "STEAM_" representation of this SteamID. | [
"Renders",
"this",
"instance",
"into",
"it",
"s",
"Steam2",
"STEAM_",
"representation",
"."
] | train | https://github.com/xPaw/SteamID.php/blob/1782f0c0bebe16821483dc3ae81075a0f6eb7268/SteamID.php#L229-L247 |
xPaw/SteamID.php | SteamID.php | SteamID.RenderSteam3 | public function RenderSteam3()
{
$AccountInstance = $this->GetAccountInstance();
$AccountType = $this->GetAccountType();
$AccountTypeChar = isset( self::$AccountTypeChars[ $AccountType ] ) ?
self::$AccountTypeChars[ $AccountType ] :
'i';
$RenderInstance = false;
switch( $AccountType )
{
case self::TypeChat:
{
if( $AccountInstance & SteamID :: InstanceFlagClan )
{
$AccountTypeChar = 'c';
}
else if( $AccountInstance & SteamID :: InstanceFlagLobby )
{
$AccountTypeChar = 'L';
}
break;
}
case self::TypeAnonGameServer:
case self::TypeMultiseat:
{
$RenderInstance = true;
break;
}
case self::TypeIndividual:
{
$RenderInstance = $AccountInstance != self::DesktopInstance;
break;
}
}
$Return = '[' . $AccountTypeChar . ':' . $this->GetAccountUniverse() .
':' . $this->GetAccountID();
if( $RenderInstance )
{
$Return .= ':' . $AccountInstance;
}
return $Return . ']';
} | php | public function RenderSteam3()
{
$AccountInstance = $this->GetAccountInstance();
$AccountType = $this->GetAccountType();
$AccountTypeChar = isset( self::$AccountTypeChars[ $AccountType ] ) ?
self::$AccountTypeChars[ $AccountType ] :
'i';
$RenderInstance = false;
switch( $AccountType )
{
case self::TypeChat:
{
if( $AccountInstance & SteamID :: InstanceFlagClan )
{
$AccountTypeChar = 'c';
}
else if( $AccountInstance & SteamID :: InstanceFlagLobby )
{
$AccountTypeChar = 'L';
}
break;
}
case self::TypeAnonGameServer:
case self::TypeMultiseat:
{
$RenderInstance = true;
break;
}
case self::TypeIndividual:
{
$RenderInstance = $AccountInstance != self::DesktopInstance;
break;
}
}
$Return = '[' . $AccountTypeChar . ':' . $this->GetAccountUniverse() .
':' . $this->GetAccountID();
if( $RenderInstance )
{
$Return .= ':' . $AccountInstance;
}
return $Return . ']';
} | [
"public",
"function",
"RenderSteam3",
"(",
")",
"{",
"$",
"AccountInstance",
"=",
"$",
"this",
"->",
"GetAccountInstance",
"(",
")",
";",
"$",
"AccountType",
"=",
"$",
"this",
"->",
"GetAccountType",
"(",
")",
";",
"$",
"AccountTypeChar",
"=",
"isset",
"(",
"self",
"::",
"$",
"AccountTypeChars",
"[",
"$",
"AccountType",
"]",
")",
"?",
"self",
"::",
"$",
"AccountTypeChars",
"[",
"$",
"AccountType",
"]",
":",
"'i'",
";",
"$",
"RenderInstance",
"=",
"false",
";",
"switch",
"(",
"$",
"AccountType",
")",
"{",
"case",
"self",
"::",
"TypeChat",
":",
"{",
"if",
"(",
"$",
"AccountInstance",
"&",
"SteamID",
"::",
"InstanceFlagClan",
")",
"{",
"$",
"AccountTypeChar",
"=",
"'c'",
";",
"}",
"else",
"if",
"(",
"$",
"AccountInstance",
"&",
"SteamID",
"::",
"InstanceFlagLobby",
")",
"{",
"$",
"AccountTypeChar",
"=",
"'L'",
";",
"}",
"break",
";",
"}",
"case",
"self",
"::",
"TypeAnonGameServer",
":",
"case",
"self",
"::",
"TypeMultiseat",
":",
"{",
"$",
"RenderInstance",
"=",
"true",
";",
"break",
";",
"}",
"case",
"self",
"::",
"TypeIndividual",
":",
"{",
"$",
"RenderInstance",
"=",
"$",
"AccountInstance",
"!=",
"self",
"::",
"DesktopInstance",
";",
"break",
";",
"}",
"}",
"$",
"Return",
"=",
"'['",
".",
"$",
"AccountTypeChar",
".",
"':'",
".",
"$",
"this",
"->",
"GetAccountUniverse",
"(",
")",
".",
"':'",
".",
"$",
"this",
"->",
"GetAccountID",
"(",
")",
";",
"if",
"(",
"$",
"RenderInstance",
")",
"{",
"$",
"Return",
".=",
"':'",
".",
"$",
"AccountInstance",
";",
"}",
"return",
"$",
"Return",
".",
"']'",
";",
"}"
] | Renders this instance into its Steam3 representation.
@return string A string Steam3 representation of this SteamID. | [
"Renders",
"this",
"instance",
"into",
"its",
"Steam3",
"representation",
"."
] | train | https://github.com/xPaw/SteamID.php/blob/1782f0c0bebe16821483dc3ae81075a0f6eb7268/SteamID.php#L254-L303 |
xPaw/SteamID.php | SteamID.php | SteamID.RenderSteamInvite | public function RenderSteamInvite()
{
switch( $this->GetAccountType() )
{
case self::TypeInvalid:
case self::TypeIndividual:
{
$Code = dechex( $this->GetAccountID() );
$Code = strtr( $Code, self::$SteamInviteDictionary );
$Length = strlen( $Code );
// TODO: We don't know when Valve starts inserting the dash
if( $Length > 3 )
{
$Code = substr_replace( $Code, '-', (int)( $Length / 2 ), 0 );
}
return $Code;
}
default:
{
throw new InvalidArgumentException( 'This can only be used on Individual SteamID.' );
}
}
} | php | public function RenderSteamInvite()
{
switch( $this->GetAccountType() )
{
case self::TypeInvalid:
case self::TypeIndividual:
{
$Code = dechex( $this->GetAccountID() );
$Code = strtr( $Code, self::$SteamInviteDictionary );
$Length = strlen( $Code );
// TODO: We don't know when Valve starts inserting the dash
if( $Length > 3 )
{
$Code = substr_replace( $Code, '-', (int)( $Length / 2 ), 0 );
}
return $Code;
}
default:
{
throw new InvalidArgumentException( 'This can only be used on Individual SteamID.' );
}
}
} | [
"public",
"function",
"RenderSteamInvite",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"GetAccountType",
"(",
")",
")",
"{",
"case",
"self",
"::",
"TypeInvalid",
":",
"case",
"self",
"::",
"TypeIndividual",
":",
"{",
"$",
"Code",
"=",
"dechex",
"(",
"$",
"this",
"->",
"GetAccountID",
"(",
")",
")",
";",
"$",
"Code",
"=",
"strtr",
"(",
"$",
"Code",
",",
"self",
"::",
"$",
"SteamInviteDictionary",
")",
";",
"$",
"Length",
"=",
"strlen",
"(",
"$",
"Code",
")",
";",
"// TODO: We don't know when Valve starts inserting the dash",
"if",
"(",
"$",
"Length",
">",
"3",
")",
"{",
"$",
"Code",
"=",
"substr_replace",
"(",
"$",
"Code",
",",
"'-'",
",",
"(",
"int",
")",
"(",
"$",
"Length",
"/",
"2",
")",
",",
"0",
")",
";",
"}",
"return",
"$",
"Code",
";",
"}",
"default",
":",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'This can only be used on Individual SteamID.'",
")",
";",
"}",
"}",
"}"
] | Renders this instance into Steam's new invite code. Which can be formatted as:
http://s.team/p/%s
https://steamcommunity.com/user/%s
@return string A Steam invite code which can be used in a URL. | [
"Renders",
"this",
"instance",
"into",
"Steam",
"s",
"new",
"invite",
"code",
".",
"Which",
"can",
"be",
"formatted",
"as",
":",
"http",
":",
"//",
"s",
".",
"team",
"/",
"p",
"/",
"%s",
"https",
":",
"//",
"steamcommunity",
".",
"com",
"/",
"user",
"/",
"%s"
] | train | https://github.com/xPaw/SteamID.php/blob/1782f0c0bebe16821483dc3ae81075a0f6eb7268/SteamID.php#L312-L336 |
xPaw/SteamID.php | SteamID.php | SteamID.IsValid | public function IsValid()
{
$AccountType = $this->GetAccountType();
if( $AccountType <= self::TypeInvalid || $AccountType >= 11 ) // EAccountType.Max
{
return false;
}
$AccountUniverse = $this->GetAccountUniverse();
if( $AccountUniverse <= self::UniverseInvalid || $AccountUniverse >= self::UniverseMax )
{
return false;
}
$AccountID = $this->GetAccountID();
$AccountInstance = $this->GetAccountInstance();
if( $AccountType === self::TypeIndividual )
{
if( $AccountID == 0 || $AccountInstance > self::WebInstance )
{
return false;
}
}
if( $AccountType === self::TypeClan )
{
if( $AccountID == 0 || $AccountInstance != 0 )
{
return false;
}
}
if( $AccountType === self::TypeGameServer )
{
if( $AccountID == 0 )
{
return false;
}
}
return true;
} | php | public function IsValid()
{
$AccountType = $this->GetAccountType();
if( $AccountType <= self::TypeInvalid || $AccountType >= 11 ) // EAccountType.Max
{
return false;
}
$AccountUniverse = $this->GetAccountUniverse();
if( $AccountUniverse <= self::UniverseInvalid || $AccountUniverse >= self::UniverseMax )
{
return false;
}
$AccountID = $this->GetAccountID();
$AccountInstance = $this->GetAccountInstance();
if( $AccountType === self::TypeIndividual )
{
if( $AccountID == 0 || $AccountInstance > self::WebInstance )
{
return false;
}
}
if( $AccountType === self::TypeClan )
{
if( $AccountID == 0 || $AccountInstance != 0 )
{
return false;
}
}
if( $AccountType === self::TypeGameServer )
{
if( $AccountID == 0 )
{
return false;
}
}
return true;
} | [
"public",
"function",
"IsValid",
"(",
")",
"{",
"$",
"AccountType",
"=",
"$",
"this",
"->",
"GetAccountType",
"(",
")",
";",
"if",
"(",
"$",
"AccountType",
"<=",
"self",
"::",
"TypeInvalid",
"||",
"$",
"AccountType",
">=",
"11",
")",
"// EAccountType.Max",
"{",
"return",
"false",
";",
"}",
"$",
"AccountUniverse",
"=",
"$",
"this",
"->",
"GetAccountUniverse",
"(",
")",
";",
"if",
"(",
"$",
"AccountUniverse",
"<=",
"self",
"::",
"UniverseInvalid",
"||",
"$",
"AccountUniverse",
">=",
"self",
"::",
"UniverseMax",
")",
"{",
"return",
"false",
";",
"}",
"$",
"AccountID",
"=",
"$",
"this",
"->",
"GetAccountID",
"(",
")",
";",
"$",
"AccountInstance",
"=",
"$",
"this",
"->",
"GetAccountInstance",
"(",
")",
";",
"if",
"(",
"$",
"AccountType",
"===",
"self",
"::",
"TypeIndividual",
")",
"{",
"if",
"(",
"$",
"AccountID",
"==",
"0",
"||",
"$",
"AccountInstance",
">",
"self",
"::",
"WebInstance",
")",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"$",
"AccountType",
"===",
"self",
"::",
"TypeClan",
")",
"{",
"if",
"(",
"$",
"AccountID",
"==",
"0",
"||",
"$",
"AccountInstance",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"$",
"AccountType",
"===",
"self",
"::",
"TypeGameServer",
")",
"{",
"if",
"(",
"$",
"AccountID",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Gets a value indicating whether this instance is valid.
@return bool true if this instance is valid; otherwise, false. | [
"Gets",
"a",
"value",
"indicating",
"whether",
"this",
"instance",
"is",
"valid",
"."
] | train | https://github.com/xPaw/SteamID.php/blob/1782f0c0bebe16821483dc3ae81075a0f6eb7268/SteamID.php#L343-L387 |
xPaw/SteamID.php | SteamID.php | SteamID.SetFromURL | public static function SetFromURL( $Value, callable $VanityCallback )
{
if( preg_match( '/^https?:\/\/steamcommunity\.com\/profiles\/(.+?)(?:\/|$)/', $Value, $Matches ) === 1 )
{
$Value = $Matches[ 1 ];
}
else if( preg_match( '/^https?:\/\/steamcommunity\.com\/(id|groups|games)\/([\w-]+)(?:\/|$)/', $Value, $Matches ) === 1
|| preg_match( '/^()([\w-]+)$/', $Value, $Matches ) === 1 ) // Empty capturing group so that $Matches has same indexes
{
$Length = strlen( $Matches[ 2 ] );
if( $Length < 2 || $Length > 32 )
{
throw new InvalidArgumentException( 'Provided vanity url has bad length.' );
}
// Steam doesn't allow vanity urls to be valid steamids
if( self::IsNumeric( $Matches[ 2 ] ) )
{
$SteamID = new SteamID( $Matches[ 2 ] );
if( $SteamID->IsValid() )
{
return $SteamID;
}
}
switch( $Matches[ 1 ] )
{
case 'groups': $VanityType = self::VanityGroup; break;
case 'games' : $VanityType = self::VanityGameGroup; break;
default : $VanityType = self::VanityIndividual;
}
$Value = call_user_func( $VanityCallback, $Matches[ 2 ], $VanityType );
if( $Value === null )
{
throw new InvalidArgumentException( 'Provided vanity url does not resolve to any SteamID.' );
}
}
else if( preg_match( '/^https?:\/\/(steamcommunity\.com\/user|s\.team\/p)\/([\w-]+)(?:\/|$)/', $Value, $Matches ) === 1 )
{
$Value = strtolower( $Matches[ 2 ] );
$Value = strtr( $Value, array_flip( self::$SteamInviteDictionary ) );
// hexdec() will ignore any non-hexadecimal characters it encounters.
$Value = hexdec( $Value );
$Value = '[U:1:' . $Value . ']';
}
return new SteamID( $Value );
} | php | public static function SetFromURL( $Value, callable $VanityCallback )
{
if( preg_match( '/^https?:\/\/steamcommunity\.com\/profiles\/(.+?)(?:\/|$)/', $Value, $Matches ) === 1 )
{
$Value = $Matches[ 1 ];
}
else if( preg_match( '/^https?:\/\/steamcommunity\.com\/(id|groups|games)\/([\w-]+)(?:\/|$)/', $Value, $Matches ) === 1
|| preg_match( '/^()([\w-]+)$/', $Value, $Matches ) === 1 ) // Empty capturing group so that $Matches has same indexes
{
$Length = strlen( $Matches[ 2 ] );
if( $Length < 2 || $Length > 32 )
{
throw new InvalidArgumentException( 'Provided vanity url has bad length.' );
}
// Steam doesn't allow vanity urls to be valid steamids
if( self::IsNumeric( $Matches[ 2 ] ) )
{
$SteamID = new SteamID( $Matches[ 2 ] );
if( $SteamID->IsValid() )
{
return $SteamID;
}
}
switch( $Matches[ 1 ] )
{
case 'groups': $VanityType = self::VanityGroup; break;
case 'games' : $VanityType = self::VanityGameGroup; break;
default : $VanityType = self::VanityIndividual;
}
$Value = call_user_func( $VanityCallback, $Matches[ 2 ], $VanityType );
if( $Value === null )
{
throw new InvalidArgumentException( 'Provided vanity url does not resolve to any SteamID.' );
}
}
else if( preg_match( '/^https?:\/\/(steamcommunity\.com\/user|s\.team\/p)\/([\w-]+)(?:\/|$)/', $Value, $Matches ) === 1 )
{
$Value = strtolower( $Matches[ 2 ] );
$Value = strtr( $Value, array_flip( self::$SteamInviteDictionary ) );
// hexdec() will ignore any non-hexadecimal characters it encounters.
$Value = hexdec( $Value );
$Value = '[U:1:' . $Value . ']';
}
return new SteamID( $Value );
} | [
"public",
"static",
"function",
"SetFromURL",
"(",
"$",
"Value",
",",
"callable",
"$",
"VanityCallback",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^https?:\\/\\/steamcommunity\\.com\\/profiles\\/(.+?)(?:\\/|$)/'",
",",
"$",
"Value",
",",
"$",
"Matches",
")",
"===",
"1",
")",
"{",
"$",
"Value",
"=",
"$",
"Matches",
"[",
"1",
"]",
";",
"}",
"else",
"if",
"(",
"preg_match",
"(",
"'/^https?:\\/\\/steamcommunity\\.com\\/(id|groups|games)\\/([\\w-]+)(?:\\/|$)/'",
",",
"$",
"Value",
",",
"$",
"Matches",
")",
"===",
"1",
"||",
"preg_match",
"(",
"'/^()([\\w-]+)$/'",
",",
"$",
"Value",
",",
"$",
"Matches",
")",
"===",
"1",
")",
"// Empty capturing group so that $Matches has same indexes",
"{",
"$",
"Length",
"=",
"strlen",
"(",
"$",
"Matches",
"[",
"2",
"]",
")",
";",
"if",
"(",
"$",
"Length",
"<",
"2",
"||",
"$",
"Length",
">",
"32",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Provided vanity url has bad length.'",
")",
";",
"}",
"// Steam doesn't allow vanity urls to be valid steamids",
"if",
"(",
"self",
"::",
"IsNumeric",
"(",
"$",
"Matches",
"[",
"2",
"]",
")",
")",
"{",
"$",
"SteamID",
"=",
"new",
"SteamID",
"(",
"$",
"Matches",
"[",
"2",
"]",
")",
";",
"if",
"(",
"$",
"SteamID",
"->",
"IsValid",
"(",
")",
")",
"{",
"return",
"$",
"SteamID",
";",
"}",
"}",
"switch",
"(",
"$",
"Matches",
"[",
"1",
"]",
")",
"{",
"case",
"'groups'",
":",
"$",
"VanityType",
"=",
"self",
"::",
"VanityGroup",
";",
"break",
";",
"case",
"'games'",
":",
"$",
"VanityType",
"=",
"self",
"::",
"VanityGameGroup",
";",
"break",
";",
"default",
":",
"$",
"VanityType",
"=",
"self",
"::",
"VanityIndividual",
";",
"}",
"$",
"Value",
"=",
"call_user_func",
"(",
"$",
"VanityCallback",
",",
"$",
"Matches",
"[",
"2",
"]",
",",
"$",
"VanityType",
")",
";",
"if",
"(",
"$",
"Value",
"===",
"null",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Provided vanity url does not resolve to any SteamID.'",
")",
";",
"}",
"}",
"else",
"if",
"(",
"preg_match",
"(",
"'/^https?:\\/\\/(steamcommunity\\.com\\/user|s\\.team\\/p)\\/([\\w-]+)(?:\\/|$)/'",
",",
"$",
"Value",
",",
"$",
"Matches",
")",
"===",
"1",
")",
"{",
"$",
"Value",
"=",
"strtolower",
"(",
"$",
"Matches",
"[",
"2",
"]",
")",
";",
"$",
"Value",
"=",
"strtr",
"(",
"$",
"Value",
",",
"array_flip",
"(",
"self",
"::",
"$",
"SteamInviteDictionary",
")",
")",
";",
"// hexdec() will ignore any non-hexadecimal characters it encounters.",
"$",
"Value",
"=",
"hexdec",
"(",
"$",
"Value",
")",
";",
"$",
"Value",
"=",
"'[U:1:'",
".",
"$",
"Value",
".",
"']'",
";",
"}",
"return",
"new",
"SteamID",
"(",
"$",
"Value",
")",
";",
"}"
] | Returns a SteamID instance constructed from a steamcommunity.com
URL form, or simply from a vanity url.
Please note that you must implement vanity lookup function using
ISteamUser/ResolveVanityURL api interface yourself.
Callback function must return resolved SteamID as a string,
or null if API returns success=42 (meaning no match).
It's up to you to throw any exceptions if you wish to do so.
This function can act as a pass-through for rendered Steam2/Steam3 ids.
Example implementation is provided in `VanityURLs.php` file.
@param string $Value Input URL
@param string $VanityCallback Callback which is called when a vanity lookup is required
@return SteamID Fluent interface
@throws InvalidArgumentException | [
"Returns",
"a",
"SteamID",
"instance",
"constructed",
"from",
"a",
"steamcommunity",
".",
"com",
"URL",
"form",
"or",
"simply",
"from",
"a",
"vanity",
"url",
"."
] | train | https://github.com/xPaw/SteamID.php/blob/1782f0c0bebe16821483dc3ae81075a0f6eb7268/SteamID.php#L412-L465 |
xPaw/SteamID.php | SteamID.php | SteamID.SetFromUInt64 | public function SetFromUInt64( $Value )
{
if( self::IsNumeric( $Value ) )
{
$this->Data = gmp_init( $Value, 10 );
}
else
{
throw new InvalidArgumentException( 'Provided SteamID is not numeric.' );
}
return $this;
} | php | public function SetFromUInt64( $Value )
{
if( self::IsNumeric( $Value ) )
{
$this->Data = gmp_init( $Value, 10 );
}
else
{
throw new InvalidArgumentException( 'Provided SteamID is not numeric.' );
}
return $this;
} | [
"public",
"function",
"SetFromUInt64",
"(",
"$",
"Value",
")",
"{",
"if",
"(",
"self",
"::",
"IsNumeric",
"(",
"$",
"Value",
")",
")",
"{",
"$",
"this",
"->",
"Data",
"=",
"gmp_init",
"(",
"$",
"Value",
",",
"10",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Provided SteamID is not numeric.'",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Sets the various components of this SteamID from a 64bit integer form.
@param int|string $Value The 64bit integer to assign this SteamID from.
@return SteamID Fluent interface
@throws InvalidArgumentException | [
"Sets",
"the",
"various",
"components",
"of",
"this",
"SteamID",
"from",
"a",
"64bit",
"integer",
"form",
"."
] | train | https://github.com/xPaw/SteamID.php/blob/1782f0c0bebe16821483dc3ae81075a0f6eb7268/SteamID.php#L476-L488 |
xPaw/SteamID.php | SteamID.php | SteamID.Get | private function Get( $BitOffset, $ValueMask )
{
return gmp_and( self::ShiftRight( $this->Data, $BitOffset ), $ValueMask );
} | php | private function Get( $BitOffset, $ValueMask )
{
return gmp_and( self::ShiftRight( $this->Data, $BitOffset ), $ValueMask );
} | [
"private",
"function",
"Get",
"(",
"$",
"BitOffset",
",",
"$",
"ValueMask",
")",
"{",
"return",
"gmp_and",
"(",
"self",
"::",
"ShiftRight",
"(",
"$",
"this",
"->",
"Data",
",",
"$",
"BitOffset",
")",
",",
"$",
"ValueMask",
")",
";",
"}"
] | @param int $BitOffset
@param int|string $ValueMask
@return \GMP | [
"@param",
"int",
"$BitOffset",
"@param",
"int|string",
"$ValueMask"
] | train | https://github.com/xPaw/SteamID.php/blob/1782f0c0bebe16821483dc3ae81075a0f6eb7268/SteamID.php#L603-L606 |
xPaw/SteamID.php | SteamID.php | SteamID.Set | private function Set( $BitOffset, $ValueMask, $Value )
{
$this->Data = gmp_or(
gmp_and( $this->Data, gmp_com( self::ShiftLeft( $ValueMask, $BitOffset ) ) ),
self::ShiftLeft( gmp_and( $Value, $ValueMask ), $BitOffset )
);
} | php | private function Set( $BitOffset, $ValueMask, $Value )
{
$this->Data = gmp_or(
gmp_and( $this->Data, gmp_com( self::ShiftLeft( $ValueMask, $BitOffset ) ) ),
self::ShiftLeft( gmp_and( $Value, $ValueMask ), $BitOffset )
);
} | [
"private",
"function",
"Set",
"(",
"$",
"BitOffset",
",",
"$",
"ValueMask",
",",
"$",
"Value",
")",
"{",
"$",
"this",
"->",
"Data",
"=",
"gmp_or",
"(",
"gmp_and",
"(",
"$",
"this",
"->",
"Data",
",",
"gmp_com",
"(",
"self",
"::",
"ShiftLeft",
"(",
"$",
"ValueMask",
",",
"$",
"BitOffset",
")",
")",
")",
",",
"self",
"::",
"ShiftLeft",
"(",
"gmp_and",
"(",
"$",
"Value",
",",
"$",
"ValueMask",
")",
",",
"$",
"BitOffset",
")",
")",
";",
"}"
] | @param int $BitOffset
@param int|string $ValueMask
@param int|string $Value
@return void | [
"@param",
"int",
"$BitOffset",
"@param",
"int|string",
"$ValueMask",
"@param",
"int|string",
"$Value"
] | train | https://github.com/xPaw/SteamID.php/blob/1782f0c0bebe16821483dc3ae81075a0f6eb7268/SteamID.php#L615-L621 |
yunpian/yunpian-php-sdk | src/YunpianClient.php | YunpianClient.create | static function create($apikey, array $conf = []) {
$clnt = new YunpianClient();
$clnt->conf->init()->with($apikey, $conf);
$clnt->initHttp($clnt->conf); // YunpianGuzzle->initHttp
return $clnt;
} | php | static function create($apikey, array $conf = []) {
$clnt = new YunpianClient();
$clnt->conf->init()->with($apikey, $conf);
$clnt->initHttp($clnt->conf); // YunpianGuzzle->initHttp
return $clnt;
} | [
"static",
"function",
"create",
"(",
"$",
"apikey",
",",
"array",
"$",
"conf",
"=",
"[",
"]",
")",
"{",
"$",
"clnt",
"=",
"new",
"YunpianClient",
"(",
")",
";",
"$",
"clnt",
"->",
"conf",
"->",
"init",
"(",
")",
"->",
"with",
"(",
"$",
"apikey",
",",
"$",
"conf",
")",
";",
"$",
"clnt",
"->",
"initHttp",
"(",
"$",
"clnt",
"->",
"conf",
")",
";",
"// YunpianGuzzle->initHttp",
"return",
"$",
"clnt",
";",
"}"
] | Initialize/Create YunpianClient
@param string $apikey
@param array $conf
@return \Yunpian\SDK\YunpianClient | [
"Initialize",
"/",
"Create",
"YunpianClient"
] | train | https://github.com/yunpian/yunpian-php-sdk/blob/b2c06c335807831e6d0f7818873f87735dd1bb0f/src/YunpianClient.php#L39-L44 |
yunpian/yunpian-php-sdk | src/Api/VoiceApi.php | VoiceApi.pull_status | function pull_status(array $param) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::VOICE_STATUS];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path("pull_status.json")->post($param, $h, $r);
} | php | function pull_status(array $param) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::VOICE_STATUS];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path("pull_status.json")->post($param, $h, $r);
} | [
"function",
"pull_status",
"(",
"array",
"$",
"param",
")",
"{",
"static",
"$",
"must",
"=",
"[",
"self",
"::",
"APIKEY",
"]",
";",
"$",
"r",
"=",
"$",
"this",
"->",
"verifyParam",
"(",
"$",
"param",
",",
"$",
"must",
")",
";",
"if",
"(",
"!",
"$",
"r",
"->",
"isSucc",
"(",
")",
")",
"return",
"$",
"r",
";",
"$",
"v",
"=",
"$",
"this",
"->",
"version",
"(",
")",
";",
"$",
"h",
"=",
"new",
"CommonResultHandler",
"(",
"function",
"(",
"$",
"rsp",
")",
"use",
"(",
"$",
"v",
")",
"{",
"switch",
"(",
"$",
"v",
")",
"{",
"case",
"self",
"::",
"VERSION_V1",
":",
"return",
"$",
"rsp",
"[",
"self",
"::",
"VOICE_STATUS",
"]",
";",
"case",
"self",
"::",
"VERSION_V2",
":",
"return",
"$",
"rsp",
";",
"}",
"return",
"null",
";",
"}",
")",
";",
"return",
"$",
"this",
"->",
"path",
"(",
"\"pull_status.json\"",
")",
"->",
"post",
"(",
"$",
"param",
",",
"$",
"h",
",",
"$",
"r",
")",
";",
"}"
] | <h1>获取状态报告</h1>
<p>
参数名 是否必须 描述 示例
</p>
<p>
apikey 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
</p>
<p>
page_size 否 每页个数,最大100个,默认20个 20
</p>
@param array $param
@return Result | [
"<h1",
">",
"获取状态报告<",
"/",
"h1",
">"
] | train | https://github.com/yunpian/yunpian-php-sdk/blob/b2c06c335807831e6d0f7818873f87735dd1bb0f/src/Api/VoiceApi.php#L93-L109 |
yunpian/yunpian-php-sdk | src/YunpianConf.php | YunpianConf.with | function with($apikey, array $conf = []) {
if (!empty($conf)) foreach ($conf as $key => $value) {
$this->conf[$key] = $value;
}
if (isset($apikey)) $this->conf[self::YP_APIKEY] = $apikey;
return $this;
} | php | function with($apikey, array $conf = []) {
if (!empty($conf)) foreach ($conf as $key => $value) {
$this->conf[$key] = $value;
}
if (isset($apikey)) $this->conf[self::YP_APIKEY] = $apikey;
return $this;
} | [
"function",
"with",
"(",
"$",
"apikey",
",",
"array",
"$",
"conf",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"conf",
")",
")",
"foreach",
"(",
"$",
"conf",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"conf",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"apikey",
")",
")",
"$",
"this",
"->",
"conf",
"[",
"self",
"::",
"YP_APIKEY",
"]",
"=",
"$",
"apikey",
";",
"return",
"$",
"this",
";",
"}"
] | to upsert $conf
@param string $apikey
@param array $conf
@return \Yunpian\Sdk\YunpianConf | [
"to",
"upsert",
"$conf"
] | train | https://github.com/yunpian/yunpian-php-sdk/blob/b2c06c335807831e6d0f7818873f87735dd1bb0f/src/YunpianConf.php#L25-L33 |
yunpian/yunpian-php-sdk | src/YunpianConf.php | YunpianConf.init | function init() {
if (is_null($this->conf)) {
$this->conf = [];
}
$yp = parse_ini_file("yunpian.ini");
foreach ($yp as $key => $value) {
$this->conf[$key] = $value;
}
return $this;
} | php | function init() {
if (is_null($this->conf)) {
$this->conf = [];
}
$yp = parse_ini_file("yunpian.ini");
foreach ($yp as $key => $value) {
$this->conf[$key] = $value;
}
return $this;
} | [
"function",
"init",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"conf",
")",
")",
"{",
"$",
"this",
"->",
"conf",
"=",
"[",
"]",
";",
"}",
"$",
"yp",
"=",
"parse_ini_file",
"(",
"\"yunpian.ini\"",
")",
";",
"foreach",
"(",
"$",
"yp",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"conf",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | load yunpian.ini to initialize YunpianConf firstly:
<p>
</p>
@return Yunpian\Sdk\YunpianConf | [
"load",
"yunpian",
".",
"ini",
"to",
"initialize",
"YunpianConf",
"firstly",
":",
"<p",
">"
] | train | https://github.com/yunpian/yunpian-php-sdk/blob/b2c06c335807831e6d0f7818873f87735dd1bb0f/src/YunpianConf.php#L43-L53 |
yunpian/yunpian-php-sdk | src/Api/SmsApi.php | SmsApi.get_reply | function get_reply(array $param) {
static $must = [self::APIKEY,self::START_TIME,self::END_TIME,self::PAGE_NUM,self::PAGE_SIZE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::SMS_REPLY];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_reply.json')->post($param, $h, $r);
} | php | function get_reply(array $param) {
static $must = [self::APIKEY,self::START_TIME,self::END_TIME,self::PAGE_NUM,self::PAGE_SIZE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::SMS_REPLY];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_reply.json')->post($param, $h, $r);
} | [
"function",
"get_reply",
"(",
"array",
"$",
"param",
")",
"{",
"static",
"$",
"must",
"=",
"[",
"self",
"::",
"APIKEY",
",",
"self",
"::",
"START_TIME",
",",
"self",
"::",
"END_TIME",
",",
"self",
"::",
"PAGE_NUM",
",",
"self",
"::",
"PAGE_SIZE",
"]",
";",
"$",
"r",
"=",
"$",
"this",
"->",
"verifyParam",
"(",
"$",
"param",
",",
"$",
"must",
")",
";",
"if",
"(",
"!",
"$",
"r",
"->",
"isSucc",
"(",
")",
")",
"return",
"$",
"r",
";",
"$",
"v",
"=",
"$",
"this",
"->",
"version",
"(",
")",
";",
"$",
"h",
"=",
"new",
"CommonResultHandler",
"(",
"function",
"(",
"$",
"rsp",
")",
"use",
"(",
"$",
"v",
")",
"{",
"switch",
"(",
"$",
"v",
")",
"{",
"case",
"self",
"::",
"VERSION_V1",
":",
"return",
"$",
"rsp",
"[",
"self",
"::",
"SMS_REPLY",
"]",
";",
"case",
"self",
"::",
"VERSION_V2",
":",
"return",
"$",
"rsp",
";",
"}",
"return",
"null",
";",
"}",
")",
";",
"return",
"$",
"this",
"->",
"path",
"(",
"'get_reply.json'",
")",
"->",
"post",
"(",
"$",
"param",
",",
"$",
"h",
",",
"$",
"r",
")",
";",
"}"
] | <h1>查回复的短信</h1>
<p>
参数名 类型 是否必须 描述 示例
</p>
<p>
apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
</p>
<p>
start_time String 是 短信回复开始时间 2013-08-11 00:00:00
</p>
<p>
end_time String 是 短信回复结束时间 2013-08-12 00:00:00
</p>
<p>
page_num Integer 是 页码,默认值为1 1
</p>
<p>
page_size Integer 是 每页个数,最大100个 20
</p>
<p>
mobile String 否 填写时只查该手机号的回复,不填时查所有的回复 15205201314
</p>
<p>
return_fields 否 返回字段(暂未开放
</p>
<p>
sort_fields 否 排序字段(暂未开放) 默认按提交时间降序
</p>
@param array $param
@return Result | [
"<h1",
">",
"查回复的短信<",
"/",
"h1",
">"
] | train | https://github.com/yunpian/yunpian-php-sdk/blob/b2c06c335807831e6d0f7818873f87735dd1bb0f/src/Api/SmsApi.php#L334-L350 |
yunpian/yunpian-php-sdk | src/Api/SmsApi.php | SmsApi.get_black_word | function get_black_word(array $param) {
static $must = [self::APIKEY,self::TEXT];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::RESULT];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_black_word.json')->post($param, $h, $r);
} | php | function get_black_word(array $param) {
static $must = [self::APIKEY,self::TEXT];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::RESULT];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_black_word.json')->post($param, $h, $r);
} | [
"function",
"get_black_word",
"(",
"array",
"$",
"param",
")",
"{",
"static",
"$",
"must",
"=",
"[",
"self",
"::",
"APIKEY",
",",
"self",
"::",
"TEXT",
"]",
";",
"$",
"r",
"=",
"$",
"this",
"->",
"verifyParam",
"(",
"$",
"param",
",",
"$",
"must",
")",
";",
"if",
"(",
"!",
"$",
"r",
"->",
"isSucc",
"(",
")",
")",
"return",
"$",
"r",
";",
"$",
"v",
"=",
"$",
"this",
"->",
"version",
"(",
")",
";",
"$",
"h",
"=",
"new",
"CommonResultHandler",
"(",
"function",
"(",
"$",
"rsp",
")",
"use",
"(",
"$",
"v",
")",
"{",
"switch",
"(",
"$",
"v",
")",
"{",
"case",
"self",
"::",
"VERSION_V1",
":",
"return",
"$",
"rsp",
"[",
"self",
"::",
"RESULT",
"]",
";",
"case",
"self",
"::",
"VERSION_V2",
":",
"return",
"$",
"rsp",
";",
"}",
"return",
"null",
";",
"}",
")",
";",
"return",
"$",
"this",
"->",
"path",
"(",
"'get_black_word.json'",
")",
"->",
"post",
"(",
"$",
"param",
",",
"$",
"h",
",",
"$",
"r",
")",
";",
"}"
] | <h1>查屏蔽词</h1>
<p>
参数名 类型 是否必须 描述 示例
</p>
<p>
apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
</p>
<p>
text String 是 要检查的短信模板或者内容 这是一条测试短信
</p>
@param array $param
@return Result | [
"<h1",
">",
"查屏蔽词<",
"/",
"h1",
">"
] | train | https://github.com/yunpian/yunpian-php-sdk/blob/b2c06c335807831e6d0f7818873f87735dd1bb0f/src/Api/SmsApi.php#L368-L384 |
yunpian/yunpian-php-sdk | src/Api/SmsApi.php | SmsApi.get_record | function get_record(array $param) {
static $must = [self::APIKEY,self::START_TIME,self::END_TIME];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::SMS];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_record.json')->post($param, $h, $r);
} | php | function get_record(array $param) {
static $must = [self::APIKEY,self::START_TIME,self::END_TIME];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::SMS];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_record.json')->post($param, $h, $r);
} | [
"function",
"get_record",
"(",
"array",
"$",
"param",
")",
"{",
"static",
"$",
"must",
"=",
"[",
"self",
"::",
"APIKEY",
",",
"self",
"::",
"START_TIME",
",",
"self",
"::",
"END_TIME",
"]",
";",
"$",
"r",
"=",
"$",
"this",
"->",
"verifyParam",
"(",
"$",
"param",
",",
"$",
"must",
")",
";",
"if",
"(",
"!",
"$",
"r",
"->",
"isSucc",
"(",
")",
")",
"return",
"$",
"r",
";",
"$",
"v",
"=",
"$",
"this",
"->",
"version",
"(",
")",
";",
"$",
"h",
"=",
"new",
"CommonResultHandler",
"(",
"function",
"(",
"$",
"rsp",
")",
"use",
"(",
"$",
"v",
")",
"{",
"switch",
"(",
"$",
"v",
")",
"{",
"case",
"self",
"::",
"VERSION_V1",
":",
"return",
"$",
"rsp",
"[",
"self",
"::",
"SMS",
"]",
";",
"case",
"self",
"::",
"VERSION_V2",
":",
"return",
"$",
"rsp",
";",
"}",
"return",
"null",
";",
"}",
")",
";",
"return",
"$",
"this",
"->",
"path",
"(",
"'get_record.json'",
")",
"->",
"post",
"(",
"$",
"param",
",",
"$",
"h",
",",
"$",
"r",
")",
";",
"}"
] | <h1>查短信发送记录</h1>
<p>
参数名 类型 是否必须 描述 示例
</p>
<p>
apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
</p>
<p>
mobile String 否 需要查询的手机号 15205201314
</p>
<p>
start_time String 是 短信发送开始时间 2013-08-11 00:00:00
</p>
<p>
end_time String 是 短信发送结束时间 2013-08-12 00:00:00
</p>
<p>
page_num Integer 否 页码,默认值为1 1
</p>
<p>
page_size Integer 否 每页个数,最大100个 20
</p>
@param array $param
@return Result | [
"<h1",
">",
"查短信发送记录<",
"/",
"h1",
">"
] | train | https://github.com/yunpian/yunpian-php-sdk/blob/b2c06c335807831e6d0f7818873f87735dd1bb0f/src/Api/SmsApi.php#L414-L430 |
yunpian/yunpian-php-sdk | src/Api/SmsApi.php | SmsApi.count | function count(array $param) {
static $must = [self::APIKEY,self::START_TIME,self::END_TIME];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
$total = $rsp[self::TOTAL];
return is_null($total) ? 0 : $total;
});
return $this->path('count.json')->post($param, $h, $r);
} | php | function count(array $param) {
static $must = [self::APIKEY,self::START_TIME,self::END_TIME];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
$total = $rsp[self::TOTAL];
return is_null($total) ? 0 : $total;
});
return $this->path('count.json')->post($param, $h, $r);
} | [
"function",
"count",
"(",
"array",
"$",
"param",
")",
"{",
"static",
"$",
"must",
"=",
"[",
"self",
"::",
"APIKEY",
",",
"self",
"::",
"START_TIME",
",",
"self",
"::",
"END_TIME",
"]",
";",
"$",
"r",
"=",
"$",
"this",
"->",
"verifyParam",
"(",
"$",
"param",
",",
"$",
"must",
")",
";",
"if",
"(",
"!",
"$",
"r",
"->",
"isSucc",
"(",
")",
")",
"return",
"$",
"r",
";",
"$",
"v",
"=",
"$",
"this",
"->",
"version",
"(",
")",
";",
"$",
"h",
"=",
"new",
"CommonResultHandler",
"(",
"function",
"(",
"$",
"rsp",
")",
"use",
"(",
"$",
"v",
")",
"{",
"$",
"total",
"=",
"$",
"rsp",
"[",
"self",
"::",
"TOTAL",
"]",
";",
"return",
"is_null",
"(",
"$",
"total",
")",
"?",
"0",
":",
"$",
"total",
";",
"}",
")",
";",
"return",
"$",
"this",
"->",
"path",
"(",
"'count.json'",
")",
"->",
"post",
"(",
"$",
"param",
",",
"$",
"h",
",",
"$",
"r",
")",
";",
"}"
] | <h1>统计短信条数</h1>
<p>
参数名 类型 是否必须 描述 示例
</p>
<p>
apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
</p>
<p>
start_time String 是 短信发送开始时间 2013-08-11 00:00:00
</p>
<p>
end_time String 是 短信发送结束时间 2013-08-12 00:00:00
</p>
<p>
mobile String 否 需要查询的手机号 15205201314
</p>
<p>
page_num Integer 否 页码,默认值为1 1
</p>
<p>
page_size Integer 否 每页个数,最大100个 20
</p>
@param array $param
@return Result | [
"<h1",
">",
"统计短信条数<",
"/",
"h1",
">"
] | train | https://github.com/yunpian/yunpian-php-sdk/blob/b2c06c335807831e6d0f7818873f87735dd1bb0f/src/Api/SmsApi.php#L460-L471 |
yunpian/yunpian-php-sdk | src/Api/SmsApi.php | SmsApi.tpl_send | function tpl_send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::TPL_ID,self::TPL_VALUE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::RESULT];
}
return null;
});
return $this->path('tpl_send.json')->post($param, $h, $r);
} | php | function tpl_send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::TPL_ID,self::TPL_VALUE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::RESULT];
}
return null;
});
return $this->path('tpl_send.json')->post($param, $h, $r);
} | [
"function",
"tpl_send",
"(",
"array",
"$",
"param",
")",
"{",
"static",
"$",
"must",
"=",
"[",
"self",
"::",
"APIKEY",
",",
"self",
"::",
"MOBILE",
",",
"self",
"::",
"TPL_ID",
",",
"self",
"::",
"TPL_VALUE",
"]",
";",
"$",
"r",
"=",
"$",
"this",
"->",
"verifyParam",
"(",
"$",
"param",
",",
"$",
"must",
")",
";",
"if",
"(",
"!",
"$",
"r",
"->",
"isSucc",
"(",
")",
")",
"return",
"$",
"r",
";",
"$",
"v",
"=",
"$",
"this",
"->",
"version",
"(",
")",
";",
"$",
"h",
"=",
"new",
"CommonResultHandler",
"(",
"function",
"(",
"$",
"rsp",
")",
"use",
"(",
"$",
"v",
")",
"{",
"switch",
"(",
"$",
"v",
")",
"{",
"case",
"self",
"::",
"VERSION_V1",
":",
"return",
"$",
"rsp",
"[",
"self",
"::",
"RESULT",
"]",
";",
"}",
"return",
"null",
";",
"}",
")",
";",
"return",
"$",
"this",
"->",
"path",
"(",
"'tpl_send.json'",
")",
"->",
"post",
"(",
"$",
"param",
",",
"$",
"h",
",",
"$",
"r",
")",
";",
"}"
] | <h1>指定模板发送 only v1</h1>
<p>
参数名 类型 是否必须 描述 示例
</p>
<p>
apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
</p>
<p>
mobile String 是 接收的手机号 15205201314
</p>
<p>
tpl_id Long 是 模板id 1
</p>
<p>
tpl_value String 是 变量名和变量值对。请先对您的变量名和变量值分别进行urlencode再传递。使用参考:代码示例。
注:变量名和变量值都不能为空 模板: 【#company#】您的验证码是#code#。 最终发送结果: 【云片网】您的验证码是1234。
tplvalue=urlencode("#code#") + "=" + urlencode("1234") + "&" +
urlencode("#company#") + "=" + urlencode("云片网"); 若您直接发送报文请求则使用下面这种形式
tplvalue=urlencode(urlencode("#code#") + "=" + urlencode("1234") + "&" +
urlencode("#company#") + "=" + urlencode("云片网"));
</p>
<p>
extend String 否 扩展号。默认不开放,如有需要请联系客服申请 001
</p>
<p>
uid String 否 用户自定义唯一id。最大长度不超过256的字符串。 默认不开放,如有需要请联系客服申请 10001
</p>
@deprecated
@param array $param
@return Result | [
"<h1",
">",
"指定模板发送",
"only",
"v1<",
"/",
"h1",
">"
] | train | https://github.com/yunpian/yunpian-php-sdk/blob/b2c06c335807831e6d0f7818873f87735dd1bb0f/src/Api/SmsApi.php#L508-L522 |
vinkla/laravel-facebook | src/FacebookServiceProvider.php | FacebookServiceProvider.registerFactory | protected function registerFactory(): void
{
$this->app->singleton('facebook.factory', function () {
return new FacebookFactory();
});
$this->app->alias('facebook.factory', FacebookFactory::class);
} | php | protected function registerFactory(): void
{
$this->app->singleton('facebook.factory', function () {
return new FacebookFactory();
});
$this->app->alias('facebook.factory', FacebookFactory::class);
} | [
"protected",
"function",
"registerFactory",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'facebook.factory'",
",",
"function",
"(",
")",
"{",
"return",
"new",
"FacebookFactory",
"(",
")",
";",
"}",
")",
";",
"$",
"this",
"->",
"app",
"->",
"alias",
"(",
"'facebook.factory'",
",",
"FacebookFactory",
"::",
"class",
")",
";",
"}"
] | Register the factory class.
@return void | [
"Register",
"the",
"factory",
"class",
"."
] | train | https://github.com/vinkla/laravel-facebook/blob/46b5b5363500c397ea8c222331a31c1b5160bda2/src/FacebookServiceProvider.php#L74-L81 |
vinkla/laravel-facebook | src/FacebookFactory.php | FacebookFactory.make | public function make(array $config): Facebook
{
$config = $this->getConfig($config);
return $this->getClient($config);
} | php | public function make(array $config): Facebook
{
$config = $this->getConfig($config);
return $this->getClient($config);
} | [
"public",
"function",
"make",
"(",
"array",
"$",
"config",
")",
":",
"Facebook",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"$",
"config",
")",
";",
"return",
"$",
"this",
"->",
"getClient",
"(",
"$",
"config",
")",
";",
"}"
] | Make a new facebook client.
@param array $config
@return \Facebook\Facebook | [
"Make",
"a",
"new",
"facebook",
"client",
"."
] | train | https://github.com/vinkla/laravel-facebook/blob/46b5b5363500c397ea8c222331a31c1b5160bda2/src/FacebookFactory.php#L33-L38 |
vinkla/laravel-facebook | src/FacebookFactory.php | FacebookFactory.getConfig | protected function getConfig(array $config): array
{
$keys = ['app_id', 'app_secret'];
foreach ($keys as $key) {
if (!array_key_exists($key, $config)) {
throw new InvalidArgumentException("Missing configuration key [$key].");
}
}
return array_only($config, [
'app_id',
'app_secret',
'default_access_token',
'default_graph_version',
'enable_beta_mode',
'http_client_handler',
'persistent_data_handler',
'url_detection_handler',
]);
} | php | protected function getConfig(array $config): array
{
$keys = ['app_id', 'app_secret'];
foreach ($keys as $key) {
if (!array_key_exists($key, $config)) {
throw new InvalidArgumentException("Missing configuration key [$key].");
}
}
return array_only($config, [
'app_id',
'app_secret',
'default_access_token',
'default_graph_version',
'enable_beta_mode',
'http_client_handler',
'persistent_data_handler',
'url_detection_handler',
]);
} | [
"protected",
"function",
"getConfig",
"(",
"array",
"$",
"config",
")",
":",
"array",
"{",
"$",
"keys",
"=",
"[",
"'app_id'",
",",
"'app_secret'",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"config",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Missing configuration key [$key].\"",
")",
";",
"}",
"}",
"return",
"array_only",
"(",
"$",
"config",
",",
"[",
"'app_id'",
",",
"'app_secret'",
",",
"'default_access_token'",
",",
"'default_graph_version'",
",",
"'enable_beta_mode'",
",",
"'http_client_handler'",
",",
"'persistent_data_handler'",
",",
"'url_detection_handler'",
",",
"]",
")",
";",
"}"
] | Get the configuration data.
@param string[] $config
@throws \InvalidArgumentException
@return array | [
"Get",
"the",
"configuration",
"data",
"."
] | train | https://github.com/vinkla/laravel-facebook/blob/46b5b5363500c397ea8c222331a31c1b5160bda2/src/FacebookFactory.php#L49-L69 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.