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
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Projects.php
Projects.members
public function members($project_id, $parameters = []) { if (!is_array($parameters)) { @trigger_error("Deprecated: String parameter of the members() function is deprecated.", E_USER_NOTICE); $username_query = $parameters; $parameters = array(); if (!empty($use...
php
public function members($project_id, $parameters = []) { if (!is_array($parameters)) { @trigger_error("Deprecated: String parameter of the members() function is deprecated.", E_USER_NOTICE); $username_query = $parameters; $parameters = array(); if (!empty($use...
[ "public", "function", "members", "(", "$", "project_id", ",", "$", "parameters", "=", "[", "]", ")", "{", "if", "(", "!", "is_array", "(", "$", "parameters", ")", ")", "{", "@", "trigger_error", "(", "\"Deprecated: String parameter of the members() function is d...
@param int $project_id @param array $parameters ( @var string $query The query you want to search members for. ) @throws MissingOptionsException If a required option is not provided @return mixed
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Projects.php#L288-L306
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Projects.php
Projects.fork
public function fork($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setDefined(['namespace', 'path', 'name']); $resolved = $resolver->resolve($parameters); return $this->post($this->getProjectPath($project_id, 'fork'), $resolved); }
php
public function fork($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setDefined(['namespace', 'path', 'name']); $resolved = $resolver->resolve($parameters); return $this->post($this->getProjectPath($project_id, 'fork'), $resolved); }
[ "public", "function", "fork", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefined", "(", "[", "'namespace'", ",", "'path'", ...
@param int $project_id @param array $params ( @var string $namespace The ID or path of the namespace that the project will be forked to @var string $path The path of the forked project (optional) @var string $name The name of the forked project (optional) ) @return mixed
[ "@param", "int", "$project_id", "@param", "array", "$params", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Projects.php#L619-L627
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/RepositoryFiles.php
RepositoryFiles.createFile
public function createFile($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); $resolver->setRequired('branch'); $resolver->setDefined('start_branch'); $resolver->setDefined('encoding') ->setAllowedValues(...
php
public function createFile($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); $resolver->setRequired('branch'); $resolver->setDefined('start_branch'); $resolver->setDefined('encoding') ->setAllowedValues(...
[ "public", "function", "createFile", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setRequired", "(", "'file_path'", ")", ";", "$", ...
@param int $project_id @param array $parameters ( @var string $file_path Url encoded full path to new file. Ex. lib%2Fclass%2Erb. @var string $branch Name of the branch. @var string $start_branch Name of the branch to start the new commit from. @var string $encoding Change encoding to 'base64'. ...
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/RepositoryFiles.php#L51-L68
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/RepositoryFiles.php
RepositoryFiles.updateFile
public function updateFile($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); $resolver->setRequired('branch'); $resolver->setDefined('start_branch'); $resolver->setDefined('encoding') ->setAllowedValues(...
php
public function updateFile($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); $resolver->setRequired('branch'); $resolver->setDefined('start_branch'); $resolver->setDefined('encoding') ->setAllowedValues(...
[ "public", "function", "updateFile", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setRequired", "(", "'file_path'", ")", ";", "$", ...
@param int $project_id @param array $parameters ( @var string $file_path Url encoded full path to new file. Ex. lib%2Fclass%2Erb. @var string $branch Name of the branch. @var string $start_branch Name of the branch to start the new commit from. @var string $encoding Change encoding to 'base64'. ...
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/RepositoryFiles.php#L87-L105
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/RepositoryFiles.php
RepositoryFiles.deleteFile
public function deleteFile($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); $resolver->setRequired('branch'); $resolver->setDefined('start_branch'); $resolver->setDefined('author_email'); $resolver->setDefi...
php
public function deleteFile($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); $resolver->setRequired('branch'); $resolver->setDefined('start_branch'); $resolver->setDefined('author_email'); $resolver->setDefi...
[ "public", "function", "deleteFile", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setRequired", "(", "'file_path'", ")", ";", "$", ...
@param int $project_id @param array $parameters ( @var string $file_path Url encoded full path to new file. Ex. lib%2Fclass%2Erb. @var string $branch Name of the branch. @var string $start_branch Name of the branch to start the new commit from. @var string $author_email Specify the commit author's e...
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/RepositoryFiles.php#L121-L134
m4tthumphrey/php-gitlab-api
lib/Gitlab/HttpClient/Message/QueryStringBuilder.php
QueryStringBuilder.encode
private static function encode($query, $prefix) { if (!is_array($query)) { return static::rawurlencode($prefix).'='.static::rawurlencode($query); } $isIndexedArray = static::isIndexedArray($query); return implode('&', array_map(function ($value, $key) use ($prefix, $isIn...
php
private static function encode($query, $prefix) { if (!is_array($query)) { return static::rawurlencode($prefix).'='.static::rawurlencode($query); } $isIndexedArray = static::isIndexedArray($query); return implode('&', array_map(function ($value, $key) use ($prefix, $isIn...
[ "private", "static", "function", "encode", "(", "$", "query", ",", "$", "prefix", ")", "{", "if", "(", "!", "is_array", "(", "$", "query", ")", ")", "{", "return", "static", "::", "rawurlencode", "(", "$", "prefix", ")", ".", "'='", ".", "static", ...
Encode a value @param mixed $query @param string $prefix @return string
[ "Encode", "a", "value", "@param", "mixed", "$query", "@param", "string", "$prefix" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/HttpClient/Message/QueryStringBuilder.php#L36-L47
m4tthumphrey/php-gitlab-api
lib/Gitlab/HttpClient/Message/QueryStringBuilder.php
QueryStringBuilder.isIndexedArray
public static function isIndexedArray(array $query) { if (empty($query) || !isset($query[0])) { return false; } return array_keys($query) === range(0, count($query) - 1); }
php
public static function isIndexedArray(array $query) { if (empty($query) || !isset($query[0])) { return false; } return array_keys($query) === range(0, count($query) - 1); }
[ "public", "static", "function", "isIndexedArray", "(", "array", "$", "query", ")", "{", "if", "(", "empty", "(", "$", "query", ")", "||", "!", "isset", "(", "$", "query", "[", "0", "]", ")", ")", "{", "return", "false", ";", "}", "return", "array_k...
Tell if the given array is an indexed one (i.e. contains only sequential integer keys starting from 0). @param array $query @return bool
[ "Tell", "if", "the", "given", "array", "is", "an", "indexed", "one", "(", "i", ".", "e", ".", "contains", "only", "sequential", "integer", "keys", "starting", "from", "0", ")", "." ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/HttpClient/Message/QueryStringBuilder.php#L56-L63
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Groups.php
Groups.all
public function all(array $parameters = []) { $resolver = $this->getGroupSearchResolver(); return $this->get('groups', $resolver->resolve($parameters)); }
php
public function all(array $parameters = []) { $resolver = $this->getGroupSearchResolver(); return $this->get('groups', $resolver->resolve($parameters)); }
[ "public", "function", "all", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "getGroupSearchResolver", "(", ")", ";", "return", "$", "this", "->", "get", "(", "'groups'", ",", "$", "resolver", "->", ...
@param array $parameters ( @var int[] $skip_groups Skip the group IDs passes. @var bool $all_available Show all the groups you have access to. @var string $search Return list of authorized groups matching the search criteria. @var string $order_by Order groups by name or path. Default is name. @var st...
[ "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Groups.php#L20-L25
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Groups.php
Groups.projects
public function projects($id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value) { return $value ? 'true' : 'false'; }; $resolver->setDefined('archived') ->setAllowedTypes('archived'...
php
public function projects($id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value) { return $value ? 'true' : 'false'; }; $resolver->setDefined('archived') ->setAllowedTypes('archived'...
[ "public", "function", "projects", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "createOptionsResolver", "(", ")", ";", "$", "booleanNormalizer", "=", "function", "(", "Options", "$", ...
@param $id @param array $parameters ( @var bool $archived Limit by archived status. @var string $visibility Limit by visibility public, internal, or private. @var string $order_by Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. Default is created_at. @var string $so...
[ "@param", "$id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Groups.php#L176-L211
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Groups.php
Groups.subgroups
public function subgroups($group_id, array $parameters = []) { $resolver = $this->getGroupSearchResolver(); return $this->get('groups/'.$this->encodePath($group_id).'/subgroups', $resolver->resolve($parameters)); }
php
public function subgroups($group_id, array $parameters = []) { $resolver = $this->getGroupSearchResolver(); return $this->get('groups/'.$this->encodePath($group_id).'/subgroups', $resolver->resolve($parameters)); }
[ "public", "function", "subgroups", "(", "$", "group_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "getGroupSearchResolver", "(", ")", ";", "return", "$", "this", "->", "get", "(", "'groups/'", "...
@param int $group_id @param array $parameters ( @var int[] $skip_groups Skip the group IDs passes. @var bool $all_available Show all the groups you have access to. @var string $search Return list of authorized groups matching the search criteria. @var string $order_by Order groups by name or path. Def...
[ "@param", "int", "$group_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Groups.php#L227-L232
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Milestones.php
Milestones.all
public function all($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('iids') ->setAllowedTypes('iids', 'array') ->setAllowedValues('iids', function (array $value) { return count($value) == count(array_fil...
php
public function all($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('iids') ->setAllowedTypes('iids', 'array') ->setAllowedValues('iids', function (array $value) { return count($value) == count(array_fil...
[ "public", "function", "all", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "createOptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefined", "(", "'iids'", ")", "->...
@param int $project_id @param array $parameters ( @var int[] $iids Return only the milestones having the given iids. @var string $state Return only active or closed milestones. @var string $search Return only milestones with a title or description matching the provided string. ) @return mixed
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Milestones.php#L16-L31
m4tthumphrey/php-gitlab-api
lib/Gitlab/HttpClient/Plugin/GitlabExceptionThrower.php
GitlabExceptionThrower.handleRequest
public function handleRequest(RequestInterface $request, callable $next, callable $first) { return $next($request)->then(function (ResponseInterface $response) { if ($response->getStatusCode() >= 400 && $response->getStatusCode() < 600) { $content = ResponseMediator::getContent($...
php
public function handleRequest(RequestInterface $request, callable $next, callable $first) { return $next($request)->then(function (ResponseInterface $response) { if ($response->getStatusCode() >= 400 && $response->getStatusCode() < 600) { $content = ResponseMediator::getContent($...
[ "public", "function", "handleRequest", "(", "RequestInterface", "$", "request", ",", "callable", "$", "next", ",", "callable", "$", "first", ")", "{", "return", "$", "next", "(", "$", "request", ")", "->", "then", "(", "function", "(", "ResponseInterface", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/HttpClient/Plugin/GitlabExceptionThrower.php#L23-L53
m4tthumphrey/php-gitlab-api
lib/Gitlab/HttpClient/Plugin/GitlabExceptionThrower.php
GitlabExceptionThrower.parseMessage
private function parseMessage($message) { $string = $message; if (is_array($message)) { $format = '"%s" %s'; $errors = array(); foreach ($message as $field => $messages) { if (is_array($messages)) { $messages = array_unique($m...
php
private function parseMessage($message) { $string = $message; if (is_array($message)) { $format = '"%s" %s'; $errors = array(); foreach ($message as $field => $messages) { if (is_array($messages)) { $messages = array_unique($m...
[ "private", "function", "parseMessage", "(", "$", "message", ")", "{", "$", "string", "=", "$", "message", ";", "if", "(", "is_array", "(", "$", "message", ")", ")", "{", "$", "format", "=", "'\"%s\" %s'", ";", "$", "errors", "=", "array", "(", ")", ...
@param mixed $message @return string
[ "@param", "mixed", "$message" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/HttpClient/Plugin/GitlabExceptionThrower.php#L60-L85
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/ProjectNamespaces.php
ProjectNamespaces.all
public function all(array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('search'); return $this->get('namespaces', $resolver->resolve($parameters)); }
php
public function all(array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('search'); return $this->get('namespaces', $resolver->resolve($parameters)); }
[ "public", "function", "all", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "createOptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefined", "(", "'search'", ")", ";", "return", "$", "this...
@param array $parameters ( @var string $search Returns a list of namespaces the user is authorized to see based on the search criteria. ) @return mixed
[ "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/ProjectNamespaces.php#L13-L19
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Issues.php
Issues.all
public function all($project_id = null, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('state') ->setAllowedValues('state', ['opened', 'closed']) ; $resolver->setDefined('labels'); $resolver->setDefined('milestone'); ...
php
public function all($project_id = null, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('state') ->setAllowedValues('state', ['opened', 'closed']) ; $resolver->setDefined('labels'); $resolver->setDefined('milestone'); ...
[ "public", "function", "all", "(", "$", "project_id", "=", "null", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "createOptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefined", "(", "'sta...
@param int $project_id @param array $parameters ( @var string $state Return all issues or just those that are opened or closed. @var string $labels Comma-separated list of label names, issues must have all labels to be returned. No+Label lists all issues with no labels. @var string $milestone The milestone titl...
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Issues.php#L22-L54
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Issues.php
Issues.awardEmoji
public function awardEmoji($project_id, $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/award_emoji')); }
php
public function awardEmoji($project_id, $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/award_emoji')); }
[ "public", "function", "awardEmoji", "(", "$", "project_id", ",", "$", "issue_iid", ")", "{", "return", "$", "this", "->", "get", "(", "$", "this", "->", "getProjectPath", "(", "$", "project_id", ",", "'issues/'", ".", "$", "this", "->", "encodePath", "("...
@param int $project_id @param int $issue_iid @return mixed
[ "@param", "int", "$project_id", "@param", "int", "$issue_iid" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Issues.php#L317-L320
m4tthumphrey/php-gitlab-api
lib/Gitlab/HttpClient/Plugin/Authentication.php
Authentication.handleRequest
public function handleRequest(RequestInterface $request, callable $next, callable $first) { switch ($this->method) { case Client::AUTH_HTTP_TOKEN: $request = $request->withHeader('PRIVATE-TOKEN', $this->token); if (!is_null($this->sudo)) { $req...
php
public function handleRequest(RequestInterface $request, callable $next, callable $first) { switch ($this->method) { case Client::AUTH_HTTP_TOKEN: $request = $request->withHeader('PRIVATE-TOKEN', $this->token); if (!is_null($this->sudo)) { $req...
[ "public", "function", "handleRequest", "(", "RequestInterface", "$", "request", ",", "callable", "$", "next", ",", "callable", "$", "first", ")", "{", "switch", "(", "$", "this", "->", "method", ")", "{", "case", "Client", "::", "AUTH_HTTP_TOKEN", ":", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/HttpClient/Plugin/Authentication.php#L47-L85
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/GroupsBoards.php
GroupsBoards.all
public function all($group_id = null, array $parameters = []) { $resolver = $this->createOptionsResolver(); $path = $group_id === null ? 'boards' : $this->getGroupPath($group_id, 'boards'); return $this->get($path, $resolver->resolve($parameters)); }
php
public function all($group_id = null, array $parameters = []) { $resolver = $this->createOptionsResolver(); $path = $group_id === null ? 'boards' : $this->getGroupPath($group_id, 'boards'); return $this->get($path, $resolver->resolve($parameters)); }
[ "public", "function", "all", "(", "$", "group_id", "=", "null", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "createOptionsResolver", "(", ")", ";", "$", "path", "=", "$", "group_id", "===", "null...
@param int $group_id @param array $parameters @return mixed
[ "@param", "int", "$group_id", "@param", "array", "$parameters" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/GroupsBoards.php#L11-L18
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Snippets.php
Snippets.awardEmoji
public function awardEmoji($project_id, $snippet_id) { return $this->get($this->getProjectPath($project_id, 'snippets/'.$this->encodePath($snippet_id).'/award_emoji')); }
php
public function awardEmoji($project_id, $snippet_id) { return $this->get($this->getProjectPath($project_id, 'snippets/'.$this->encodePath($snippet_id).'/award_emoji')); }
[ "public", "function", "awardEmoji", "(", "$", "project_id", ",", "$", "snippet_id", ")", "{", "return", "$", "this", "->", "get", "(", "$", "this", "->", "getProjectPath", "(", "$", "project_id", ",", "'snippets/'", ".", "$", "this", "->", "encodePath", ...
@param int $project_id @param int $snippet_id @return mixed
[ "@param", "int", "$project_id", "@param", "int", "$snippet_id" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Snippets.php#L79-L82
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Environments.php
Environments.create
public function create($project_id, array $parameters = array()) { $resolver = new OptionsResolver(); $resolver->setDefined('name') ->setRequired('name') ->setAllowedTypes('name', 'string'); $resolver->setDefined('external_url') ->setAllowedTypes('external...
php
public function create($project_id, array $parameters = array()) { $resolver = new OptionsResolver(); $resolver->setDefined('name') ->setRequired('name') ->setAllowedTypes('name', 'string'); $resolver->setDefined('external_url') ->setAllowedTypes('external...
[ "public", "function", "create", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "array", "(", ")", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefined", "(", "'name'", ")", "->", "se...
@param int $project_id @param array $parameters ( @var string $name The name of the environment @var string $external_url Place to link to for this environment ) @return mixed
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Environments.php#L27-L37
m4tthumphrey/php-gitlab-api
lib/Gitlab/Model/Project.php
Project.hooks
public function hooks(array $parameters = []) { $data = $this->client->projects()->hooks($this->id, $parameters); $hooks = array(); foreach ($data as $hook) { $hooks[] = ProjectHook::fromArray($this->getClient(), $this, $hook); } return $hooks; }
php
public function hooks(array $parameters = []) { $data = $this->client->projects()->hooks($this->id, $parameters); $hooks = array(); foreach ($data as $hook) { $hooks[] = ProjectHook::fromArray($this->getClient(), $this, $hook); } return $hooks; }
[ "public", "function", "hooks", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "client", "->", "projects", "(", ")", "->", "hooks", "(", "$", "this", "->", "id", ",", "$", "parameters", ")", ";", "$"...
@param array $parameters @see Projects::hooks() for available parameters. @return ProjectHook[]
[ "@param", "array", "$parameters" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Model/Project.php#L246-L256
m4tthumphrey/php-gitlab-api
lib/Gitlab/Model/Project.php
Project.commits
public function commits(array $parameters = []) { $data = $this->client->repositories()->commits($this->id, $parameters); $commits = array(); foreach ($data as $commit) { $commits[] = Commit::fromArray($this->getClient(), $this, $commit); } return $commits; ...
php
public function commits(array $parameters = []) { $data = $this->client->repositories()->commits($this->id, $parameters); $commits = array(); foreach ($data as $commit) { $commits[] = Commit::fromArray($this->getClient(), $this, $commit); } return $commits; ...
[ "public", "function", "commits", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "client", "->", "repositories", "(", ")", "->", "commits", "(", "$", "this", "->", "id", ",", "$", "parameters", ")", ";...
@param array $parameters @see Repositories::commits() for available parameters. @return Commit[]
[ "@param", "array", "$parameters" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Model/Project.php#L463-L473
m4tthumphrey/php-gitlab-api
lib/Gitlab/Model/Project.php
Project.commitComments
public function commitComments($ref, array $parameters = []) { $data = $this->client->repositories()->commitComments($this->id, $ref, $parameters); $comments = array(); foreach ($data as $comment) { $comments[] = CommitNote::fromArray($this->getClient(), $comment); } ...
php
public function commitComments($ref, array $parameters = []) { $data = $this->client->repositories()->commitComments($this->id, $ref, $parameters); $comments = array(); foreach ($data as $comment) { $comments[] = CommitNote::fromArray($this->getClient(), $comment); } ...
[ "public", "function", "commitComments", "(", "$", "ref", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "client", "->", "repositories", "(", ")", "->", "commitComments", "(", "$", "this", "->", "id", ",...
@param string $ref @param array $parameters @see Repositories::commitComments() for available parameters. @return Commit[]
[ "@param", "string", "$ref", "@param", "array", "$parameters" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Model/Project.php#L494-L504
m4tthumphrey/php-gitlab-api
lib/Gitlab/Model/Project.php
Project.getFile
public function getFile($sha, $filepath) { return $this->client->repositories()->getFile($this->id, $filepath, $sha); }
php
public function getFile($sha, $filepath) { return $this->client->repositories()->getFile($this->id, $filepath, $sha); }
[ "public", "function", "getFile", "(", "$", "sha", ",", "$", "filepath", ")", "{", "return", "$", "this", "->", "client", "->", "repositories", "(", ")", "->", "getFile", "(", "$", "this", "->", "id", ",", "$", "filepath", ",", "$", "sha", ")", ";",...
@param $sha @param $filepath @return array
[ "@param", "$sha", "@param", "$filepath" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Model/Project.php#L572-L575
m4tthumphrey/php-gitlab-api
lib/Gitlab/Model/Project.php
Project.events
public function events(array $parameters = []) { $data = $this->client->projects()->events($this->id, $parameters); $events = array(); foreach ($data as $event) { $events[] = Event::fromArray($this->getClient(), $this, $event); } return $events; }
php
public function events(array $parameters = []) { $data = $this->client->projects()->events($this->id, $parameters); $events = array(); foreach ($data as $event) { $events[] = Event::fromArray($this->getClient(), $this, $event); } return $events; }
[ "public", "function", "events", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "client", "->", "projects", "(", ")", "->", "events", "(", "$", "this", "->", "id", ",", "$", "parameters", ")", ";", "...
@param array $parameters @see Projects::events() for available parameters. @return Event[]
[ "@param", "array", "$parameters" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Model/Project.php#L675-L685
m4tthumphrey/php-gitlab-api
lib/Gitlab/Model/Project.php
Project.mergeRequests
public function mergeRequests(array $parameters = []) { $data = $this->client->mergeRequests()->all($this->id, $parameters); $mrs = array(); foreach ($data as $mr) { $mrs[] = MergeRequest::fromArray($this->getClient(), $this, $mr); } return $mrs; }
php
public function mergeRequests(array $parameters = []) { $data = $this->client->mergeRequests()->all($this->id, $parameters); $mrs = array(); foreach ($data as $mr) { $mrs[] = MergeRequest::fromArray($this->getClient(), $this, $mr); } return $mrs; }
[ "public", "function", "mergeRequests", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "client", "->", "mergeRequests", "(", ")", "->", "all", "(", "$", "this", "->", "id", ",", "$", "parameters", ")", ...
@param array $parameters @see MergeRequests::all() for available parameters. @return MergeRequest[]
[ "@param", "array", "$parameters" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Model/Project.php#L694-L704
m4tthumphrey/php-gitlab-api
lib/Gitlab/Model/Project.php
Project.issues
public function issues(array $parameters = []) { $data = $this->client->issues()->all($this->id, $parameters); $issues = array(); foreach ($data as $issue) { $issues[] = Issue::fromArray($this->getClient(), $this, $issue); } return $issues; }
php
public function issues(array $parameters = []) { $data = $this->client->issues()->all($this->id, $parameters); $issues = array(); foreach ($data as $issue) { $issues[] = Issue::fromArray($this->getClient(), $this, $issue); } return $issues; }
[ "public", "function", "issues", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "client", "->", "issues", "(", ")", "->", "all", "(", "$", "this", "->", "id", ",", "$", "parameters", ")", ";", "$", ...
@param array $parameters @see Issues::all() for available parameters. @return Issue[]
[ "@param", "array", "$parameters" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Model/Project.php#L784-L794
m4tthumphrey/php-gitlab-api
lib/Gitlab/Model/Project.php
Project.milestones
public function milestones(array $parameters = []) { $data = $this->client->milestones()->all($this->id, $parameters); $milestones = array(); foreach ($data as $milestone) { $milestones[] = Milestone::fromArray($this->getClient(), $this, $milestone); } return $m...
php
public function milestones(array $parameters = []) { $data = $this->client->milestones()->all($this->id, $parameters); $milestones = array(); foreach ($data as $milestone) { $milestones[] = Milestone::fromArray($this->getClient(), $this, $milestone); } return $m...
[ "public", "function", "milestones", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "client", "->", "milestones", "(", ")", "->", "all", "(", "$", "this", "->", "id", ",", "$", "parameters", ")", ";", ...
@param array $parameters @see Milestones::all() for available parameters. @return Milestone[]
[ "@param", "array", "$parameters" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Model/Project.php#L862-L872
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Users.php
Users.all
public function all(array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value) { return $value->format('c'); }; $resolver->setDefined('search'); $resolver->setDefined('userna...
php
public function all(array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value) { return $value->format('c'); }; $resolver->setDefined('search'); $resolver->setDefined('userna...
[ "public", "function", "all", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "createOptionsResolver", "(", ")", ";", "$", "datetimeNormalizer", "=", "function", "(", "Options", "$", "resolver", ",", "\\"...
@param array $parameters ( @var string $search Search for user by email or username. @var string $username Lookup for user by username. @var bool $external Search for external users only. @var string $extern_uid Lookup for users by external uid....
[ "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Users.php#L23-L56
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Users.php
Users.userKey
public function userKey($user_id, $key_id) { return $this->get('users/'.$this->encodePath($user_id).'/keys/'.$this->encodePath($key_id)); }
php
public function userKey($user_id, $key_id) { return $this->get('users/'.$this->encodePath($user_id).'/keys/'.$this->encodePath($key_id)); }
[ "public", "function", "userKey", "(", "$", "user_id", ",", "$", "key_id", ")", "{", "return", "$", "this", "->", "get", "(", "'users/'", ".", "$", "this", "->", "encodePath", "(", "$", "user_id", ")", ".", "'/keys/'", ".", "$", "this", "->", "encodeP...
/* @param int $user_id @param int $key_id @return mixed
[ "/", "*" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Users.php#L221-L224
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Repositories.php
Repositories.branches
public function branches($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('search') ->setAllowedTypes('search', 'string'); return $this->get($this->getProjectPath($project_id, 'repository/branches'), $resolver->resolve($par...
php
public function branches($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('search') ->setAllowedTypes('search', 'string'); return $this->get($this->getProjectPath($project_id, 'repository/branches'), $resolver->resolve($par...
[ "public", "function", "branches", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "createOptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefined", "(", "'search'", ")"...
@param int $project_id @param array $parameters ( @var string $search ) @return mixed
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Repositories.php#L19-L26
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Repositories.php
Repositories.commits
public function commits($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $options, \DateTimeInterface $value) { return $value->format('c'); }; $resolver->setDefined('path'); $resolver->setD...
php
public function commits($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $options, \DateTimeInterface $value) { return $value->format('c'); }; $resolver->setDefined('path'); $resolver->setD...
[ "public", "function", "commits", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "createOptionsResolver", "(", ")", ";", "$", "datetimeNormalizer", "=", "function", "(", "Options", ...
@param int $project_id @param array $parameters ( @var string $ref_name The name of a repository branch or tag or if not given the default branch. @var \DateTimeInterface $since Only commits after or on this date will be returned. @var \DateTimeInterface $until Only commits before or on this date wil...
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Repositories.php#L166-L187
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/Repositories.php
Repositories.createCommit
public function createCommit($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setDefined('branch') ->setRequired('branch') ; $resolver->setDefined('commit_message') ->setRequired('commit_message') ; $resolver...
php
public function createCommit($project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setDefined('branch') ->setRequired('branch') ; $resolver->setDefined('commit_message') ->setRequired('commit_message') ; $resolver...
[ "public", "function", "createCommit", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefined", "(", "'branch'", ")", "->", "setRe...
@param int $project_id @param array $parameters ( @var string $branch Name of the branch to commit into. To create a new branch, also provide start_branch. @var string $commit_message Commit message. @var string $start_branch Name of the branch to start the new commit from. @var array $actions ( @var string...
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "(" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/Repositories.php#L236-L276
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/MergeRequests.php
MergeRequests.all
public function all($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value) { return $value->format('c'); }; $resolver->setDefined('iids') ->setAllowedType...
php
public function all($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value) { return $value->format('c'); }; $resolver->setDefined('iids') ->setAllowedType...
[ "public", "function", "all", "(", "$", "project_id", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "resolver", "=", "$", "this", "->", "createOptionsResolver", "(", ")", ";", "$", "datetimeNormalizer", "=", "function", "(", "Options", "$...
@param int $project_id @param array $parameters { @var int[] $iids Return the request having the given iid. @var string $state Return all merge requests or just those that are opened, closed, or merged. @var string $order_by Return requests ordered by cre...
[ "@param", "int", "$project_id", "@param", "array", "$parameters", "{" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/MergeRequests.php#L37-L95
m4tthumphrey/php-gitlab-api
lib/Gitlab/Api/MergeRequests.php
MergeRequests.showNotes
public function showNotes($project_id, $mr_id) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/notes')); }
php
public function showNotes($project_id, $mr_id) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/notes')); }
[ "public", "function", "showNotes", "(", "$", "project_id", ",", "$", "mr_id", ")", "{", "return", "$", "this", "->", "get", "(", "$", "this", "->", "getProjectPath", "(", "$", "project_id", ",", "'merge_requests/'", ".", "$", "this", "->", "encodePath", ...
@param int $project_id @param int $mr_id @return mixed
[ "@param", "int", "$project_id", "@param", "int", "$mr_id" ]
train
https://github.com/m4tthumphrey/php-gitlab-api/blob/d6e7539b79958a2228407247119546c6b1ada9d8/lib/Gitlab/Api/MergeRequests.php#L163-L166
sonata-project/exporter
src/Source/CsvSourceIterator.php
CsvSourceIterator.next
public function next(): void { $line = fgetcsv($this->file, 0, $this->delimiter, $this->enclosure, $this->escape); $this->currentLine = $line; ++$this->position; if ($this->hasHeaders && \is_array($line)) { $data = []; foreach ($line as $key => $value) { ...
php
public function next(): void { $line = fgetcsv($this->file, 0, $this->delimiter, $this->enclosure, $this->escape); $this->currentLine = $line; ++$this->position; if ($this->hasHeaders && \is_array($line)) { $data = []; foreach ($line as $key => $value) { ...
[ "public", "function", "next", "(", ")", ":", "void", "{", "$", "line", "=", "fgetcsv", "(", "$", "this", "->", "file", ",", "0", ",", "$", "this", "->", "delimiter", ",", "$", "this", "->", "enclosure", ",", "$", "this", "->", "escape", ")", ";",...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Source/CsvSourceIterator.php#L106-L118
sonata-project/exporter
src/Source/CsvSourceIterator.php
CsvSourceIterator.rewind
public function rewind(): void { $this->file = fopen($this->filename, 'r'); $this->position = 0; $line = fgetcsv($this->file, 0, $this->delimiter, $this->enclosure, $this->escape); if ($this->hasHeaders) { $this->columns = $line; $line = fgetcsv($this->file, 0...
php
public function rewind(): void { $this->file = fopen($this->filename, 'r'); $this->position = 0; $line = fgetcsv($this->file, 0, $this->delimiter, $this->enclosure, $this->escape); if ($this->hasHeaders) { $this->columns = $line; $line = fgetcsv($this->file, 0...
[ "public", "function", "rewind", "(", ")", ":", "void", "{", "$", "this", "->", "file", "=", "fopen", "(", "$", "this", "->", "filename", ",", "'r'", ")", ";", "$", "this", "->", "position", "=", "0", ";", "$", "line", "=", "fgetcsv", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Source/CsvSourceIterator.php#L123-L140
sonata-project/exporter
src/Source/CsvSourceIterator.php
CsvSourceIterator.valid
public function valid(): bool { if (!\is_array($this->currentLine)) { if (\is_resource($this->file)) { fclose($this->file); } return false; } return true; }
php
public function valid(): bool { if (!\is_array($this->currentLine)) { if (\is_resource($this->file)) { fclose($this->file); } return false; } return true; }
[ "public", "function", "valid", "(", ")", ":", "bool", "{", "if", "(", "!", "\\", "is_array", "(", "$", "this", "->", "currentLine", ")", ")", "{", "if", "(", "\\", "is_resource", "(", "$", "this", "->", "file", ")", ")", "{", "fclose", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Source/CsvSourceIterator.php#L145-L156
sonata-project/exporter
src/Source/AbstractXmlSourceIterator.php
AbstractXmlSourceIterator.parseRow
final protected function parseRow(): void { // only parse the next row if only one in buffer if (\count($this->bufferedRow) > 1) { return; } if (feof($this->file)) { $this->currentRow = null; return; } $this->currentRowEnded = fal...
php
final protected function parseRow(): void { // only parse the next row if only one in buffer if (\count($this->bufferedRow) > 1) { return; } if (feof($this->file)) { $this->currentRow = null; return; } $this->currentRowEnded = fal...
[ "final", "protected", "function", "parseRow", "(", ")", ":", "void", "{", "// only parse the next row if only one in buffer", "if", "(", "\\", "count", "(", "$", "this", "->", "bufferedRow", ")", ">", "1", ")", "{", "return", ";", "}", "if", "(", "feof", "...
Parse until </Row> reached.
[ "Parse", "until", "<", "/", "Row", ">", "reached", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Source/AbstractXmlSourceIterator.php#L160-L178
sonata-project/exporter
src/Source/AbstractXmlSourceIterator.php
AbstractXmlSourceIterator.prepareCurrentRow
protected function prepareCurrentRow(): void { $this->currentRow = array_shift($this->bufferedRow); if (\is_array($this->currentRow)) { $datas = []; foreach ($this->currentRow as $key => $value) { if ($this->hasHeaders) { $datas[$this->colu...
php
protected function prepareCurrentRow(): void { $this->currentRow = array_shift($this->bufferedRow); if (\is_array($this->currentRow)) { $datas = []; foreach ($this->currentRow as $key => $value) { if ($this->hasHeaders) { $datas[$this->colu...
[ "protected", "function", "prepareCurrentRow", "(", ")", ":", "void", "{", "$", "this", "->", "currentRow", "=", "array_shift", "(", "$", "this", "->", "bufferedRow", ")", ";", "if", "(", "\\", "is_array", "(", "$", "this", "->", "currentRow", ")", ")", ...
Prepare the row to return.
[ "Prepare", "the", "row", "to", "return", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Source/AbstractXmlSourceIterator.php#L183-L197
sonata-project/exporter
src/Writer/SitemapWriter.php
SitemapWriter.generateSitemapIndex
public static function generateSitemapIndex(string $folder, string $baseUrl, string $pattern = 'sitemap*.xml', string $filename = 'sitemap.xml'): void { $content = "<?xml version='1.0' encoding='UTF-8'?".">\n<sitemapindex xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.s...
php
public static function generateSitemapIndex(string $folder, string $baseUrl, string $pattern = 'sitemap*.xml', string $filename = 'sitemap.xml'): void { $content = "<?xml version='1.0' encoding='UTF-8'?".">\n<sitemapindex xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.s...
[ "public", "static", "function", "generateSitemapIndex", "(", "string", "$", "folder", ",", "string", "$", "baseUrl", ",", "string", "$", "pattern", "=", "'sitemap*.xml'", ",", "string", "$", "filename", "=", "'sitemap.xml'", ")", ":", "void", "{", "$", "cont...
Generates the sitemap index from the sitemap part avaible in the folder. @param string $folder A folder to write sitemap index @param string $baseUrl A base URL @param string $pattern A sitemap pattern, optional @param string $filename A sitemap file name, optional
[ "Generates", "the", "sitemap", "index", "from", "the", "sitemap", "part", "avaible", "in", "the", "folder", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/SitemapWriter.php#L153-L168
sonata-project/exporter
src/Writer/SitemapWriter.php
SitemapWriter.generateNewPart
private function generateNewPart(): void { if ($this->buffer) { $this->closeSitemap(); } $this->bufferUrlCount = 0; $this->bufferSize = 0; ++$this->bufferPart; if (!is_writable($this->folder)) { throw new \RuntimeException(sprintf('Unable to ...
php
private function generateNewPart(): void { if ($this->buffer) { $this->closeSitemap(); } $this->bufferUrlCount = 0; $this->bufferSize = 0; ++$this->bufferPart; if (!is_writable($this->folder)) { throw new \RuntimeException(sprintf('Unable to ...
[ "private", "function", "generateNewPart", "(", ")", ":", "void", "{", "if", "(", "$", "this", "->", "buffer", ")", "{", "$", "this", "->", "closeSitemap", "(", ")", ";", "}", "$", "this", "->", "bufferUrlCount", "=", "0", ";", "$", "this", "->", "b...
Generate a new sitemap part. @throws \RuntimeException
[ "Generate", "a", "new", "sitemap", "part", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/SitemapWriter.php#L175-L194
sonata-project/exporter
src/Writer/SitemapWriter.php
SitemapWriter.addSitemapLine
private function addSitemapLine(string $line): void { if ($this->bufferUrlCount >= self::LIMIT_URL) { $this->generateNewPart(); } if (($this->bufferSize + \strlen($line) + 9) > self::LIMIT_SIZE) { $this->generateNewPart(); } ++$this->bufferUrlCount; ...
php
private function addSitemapLine(string $line): void { if ($this->bufferUrlCount >= self::LIMIT_URL) { $this->generateNewPart(); } if (($this->bufferSize + \strlen($line) + 9) > self::LIMIT_SIZE) { $this->generateNewPart(); } ++$this->bufferUrlCount; ...
[ "private", "function", "addSitemapLine", "(", "string", "$", "line", ")", ":", "void", "{", "if", "(", "$", "this", "->", "bufferUrlCount", ">=", "self", "::", "LIMIT_URL", ")", "{", "$", "this", "->", "generateNewPart", "(", ")", ";", "}", "if", "(", ...
Add a new line into the sitemap part.
[ "Add", "a", "new", "line", "into", "the", "sitemap", "part", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/SitemapWriter.php#L199-L212
sonata-project/exporter
src/Writer/SitemapWriter.php
SitemapWriter.buildData
private function buildData(array $data): array { $default = [ 'url' => null, 'lastmod' => 'now', 'changefreq' => 'weekly', 'priority' => 0.5, 'type' => 'default', ]; $data = array_merge($default, $data); $this->fixDataType...
php
private function buildData(array $data): array { $default = [ 'url' => null, 'lastmod' => 'now', 'changefreq' => 'weekly', 'priority' => 0.5, 'type' => 'default', ]; $data = array_merge($default, $data); $this->fixDataType...
[ "private", "function", "buildData", "(", "array", "$", "data", ")", ":", "array", "{", "$", "default", "=", "[", "'url'", "=>", "null", ",", "'lastmod'", "=>", "'now'", ",", "'changefreq'", "=>", "'weekly'", ",", "'priority'", "=>", "0.5", ",", "'type'",...
Build data with default parameters. @param array $data List of parameters
[ "Build", "data", "with", "default", "parameters", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/SitemapWriter.php#L219-L234
sonata-project/exporter
src/Writer/SitemapWriter.php
SitemapWriter.fixDataType
private function fixDataType(array &$data): void { if ('default' === $data['type']) { return; } $valid_var_name = [ 'image' => 'images', 'video' => 'video', ]; if (!isset($valid_var_name[$data['type']], $data[$valid_var_name[$data['type']...
php
private function fixDataType(array &$data): void { if ('default' === $data['type']) { return; } $valid_var_name = [ 'image' => 'images', 'video' => 'video', ]; if (!isset($valid_var_name[$data['type']], $data[$valid_var_name[$data['type']...
[ "private", "function", "fixDataType", "(", "array", "&", "$", "data", ")", ":", "void", "{", "if", "(", "'default'", "===", "$", "data", "[", "'type'", "]", ")", "{", "return", ";", "}", "$", "valid_var_name", "=", "[", "'image'", "=>", "'images'", "...
Fix type of data, if data type is specific, he must to be defined in data and he must to be a array. @param array &$data List of parameters
[ "Fix", "type", "of", "data", "if", "data", "type", "is", "specific", "he", "must", "to", "be", "defined", "in", "data", "and", "he", "must", "to", "be", "a", "array", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/SitemapWriter.php#L242-L256
sonata-project/exporter
src/Writer/SitemapWriter.php
SitemapWriter.generateDefaultLine
private function generateDefaultLine(array $data): string { return sprintf(' '.'<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%s</priority></url>'."\n", $data['url'], date('Y-m-d', strtotime($data['lastmod'])), $data['changefreq'], $data['priority']); }
php
private function generateDefaultLine(array $data): string { return sprintf(' '.'<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%s</priority></url>'."\n", $data['url'], date('Y-m-d', strtotime($data['lastmod'])), $data['changefreq'], $data['priority']); }
[ "private", "function", "generateDefaultLine", "(", "array", "$", "data", ")", ":", "string", "{", "return", "sprintf", "(", "' '", ".", "'<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%s</priority></url>'", ".", "\"\\n\"", ",", "$", "data", ...
Generate standard line of sitemap. @param array $data List of parameters
[ "Generate", "standard", "line", "of", "sitemap", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/SitemapWriter.php#L263-L266
sonata-project/exporter
src/Writer/SitemapWriter.php
SitemapWriter.generateImageLine
private function generateImageLine(array $data): string { $images = ''; if (\count($data['images']) > 1000) { $data['images'] = array_splice($data['images'], 1000); } $builder = [ 'url' => 'loc', 'location' => 'geo_location', ]; ...
php
private function generateImageLine(array $data): string { $images = ''; if (\count($data['images']) > 1000) { $data['images'] = array_splice($data['images'], 1000); } $builder = [ 'url' => 'loc', 'location' => 'geo_location', ]; ...
[ "private", "function", "generateImageLine", "(", "array", "$", "data", ")", ":", "string", "{", "$", "images", "=", "''", ";", "if", "(", "\\", "count", "(", "$", "data", "[", "'images'", "]", ")", ">", "1000", ")", "{", "$", "data", "[", "'images'...
Generate image line of sitemap. @param array $data List of parameters
[ "Generate", "image", "line", "of", "sitemap", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/SitemapWriter.php#L273-L297
sonata-project/exporter
src/Writer/SitemapWriter.php
SitemapWriter.generateVideoLine
private function generateVideoLine(array $data): string { $videos = ''; $builder = [ 'thumbnail' => 'thumbnail_loc', ]; foreach ($data['video'] as $key => $video) { $videos .= sprintf('<video:%1$s>%2$s</video:%1$s>', ($builder[$key] ?? $key), $video); ...
php
private function generateVideoLine(array $data): string { $videos = ''; $builder = [ 'thumbnail' => 'thumbnail_loc', ]; foreach ($data['video'] as $key => $video) { $videos .= sprintf('<video:%1$s>%2$s</video:%1$s>', ($builder[$key] ?? $key), $video); ...
[ "private", "function", "generateVideoLine", "(", "array", "$", "data", ")", ":", "string", "{", "$", "videos", "=", "''", ";", "$", "builder", "=", "[", "'thumbnail'", "=>", "'thumbnail_loc'", ",", "]", ";", "foreach", "(", "$", "data", "[", "'video'", ...
Generate video line of sitemap. @param array $data List of parameters
[ "Generate", "video", "line", "of", "sitemap", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/SitemapWriter.php#L304-L316
sonata-project/exporter
src/Writer/SitemapWriter.php
SitemapWriter.getHeaderByFlag
private function getHeaderByFlag(): string { $namespaces = [ 'video' => 'xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"', 'image' => 'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"', ]; $result = ''; foreach ($this->headers as $f...
php
private function getHeaderByFlag(): string { $namespaces = [ 'video' => 'xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"', 'image' => 'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"', ]; $result = ''; foreach ($this->headers as $f...
[ "private", "function", "getHeaderByFlag", "(", ")", ":", "string", "{", "$", "namespaces", "=", "[", "'video'", "=>", "'xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\"'", ",", "'image'", "=>", "'xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\"'", ...
Generate additional header with namespace adapted to the content.
[ "Generate", "additional", "header", "with", "namespace", "adapted", "to", "the", "content", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/SitemapWriter.php#L321-L334
sonata-project/exporter
src/Writer/XmlExcelWriter.php
XmlExcelWriter.getXmlString
private function getXmlString(array $fields = []): string { $xmlData = []; $xmlData[] = '<Row>'; foreach ($fields as $key => $value) { $value = htmlspecialchars($value); $value = str_replace(["\r\n", "\r", "\n"], '&#10;', $value); $dataType = 'String'; ...
php
private function getXmlString(array $fields = []): string { $xmlData = []; $xmlData[] = '<Row>'; foreach ($fields as $key => $value) { $value = htmlspecialchars($value); $value = str_replace(["\r\n", "\r", "\n"], '&#10;', $value); $dataType = 'String'; ...
[ "private", "function", "getXmlString", "(", "array", "$", "fields", "=", "[", "]", ")", ":", "string", "{", "$", "xmlData", "=", "[", "]", ";", "$", "xmlData", "[", "]", "=", "'<Row>'", ";", "foreach", "(", "$", "fields", "as", "$", "key", "=>", ...
Prepare and return XML string for MS Excel XML from array.
[ "Prepare", "and", "return", "XML", "string", "for", "MS", "Excel", "XML", "from", "array", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/XmlExcelWriter.php#L98-L115
sonata-project/exporter
src/Writer/GsaFeedWriter.php
GsaFeedWriter.generateNewPart
private function generateNewPart(): void { if ($this->buffer) { $this->closeFeed(); } $this->bufferSize = 0; ++$this->bufferPart; if (!$this->folder->isWritable()) { throw new \RuntimeException(sprintf('Unable to write to folder: %s', $this->folder))...
php
private function generateNewPart(): void { if ($this->buffer) { $this->closeFeed(); } $this->bufferSize = 0; ++$this->bufferPart; if (!$this->folder->isWritable()) { throw new \RuntimeException(sprintf('Unable to write to folder: %s', $this->folder))...
[ "private", "function", "generateNewPart", "(", ")", ":", "void", "{", "if", "(", "$", "this", "->", "buffer", ")", "{", "$", "this", "->", "closeFeed", "(", ")", ";", "}", "$", "this", "->", "bufferSize", "=", "0", ";", "++", "$", "this", "->", "...
Generates a new file. @throws \RuntimeException
[ "Generates", "a", "new", "file", "." ]
train
https://github.com/sonata-project/exporter/blob/ea5640f6eb415f7da985def9f1e90c8186dbaac1/src/Writer/GsaFeedWriter.php#L109-L137
schmittjoh/serializer
src/Ordering/CustomPropertyOrderingStrategy.php
CustomPropertyOrderingStrategy.order
public function order(array $properties): array { $currentSorting = $properties ? array_combine(array_keys($properties), range(1, \count($properties))) : []; uksort($properties, function ($a, $b) use ($currentSorting) { $existsA = isset($this->ordering[$a]); $existsB = isset...
php
public function order(array $properties): array { $currentSorting = $properties ? array_combine(array_keys($properties), range(1, \count($properties))) : []; uksort($properties, function ($a, $b) use ($currentSorting) { $existsA = isset($this->ordering[$a]); $existsB = isset...
[ "public", "function", "order", "(", "array", "$", "properties", ")", ":", "array", "{", "$", "currentSorting", "=", "$", "properties", "?", "array_combine", "(", "array_keys", "(", "$", "properties", ")", ",", "range", "(", "1", ",", "\\", "count", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Ordering/CustomPropertyOrderingStrategy.php#L23-L47
schmittjoh/serializer
src/Handler/FormErrorHandler.php
FormErrorHandler.getSubscribingMethods
public static function getSubscribingMethods() { $methods = []; foreach (['xml', 'json'] as $format) { $methods[] = [ 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, 'type' => 'Symfony\Component\Form\Form', 'format' => $for...
php
public static function getSubscribingMethods() { $methods = []; foreach (['xml', 'json'] as $format) { $methods[] = [ 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, 'type' => 'Symfony\Component\Form\Form', 'format' => $for...
[ "public", "static", "function", "getSubscribingMethods", "(", ")", "{", "$", "methods", "=", "[", "]", ";", "foreach", "(", "[", "'xml'", ",", "'json'", "]", "as", "$", "format", ")", "{", "$", "methods", "[", "]", "=", "[", "'direction'", "=>", "Gra...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/FormErrorHandler.php#L31-L48
schmittjoh/serializer
src/Metadata/Driver/ExpressionMetadataTrait.php
ExpressionMetadataTrait.parseExpression
private function parseExpression(string $expression, array $names = []) { if (null === $this->expressionEvaluator) { return $expression; } try { return $this->expressionEvaluator->parse($expression, array_merge(['context', 'property_metadata', 'object'], $names)); ...
php
private function parseExpression(string $expression, array $names = []) { if (null === $this->expressionEvaluator) { return $expression; } try { return $this->expressionEvaluator->parse($expression, array_merge(['context', 'property_metadata', 'object'], $names)); ...
[ "private", "function", "parseExpression", "(", "string", "$", "expression", ",", "array", "$", "names", "=", "[", "]", ")", "{", "if", "(", "null", "===", "$", "this", "->", "expressionEvaluator", ")", "{", "return", "$", "expression", ";", "}", "try", ...
@return Expression|string @throws InvalidMetadataException
[ "@return", "Expression|string" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Metadata/Driver/ExpressionMetadataTrait.php#L23-L34
schmittjoh/serializer
src/Accessor/DefaultAccessorStrategy.php
DefaultAccessorStrategy.getValue
public function getValue(object $object, PropertyMetadata $metadata, SerializationContext $context) { if ($metadata instanceof StaticPropertyMetadata) { return $metadata->getValue(null); } if ($metadata instanceof ExpressionPropertyMetadata) { if (null === $this->eva...
php
public function getValue(object $object, PropertyMetadata $metadata, SerializationContext $context) { if ($metadata instanceof StaticPropertyMetadata) { return $metadata->getValue(null); } if ($metadata instanceof ExpressionPropertyMetadata) { if (null === $this->eva...
[ "public", "function", "getValue", "(", "object", "$", "object", ",", "PropertyMetadata", "$", "metadata", ",", "SerializationContext", "$", "context", ")", "{", "if", "(", "$", "metadata", "instanceof", "StaticPropertyMetadata", ")", "{", "return", "$", "metadat...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Accessor/DefaultAccessorStrategy.php#L52-L95
schmittjoh/serializer
src/Accessor/DefaultAccessorStrategy.php
DefaultAccessorStrategy.setValue
public function setValue(object $object, $value, PropertyMetadata $metadata, DeserializationContext $context): void { if (true === $metadata->readOnly) { throw new LogicException(sprintf('%s on %s is read only.', $metadata->name, $metadata->class)); } if (null === $metadata->set...
php
public function setValue(object $object, $value, PropertyMetadata $metadata, DeserializationContext $context): void { if (true === $metadata->readOnly) { throw new LogicException(sprintf('%s on %s is read only.', $metadata->name, $metadata->class)); } if (null === $metadata->set...
[ "public", "function", "setValue", "(", "object", "$", "object", ",", "$", "value", ",", "PropertyMetadata", "$", "metadata", ",", "DeserializationContext", "$", "context", ")", ":", "void", "{", "if", "(", "true", "===", "$", "metadata", "->", "readOnly", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Accessor/DefaultAccessorStrategy.php#L100-L131
schmittjoh/serializer
src/Metadata/ExpressionPropertyMetadata.php
ExpressionPropertyMetadata.unserialize
public function unserialize($str) { $parentStr = $this->unserializeProperties($str); [$this->class, $this->name] = unserialize($parentStr); }
php
public function unserialize($str) { $parentStr = $this->unserializeProperties($str); [$this->class, $this->name] = unserialize($parentStr); }
[ "public", "function", "unserialize", "(", "$", "str", ")", "{", "$", "parentStr", "=", "$", "this", "->", "unserializeProperties", "(", "$", "str", ")", ";", "[", "$", "this", "->", "class", ",", "$", "this", "->", "name", "]", "=", "unserialize", "(...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Metadata/ExpressionPropertyMetadata.php#L51-L55
schmittjoh/serializer
src/Metadata/ClassMetadata.php
ClassMetadata.setAccessorOrder
public function setAccessorOrder(string $order, array $customOrder = []): void { if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { throw new InvalidMetadataException(sprintf('The accessor order "%s" is invalid.', $ord...
php
public function setAccessorOrder(string $order, array $customOrder = []): void { if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { throw new InvalidMetadataException(sprintf('The accessor order "%s" is invalid.', $ord...
[ "public", "function", "setAccessorOrder", "(", "string", "$", "order", ",", "array", "$", "customOrder", "=", "[", "]", ")", ":", "void", "{", "if", "(", "!", "in_array", "(", "$", "order", ",", "[", "self", "::", "ACCESSOR_ORDER_UNDEFINED", ",", "self",...
Sets the order of properties in the class. @param array $customOrder @throws InvalidMetadataException When the accessor order is not valid. @throws InvalidMetadataException When the custom order is not valid.
[ "Sets", "the", "order", "of", "properties", "in", "the", "class", "." ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Metadata/ClassMetadata.php#L160-L175
schmittjoh/serializer
src/Metadata/ClassMetadata.php
ClassMetadata.serialize
public function serialize() { $this->sortProperties(); return serialize([ $this->preSerializeMethods, $this->postSerializeMethods, $this->postDeserializeMethods, $this->xmlRootName, $this->xmlRootNamespace, $this->xmlNamespaces...
php
public function serialize() { $this->sortProperties(); return serialize([ $this->preSerializeMethods, $this->postSerializeMethods, $this->postDeserializeMethods, $this->xmlRootName, $this->xmlRootNamespace, $this->xmlNamespaces...
[ "public", "function", "serialize", "(", ")", "{", "$", "this", "->", "sortProperties", "(", ")", ";", "return", "serialize", "(", "[", "$", "this", "->", "preSerializeMethods", ",", "$", "this", "->", "postSerializeMethods", ",", "$", "this", "->", "postDe...
@return string @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.UselessReturnAnnotation
[ "@return", "string" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Metadata/ClassMetadata.php#L271-L300
schmittjoh/serializer
src/Metadata/ClassMetadata.php
ClassMetadata.unserialize
public function unserialize($str) { $unserialized = unserialize($str); [ $this->preSerializeMethods, $this->postSerializeMethods, $this->postDeserializeMethods, $this->xmlRootName, $this->xmlRootNamespace, $this->xmlNamespaces,...
php
public function unserialize($str) { $unserialized = unserialize($str); [ $this->preSerializeMethods, $this->postSerializeMethods, $this->postDeserializeMethods, $this->xmlRootName, $this->xmlRootNamespace, $this->xmlNamespaces,...
[ "public", "function", "unserialize", "(", "$", "str", ")", "{", "$", "unserialized", "=", "unserialize", "(", "$", "str", ")", ";", "[", "$", "this", "->", "preSerializeMethods", ",", "$", "this", "->", "postSerializeMethods", ",", "$", "this", "->", "po...
@param string $str @return void @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.UselessReturnAnnotation
[ "@param", "string", "$str" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Metadata/ClassMetadata.php#L311-L365
schmittjoh/serializer
src/GraphNavigator/DeserializationGraphNavigator.php
DeserializationGraphNavigator.accept
public function accept($data, ?array $type = null) { // If the type was not given, we infer the most specific type from the // input data in serialization mode. if (null === $type) { throw new RuntimeException('The type must be given for all properties when deserializing.'); ...
php
public function accept($data, ?array $type = null) { // If the type was not given, we infer the most specific type from the // input data in serialization mode. if (null === $type) { throw new RuntimeException('The type must be given for all properties when deserializing.'); ...
[ "public", "function", "accept", "(", "$", "data", ",", "?", "array", "$", "type", "=", "null", ")", "{", "// If the type was not given, we infer the most specific type from the", "// input data in serialization mode.", "if", "(", "null", "===", "$", "type", ")", "{", ...
Called for each node of the graph that is being traversed. @param mixed $data the data depends on the direction, and type of visitor @param array|null $type array has the format ["name" => string, "params" => array] @return mixed the return value depends on the direction, and type of visitor
[ "Called", "for", "each", "node", "of", "the", "graph", "that", "is", "being", "traversed", "." ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/GraphNavigator/DeserializationGraphNavigator.php#L103-L215
schmittjoh/serializer
src/Exclusion/GroupsExclusionStrategy.php
GroupsExclusionStrategy.shouldSkipProperty
public function shouldSkipProperty(PropertyMetadata $property, Context $navigatorContext): bool { if ($this->nestedGroups) { $groups = $this->getGroupsFor($navigatorContext); if (!$property->groups) { return !in_array(self::DEFAULT_GROUP, $groups); } ...
php
public function shouldSkipProperty(PropertyMetadata $property, Context $navigatorContext): bool { if ($this->nestedGroups) { $groups = $this->getGroupsFor($navigatorContext); if (!$property->groups) { return !in_array(self::DEFAULT_GROUP, $groups); } ...
[ "public", "function", "shouldSkipProperty", "(", "PropertyMetadata", "$", "property", ",", "Context", "$", "navigatorContext", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "nestedGroups", ")", "{", "$", "groups", "=", "$", "this", "->", "getGroupsFor...
{@inheritDoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Exclusion/GroupsExclusionStrategy.php#L58-L80
schmittjoh/serializer
src/Handler/LazyHandlerRegistry.php
LazyHandlerRegistry.registerHandler
public function registerHandler(int $direction, string $typeName, string $format, $handler): void { parent::registerHandler($direction, $typeName, $format, $handler); unset($this->initializedHandlers[$direction][$typeName][$format]); }
php
public function registerHandler(int $direction, string $typeName, string $format, $handler): void { parent::registerHandler($direction, $typeName, $format, $handler); unset($this->initializedHandlers[$direction][$typeName][$format]); }
[ "public", "function", "registerHandler", "(", "int", "$", "direction", ",", "string", "$", "typeName", ",", "string", "$", "format", ",", "$", "handler", ")", ":", "void", "{", "parent", "::", "registerHandler", "(", "$", "direction", ",", "$", "typeName",...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/LazyHandlerRegistry.php#L40-L44
schmittjoh/serializer
src/Handler/LazyHandlerRegistry.php
LazyHandlerRegistry.getHandler
public function getHandler(int $direction, string $typeName, string $format) { if (isset($this->initializedHandlers[$direction][$typeName][$format])) { return $this->initializedHandlers[$direction][$typeName][$format]; } if (!isset($this->handlers[$direction][$typeName][$format]...
php
public function getHandler(int $direction, string $typeName, string $format) { if (isset($this->initializedHandlers[$direction][$typeName][$format])) { return $this->initializedHandlers[$direction][$typeName][$format]; } if (!isset($this->handlers[$direction][$typeName][$format]...
[ "public", "function", "getHandler", "(", "int", "$", "direction", ",", "string", "$", "typeName", ",", "string", "$", "format", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "initializedHandlers", "[", "$", "direction", "]", "[", "$", "typeName",...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/LazyHandlerRegistry.php#L49-L65
schmittjoh/serializer
src/JsonSerializationVisitor.php
JsonSerializationVisitor.visitArray
public function visitArray(array $data, array $type) { \array_push($this->dataStack, $data); $rs = isset($type['params'][1]) ? new \ArrayObject() : []; $isList = isset($type['params'][0]) && !isset($type['params'][1]); $elType = $this->getElementType($type); foreach ($data...
php
public function visitArray(array $data, array $type) { \array_push($this->dataStack, $data); $rs = isset($type['params'][1]) ? new \ArrayObject() : []; $isList = isset($type['params'][0]) && !isset($type['params'][1]); $elType = $this->getElementType($type); foreach ($data...
[ "public", "function", "visitArray", "(", "array", "$", "data", ",", "array", "$", "type", ")", "{", "\\", "array_push", "(", "$", "this", "->", "dataStack", ",", "$", "data", ")", ";", "$", "rs", "=", "isset", "(", "$", "type", "[", "'params'", "]"...
@param array $data @param array $type @return array|\ArrayObject
[ "@param", "array", "$data", "@param", "array", "$type" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/JsonSerializationVisitor.php#L82-L107
schmittjoh/serializer
src/JsonSerializationVisitor.php
JsonSerializationVisitor.visitProperty
public function visitProperty(PropertyMetadata $metadata, $v): void { try { $v = $this->navigator->accept($v, $metadata->type); } catch (NotAcceptableException $e) { return; } if (true === $metadata->skipWhenEmpty && ($v instanceof \ArrayObject || \is_array($...
php
public function visitProperty(PropertyMetadata $metadata, $v): void { try { $v = $this->navigator->accept($v, $metadata->type); } catch (NotAcceptableException $e) { return; } if (true === $metadata->skipWhenEmpty && ($v instanceof \ArrayObject || \is_array($...
[ "public", "function", "visitProperty", "(", "PropertyMetadata", "$", "metadata", ",", "$", "v", ")", ":", "void", "{", "try", "{", "$", "v", "=", "$", "this", "->", "navigator", "->", "accept", "(", "$", "v", ",", "$", "metadata", "->", "type", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/JsonSerializationVisitor.php#L133-L156
schmittjoh/serializer
src/JsonSerializationVisitor.php
JsonSerializationVisitor.getResult
public function getResult($data) { $result = @json_encode($data, $this->options); switch (json_last_error()) { case JSON_ERROR_NONE: return $result; case JSON_ERROR_UTF8: throw new RuntimeException('Your data could not be encoded because it c...
php
public function getResult($data) { $result = @json_encode($data, $this->options); switch (json_last_error()) { case JSON_ERROR_NONE: return $result; case JSON_ERROR_UTF8: throw new RuntimeException('Your data could not be encoded because it c...
[ "public", "function", "getResult", "(", "$", "data", ")", "{", "$", "result", "=", "@", "json_encode", "(", "$", "data", ",", "$", "this", "->", "options", ")", ";", "switch", "(", "json_last_error", "(", ")", ")", "{", "case", "JSON_ERROR_NONE", ":", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/JsonSerializationVisitor.php#L184-L198
schmittjoh/serializer
src/Construction/UnserializeObjectConstructor.php
UnserializeObjectConstructor.construct
public function construct(DeserializationVisitorInterface $visitor, ClassMetadata $metadata, $data, array $type, DeserializationContext $context): ?object { return $this->getInstantiator()->instantiate($metadata->name); }
php
public function construct(DeserializationVisitorInterface $visitor, ClassMetadata $metadata, $data, array $type, DeserializationContext $context): ?object { return $this->getInstantiator()->instantiate($metadata->name); }
[ "public", "function", "construct", "(", "DeserializationVisitorInterface", "$", "visitor", ",", "ClassMetadata", "$", "metadata", ",", "$", "data", ",", "array", "$", "type", ",", "DeserializationContext", "$", "context", ")", ":", "?", "object", "{", "return", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Construction/UnserializeObjectConstructor.php#L20-L23
schmittjoh/serializer
src/Handler/ConstraintViolationHandler.php
ConstraintViolationHandler.getSubscribingMethods
public static function getSubscribingMethods() { $methods = []; $formats = ['xml', 'json']; $types = ['Symfony\Component\Validator\ConstraintViolationList' => 'serializeList', 'Symfony\Component\Validator\ConstraintViolation' => 'serializeViolation']; foreach ($types as $type => $me...
php
public static function getSubscribingMethods() { $methods = []; $formats = ['xml', 'json']; $types = ['Symfony\Component\Validator\ConstraintViolationList' => 'serializeList', 'Symfony\Component\Validator\ConstraintViolation' => 'serializeViolation']; foreach ($types as $type => $me...
[ "public", "static", "function", "getSubscribingMethods", "(", ")", "{", "$", "methods", "=", "[", "]", ";", "$", "formats", "=", "[", "'xml'", ",", "'json'", "]", ";", "$", "types", "=", "[", "'Symfony\\Component\\Validator\\ConstraintViolationList'", "=>", "'...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/ConstraintViolationHandler.php#L19-L37
schmittjoh/serializer
src/GraphNavigator/SerializationGraphNavigator.php
SerializationGraphNavigator.accept
public function accept($data, ?array $type = null) { // If the type was not given, we infer the most specific type from the // input data in serialization mode. if (null === $type) { $typeName = \gettype($data); if ('object' === $typeName) { $typeName ...
php
public function accept($data, ?array $type = null) { // If the type was not given, we infer the most specific type from the // input data in serialization mode. if (null === $type) { $typeName = \gettype($data); if ('object' === $typeName) { $typeName ...
[ "public", "function", "accept", "(", "$", "data", ",", "?", "array", "$", "type", "=", "null", ")", "{", "// If the type was not given, we infer the most specific type from the", "// input data in serialization mode.", "if", "(", "null", "===", "$", "type", ")", "{", ...
Called for each node of the graph that is being traversed. @param mixed $data the data depends on the direction, and type of visitor @param array|null $type array has the format ["name" => string, "params" => array] @return mixed the return value depends on the direction, and type of visitor
[ "Called", "for", "each", "node", "of", "the", "graph", "that", "is", "being", "traversed", "." ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/GraphNavigator/SerializationGraphNavigator.php#L110-L245
schmittjoh/serializer
src/Handler/IteratorHandler.php
IteratorHandler.getSubscribingMethods
public static function getSubscribingMethods() { $methods = []; foreach (self::SUPPORTED_FORMATS as $format) { $methods[] = [ 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, 'type' => \ArrayIterator::class, 'format' => $fo...
php
public static function getSubscribingMethods() { $methods = []; foreach (self::SUPPORTED_FORMATS as $format) { $methods[] = [ 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, 'type' => \ArrayIterator::class, 'format' => $fo...
[ "public", "static", "function", "getSubscribingMethods", "(", ")", "{", "$", "methods", "=", "[", "]", ";", "foreach", "(", "self", "::", "SUPPORTED_FORMATS", "as", "$", "format", ")", "{", "$", "methods", "[", "]", "=", "[", "'direction'", "=>", "GraphN...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/IteratorHandler.php#L20-L57
schmittjoh/serializer
src/XmlDeserializationVisitor.php
XmlDeserializationVisitor.prepare
public function prepare($data) { $data = $this->emptyStringToSpaceCharacter($data); $previous = libxml_use_internal_errors(true); libxml_clear_errors(); $previousEntityLoaderState = libxml_disable_entity_loader($this->disableExternalEntities); if (false !== stripos($data, ...
php
public function prepare($data) { $data = $this->emptyStringToSpaceCharacter($data); $previous = libxml_use_internal_errors(true); libxml_clear_errors(); $previousEntityLoaderState = libxml_disable_entity_loader($this->disableExternalEntities); if (false !== stripos($data, ...
[ "public", "function", "prepare", "(", "$", "data", ")", "{", "$", "data", "=", "$", "this", "->", "emptyStringToSpaceCharacter", "(", "$", "data", ")", ";", "$", "previous", "=", "libxml_use_internal_errors", "(", "true", ")", ";", "libxml_clear_errors", "("...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlDeserializationVisitor.php#L73-L102
schmittjoh/serializer
src/XmlDeserializationVisitor.php
XmlDeserializationVisitor.visitBoolean
public function visitBoolean($data, array $type): bool { $data = (string) $data; if ('true' === $data || '1' === $data) { return true; } elseif ('false' === $data || '0' === $data) { return false; } else { throw new RuntimeException(sprintf('Could...
php
public function visitBoolean($data, array $type): bool { $data = (string) $data; if ('true' === $data || '1' === $data) { return true; } elseif ('false' === $data || '0' === $data) { return false; } else { throw new RuntimeException(sprintf('Could...
[ "public", "function", "visitBoolean", "(", "$", "data", ",", "array", "$", "type", ")", ":", "bool", "{", "$", "data", "=", "(", "string", ")", "$", "data", ";", "if", "(", "'true'", "===", "$", "data", "||", "'1'", "===", "$", "data", ")", "{", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlDeserializationVisitor.php#L129-L140
schmittjoh/serializer
src/XmlDeserializationVisitor.php
XmlDeserializationVisitor.visitArray
public function visitArray($data, array $type): array { // handle key-value-pairs if (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs) { if (2 !== count($type['params'])) { throw new RuntimeException('The array type must be specified as "array<...
php
public function visitArray($data, array $type): array { // handle key-value-pairs if (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs) { if (2 !== count($type['params'])) { throw new RuntimeException('The array type must be specified as "array<...
[ "public", "function", "visitArray", "(", "$", "data", ",", "array", "$", "type", ")", ":", "array", "{", "// handle key-value-pairs", "if", "(", "null", "!==", "$", "this", "->", "currentMetadata", "&&", "$", "this", "->", "currentMetadata", "->", "xmlKeyVal...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlDeserializationVisitor.php#L158-L241
schmittjoh/serializer
src/XmlDeserializationVisitor.php
XmlDeserializationVisitor.visitDiscriminatorMapProperty
public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): string { switch (true) { // Check XML attribute without namespace for discriminatorFieldName case $metadata->xmlDiscriminatorAttribute && null === $metadata->xmlDiscriminatorNamespace && isset($data->attri...
php
public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): string { switch (true) { // Check XML attribute without namespace for discriminatorFieldName case $metadata->xmlDiscriminatorAttribute && null === $metadata->xmlDiscriminatorNamespace && isset($data->attri...
[ "public", "function", "visitDiscriminatorMapProperty", "(", "$", "data", ",", "ClassMetadata", "$", "metadata", ")", ":", "string", "{", "switch", "(", "true", ")", "{", "// Check XML attribute without namespace for discriminatorFieldName", "case", "$", "metadata", "->"...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlDeserializationVisitor.php#L245-L270
schmittjoh/serializer
src/XmlDeserializationVisitor.php
XmlDeserializationVisitor.visitProperty
public function visitProperty(PropertyMetadata $metadata, $data) { $name = $metadata->serializedName; if (true === $metadata->inline) { return $this->navigator->accept($data, $metadata->type); } if ($metadata->xmlAttribute) { $attributes = $data->attributes($...
php
public function visitProperty(PropertyMetadata $metadata, $data) { $name = $metadata->serializedName; if (true === $metadata->inline) { return $this->navigator->accept($data, $metadata->type); } if ($metadata->xmlAttribute) { $attributes = $data->attributes($...
[ "public", "function", "visitProperty", "(", "PropertyMetadata", "$", "metadata", ",", "$", "data", ")", "{", "$", "name", "=", "$", "metadata", "->", "serializedName", ";", "if", "(", "true", "===", "$", "metadata", "->", "inline", ")", "{", "return", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlDeserializationVisitor.php#L280-L337
schmittjoh/serializer
src/XmlDeserializationVisitor.php
XmlDeserializationVisitor.endVisitingObject
public function endVisitingObject(ClassMetadata $metadata, $data, array $type): object { $rs = $this->currentObject; $this->objectMetadataStack->pop(); $this->revertCurrentObject(); return $rs; }
php
public function endVisitingObject(ClassMetadata $metadata, $data, array $type): object { $rs = $this->currentObject; $this->objectMetadataStack->pop(); $this->revertCurrentObject(); return $rs; }
[ "public", "function", "endVisitingObject", "(", "ClassMetadata", "$", "metadata", ",", "$", "data", ",", "array", "$", "type", ")", ":", "object", "{", "$", "rs", "=", "$", "this", "->", "currentObject", ";", "$", "this", "->", "objectMetadataStack", "->",...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlDeserializationVisitor.php#L342-L349
schmittjoh/serializer
src/XmlDeserializationVisitor.php
XmlDeserializationVisitor.isNull
public function isNull($value): bool { if ($value instanceof \SimpleXMLElement) { // Workaround for https://bugs.php.net/bug.php?id=75168 and https://github.com/schmittjoh/serializer/issues/817 // If the "name" is empty means that we are on an not-existent node and subsequent operati...
php
public function isNull($value): bool { if ($value instanceof \SimpleXMLElement) { // Workaround for https://bugs.php.net/bug.php?id=75168 and https://github.com/schmittjoh/serializer/issues/817 // If the "name" is empty means that we are on an not-existent node and subsequent operati...
[ "public", "function", "isNull", "(", "$", "value", ")", ":", "bool", "{", "if", "(", "$", "value", "instanceof", "\\", "SimpleXMLElement", ")", "{", "// Workaround for https://bugs.php.net/bug.php?id=75168 and https://github.com/schmittjoh/serializer/issues/817", "// If the \...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlDeserializationVisitor.php#L425-L445
schmittjoh/serializer
src/EventDispatcher/LazyEventDispatcher.php
LazyEventDispatcher.initializeListeners
protected function initializeListeners(string $eventName, string $loweredClass, string $format): array { $listeners = parent::initializeListeners($eventName, $loweredClass, $format); foreach ($listeners as &$listener) { if (!\is_array($listener[0]) || !\is_string($listener[0][0])) { ...
php
protected function initializeListeners(string $eventName, string $loweredClass, string $format): array { $listeners = parent::initializeListeners($eventName, $loweredClass, $format); foreach ($listeners as &$listener) { if (!\is_array($listener[0]) || !\is_string($listener[0][0])) { ...
[ "protected", "function", "initializeListeners", "(", "string", "$", "eventName", ",", "string", "$", "loweredClass", ",", "string", "$", "format", ")", ":", "array", "{", "$", "listeners", "=", "parent", "::", "initializeListeners", "(", "$", "eventName", ",",...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/EventDispatcher/LazyEventDispatcher.php#L33-L50
schmittjoh/serializer
src/Handler/DateHandler.php
DateHandler.getSubscribingMethods
public static function getSubscribingMethods() { $methods = []; $deserializationTypes = ['DateTime', 'DateTimeImmutable', 'DateInterval']; $serialisationTypes = ['DateTime', 'DateTimeImmutable', 'DateInterval']; foreach (['json', 'xml'] as $format) { foreach ($deserializ...
php
public static function getSubscribingMethods() { $methods = []; $deserializationTypes = ['DateTime', 'DateTimeImmutable', 'DateInterval']; $serialisationTypes = ['DateTime', 'DateTimeImmutable', 'DateInterval']; foreach (['json', 'xml'] as $format) { foreach ($deserializ...
[ "public", "static", "function", "getSubscribingMethods", "(", ")", "{", "$", "methods", "=", "[", "]", ";", "$", "deserializationTypes", "=", "[", "'DateTime'", ",", "'DateTimeImmutable'", ",", "'DateInterval'", "]", ";", "$", "serialisationTypes", "=", "[", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/DateHandler.php#L35-L61
schmittjoh/serializer
src/Handler/DateHandler.php
DateHandler.serializeDateTime
public function serializeDateTime(SerializationVisitorInterface $visitor, \DateTime $date, array $type, SerializationContext $context) { return $this->serializeDateTimeInterface($visitor, $date, $type, $context); }
php
public function serializeDateTime(SerializationVisitorInterface $visitor, \DateTime $date, array $type, SerializationContext $context) { return $this->serializeDateTimeInterface($visitor, $date, $type, $context); }
[ "public", "function", "serializeDateTime", "(", "SerializationVisitorInterface", "$", "visitor", ",", "\\", "DateTime", "$", "date", ",", "array", "$", "type", ",", "SerializationContext", "$", "context", ")", "{", "return", "$", "this", "->", "serializeDateTimeIn...
@param array $type @return \DOMCdataSection|\DOMText|mixed
[ "@param", "array", "$type" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/DateHandler.php#L96-L99
schmittjoh/serializer
src/Handler/DateHandler.php
DateHandler.serializeDateTimeImmutable
public function serializeDateTimeImmutable( SerializationVisitorInterface $visitor, \DateTimeImmutable $date, array $type, SerializationContext $context ) { return $this->serializeDateTimeInterface($visitor, $date, $type, $context); }
php
public function serializeDateTimeImmutable( SerializationVisitorInterface $visitor, \DateTimeImmutable $date, array $type, SerializationContext $context ) { return $this->serializeDateTimeInterface($visitor, $date, $type, $context); }
[ "public", "function", "serializeDateTimeImmutable", "(", "SerializationVisitorInterface", "$", "visitor", ",", "\\", "DateTimeImmutable", "$", "date", ",", "array", "$", "type", ",", "SerializationContext", "$", "context", ")", "{", "return", "$", "this", "->", "s...
@param array $type @return \DOMCdataSection|\DOMText|mixed
[ "@param", "array", "$type" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/DateHandler.php#L106-L113
schmittjoh/serializer
src/Handler/DateHandler.php
DateHandler.serializeDateInterval
public function serializeDateInterval(SerializationVisitorInterface $visitor, \DateInterval $date, array $type, SerializationContext $context) { $iso8601DateIntervalString = $this->format($date); if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) { return $vis...
php
public function serializeDateInterval(SerializationVisitorInterface $visitor, \DateInterval $date, array $type, SerializationContext $context) { $iso8601DateIntervalString = $this->format($date); if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) { return $vis...
[ "public", "function", "serializeDateInterval", "(", "SerializationVisitorInterface", "$", "visitor", ",", "\\", "DateInterval", "$", "date", ",", "array", "$", "type", ",", "SerializationContext", "$", "context", ")", "{", "$", "iso8601DateIntervalString", "=", "$",...
@param array $type @return \DOMCdataSection|\DOMText|mixed
[ "@param", "array", "$type" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Handler/DateHandler.php#L120-L129
schmittjoh/serializer
src/SerializerBuilder.php
SerializerBuilder.setMetadataDirs
public function setMetadataDirs(array $namespacePrefixToDirMap): self { foreach ($namespacePrefixToDirMap as $dir) { if (!is_dir($dir)) { throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); } } $this->metadataDirs ...
php
public function setMetadataDirs(array $namespacePrefixToDirMap): self { foreach ($namespacePrefixToDirMap as $dir) { if (!is_dir($dir)) { throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); } } $this->metadataDirs ...
[ "public", "function", "setMetadataDirs", "(", "array", "$", "namespacePrefixToDirMap", ")", ":", "self", "{", "foreach", "(", "$", "namespacePrefixToDirMap", "as", "$", "dir", ")", "{", "if", "(", "!", "is_dir", "(", "$", "dir", ")", ")", "{", "throw", "...
Sets a map of namespace prefixes to directories. This method overrides any previously defined directories. @param array <string,string> $namespacePrefixToDirMap @return SerializerBuilder @throws InvalidArgumentException When a directory does not exist.
[ "Sets", "a", "map", "of", "namespace", "prefixes", "to", "directories", "." ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/SerializerBuilder.php#L360-L371
schmittjoh/serializer
src/SerializerBuilder.php
SerializerBuilder.addMetadataDirs
public function addMetadataDirs(array $namespacePrefixToDirMap): self { foreach ($namespacePrefixToDirMap as $prefix => $dir) { $this->addMetadataDir($dir, $prefix); } return $this; }
php
public function addMetadataDirs(array $namespacePrefixToDirMap): self { foreach ($namespacePrefixToDirMap as $prefix => $dir) { $this->addMetadataDir($dir, $prefix); } return $this; }
[ "public", "function", "addMetadataDirs", "(", "array", "$", "namespacePrefixToDirMap", ")", ":", "self", "{", "foreach", "(", "$", "namespacePrefixToDirMap", "as", "$", "prefix", "=>", "$", "dir", ")", "{", "$", "this", "->", "addMetadataDir", "(", "$", "dir...
Adds a map of namespace prefixes to directories. @param array <string,string> $namespacePrefixToDirMap @return SerializerBuilder
[ "Adds", "a", "map", "of", "namespace", "prefixes", "to", "directories", "." ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/SerializerBuilder.php#L421-L428
schmittjoh/serializer
src/Metadata/Driver/YamlDriver.php
YamlDriver.getAllClassNames
public function getAllClassNames(): array { if (!$this->locator instanceof AdvancedFileLocatorInterface) { throw new RuntimeException( sprintf( 'Locator "%s" must be an instance of "AdvancedFileLocatorInterface".', get_class($this->locator)...
php
public function getAllClassNames(): array { if (!$this->locator instanceof AdvancedFileLocatorInterface) { throw new RuntimeException( sprintf( 'Locator "%s" must be an instance of "AdvancedFileLocatorInterface".', get_class($this->locator)...
[ "public", "function", "getAllClassNames", "(", ")", ":", "array", "{", "if", "(", "!", "$", "this", "->", "locator", "instanceof", "AdvancedFileLocatorInterface", ")", "{", "throw", "new", "RuntimeException", "(", "sprintf", "(", "'Locator \"%s\" must be an instance...
{@inheritDoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Metadata/Driver/YamlDriver.php#L71-L90
schmittjoh/serializer
src/EventDispatcher/EventDispatcher.php
EventDispatcher.addListener
public function addListener(string $eventName, $callable, ?string $class = null, ?string $format = null, ?string $interface = null): void { $this->listeners[$eventName][] = [$callable, $class, $format, $interface]; unset($this->classListeners[$eventName]); }
php
public function addListener(string $eventName, $callable, ?string $class = null, ?string $format = null, ?string $interface = null): void { $this->listeners[$eventName][] = [$callable, $class, $format, $interface]; unset($this->classListeners[$eventName]); }
[ "public", "function", "addListener", "(", "string", "$", "eventName", ",", "$", "callable", ",", "?", "string", "$", "class", "=", "null", ",", "?", "string", "$", "format", "=", "null", ",", "?", "string", "$", "interface", "=", "null", ")", ":", "v...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/EventDispatcher/EventDispatcher.php#L50-L54
schmittjoh/serializer
src/Metadata/PropertyMetadata.php
PropertyMetadata.serialize
public function serialize() { return serialize([ $this->sinceVersion, $this->untilVersion, $this->groups, $this->serializedName, $this->type, $this->xmlCollection, $this->xmlCollectionInline, $this->xmlEntryName,...
php
public function serialize() { return serialize([ $this->sinceVersion, $this->untilVersion, $this->groups, $this->serializedName, $this->type, $this->xmlCollection, $this->xmlCollectionInline, $this->xmlEntryName,...
[ "public", "function", "serialize", "(", ")", "{", "return", "serialize", "(", "[", "$", "this", "->", "sinceVersion", ",", "$", "this", "->", "untilVersion", ",", "$", "this", "->", "groups", ",", "$", "this", "->", "serializedName", ",", "$", "this", ...
@return string @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.UselessReturnAnnotation
[ "@return", "string" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Metadata/PropertyMetadata.php#L212-L242
schmittjoh/serializer
src/Naming/SerializedNameAnnotationStrategy.php
SerializedNameAnnotationStrategy.translateName
public function translateName(PropertyMetadata $property): string { if (null !== $name = $property->serializedName) { return $name; } return $this->delegate->translateName($property); }
php
public function translateName(PropertyMetadata $property): string { if (null !== $name = $property->serializedName) { return $name; } return $this->delegate->translateName($property); }
[ "public", "function", "translateName", "(", "PropertyMetadata", "$", "property", ")", ":", "string", "{", "if", "(", "null", "!==", "$", "name", "=", "$", "property", "->", "serializedName", ")", "{", "return", "$", "name", ";", "}", "return", "$", "this...
{@inheritDoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Naming/SerializedNameAnnotationStrategy.php#L29-L36
schmittjoh/serializer
src/JsonDeserializationVisitor.php
JsonDeserializationVisitor.visitArray
public function visitArray($data, array $type): array { if (!\is_array($data)) { throw new RuntimeException(sprintf('Expected array, but got %s: %s', \gettype($data), json_encode($data))); } // If no further parameters were given, keys/values are just passed as is. if (!...
php
public function visitArray($data, array $type): array { if (!\is_array($data)) { throw new RuntimeException(sprintf('Expected array, but got %s: %s', \gettype($data), json_encode($data))); } // If no further parameters were given, keys/values are just passed as is. if (!...
[ "public", "function", "visitArray", "(", "$", "data", ",", "array", "$", "type", ")", ":", "array", "{", "if", "(", "!", "\\", "is_array", "(", "$", "data", ")", ")", "{", "throw", "new", "RuntimeException", "(", "sprintf", "(", "'Expected array, but got...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/JsonDeserializationVisitor.php#L87-L124
schmittjoh/serializer
src/JsonDeserializationVisitor.php
JsonDeserializationVisitor.visitDiscriminatorMapProperty
public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): string { if (isset($data[$metadata->discriminatorFieldName])) { return (string) $data[$metadata->discriminatorFieldName]; } throw new LogicException(sprintf( 'The discriminator field name ...
php
public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): string { if (isset($data[$metadata->discriminatorFieldName])) { return (string) $data[$metadata->discriminatorFieldName]; } throw new LogicException(sprintf( 'The discriminator field name ...
[ "public", "function", "visitDiscriminatorMapProperty", "(", "$", "data", ",", "ClassMetadata", "$", "metadata", ")", ":", "string", "{", "if", "(", "isset", "(", "$", "data", "[", "$", "metadata", "->", "discriminatorFieldName", "]", ")", ")", "{", "return",...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/JsonDeserializationVisitor.php#L129-L140
schmittjoh/serializer
src/JsonDeserializationVisitor.php
JsonDeserializationVisitor.visitProperty
public function visitProperty(PropertyMetadata $metadata, $data) { if (null === $data) { return null; } if (!\is_array($data)) { throw new RuntimeException(sprintf('Invalid data %s (%s), expected "%s".', json_encode($data), $metadata->type['name'], $metadata->class))...
php
public function visitProperty(PropertyMetadata $metadata, $data) { if (null === $data) { return null; } if (!\is_array($data)) { throw new RuntimeException(sprintf('Invalid data %s (%s), expected "%s".', json_encode($data), $metadata->type['name'], $metadata->class))...
[ "public", "function", "visitProperty", "(", "PropertyMetadata", "$", "metadata", ",", "$", "data", ")", "{", "if", "(", "null", "===", "$", "data", ")", "{", "return", "null", ";", "}", "if", "(", "!", "\\", "is_array", "(", "$", "data", ")", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/JsonDeserializationVisitor.php#L153-L173
schmittjoh/serializer
src/JsonDeserializationVisitor.php
JsonDeserializationVisitor.endVisitingObject
public function endVisitingObject(ClassMetadata $metadata, $data, array $type): object { $obj = $this->currentObject; $this->revertCurrentObject(); return $obj; }
php
public function endVisitingObject(ClassMetadata $metadata, $data, array $type): object { $obj = $this->currentObject; $this->revertCurrentObject(); return $obj; }
[ "public", "function", "endVisitingObject", "(", "ClassMetadata", "$", "metadata", ",", "$", "data", ",", "array", "$", "type", ")", ":", "object", "{", "$", "obj", "=", "$", "this", "->", "currentObject", ";", "$", "this", "->", "revertCurrentObject", "(",...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/JsonDeserializationVisitor.php#L178-L184
schmittjoh/serializer
src/JsonDeserializationVisitor.php
JsonDeserializationVisitor.prepare
public function prepare($str) { $decoded = json_decode($str, true, $this->depth, $this->options); switch (json_last_error()) { case JSON_ERROR_NONE: return $decoded; case JSON_ERROR_DEPTH: throw new RuntimeException('Could not decode JSON, ma...
php
public function prepare($str) { $decoded = json_decode($str, true, $this->depth, $this->options); switch (json_last_error()) { case JSON_ERROR_NONE: return $decoded; case JSON_ERROR_DEPTH: throw new RuntimeException('Could not decode JSON, ma...
[ "public", "function", "prepare", "(", "$", "str", ")", "{", "$", "decoded", "=", "json_decode", "(", "$", "str", ",", "true", ",", "$", "this", "->", "depth", ",", "$", "this", "->", "options", ")", ";", "switch", "(", "json_last_error", "(", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/JsonDeserializationVisitor.php#L213-L239
schmittjoh/serializer
src/Construction/DoctrineObjectConstructor.php
DoctrineObjectConstructor.construct
public function construct(DeserializationVisitorInterface $visitor, ClassMetadata $metadata, $data, array $type, DeserializationContext $context): ?object { // Locate possible ObjectManager $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); if (!$objectManager) { ...
php
public function construct(DeserializationVisitorInterface $visitor, ClassMetadata $metadata, $data, array $type, DeserializationContext $context): ?object { // Locate possible ObjectManager $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); if (!$objectManager) { ...
[ "public", "function", "construct", "(", "DeserializationVisitorInterface", "$", "visitor", ",", "ClassMetadata", "$", "metadata", ",", "$", "data", ",", "array", "$", "type", ",", "DeserializationContext", "$", "context", ")", ":", "?", "object", "{", "// Locate...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Construction/DoctrineObjectConstructor.php#L51-L117
schmittjoh/serializer
src/Ordering/AlphabeticalPropertyOrderingStrategy.php
AlphabeticalPropertyOrderingStrategy.order
public function order(array $properties): array { uasort( $properties, static function (PropertyMetadata $a, PropertyMetadata $b): int { return strcmp($a->name, $b->name); } ); return $properties; }
php
public function order(array $properties): array { uasort( $properties, static function (PropertyMetadata $a, PropertyMetadata $b): int { return strcmp($a->name, $b->name); } ); return $properties; }
[ "public", "function", "order", "(", "array", "$", "properties", ")", ":", "array", "{", "uasort", "(", "$", "properties", ",", "static", "function", "(", "PropertyMetadata", "$", "a", ",", "PropertyMetadata", "$", "b", ")", ":", "int", "{", "return", "st...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/Ordering/AlphabeticalPropertyOrderingStrategy.php#L14-L24
schmittjoh/serializer
src/XmlSerializationVisitor.php
XmlSerializationVisitor.visitNull
public function visitNull($data, array $type) { $node = $this->document->createAttribute('xsi:nil'); $node->value = 'true'; $this->nullWasVisited = true; return $node; }
php
public function visitNull($data, array $type) { $node = $this->document->createAttribute('xsi:nil'); $node->value = 'true'; $this->nullWasVisited = true; return $node; }
[ "public", "function", "visitNull", "(", "$", "data", ",", "array", "$", "type", ")", "{", "$", "node", "=", "$", "this", "->", "document", "->", "createAttribute", "(", "'xsi:nil'", ")", ";", "$", "node", "->", "value", "=", "'true'", ";", "$", "this...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlSerializationVisitor.php#L131-L138
schmittjoh/serializer
src/XmlSerializationVisitor.php
XmlSerializationVisitor.visitString
public function visitString(string $data, array $type) { $doCData = null !== $this->currentMetadata ? $this->currentMetadata->xmlElementCData : true; return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); }
php
public function visitString(string $data, array $type) { $doCData = null !== $this->currentMetadata ? $this->currentMetadata->xmlElementCData : true; return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); }
[ "public", "function", "visitString", "(", "string", "$", "data", ",", "array", "$", "type", ")", "{", "$", "doCData", "=", "null", "!==", "$", "this", "->", "currentMetadata", "?", "$", "this", "->", "currentMetadata", "->", "xmlElementCData", ":", "true",...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlSerializationVisitor.php#L142-L147
schmittjoh/serializer
src/XmlSerializationVisitor.php
XmlSerializationVisitor.visitDouble
public function visitDouble(float $data, array $type) { return $this->document->createTextNode(var_export((float) $data, true)); }
php
public function visitDouble(float $data, array $type) { return $this->document->createTextNode(var_export((float) $data, true)); }
[ "public", "function", "visitDouble", "(", "float", "$", "data", ",", "array", "$", "type", ")", "{", "return", "$", "this", "->", "document", "->", "createTextNode", "(", "var_export", "(", "(", "float", ")", "$", "data", ",", "true", ")", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlSerializationVisitor.php#L177-L180
schmittjoh/serializer
src/XmlSerializationVisitor.php
XmlSerializationVisitor.visitArray
public function visitArray(array $data, array $type): void { if (null === $this->currentNode) { $this->createRoot(); } $entryName = null !== $this->currentMetadata && null !== $this->currentMetadata->xmlEntryName ? $this->currentMetadata->xmlEntryName : 'entry'; $keyAttr...
php
public function visitArray(array $data, array $type): void { if (null === $this->currentNode) { $this->createRoot(); } $entryName = null !== $this->currentMetadata && null !== $this->currentMetadata->xmlEntryName ? $this->currentMetadata->xmlEntryName : 'entry'; $keyAttr...
[ "public", "function", "visitArray", "(", "array", "$", "data", ",", "array", "$", "type", ")", ":", "void", "{", "if", "(", "null", "===", "$", "this", "->", "currentNode", ")", "{", "$", "this", "->", "createRoot", "(", ")", ";", "}", "$", "entryN...
{@inheritdoc}
[ "{" ]
train
https://github.com/schmittjoh/serializer/blob/cb3e1678cf572dade284bad3e55316e2c579c65f/src/XmlSerializationVisitor.php#L185-L217