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
vgrem/phpSPO
src/SharePoint/Web.php
Web.getSiteUsers
public function getSiteUsers() { if(!isset($this->SiteUsers)){ $this->SiteUsers = new UserCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"siteusers")); } return $this->SiteUsers; }
php
public function getSiteUsers() { if(!isset($this->SiteUsers)){ $this->SiteUsers = new UserCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"siteusers")); } return $this->SiteUsers; }
[ "public", "function", "getSiteUsers", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "SiteUsers", ")", ")", "{", "$", "this", "->", "SiteUsers", "=", "new", "UserCollection", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"siteusers\"", ")", ")", ";", "}", "return", "$", "this", "->", "SiteUsers", ";", "}" ]
Gets the collection of all users that belong to the site collection. @return UserCollection
[ "Gets", "the", "collection", "of", "all", "users", "that", "belong", "to", "the", "site", "collection", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Web.php#L164-L170
vgrem/phpSPO
src/SharePoint/Web.php
Web.getSiteGroups
public function getSiteGroups() { if(!isset($this->SiteGroups)){ $this->setProperty("SiteGroups", new GroupCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"sitegroups"))); } return $this->getProperty("SiteGroups"); }
php
public function getSiteGroups() { if(!isset($this->SiteGroups)){ $this->setProperty("SiteGroups", new GroupCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"sitegroups"))); } return $this->getProperty("SiteGroups"); }
[ "public", "function", "getSiteGroups", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "SiteGroups", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"SiteGroups\"", ",", "new", "GroupCollection", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"sitegroups\"", ")", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"SiteGroups\"", ")", ";", "}" ]
Gets the collection of groups for the site collection. @return mixed|null|GroupCollection
[ "Gets", "the", "collection", "of", "groups", "for", "the", "site", "collection", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Web.php#L177-L183
vgrem/phpSPO
src/SharePoint/Web.php
Web.getRoleDefinitions
public function getRoleDefinitions() { if(!$this->isPropertyAvailable('RoleDefinitions')){ $this->setProperty("RoleDefinitions", new RoleDefinitionCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"roledefinitions"))); } return $this->getProperty("RoleDefinitions"); }
php
public function getRoleDefinitions() { if(!$this->isPropertyAvailable('RoleDefinitions')){ $this->setProperty("RoleDefinitions", new RoleDefinitionCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"roledefinitions"))); } return $this->getProperty("RoleDefinitions"); }
[ "public", "function", "getRoleDefinitions", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'RoleDefinitions'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"RoleDefinitions\"", ",", "new", "RoleDefinitionCollection", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"roledefinitions\"", ")", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"RoleDefinitions\"", ")", ";", "}" ]
Gets the collection of role definitions for the Web site. @return RoleAssignmentCollection
[ "Gets", "the", "collection", "of", "role", "definitions", "for", "the", "Web", "site", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Web.php#L190-L196
vgrem/phpSPO
src/SharePoint/Web.php
Web.getUserCustomActions
public function getUserCustomActions() { if(!$this->isPropertyAvailable('UserCustomActions')){ $this->setProperty("UserCustomActions", new UserCustomActionCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"UserCustomActions"))); } return $this->getProperty("UserCustomActions"); }
php
public function getUserCustomActions() { if(!$this->isPropertyAvailable('UserCustomActions')){ $this->setProperty("UserCustomActions", new UserCustomActionCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(),"UserCustomActions"))); } return $this->getProperty("UserCustomActions"); }
[ "public", "function", "getUserCustomActions", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'UserCustomActions'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"UserCustomActions\"", ",", "new", "UserCustomActionCollection", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"UserCustomActions\"", ")", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"UserCustomActions\"", ")", ";", "}" ]
Gets a value that specifies the collection of user custom actions for the site. @return UserCustomActionCollection
[ "Gets", "a", "value", "that", "specifies", "the", "collection", "of", "user", "custom", "actions", "for", "the", "site", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Web.php#L203-L209
vgrem/phpSPO
src/SharePoint/Web.php
Web.getFileByServerRelativeUrl
public function getFileByServerRelativeUrl($serverRelativeUrl){ $path = new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getfilebyserverrelativeurl",array( rawurlencode($serverRelativeUrl) )); $file = new File($this->getContext(),$path); return $file; }
php
public function getFileByServerRelativeUrl($serverRelativeUrl){ $path = new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getfilebyserverrelativeurl",array( rawurlencode($serverRelativeUrl) )); $file = new File($this->getContext(),$path); return $file; }
[ "public", "function", "getFileByServerRelativeUrl", "(", "$", "serverRelativeUrl", ")", "{", "$", "path", "=", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getfilebyserverrelativeurl\"", ",", "array", "(", "rawurlencode", "(", "$", "serverRelativeUrl", ")", ")", ")", ";", "$", "file", "=", "new", "File", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "path", ")", ";", "return", "$", "file", ";", "}" ]
Returns the file object located at the specified server-relative URL. @param string $serverRelativeUrl The server relative URL of the file. @return File
[ "Returns", "the", "file", "object", "located", "at", "the", "specified", "server", "-", "relative", "URL", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Web.php#L241-L247
vgrem/phpSPO
src/SharePoint/Web.php
Web.getFolderByServerRelativeUrl
public function getFolderByServerRelativeUrl($serverRelativeUrl){ return new Folder( $this->getContext(), new ResourcePathServiceOperation( $this->getContext(), $this->getResourcePath(), "getfolderbyserverrelativeurl", array( rawurlencode($serverRelativeUrl) ) ) ); }
php
public function getFolderByServerRelativeUrl($serverRelativeUrl){ return new Folder( $this->getContext(), new ResourcePathServiceOperation( $this->getContext(), $this->getResourcePath(), "getfolderbyserverrelativeurl", array( rawurlencode($serverRelativeUrl) ) ) ); }
[ "public", "function", "getFolderByServerRelativeUrl", "(", "$", "serverRelativeUrl", ")", "{", "return", "new", "Folder", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getfolderbyserverrelativeurl\"", ",", "array", "(", "rawurlencode", "(", "$", "serverRelativeUrl", ")", ")", ")", ")", ";", "}" ]
Returns the folder object located at the specified server-relative URL. @param string $serverRelativeUrl The server relative URL of the folder. @return Folder
[ "Returns", "the", "folder", "object", "located", "at", "the", "specified", "server", "-", "relative", "URL", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Web.php#L254-L266
vgrem/phpSPO
src/Runtime/OData/ODataSerializerContext.php
ODataSerializerContext.map
public function map($json,&$resultObject) { if ($this->RootElement && property_exists($json, $this->RootElement)) { $json = $json->{$this->RootElement}; $this->RootElement = null; } if ($resultObject instanceof IEntityType) { if ($resultObject instanceof IEntityTypeCollection) $this->mapTypeCollection($json, $resultObject); else $this->mapType($json, $resultObject); } else $resultObject = $json; }
php
public function map($json,&$resultObject) { if ($this->RootElement && property_exists($json, $this->RootElement)) { $json = $json->{$this->RootElement}; $this->RootElement = null; } if ($resultObject instanceof IEntityType) { if ($resultObject instanceof IEntityTypeCollection) $this->mapTypeCollection($json, $resultObject); else $this->mapType($json, $resultObject); } else $resultObject = $json; }
[ "public", "function", "map", "(", "$", "json", ",", "&", "$", "resultObject", ")", "{", "if", "(", "$", "this", "->", "RootElement", "&&", "property_exists", "(", "$", "json", ",", "$", "this", "->", "RootElement", ")", ")", "{", "$", "json", "=", "$", "json", "->", "{", "$", "this", "->", "RootElement", "}", ";", "$", "this", "->", "RootElement", "=", "null", ";", "}", "if", "(", "$", "resultObject", "instanceof", "IEntityType", ")", "{", "if", "(", "$", "resultObject", "instanceof", "IEntityTypeCollection", ")", "$", "this", "->", "mapTypeCollection", "(", "$", "json", ",", "$", "resultObject", ")", ";", "else", "$", "this", "->", "mapType", "(", "$", "json", ",", "$", "resultObject", ")", ";", "}", "else", "$", "resultObject", "=", "$", "json", ";", "}" ]
Maps response payload to client object @param mixed $json @param $resultObject
[ "Maps", "response", "payload", "to", "client", "object" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/OData/ODataSerializerContext.php#L23-L39
vgrem/phpSPO
src/Runtime/OData/ODataSerializerContext.php
ODataSerializerContext.normalize
public function normalize($value) { if ($value instanceof IEntityType) { $payload = array_map(function ($property) { return $this->normalize($property); }, $value->getProperties(SCHEMA_SERIALIZABLE_PROPERTIES)); return $payload; } else if (is_array($value)) { return array_map(function ($item) { return $this->normalize($item); }, $value); } return $value; }
php
public function normalize($value) { if ($value instanceof IEntityType) { $payload = array_map(function ($property) { return $this->normalize($property); }, $value->getProperties(SCHEMA_SERIALIZABLE_PROPERTIES)); return $payload; } else if (is_array($value)) { return array_map(function ($item) { return $this->normalize($item); }, $value); } return $value; }
[ "public", "function", "normalize", "(", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "IEntityType", ")", "{", "$", "payload", "=", "array_map", "(", "function", "(", "$", "property", ")", "{", "return", "$", "this", "->", "normalize", "(", "$", "property", ")", ";", "}", ",", "$", "value", "->", "getProperties", "(", "SCHEMA_SERIALIZABLE_PROPERTIES", ")", ")", ";", "return", "$", "payload", ";", "}", "else", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "return", "array_map", "(", "function", "(", "$", "item", ")", "{", "return", "$", "this", "->", "normalize", "(", "$", "item", ")", ";", "}", ",", "$", "value", ")", ";", "}", "return", "$", "value", ";", "}" ]
Normalize request payload @param IEntityType|array $value @return array
[ "Normalize", "request", "payload" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/OData/ODataSerializerContext.php#L84-L97
vgrem/phpSPO
src/Runtime/Auth/ACSTokenProvider.php
ACSTokenProvider.acquireToken
public function acquireToken($parameters) { $realm = $this->getRealmFromTargetUrl(); $urlInfo = parse_url($this->url); $this->accessToken = $this->getAppOnlyAccessToken($urlInfo["host"],$realm); }
php
public function acquireToken($parameters) { $realm = $this->getRealmFromTargetUrl(); $urlInfo = parse_url($this->url); $this->accessToken = $this->getAppOnlyAccessToken($urlInfo["host"],$realm); }
[ "public", "function", "acquireToken", "(", "$", "parameters", ")", "{", "$", "realm", "=", "$", "this", "->", "getRealmFromTargetUrl", "(", ")", ";", "$", "urlInfo", "=", "parse_url", "(", "$", "this", "->", "url", ")", ";", "$", "this", "->", "accessToken", "=", "$", "this", "->", "getAppOnlyAccessToken", "(", "$", "urlInfo", "[", "\"host\"", "]", ",", "$", "realm", ")", ";", "}" ]
Acquires the access token from a Microsoft Azure Access Control Service (ACS) @param array $parameters
[ "Acquires", "the", "access", "token", "from", "a", "Microsoft", "Azure", "Access", "Control", "Service", "(", "ACS", ")" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/ACSTokenProvider.php#L64-L69
vgrem/phpSPO
src/OutlookServices/FolderCollection.php
FolderCollection.createFolder
public function createFolder($displayName) { $folder = new MailFolder($this->getContext(), $this->getResourcePath()); $this->addChild($folder); $folder->setProperty('DisplayName', $displayName); $qry = new CreateEntityQuery($folder); $this->getContext()->addQuery($qry, $folder); return $folder; }
php
public function createFolder($displayName) { $folder = new MailFolder($this->getContext(), $this->getResourcePath()); $this->addChild($folder); $folder->setProperty('DisplayName', $displayName); $qry = new CreateEntityQuery($folder); $this->getContext()->addQuery($qry, $folder); return $folder; }
[ "public", "function", "createFolder", "(", "$", "displayName", ")", "{", "$", "folder", "=", "new", "MailFolder", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ")", ";", "$", "this", "->", "addChild", "(", "$", "folder", ")", ";", "$", "folder", "->", "setProperty", "(", "'DisplayName'", ",", "$", "displayName", ")", ";", "$", "qry", "=", "new", "CreateEntityQuery", "(", "$", "folder", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "folder", ")", ";", "return", "$", "folder", ";", "}" ]
Creates a folder @param string $displayName name of new folder @return MailFolder
[ "Creates", "a", "folder" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/OutlookServices/FolderCollection.php#L17-L24
vgrem/phpSPO
src/Runtime/ClientObjectCollection.php
ClientObjectCollection.addChildAt
public function addChildAt(ClientObject $clientObject, $index ) { array_splice($this->data,$index,0,[$clientObject]); if (is_null($clientObject->parentCollection)) $clientObject->parentCollection = $this; }
php
public function addChildAt(ClientObject $clientObject, $index ) { array_splice($this->data,$index,0,[$clientObject]); if (is_null($clientObject->parentCollection)) $clientObject->parentCollection = $this; }
[ "public", "function", "addChildAt", "(", "ClientObject", "$", "clientObject", ",", "$", "index", ")", "{", "array_splice", "(", "$", "this", "->", "data", ",", "$", "index", ",", "0", ",", "[", "$", "clientObject", "]", ")", ";", "if", "(", "is_null", "(", "$", "clientObject", "->", "parentCollection", ")", ")", "$", "clientObject", "->", "parentCollection", "=", "$", "this", ";", "}" ]
Adds client object into collection @param ClientObject $clientObject @param int $index
[ "Adds", "client", "object", "into", "collection" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientObjectCollection.php#L56-L61
vgrem/phpSPO
src/Runtime/ClientObjectCollection.php
ClientObjectCollection.addChild
public function addChild($clientObject) { $this->data[] = $clientObject; if (is_null($clientObject->parentCollection)) $clientObject->parentCollection = $this; }
php
public function addChild($clientObject) { $this->data[] = $clientObject; if (is_null($clientObject->parentCollection)) $clientObject->parentCollection = $this; }
[ "public", "function", "addChild", "(", "$", "clientObject", ")", "{", "$", "this", "->", "data", "[", "]", "=", "$", "clientObject", ";", "if", "(", "is_null", "(", "$", "clientObject", "->", "parentCollection", ")", ")", "$", "clientObject", "->", "parentCollection", "=", "$", "this", ";", "}" ]
Adds client object into collection @param ClientObject $clientObject
[ "Adds", "client", "object", "into", "collection" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientObjectCollection.php#L67-L72
vgrem/phpSPO
src/Runtime/ClientObjectCollection.php
ClientObjectCollection.findFirst
public function findFirst($key,$value) { $result = $this->findItems( function (ClientObject $item) use ($key, $value) { return $item->getProperty($key) === $value; }); return ((count($result) > 0) ? array_values($result)[0] : null); }
php
public function findFirst($key,$value) { $result = $this->findItems( function (ClientObject $item) use ($key, $value) { return $item->getProperty($key) === $value; }); return ((count($result) > 0) ? array_values($result)[0] : null); }
[ "public", "function", "findFirst", "(", "$", "key", ",", "$", "value", ")", "{", "$", "result", "=", "$", "this", "->", "findItems", "(", "function", "(", "ClientObject", "$", "item", ")", "use", "(", "$", "key", ",", "$", "value", ")", "{", "return", "$", "item", "->", "getProperty", "(", "$", "key", ")", "===", "$", "value", ";", "}", ")", ";", "return", "(", "(", "count", "(", "$", "result", ")", ">", "0", ")", "?", "array_values", "(", "$", "result", ")", "[", "0", "]", ":", "null", ")", ";", "}" ]
Finds the first item @param string $key @param string $value @return ClientObject|null
[ "Finds", "the", "first", "item" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientObjectCollection.php#L101-L108
vgrem/phpSPO
src/Runtime/ClientObjectCollection.php
ClientObjectCollection.findItems
public function findItems(callable $callback) { $result = array_filter( $this->data, function (ClientObject $item) use ($callback) { return call_user_func($callback, $item); } ); if (count($result) > 0) return array_values($result); return null; }
php
public function findItems(callable $callback) { $result = array_filter( $this->data, function (ClientObject $item) use ($callback) { return call_user_func($callback, $item); } ); if (count($result) > 0) return array_values($result); return null; }
[ "public", "function", "findItems", "(", "callable", "$", "callback", ")", "{", "$", "result", "=", "array_filter", "(", "$", "this", "->", "data", ",", "function", "(", "ClientObject", "$", "item", ")", "use", "(", "$", "callback", ")", "{", "return", "call_user_func", "(", "$", "callback", ",", "$", "item", ")", ";", "}", ")", ";", "if", "(", "count", "(", "$", "result", ")", ">", "0", ")", "return", "array_values", "(", "$", "result", ")", ";", "return", "null", ";", "}" ]
Finds items by entity property @param callable $callback @return array
[ "Finds", "items", "by", "entity", "property" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientObjectCollection.php#L116-L127
vgrem/phpSPO
src/Runtime/ClientObjectCollection.php
ClientObjectCollection.createType
public function createType() { $clientObjectType = $this->getItemTypeName(); $clientObject = new $clientObjectType($this->getContext()); $clientObject->parentCollection = $this; return $clientObject; }
php
public function createType() { $clientObjectType = $this->getItemTypeName(); $clientObject = new $clientObjectType($this->getContext()); $clientObject->parentCollection = $this; return $clientObject; }
[ "public", "function", "createType", "(", ")", "{", "$", "clientObjectType", "=", "$", "this", "->", "getItemTypeName", "(", ")", ";", "$", "clientObject", "=", "new", "$", "clientObjectType", "(", "$", "this", "->", "getContext", "(", ")", ")", ";", "$", "clientObject", "->", "parentCollection", "=", "$", "this", ";", "return", "$", "clientObject", ";", "}" ]
Creates resource for a collection @return ClientObject
[ "Creates", "resource", "for", "a", "collection" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientObjectCollection.php#L246-L252
vgrem/phpSPO
src/SharePoint/UserProfiles/PeopleManager.php
PeopleManager.follow
public function follow($accountName){ $qry = new InvokePostMethodQuery($this->getResourcePath(), "follow",array(rawurlencode($accountName))); $this->getContext()->addQuery($qry); }
php
public function follow($accountName){ $qry = new InvokePostMethodQuery($this->getResourcePath(), "follow",array(rawurlencode($accountName))); $this->getContext()->addQuery($qry); }
[ "public", "function", "follow", "(", "$", "accountName", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"follow\"", ",", "array", "(", "rawurlencode", "(", "$", "accountName", ")", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Adds the specified user to the current user's list of followed users. @param string $accountName
[ "Adds", "the", "specified", "user", "to", "the", "current", "user", "s", "list", "of", "followed", "users", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/UserProfiles/PeopleManager.php#L66-L69
vgrem/phpSPO
src/SharePoint/UserProfiles/PeopleManager.php
PeopleManager.stopFollowing
public function stopFollowing ($accountName){ $result = new ClientResult(); $qry = new InvokePostMethodQuery($this->getResourcePath(), "StopFollowing",array(rawurlencode($accountName))); $this->getContext()->addQuery($qry,$result); return $result; }
php
public function stopFollowing ($accountName){ $result = new ClientResult(); $qry = new InvokePostMethodQuery($this->getResourcePath(), "StopFollowing",array(rawurlencode($accountName))); $this->getContext()->addQuery($qry,$result); return $result; }
[ "public", "function", "stopFollowing", "(", "$", "accountName", ")", "{", "$", "result", "=", "new", "ClientResult", "(", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"StopFollowing\"", ",", "array", "(", "rawurlencode", "(", "$", "accountName", ")", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "result", ")", ";", "return", "$", "result", ";", "}" ]
Remove the specified user from the current user's list of followed users. @param string $accountName @return ClientResult
[ "Remove", "the", "specified", "user", "from", "the", "current", "user", "s", "list", "of", "followed", "users", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/UserProfiles/PeopleManager.php#L77-L82
vgrem/phpSPO
src/SharePoint/UserProfiles/PeopleManager.php
PeopleManager.amIFollowing
public function amIFollowing ($accountName){ $result = new ClientResult(); $qry = new InvokeMethodQuery( $this->getResourcePath(), "AmIFollowing", array(rawurlencode($accountName)) ); $this->getContext()->addQuery($qry,$result); return $result; }
php
public function amIFollowing ($accountName){ $result = new ClientResult(); $qry = new InvokeMethodQuery( $this->getResourcePath(), "AmIFollowing", array(rawurlencode($accountName)) ); $this->getContext()->addQuery($qry,$result); return $result; }
[ "public", "function", "amIFollowing", "(", "$", "accountName", ")", "{", "$", "result", "=", "new", "ClientResult", "(", ")", ";", "$", "qry", "=", "new", "InvokeMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"AmIFollowing\"", ",", "array", "(", "rawurlencode", "(", "$", "accountName", ")", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "result", ")", ";", "return", "$", "result", ";", "}" ]
Checks whether the current user is following the specified user. @param string $accountName @return ClientResult
[ "Checks", "whether", "the", "current", "user", "is", "following", "the", "specified", "user", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/UserProfiles/PeopleManager.php#L90-L99
vgrem/phpSPO
src/SharePoint/UserProfiles/PeopleManager.php
PeopleManager.getUserProfilePropertyFor
public function getUserProfilePropertyFor ($accountName,$propertyName) { $clientResult = new ClientResult(); $qry = new InvokeMethodQuery( $this->getResourcePath(), "GetUserProfilePropertyFor", array( "accountname" => rawurlencode($accountName), "propertyname" => $propertyName ) ); $this->getContext()->addQuery($qry,$clientResult); return $clientResult; }
php
public function getUserProfilePropertyFor ($accountName,$propertyName) { $clientResult = new ClientResult(); $qry = new InvokeMethodQuery( $this->getResourcePath(), "GetUserProfilePropertyFor", array( "accountname" => rawurlencode($accountName), "propertyname" => $propertyName ) ); $this->getContext()->addQuery($qry,$clientResult); return $clientResult; }
[ "public", "function", "getUserProfilePropertyFor", "(", "$", "accountName", ",", "$", "propertyName", ")", "{", "$", "clientResult", "=", "new", "ClientResult", "(", ")", ";", "$", "qry", "=", "new", "InvokeMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"GetUserProfilePropertyFor\"", ",", "array", "(", "\"accountname\"", "=>", "rawurlencode", "(", "$", "accountName", ")", ",", "\"propertyname\"", "=>", "$", "propertyName", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "clientResult", ")", ";", "return", "$", "clientResult", ";", "}" ]
Gets the specified user profile property for the specified user. @param string $accountName The account name of the user, encoded and passed as an alias in the query string, as shown in the request example. @param string $propertyName The case-sensitive name of the property to get. @return ClientResult The specified profile property for the specified user.
[ "Gets", "the", "specified", "user", "profile", "property", "for", "the", "specified", "user", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/UserProfiles/PeopleManager.php#L121-L134
vgrem/phpSPO
src/SharePoint/FileCollection.php
FileCollection.add
public function add(FileCreationInformation $fileCreationInformation) { $file = new File($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery( $this->getResourcePath(), "add", array("overwrite"=>$fileCreationInformation->Overwrite,"url"=>rawurlencode($fileCreationInformation->Url)), $fileCreationInformation->Content ); $this->getContext()->addQuery($qry,$file); //$this->addChild($file); return $file; }
php
public function add(FileCreationInformation $fileCreationInformation) { $file = new File($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery( $this->getResourcePath(), "add", array("overwrite"=>$fileCreationInformation->Overwrite,"url"=>rawurlencode($fileCreationInformation->Url)), $fileCreationInformation->Content ); $this->getContext()->addQuery($qry,$file); //$this->addChild($file); return $file; }
[ "public", "function", "add", "(", "FileCreationInformation", "$", "fileCreationInformation", ")", "{", "$", "file", "=", "new", "File", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"add\"", ",", "array", "(", "\"overwrite\"", "=>", "$", "fileCreationInformation", "->", "Overwrite", ",", "\"url\"", "=>", "rawurlencode", "(", "$", "fileCreationInformation", "->", "Url", ")", ")", ",", "$", "fileCreationInformation", "->", "Content", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "file", ")", ";", "//$this->addChild($file);", "return", "$", "file", ";", "}" ]
Creates a File resource @param FileCreationInformation $fileCreationInformation @return File
[ "Creates", "a", "File", "resource" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/FileCollection.php#L21-L33
vgrem/phpSPO
src/SharePoint/FileCollection.php
FileCollection.addTemplateFile
public function addTemplateFile($urlOfFile,$templateFileType) { $file = new File($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery( $this->getResourcePath(), "addTemplateFile", array( "urlOfFile" => $urlOfFile, "templateFileType" => (int)$templateFileType ) ); $this->getContext()->addQuery($qry,$file); return $file; }
php
public function addTemplateFile($urlOfFile,$templateFileType) { $file = new File($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery( $this->getResourcePath(), "addTemplateFile", array( "urlOfFile" => $urlOfFile, "templateFileType" => (int)$templateFileType ) ); $this->getContext()->addQuery($qry,$file); return $file; }
[ "public", "function", "addTemplateFile", "(", "$", "urlOfFile", ",", "$", "templateFileType", ")", "{", "$", "file", "=", "new", "File", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"addTemplateFile\"", ",", "array", "(", "\"urlOfFile\"", "=>", "$", "urlOfFile", ",", "\"templateFileType\"", "=>", "(", "int", ")", "$", "templateFileType", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "file", ")", ";", "return", "$", "file", ";", "}" ]
Adds a ghosted file to an existing list or document library. @param $urlOfFile @param $templateFileType @return File
[ "Adds", "a", "ghosted", "file", "to", "an", "existing", "list", "or", "document", "library", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/FileCollection.php#L42-L55
vgrem/phpSPO
src/SharePoint/Field.php
Field.setShowInDisplayForm
public function setShowInDisplayForm($value){ $qry = new InvokePostMethodQuery( $this->getResourcePath(), "setShowInDisplayForm", array($value) ); $this->getContext()->addQuery($qry); }
php
public function setShowInDisplayForm($value){ $qry = new InvokePostMethodQuery( $this->getResourcePath(), "setShowInDisplayForm", array($value) ); $this->getContext()->addQuery($qry); }
[ "public", "function", "setShowInDisplayForm", "(", "$", "value", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"setShowInDisplayForm\"", ",", "array", "(", "$", "value", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Sets the value of the ShowInDisplayForm property for this field. @param $value true to show the field in the form; otherwise false.
[ "Sets", "the", "value", "of", "the", "ShowInDisplayForm", "property", "for", "this", "field", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Field.php#L32-L39
vgrem/phpSPO
src/SharePoint/Site.php
Site.openWebById
public function openWebById($webId) { $web = new Web($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery($this->getResourcePath(),"openWebById",array($webId)); $this->getContext()->addQuery($qry,$web); return $web; }
php
public function openWebById($webId) { $web = new Web($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery($this->getResourcePath(),"openWebById",array($webId)); $this->getContext()->addQuery($qry,$web); return $web; }
[ "public", "function", "openWebById", "(", "$", "webId", ")", "{", "$", "web", "=", "new", "Web", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"openWebById\"", ",", "array", "(", "$", "webId", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "web", ")", ";", "return", "$", "web", ";", "}" ]
Returns the site with the specified GUID @param string $webId @return Web
[ "Returns", "the", "site", "with", "the", "specified", "GUID" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Site.php#L18-L24
vgrem/phpSPO
src/Runtime/Auth/AuthenticationContext.php
AuthenticationContext.getAuthorizationRequestUrl
public function getAuthorizationRequestUrl($authorizeUrl, $clientId, $redirectUrl, $parameters = []) { $parameters = array_merge($parameters, array( 'response_type' => 'code', 'client_id' => $clientId, //'nonce' => $stateGuid->toString(), 'redirect_uri' => $redirectUrl, //'post_logout_redirect_uri' => $redirectUrl, //'response_mode' => 'form_post', //'scope' => 'openid+profile' )); return $authorizeUrl . "?" . http_build_query($parameters); }
php
public function getAuthorizationRequestUrl($authorizeUrl, $clientId, $redirectUrl, $parameters = []) { $parameters = array_merge($parameters, array( 'response_type' => 'code', 'client_id' => $clientId, //'nonce' => $stateGuid->toString(), 'redirect_uri' => $redirectUrl, //'post_logout_redirect_uri' => $redirectUrl, //'response_mode' => 'form_post', //'scope' => 'openid+profile' )); return $authorizeUrl . "?" . http_build_query($parameters); }
[ "public", "function", "getAuthorizationRequestUrl", "(", "$", "authorizeUrl", ",", "$", "clientId", ",", "$", "redirectUrl", ",", "$", "parameters", "=", "[", "]", ")", "{", "$", "parameters", "=", "array_merge", "(", "$", "parameters", ",", "array", "(", "'response_type'", "=>", "'code'", ",", "'client_id'", "=>", "$", "clientId", ",", "//'nonce' => $stateGuid->toString(),", "'redirect_uri'", "=>", "$", "redirectUrl", ",", "//'post_logout_redirect_uri' => $redirectUrl,", "//'response_mode' => 'form_post',", "//'scope' => 'openid+profile'", ")", ")", ";", "return", "$", "authorizeUrl", ".", "\"?\"", ".", "http_build_query", "(", "$", "parameters", ")", ";", "}" ]
Gets URL of the authorize endpoint including the query parameters. @param string $authorizeUrl @param string $clientId @param string $redirectUrl @param array $parameters @return string
[ "Gets", "URL", "of", "the", "authorize", "endpoint", "including", "the", "query", "parameters", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/AuthenticationContext.php#L42-L54
vgrem/phpSPO
src/Runtime/Auth/AuthenticationContext.php
AuthenticationContext.acquireTokenForUser
public function acquireTokenForUser($username, $password) { $this->provider = new SamlTokenProvider($this->authorityUrl); $parameters = array( 'username' => $username, 'password' => $password ); $this->provider->acquireToken($parameters); }
php
public function acquireTokenForUser($username, $password) { $this->provider = new SamlTokenProvider($this->authorityUrl); $parameters = array( 'username' => $username, 'password' => $password ); $this->provider->acquireToken($parameters); }
[ "public", "function", "acquireTokenForUser", "(", "$", "username", ",", "$", "password", ")", "{", "$", "this", "->", "provider", "=", "new", "SamlTokenProvider", "(", "$", "this", "->", "authorityUrl", ")", ";", "$", "parameters", "=", "array", "(", "'username'", "=>", "$", "username", ",", "'password'", "=>", "$", "password", ")", ";", "$", "this", "->", "provider", "->", "acquireToken", "(", "$", "parameters", ")", ";", "}" ]
Acquire security token from STS @param string $username @param string $password @throws \Exception
[ "Acquire", "security", "token", "from", "STS" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/AuthenticationContext.php#L63-L71
vgrem/phpSPO
src/Runtime/Utilities/Requests.php
Requests.parseCookies
public static function parseCookies($response) { preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $response, $matches); $cookies = array(); foreach($matches[1] as $item) { list($k, $v) = explode('=', $item,2); $cookies[$k] = $v; } return $cookies; }
php
public static function parseCookies($response) { preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $response, $matches); $cookies = array(); foreach($matches[1] as $item) { list($k, $v) = explode('=', $item,2); $cookies[$k] = $v; } return $cookies; }
[ "public", "static", "function", "parseCookies", "(", "$", "response", ")", "{", "preg_match_all", "(", "'/^Set-Cookie:\\s*([^;]*)/mi'", ",", "$", "response", ",", "$", "matches", ")", ";", "$", "cookies", "=", "array", "(", ")", ";", "foreach", "(", "$", "matches", "[", "1", "]", "as", "$", "item", ")", "{", "list", "(", "$", "k", ",", "$", "v", ")", "=", "explode", "(", "'='", ",", "$", "item", ",", "2", ")", ";", "$", "cookies", "[", "$", "k", "]", "=", "$", "v", ";", "}", "return", "$", "cookies", ";", "}" ]
Parse cookies (http://stackoverflow.com/a/895858/1375553) @param $response @return array
[ "Parse", "cookies", "(", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "895858", "/", "1375553", ")" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Utilities/Requests.php#L77-L86
vgrem/phpSPO
src/Runtime/Utilities/Requests.php
Requests.init
private static function init(RequestOptions $options) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $options->Url); curl_setopt_array($ch, self::$defaultOptions); //default options //include headers in response curl_setopt($ch, CURLOPT_HEADER, $options->IncludeHeaders); //include body in response curl_setopt($ch, CURLOPT_NOBODY, !$options->IncludeBody); //Set method if($options->Method == HttpMethod::Post) curl_setopt($ch, CURLOPT_POST, 1); else if($options->Method == HttpMethod::Patch) curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method); else if($options->Method == HttpMethod::Delete) curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method); //set Post Body if(isset($options->Data)) curl_setopt($ch, CURLOPT_POSTFIELDS, $options->Data); if(is_resource($options->StreamHandle)) { $opt = $options->Method === HttpMethod::Get ? CURLOPT_FILE : CURLOPT_INFILE; curl_setopt($ch, $opt, $options->StreamHandle); } $options->addCustomHeader("content-length",strlen($options->Data)); //custom HTTP headers if($options->Headers) curl_setopt($ch, CURLOPT_HTTPHEADER, $options->getRawHeaders()); //debugging mode curl_setopt($ch,CURLOPT_VERBOSE, $options->Verbose); //SSL Version if(!is_null($options->SSLVersion)) { curl_setopt($ch,CURLOPT_SSLVERSION, $options->SSLVersion); } //authentication if(!is_null($options->AuthType)) curl_setopt($ch,CURLOPT_HTTPAUTH, $options->AuthType); if(!is_null($options->UserCredentials)) curl_setopt($ch,CURLOPT_USERPWD, $options->UserCredentials->toString()); return $ch; }
php
private static function init(RequestOptions $options) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $options->Url); curl_setopt_array($ch, self::$defaultOptions); //default options //include headers in response curl_setopt($ch, CURLOPT_HEADER, $options->IncludeHeaders); //include body in response curl_setopt($ch, CURLOPT_NOBODY, !$options->IncludeBody); //Set method if($options->Method == HttpMethod::Post) curl_setopt($ch, CURLOPT_POST, 1); else if($options->Method == HttpMethod::Patch) curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method); else if($options->Method == HttpMethod::Delete) curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method); //set Post Body if(isset($options->Data)) curl_setopt($ch, CURLOPT_POSTFIELDS, $options->Data); if(is_resource($options->StreamHandle)) { $opt = $options->Method === HttpMethod::Get ? CURLOPT_FILE : CURLOPT_INFILE; curl_setopt($ch, $opt, $options->StreamHandle); } $options->addCustomHeader("content-length",strlen($options->Data)); //custom HTTP headers if($options->Headers) curl_setopt($ch, CURLOPT_HTTPHEADER, $options->getRawHeaders()); //debugging mode curl_setopt($ch,CURLOPT_VERBOSE, $options->Verbose); //SSL Version if(!is_null($options->SSLVersion)) { curl_setopt($ch,CURLOPT_SSLVERSION, $options->SSLVersion); } //authentication if(!is_null($options->AuthType)) curl_setopt($ch,CURLOPT_HTTPAUTH, $options->AuthType); if(!is_null($options->UserCredentials)) curl_setopt($ch,CURLOPT_USERPWD, $options->UserCredentials->toString()); return $ch; }
[ "private", "static", "function", "init", "(", "RequestOptions", "$", "options", ")", "{", "$", "ch", "=", "curl_init", "(", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_URL", ",", "$", "options", "->", "Url", ")", ";", "curl_setopt_array", "(", "$", "ch", ",", "self", "::", "$", "defaultOptions", ")", ";", "//default options", "//include headers in response", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_HEADER", ",", "$", "options", "->", "IncludeHeaders", ")", ";", "//include body in response", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_NOBODY", ",", "!", "$", "options", "->", "IncludeBody", ")", ";", "//Set method", "if", "(", "$", "options", "->", "Method", "==", "HttpMethod", "::", "Post", ")", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_POST", ",", "1", ")", ";", "else", "if", "(", "$", "options", "->", "Method", "==", "HttpMethod", "::", "Patch", ")", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_CUSTOMREQUEST", ",", "$", "options", "->", "Method", ")", ";", "else", "if", "(", "$", "options", "->", "Method", "==", "HttpMethod", "::", "Delete", ")", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_CUSTOMREQUEST", ",", "$", "options", "->", "Method", ")", ";", "//set Post Body", "if", "(", "isset", "(", "$", "options", "->", "Data", ")", ")", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_POSTFIELDS", ",", "$", "options", "->", "Data", ")", ";", "if", "(", "is_resource", "(", "$", "options", "->", "StreamHandle", ")", ")", "{", "$", "opt", "=", "$", "options", "->", "Method", "===", "HttpMethod", "::", "Get", "?", "CURLOPT_FILE", ":", "CURLOPT_INFILE", ";", "curl_setopt", "(", "$", "ch", ",", "$", "opt", ",", "$", "options", "->", "StreamHandle", ")", ";", "}", "$", "options", "->", "addCustomHeader", "(", "\"content-length\"", ",", "strlen", "(", "$", "options", "->", "Data", ")", ")", ";", "//custom HTTP headers", "if", "(", "$", "options", "->", "Headers", ")", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_HTTPHEADER", ",", "$", "options", "->", "getRawHeaders", "(", ")", ")", ";", "//debugging mode", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_VERBOSE", ",", "$", "options", "->", "Verbose", ")", ";", "//SSL Version", "if", "(", "!", "is_null", "(", "$", "options", "->", "SSLVersion", ")", ")", "{", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_SSLVERSION", ",", "$", "options", "->", "SSLVersion", ")", ";", "}", "//authentication", "if", "(", "!", "is_null", "(", "$", "options", "->", "AuthType", ")", ")", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_HTTPAUTH", ",", "$", "options", "->", "AuthType", ")", ";", "if", "(", "!", "is_null", "(", "$", "options", "->", "UserCredentials", ")", ")", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_USERPWD", ",", "$", "options", "->", "UserCredentials", "->", "toString", "(", ")", ")", ";", "return", "$", "ch", ";", "}" ]
Init Curl with the default parameters @param RequestOptions $options @return resource [type] [description]
[ "Init", "Curl", "with", "the", "default", "parameters" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Utilities/Requests.php#L94-L134
vgrem/phpSPO
src/SharePoint/Publishing/VideoChannelCollection.php
VideoChannelCollection.add
public function add($title) { $channel = new VideoChannel($this->getContext()); $this->addChild($channel); $channel->setProperty("Title",$title); $channel->setProperty("TileHtmlColor","#0072c6"); $qry = new CreateEntityQuery($channel); $this->getContext()->addQuery($qry, $channel); return $channel; }
php
public function add($title) { $channel = new VideoChannel($this->getContext()); $this->addChild($channel); $channel->setProperty("Title",$title); $channel->setProperty("TileHtmlColor","#0072c6"); $qry = new CreateEntityQuery($channel); $this->getContext()->addQuery($qry, $channel); return $channel; }
[ "public", "function", "add", "(", "$", "title", ")", "{", "$", "channel", "=", "new", "VideoChannel", "(", "$", "this", "->", "getContext", "(", ")", ")", ";", "$", "this", "->", "addChild", "(", "$", "channel", ")", ";", "$", "channel", "->", "setProperty", "(", "\"Title\"", ",", "$", "title", ")", ";", "$", "channel", "->", "setProperty", "(", "\"TileHtmlColor\"", ",", "\"#0072c6\"", ")", ";", "$", "qry", "=", "new", "CreateEntityQuery", "(", "$", "channel", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "channel", ")", ";", "return", "$", "channel", ";", "}" ]
Create an video channel @param string $title @return VideoChannel
[ "Create", "an", "video", "channel" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Publishing/VideoChannelCollection.php#L18-L26
vgrem/phpSPO
src/Runtime/ClientObject.php
ClientObject.getTypeName
public function getTypeName() { if (isset($this->resourceType)) { return $this->resourceType; } $classInfo = explode("\\", get_class($this)); return end($classInfo); }
php
public function getTypeName() { if (isset($this->resourceType)) { return $this->resourceType; } $classInfo = explode("\\", get_class($this)); return end($classInfo); }
[ "public", "function", "getTypeName", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "resourceType", ")", ")", "{", "return", "$", "this", "->", "resourceType", ";", "}", "$", "classInfo", "=", "explode", "(", "\"\\\\\"", ",", "get_class", "(", "$", "this", ")", ")", ";", "return", "end", "(", "$", "classInfo", ")", ";", "}" ]
Gets entity type name for a resource @return string
[ "Gets", "entity", "type", "name", "for", "a", "resource" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientObject.php#L127-L134
vgrem/phpSPO
src/Runtime/ClientObject.php
ClientObject.isPropertyAvailable
public function isPropertyAvailable($name) { return isset($this->properties[$name]) && !isset($this->properties[$name]->__deferred); }
php
public function isPropertyAvailable($name) { return isset($this->properties[$name]) && !isset($this->properties[$name]->__deferred); }
[ "public", "function", "isPropertyAvailable", "(", "$", "name", ")", "{", "return", "isset", "(", "$", "this", "->", "properties", "[", "$", "name", "]", ")", "&&", "!", "isset", "(", "$", "this", "->", "properties", "[", "$", "name", "]", "->", "__deferred", ")", ";", "}" ]
Determine whether client object property has been loaded @param $name @return bool
[ "Determine", "whether", "client", "object", "property", "has", "been", "loaded" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientObject.php#L160-L163
vgrem/phpSPO
src/Runtime/ClientObject.php
ClientObject.setProperty
public function setProperty($name, $value, $persistChanges = true) { $this->propertiesMetadata[$name] = array("Serializable" => $persistChanges); //save property $this->{$name} = $value; //update resource path if ($name === "Id") { if (is_null($this->getResourcePath())) { if (is_int($value)) { $entityKey = "({$value})"; } else { $entityKey = "(guid'{$value}')"; } $this->setResourceUrl($this->parentCollection->getResourcePath()->toUrl() . $entityKey); } } }
php
public function setProperty($name, $value, $persistChanges = true) { $this->propertiesMetadata[$name] = array("Serializable" => $persistChanges); //save property $this->{$name} = $value; //update resource path if ($name === "Id") { if (is_null($this->getResourcePath())) { if (is_int($value)) { $entityKey = "({$value})"; } else { $entityKey = "(guid'{$value}')"; } $this->setResourceUrl($this->parentCollection->getResourcePath()->toUrl() . $entityKey); } } }
[ "public", "function", "setProperty", "(", "$", "name", ",", "$", "value", ",", "$", "persistChanges", "=", "true", ")", "{", "$", "this", "->", "propertiesMetadata", "[", "$", "name", "]", "=", "array", "(", "\"Serializable\"", "=>", "$", "persistChanges", ")", ";", "//save property", "$", "this", "->", "{", "$", "name", "}", "=", "$", "value", ";", "//update resource path", "if", "(", "$", "name", "===", "\"Id\"", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "getResourcePath", "(", ")", ")", ")", "{", "if", "(", "is_int", "(", "$", "value", ")", ")", "{", "$", "entityKey", "=", "\"({$value})\"", ";", "}", "else", "{", "$", "entityKey", "=", "\"(guid'{$value}')\"", ";", "}", "$", "this", "->", "setResourceUrl", "(", "$", "this", "->", "parentCollection", "->", "getResourcePath", "(", ")", "->", "toUrl", "(", ")", ".", "$", "entityKey", ")", ";", "}", "}", "}" ]
A preferred way of setting the client object property @param string $name @param mixed $value @param bool $persistChanges
[ "A", "preferred", "way", "of", "setting", "the", "client", "object", "property" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientObject.php#L193-L212
vgrem/phpSPO
src/SharePoint/ListCollection.php
ListCollection.getByTitle
public function getByTitle($title) { return new SPList( $this->getContext(), new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getByTitle",array(rawurlencode($title))) ); }
php
public function getByTitle($title) { return new SPList( $this->getContext(), new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getByTitle",array(rawurlencode($title))) ); }
[ "public", "function", "getByTitle", "(", "$", "title", ")", "{", "return", "new", "SPList", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getByTitle\"", ",", "array", "(", "rawurlencode", "(", "$", "title", ")", ")", ")", ")", ";", "}" ]
Get List by title @param $title @return SPList
[ "Get", "List", "by", "title" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ListCollection.php#L19-L25
vgrem/phpSPO
src/SharePoint/ListCollection.php
ListCollection.getById
public function getById($id) { return new SPList( $this->getContext(), new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getById",array($id)) ); }
php
public function getById($id) { return new SPList( $this->getContext(), new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getById",array($id)) ); }
[ "public", "function", "getById", "(", "$", "id", ")", "{", "return", "new", "SPList", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getById\"", ",", "array", "(", "$", "id", ")", ")", ")", ";", "}" ]
Get List by id @param $id @return SPList
[ "Get", "List", "by", "id" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ListCollection.php#L32-L38
vgrem/phpSPO
src/SharePoint/ListCollection.php
ListCollection.add
public function add(ListCreationInformation $properties) { $list = new SPList($this->getContext()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null,$properties); $this->getContext()->addQuery($qry,$list); $this->addChild($list); return $list; }
php
public function add(ListCreationInformation $properties) { $list = new SPList($this->getContext()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null,$properties); $this->getContext()->addQuery($qry,$list); $this->addChild($list); return $list; }
[ "public", "function", "add", "(", "ListCreationInformation", "$", "properties", ")", "{", "$", "list", "=", "new", "SPList", "(", "$", "this", "->", "getContext", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "null", ",", "null", ",", "$", "properties", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "list", ")", ";", "$", "this", "->", "addChild", "(", "$", "list", ")", ";", "return", "$", "list", ";", "}" ]
Creates a List resource @param ListCreationInformation $properties @return SPList
[ "Creates", "a", "List", "resource" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ListCollection.php#L46-L53
vgrem/phpSPO
src/OutlookServices/Message.php
Message.reply
public function reply($comment) { $parameter = new ClientValueObject(); $parameter->setProperty("Comment",$comment); $qry = new InvokePostMethodQuery($this->getResourcePath(),"Reply",null,$parameter); $this->getContext()->addQuery($qry); }
php
public function reply($comment) { $parameter = new ClientValueObject(); $parameter->setProperty("Comment",$comment); $qry = new InvokePostMethodQuery($this->getResourcePath(),"Reply",null,$parameter); $this->getContext()->addQuery($qry); }
[ "public", "function", "reply", "(", "$", "comment", ")", "{", "$", "parameter", "=", "new", "ClientValueObject", "(", ")", ";", "$", "parameter", "->", "setProperty", "(", "\"Comment\"", ",", "$", "comment", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"Reply\"", ",", "null", ",", "$", "parameter", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Reply to the sender of a message by specifying a comment and using the Reply method. @param string $comment
[ "Reply", "to", "the", "sender", "of", "a", "message", "by", "specifying", "a", "comment", "and", "using", "the", "Reply", "method", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/OutlookServices/Message.php#L20-L26
vgrem/phpSPO
src/OutlookServices/Message.php
Message.forward
public function forward($comment,$toRecipients) { $parameter = new ClientValueObject(); $parameter->setProperty("Comment",$comment); $parameter->setProperty("ToRecipients",$toRecipients); $qry = new InvokePostMethodQuery($this->getResourcePath(),"Forward",null,$parameter); $this->getContext()->addQuery($qry); }
php
public function forward($comment,$toRecipients) { $parameter = new ClientValueObject(); $parameter->setProperty("Comment",$comment); $parameter->setProperty("ToRecipients",$toRecipients); $qry = new InvokePostMethodQuery($this->getResourcePath(),"Forward",null,$parameter); $this->getContext()->addQuery($qry); }
[ "public", "function", "forward", "(", "$", "comment", ",", "$", "toRecipients", ")", "{", "$", "parameter", "=", "new", "ClientValueObject", "(", ")", ";", "$", "parameter", "->", "setProperty", "(", "\"Comment\"", ",", "$", "comment", ")", ";", "$", "parameter", "->", "setProperty", "(", "\"ToRecipients\"", ",", "$", "toRecipients", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"Forward\"", ",", "null", ",", "$", "parameter", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Forward a message by using the Forward method and optionally specifying a comment. @param string $comment @param array $toRecipients
[ "Forward", "a", "message", "by", "using", "the", "Forward", "method", "and", "optionally", "specifying", "a", "comment", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/OutlookServices/Message.php#L47-L54
vgrem/phpSPO
src/OutlookServices/Message.php
Message.move
public function move($destinationId){ $parameter = new ClientValueObject(); $parameter->setProperty("DestinationId",$destinationId); $qry = new InvokePostMethodQuery($this->getResourcePath(),"Move",null,$parameter); $this->getContext()->addQuery($qry); }
php
public function move($destinationId){ $parameter = new ClientValueObject(); $parameter->setProperty("DestinationId",$destinationId); $qry = new InvokePostMethodQuery($this->getResourcePath(),"Move",null,$parameter); $this->getContext()->addQuery($qry); }
[ "public", "function", "move", "(", "$", "destinationId", ")", "{", "$", "parameter", "=", "new", "ClientValueObject", "(", ")", ";", "$", "parameter", "->", "setProperty", "(", "\"DestinationId\"", ",", "$", "destinationId", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"Move\"", ",", "null", ",", "$", "parameter", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Move a message to a folder. This creates a new copy of the message in the destination folder. @param string $destinationId The destination folder ID, or the Inbox, Drafts, SentItems, or DeletedItems well-known folder name.
[ "Move", "a", "message", "to", "a", "folder", ".", "This", "creates", "a", "new", "copy", "of", "the", "message", "in", "the", "destination", "folder", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/OutlookServices/Message.php#L62-L67
vgrem/phpSPO
src/OutlookServices/Message.php
Message.read
public function read($isRead) { $this->setProperty("IsRead", $isRead); $qry = new UpdateEntityQuery($this); $this->getContext()->addQuery($qry); }
php
public function read($isRead) { $this->setProperty("IsRead", $isRead); $qry = new UpdateEntityQuery($this); $this->getContext()->addQuery($qry); }
[ "public", "function", "read", "(", "$", "isRead", ")", "{", "$", "this", "->", "setProperty", "(", "\"IsRead\"", ",", "$", "isRead", ")", ";", "$", "qry", "=", "new", "UpdateEntityQuery", "(", "$", "this", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Marks a message as read/unread @param bool $isRead whether or not the message is read
[ "Marks", "a", "message", "as", "read", "/", "unread" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/OutlookServices/Message.php#L73-L78
vgrem/phpSPO
src/OutlookServices/Message.php
Message.important
public function important($importance) { $this->setProperty("Importance", $importance); $qry = new UpdateEntityQuery($this); $this->getContext()->addQuery($qry); }
php
public function important($importance) { $this->setProperty("Importance", $importance); $qry = new UpdateEntityQuery($this); $this->getContext()->addQuery($qry); }
[ "public", "function", "important", "(", "$", "importance", ")", "{", "$", "this", "->", "setProperty", "(", "\"Importance\"", ",", "$", "importance", ")", ";", "$", "qry", "=", "new", "UpdateEntityQuery", "(", "$", "this", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Marks a message as important/unimportant @param int $importance importance level (1,2,3)
[ "Marks", "a", "message", "as", "important", "/", "unimportant" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/OutlookServices/Message.php#L84-L89
vgrem/phpSPO
src/SharePoint/UserProfiles/UserProfile.php
UserProfile.createPersonalSiteEnque
public function createPersonalSiteEnque(){ $qry = new InvokePostMethodQuery( $this->getResourcePath(), "createpersonalsiteenque", array(false) ); $this->getContext()->addQuery($qry); }
php
public function createPersonalSiteEnque(){ $qry = new InvokePostMethodQuery( $this->getResourcePath(), "createpersonalsiteenque", array(false) ); $this->getContext()->addQuery($qry); }
[ "public", "function", "createPersonalSiteEnque", "(", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"createpersonalsiteenque\"", ",", "array", "(", "false", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Enqueues creating a personal site for this user, which can be used to share documents, web pages, and other files.
[ "Enqueues", "creating", "a", "personal", "site", "for", "this", "user", "which", "can", "be", "used", "to", "share", "documents", "web", "pages", "and", "other", "files", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/UserProfiles/UserProfile.php#L22-L29
vgrem/phpSPO
src/Runtime/ClientRequest.php
ClientRequest.addQuery
public function addQuery(ClientAction $query, $resultObject = null) { if (isset($resultObject)) { $queryId = $query->getId(); $this->resultObjects[$queryId] = $resultObject; } $this->queries[] = $query; }
php
public function addQuery(ClientAction $query, $resultObject = null) { if (isset($resultObject)) { $queryId = $query->getId(); $this->resultObjects[$queryId] = $resultObject; } $this->queries[] = $query; }
[ "public", "function", "addQuery", "(", "ClientAction", "$", "query", ",", "$", "resultObject", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "resultObject", ")", ")", "{", "$", "queryId", "=", "$", "query", "->", "getId", "(", ")", ";", "$", "this", "->", "resultObjects", "[", "$", "queryId", "]", "=", "$", "resultObject", ";", "}", "$", "this", "->", "queries", "[", "]", "=", "$", "query", ";", "}" ]
Add query into request queue @param ClientAction $query @param ClientObject $resultObject
[ "Add", "query", "into", "request", "queue" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientRequest.php#L69-L76
vgrem/phpSPO
src/SharePoint/Folder.php
Folder.getFiles
public function getFiles() { if(!$this->isPropertyAvailable('Files')){ $this->setProperty("Files", new FileCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "Files"))); } return $this->getProperty("Files"); }
php
public function getFiles() { if(!$this->isPropertyAvailable('Files')){ $this->setProperty("Files", new FileCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "Files"))); } return $this->getProperty("Files"); }
[ "public", "function", "getFiles", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'Files'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"Files\"", ",", "new", "FileCollection", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"Files\"", ")", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"Files\"", ")", ";", "}" ]
Gets the collection of all files contained in the list folder. You can add a file to a folder by using the Add method on the folder’s FileCollection resource. @return FileCollection
[ "Gets", "the", "collection", "of", "all", "files", "contained", "in", "the", "list", "folder", ".", "You", "can", "add", "a", "file", "to", "a", "folder", "by", "using", "the", "Add", "method", "on", "the", "folder’s", "FileCollection", "resource", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Folder.php#L51-L57
vgrem/phpSPO
src/SharePoint/Folder.php
Folder.getFolders
public function getFolders() { if(!$this->isPropertyAvailable("Folders")){ $this->setProperty("Folders", new FolderCollection($this->getContext(), new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "folders"))); } return $this->getProperty("Folders"); }
php
public function getFolders() { if(!$this->isPropertyAvailable("Folders")){ $this->setProperty("Folders", new FolderCollection($this->getContext(), new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "folders"))); } return $this->getProperty("Folders"); }
[ "public", "function", "getFolders", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "\"Folders\"", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"Folders\"", ",", "new", "FolderCollection", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"folders\"", ")", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"Folders\"", ")", ";", "}" ]
Gets the collection of list folders contained in the list folder. @return FolderCollection
[ "Gets", "the", "collection", "of", "list", "folders", "contained", "in", "the", "list", "folder", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Folder.php#L64-L71
vgrem/phpSPO
src/SharePoint/Folder.php
Folder.getListItemAllFields
public function getListItemAllFields() { if (!$this->isPropertyAvailable("ListItemAllFields")) { $this->setProperty("ListItemAllFields", new ListItem( $this->getContext(), new ResourcePathEntity($this->getContext(), $this->getResourcePath(), "ListItemAllFields") ) ); } return $this->getProperty("ListItemAllFields"); }
php
public function getListItemAllFields() { if (!$this->isPropertyAvailable("ListItemAllFields")) { $this->setProperty("ListItemAllFields", new ListItem( $this->getContext(), new ResourcePathEntity($this->getContext(), $this->getResourcePath(), "ListItemAllFields") ) ); } return $this->getProperty("ListItemAllFields"); }
[ "public", "function", "getListItemAllFields", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "\"ListItemAllFields\"", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"ListItemAllFields\"", ",", "new", "ListItem", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"ListItemAllFields\"", ")", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"ListItemAllFields\"", ")", ";", "}" ]
Specifies the list item field (2) values for the list item corresponding to the folder. @return ListItem
[ "Specifies", "the", "list", "item", "field", "(", "2", ")", "values", "for", "the", "list", "item", "corresponding", "to", "the", "folder", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Folder.php#L78-L89
vgrem/phpSPO
src/Runtime/ClientValueObjectCollection.php
ClientValueObjectCollection.addChild
public function addChild($value) { if (is_null($this->data)) $this->data = array(); $this->data[] = $value; }
php
public function addChild($value) { if (is_null($this->data)) $this->data = array(); $this->data[] = $value; }
[ "public", "function", "addChild", "(", "$", "value", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "data", ")", ")", "$", "this", "->", "data", "=", "array", "(", ")", ";", "$", "this", "->", "data", "[", "]", "=", "$", "value", ";", "}" ]
Adds property to collection @param ClientValueObject $value
[ "Adds", "property", "to", "collection" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientValueObjectCollection.php#L13-L18
vgrem/phpSPO
src/SharePoint/ContentTypeCollection.php
ContentTypeCollection.add
public function add(ContentTypeCreationInformation $information) { $contentType = new ContentType($this->getContext()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null,$information); $this->getContext()->addQuery($qry,$contentType); $this->addChild($contentType); return $contentType; }
php
public function add(ContentTypeCreationInformation $information) { $contentType = new ContentType($this->getContext()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null,$information); $this->getContext()->addQuery($qry,$contentType); $this->addChild($contentType); return $contentType; }
[ "public", "function", "add", "(", "ContentTypeCreationInformation", "$", "information", ")", "{", "$", "contentType", "=", "new", "ContentType", "(", "$", "this", "->", "getContext", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "null", ",", "null", ",", "$", "information", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "contentType", ")", ";", "$", "this", "->", "addChild", "(", "$", "contentType", ")", ";", "return", "$", "contentType", ";", "}" ]
Creates a ContentType resource @param ContentTypeCreationInformation $information @return ContentType
[ "Creates", "a", "ContentType", "resource" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ContentTypeCollection.php#L33-L40
vgrem/phpSPO
src/Runtime/OData/ODataBatchRequest.php
ODataBatchRequest.hex16
private function hex16(){ $val = dechex(floor((1 + ((float)rand()/(float)getrandmax())) * 0x10000)); return substr($val,0,-1); }
php
private function hex16(){ $val = dechex(floor((1 + ((float)rand()/(float)getrandmax())) * 0x10000)); return substr($val,0,-1); }
[ "private", "function", "hex16", "(", ")", "{", "$", "val", "=", "dechex", "(", "floor", "(", "(", "1", "+", "(", "(", "float", ")", "rand", "(", ")", "/", "(", "float", ")", "getrandmax", "(", ")", ")", ")", "*", "0x10000", ")", ")", ";", "return", "substr", "(", "$", "val", ",", "0", ",", "-", "1", ")", ";", "}" ]
Calculates a random 16 bit number and returns it in hexadecimal format. @return string A 16-bit number in hex format.
[ "Calculates", "a", "random", "16", "bit", "number", "and", "returns", "it", "in", "hexadecimal", "format", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/OData/ODataBatchRequest.php#L65-L68
vgrem/phpSPO
src/SharePoint/AttachmentCollection.php
AttachmentCollection.add
public function add(AttachmentCreationInformation $information) { $attachment = new Attachment($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery( $this->getResourcePath(), "add", array("FileName" =>rawurlencode($information->FileName)), $information->ContentStream); $this->getContext()->addQuery($qry,$attachment); $this->addChild($attachment); return $attachment; }
php
public function add(AttachmentCreationInformation $information) { $attachment = new Attachment($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery( $this->getResourcePath(), "add", array("FileName" =>rawurlencode($information->FileName)), $information->ContentStream); $this->getContext()->addQuery($qry,$attachment); $this->addChild($attachment); return $attachment; }
[ "public", "function", "add", "(", "AttachmentCreationInformation", "$", "information", ")", "{", "$", "attachment", "=", "new", "Attachment", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"add\"", ",", "array", "(", "\"FileName\"", "=>", "rawurlencode", "(", "$", "information", "->", "FileName", ")", ")", ",", "$", "information", "->", "ContentStream", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "attachment", ")", ";", "$", "this", "->", "addChild", "(", "$", "attachment", ")", ";", "return", "$", "attachment", ";", "}" ]
Creates a Attachment resource @param AttachmentCreationInformation $information @return Attachment
[ "Creates", "a", "Attachment", "resource" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/AttachmentCollection.php#L17-L28
vgrem/phpSPO
src/Runtime/ClientRuntimeContext.php
ClientRuntimeContext.load
public function load(ClientObject $clientObject, array $selectProperties = null) { if(!is_null($selectProperties)) { $queryOptions = new ODataQueryOptions(); $queryOptions->Select = implode(",",$selectProperties); $this->getPendingRequest()->addQueryAndResultObject($clientObject, $queryOptions); } else{ $queryOptions = null; if($clientObject instanceof ClientObjectCollection) $queryOptions = $clientObject->getQueryOptions(); $this->getPendingRequest()->addQueryAndResultObject($clientObject,$queryOptions); } return $this; }
php
public function load(ClientObject $clientObject, array $selectProperties = null) { if(!is_null($selectProperties)) { $queryOptions = new ODataQueryOptions(); $queryOptions->Select = implode(",",$selectProperties); $this->getPendingRequest()->addQueryAndResultObject($clientObject, $queryOptions); } else{ $queryOptions = null; if($clientObject instanceof ClientObjectCollection) $queryOptions = $clientObject->getQueryOptions(); $this->getPendingRequest()->addQueryAndResultObject($clientObject,$queryOptions); } return $this; }
[ "public", "function", "load", "(", "ClientObject", "$", "clientObject", ",", "array", "$", "selectProperties", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "selectProperties", ")", ")", "{", "$", "queryOptions", "=", "new", "ODataQueryOptions", "(", ")", ";", "$", "queryOptions", "->", "Select", "=", "implode", "(", "\",\"", ",", "$", "selectProperties", ")", ";", "$", "this", "->", "getPendingRequest", "(", ")", "->", "addQueryAndResultObject", "(", "$", "clientObject", ",", "$", "queryOptions", ")", ";", "}", "else", "{", "$", "queryOptions", "=", "null", ";", "if", "(", "$", "clientObject", "instanceof", "ClientObjectCollection", ")", "$", "queryOptions", "=", "$", "clientObject", "->", "getQueryOptions", "(", ")", ";", "$", "this", "->", "getPendingRequest", "(", ")", "->", "addQueryAndResultObject", "(", "$", "clientObject", ",", "$", "queryOptions", ")", ";", "}", "return", "$", "this", ";", "}" ]
Prepare to load resource @param ClientObject $clientObject @param array $selectProperties @return ClientRuntimeContext
[ "Prepare", "to", "load", "resource", "@param", "ClientObject", "$clientObject", "@param", "array", "$selectProperties", "@return", "ClientRuntimeContext" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/ClientRuntimeContext.php#L108-L122
vgrem/phpSPO
src/OutlookServices/ContactCollection.php
ContactCollection.createContact
public function createContact() { $contact = new Contact($this->getContext()); $this->addChild($contact); $qry = new CreateEntityQuery($contact); $this->getContext()->addQuery($qry, $contact); return $contact; }
php
public function createContact() { $contact = new Contact($this->getContext()); $this->addChild($contact); $qry = new CreateEntityQuery($contact); $this->getContext()->addQuery($qry, $contact); return $contact; }
[ "public", "function", "createContact", "(", ")", "{", "$", "contact", "=", "new", "Contact", "(", "$", "this", "->", "getContext", "(", ")", ")", ";", "$", "this", "->", "addChild", "(", "$", "contact", ")", ";", "$", "qry", "=", "new", "CreateEntityQuery", "(", "$", "contact", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "contact", ")", ";", "return", "$", "contact", ";", "}" ]
Creates Contact resource @return Contact
[ "Creates", "Contact", "resource" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/OutlookServices/ContactCollection.php#L17-L23
vgrem/phpSPO
src/OutlookServices/ContactCollection.php
ContactCollection.getById
function getById($contactId){ return new Contact( $this->getContext(), new ResourcePathEntity($this->getContext(),$this->getResourcePath(),$contactId) ); }
php
function getById($contactId){ return new Contact( $this->getContext(), new ResourcePathEntity($this->getContext(),$this->getResourcePath(),$contactId) ); }
[ "function", "getById", "(", "$", "contactId", ")", "{", "return", "new", "Contact", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "$", "contactId", ")", ")", ";", "}" ]
Get a contact by using the contact ID. @param string $contactId @return Contact
[ "Get", "a", "contact", "by", "using", "the", "contact", "ID", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/OutlookServices/ContactCollection.php#L33-L38
vgrem/phpSPO
src/SharePoint/ListItem.php
ListItem.getParentList
public function getParentList(){ if(!$this->isPropertyAvailable('ParentList')){ $this->setProperty("ParentList", new SPList($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "parentlist")),false); } return $this->getProperty("ParentList"); }
php
public function getParentList(){ if(!$this->isPropertyAvailable('ParentList')){ $this->setProperty("ParentList", new SPList($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "parentlist")),false); } return $this->getProperty("ParentList"); }
[ "public", "function", "getParentList", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'ParentList'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"ParentList\"", ",", "new", "SPList", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"parentlist\"", ")", ")", ",", "false", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"ParentList\"", ")", ";", "}" ]
Gets the parent list that contains the list item. @return SPList
[ "Gets", "the", "parent", "list", "that", "contains", "the", "list", "item", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ListItem.php#L64-L69
vgrem/phpSPO
src/SharePoint/ListItem.php
ListItem.getFolder
public function getFolder(){ if(!$this->isPropertyAvailable('Folder')){ $this->setProperty("Folder", new Folder($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "Folder")),false); } return $this->getProperty("Folder"); }
php
public function getFolder(){ if(!$this->isPropertyAvailable('Folder')){ $this->setProperty("Folder", new Folder($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "Folder")),false); } return $this->getProperty("Folder"); }
[ "public", "function", "getFolder", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'Folder'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"Folder\"", ",", "new", "Folder", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"Folder\"", ")", ")", ",", "false", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"Folder\"", ")", ";", "}" ]
Gets the associated Folder resource. @return Folder
[ "Gets", "the", "associated", "Folder", "resource", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ListItem.php#L76-L81
vgrem/phpSPO
src/SharePoint/ListItem.php
ListItem.getFile
public function getFile(){ if(!$this->isPropertyAvailable('File')){ $this->setProperty("File", new File($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "File")),false); } return $this->getProperty("File"); }
php
public function getFile(){ if(!$this->isPropertyAvailable('File')){ $this->setProperty("File", new File($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "File")),false); } return $this->getProperty("File"); }
[ "public", "function", "getFile", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'File'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"File\"", ",", "new", "File", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"File\"", ")", ")", ",", "false", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"File\"", ")", ";", "}" ]
Gets the associated File resource. @return File
[ "Gets", "the", "associated", "File", "resource", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ListItem.php#L88-L93
vgrem/phpSPO
src/SharePoint/FieldCollection.php
FieldCollection.add
public function add(FieldCreationInformation $parameters) { $field = new Field($this->getContext()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null,$parameters); $this->getContext()->addQuery($qry,$field); $this->addChild($field); return $field; }
php
public function add(FieldCreationInformation $parameters) { $field = new Field($this->getContext()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null,$parameters); $this->getContext()->addQuery($qry,$field); $this->addChild($field); return $field; }
[ "public", "function", "add", "(", "FieldCreationInformation", "$", "parameters", ")", "{", "$", "field", "=", "new", "Field", "(", "$", "this", "->", "getContext", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "null", ",", "null", ",", "$", "parameters", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "field", ")", ";", "$", "this", "->", "addChild", "(", "$", "field", ")", ";", "return", "$", "field", ";", "}" ]
Creates a Field resource @param FieldCreationInformation $parameters @return Field
[ "Creates", "a", "Field", "resource" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/FieldCollection.php#L20-L27
vgrem/phpSPO
src/SharePoint/WebParts/LimitedWebPartManager.php
LimitedWebPartManager.importWebPart
public function importWebPart($webPartXml) { $payload = new ClientValueObject(); $payload->setProperty("webPartXml",$webPartXml); $webPartDefinition = new WebPartDefinition($this->getContext()); $qry = new InvokePostMethodQuery( $this->getResourcePath(), "ImportWebPart", null, $payload ); $this->getContext()->addQuery($qry,$webPartDefinition); return $webPartDefinition; }
php
public function importWebPart($webPartXml) { $payload = new ClientValueObject(); $payload->setProperty("webPartXml",$webPartXml); $webPartDefinition = new WebPartDefinition($this->getContext()); $qry = new InvokePostMethodQuery( $this->getResourcePath(), "ImportWebPart", null, $payload ); $this->getContext()->addQuery($qry,$webPartDefinition); return $webPartDefinition; }
[ "public", "function", "importWebPart", "(", "$", "webPartXml", ")", "{", "$", "payload", "=", "new", "ClientValueObject", "(", ")", ";", "$", "payload", "->", "setProperty", "(", "\"webPartXml\"", ",", "$", "webPartXml", ")", ";", "$", "webPartDefinition", "=", "new", "WebPartDefinition", "(", "$", "this", "->", "getContext", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"ImportWebPart\"", ",", "null", ",", "$", "payload", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "webPartDefinition", ")", ";", "return", "$", "webPartDefinition", ";", "}" ]
Imports a Web Part from a string in the .dwp format @param string $webPartXml @return WebPartDefinition
[ "Imports", "a", "Web", "Part", "from", "a", "string", "in", "the", ".", "dwp", "format" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/WebParts/LimitedWebPartManager.php#L20-L33
vgrem/phpSPO
src/SharePoint/UserCollection.php
UserCollection.getById
public function getById($id) { $path = new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getById",array($id)); return new User($this->getContext(),$path); }
php
public function getById($id) { $path = new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getById",array($id)); return new User($this->getContext(),$path); }
[ "public", "function", "getById", "(", "$", "id", ")", "{", "$", "path", "=", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getById\"", ",", "array", "(", "$", "id", ")", ")", ";", "return", "new", "User", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "path", ")", ";", "}" ]
Gets the user with the specified member identifier (ID). @param int $id @return User
[ "Gets", "the", "user", "with", "the", "specified", "member", "identifier", "(", "ID", ")", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/UserCollection.php#L21-L25
vgrem/phpSPO
src/SharePoint/UserCollection.php
UserCollection.getByEmail
public function getByEmail($emailAddress) { $path = new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getByEmail",array($emailAddress)); return new User($this->getContext(),$path); }
php
public function getByEmail($emailAddress) { $path = new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getByEmail",array($emailAddress)); return new User($this->getContext(),$path); }
[ "public", "function", "getByEmail", "(", "$", "emailAddress", ")", "{", "$", "path", "=", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getByEmail\"", ",", "array", "(", "$", "emailAddress", ")", ")", ";", "return", "new", "User", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "path", ")", ";", "}" ]
Gets the user with the specified email address. @param string $emailAddress The email of the user to get. @return User
[ "Gets", "the", "user", "with", "the", "specified", "email", "address", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/UserCollection.php#L32-L36
vgrem/phpSPO
src/SharePoint/UserCollection.php
UserCollection.removeById
public function removeById($id) { $qry = new InvokePostMethodQuery($this->getResourcePath(),"removebyid",array($id)); $this->getContext()->addQuery($qry); }
php
public function removeById($id) { $qry = new InvokePostMethodQuery($this->getResourcePath(),"removebyid",array($id)); $this->getContext()->addQuery($qry); }
[ "public", "function", "removeById", "(", "$", "id", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"removebyid\"", ",", "array", "(", "$", "id", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Removes the user with the specified ID. @param int $id
[ "Removes", "the", "user", "with", "the", "specified", "ID", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/UserCollection.php#L53-L57
vgrem/phpSPO
src/SharePoint/UserCollection.php
UserCollection.removeByLoginName
public function removeByLoginName($loginName) { $qry = new InvokePostMethodQuery( $this->getResourcePath(), "removebyloginname", array(rawurlencode($loginName))); $this->getContext()->addQuery($qry); }
php
public function removeByLoginName($loginName) { $qry = new InvokePostMethodQuery( $this->getResourcePath(), "removebyloginname", array(rawurlencode($loginName))); $this->getContext()->addQuery($qry); }
[ "public", "function", "removeByLoginName", "(", "$", "loginName", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"removebyloginname\"", ",", "array", "(", "rawurlencode", "(", "$", "loginName", ")", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Removes the user with the specified login name @param string $loginName
[ "Removes", "the", "user", "with", "the", "specified", "login", "name" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/UserCollection.php#L63-L70
vgrem/phpSPO
src/SharePoint/SecurableObject.php
SecurableObject.breakRoleInheritance
public function breakRoleInheritance($copyRoleAssignments) { $qry = new InvokePostMethodQuery($this->getResourcePath(),"breakroleinheritance",array( $copyRoleAssignments )); $this->getContext()->addQuery($qry); }
php
public function breakRoleInheritance($copyRoleAssignments) { $qry = new InvokePostMethodQuery($this->getResourcePath(),"breakroleinheritance",array( $copyRoleAssignments )); $this->getContext()->addQuery($qry); }
[ "public", "function", "breakRoleInheritance", "(", "$", "copyRoleAssignments", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"breakroleinheritance\"", ",", "array", "(", "$", "copyRoleAssignments", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Creates unique role assignments for the securable object. @param bool $copyRoleAssignments
[ "Creates", "unique", "role", "assignments", "for", "the", "securable", "object", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/SecurableObject.php#L18-L24
vgrem/phpSPO
src/SharePoint/Group.php
Group.getUsers
public function getUsers() { if(!$this->isPropertyAvailable('Users')){ $this->setProperty("Users", new UserCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath() , "Users"))); } return $this->getProperty("Users"); }
php
public function getUsers() { if(!$this->isPropertyAvailable('Users')){ $this->setProperty("Users", new UserCollection($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath() , "Users"))); } return $this->getProperty("Users"); }
[ "public", "function", "getUsers", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'Users'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"Users\"", ",", "new", "UserCollection", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"Users\"", ")", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"Users\"", ")", ";", "}" ]
Gets a collection of user objects that represents all of the users in the group. @return UserCollection
[ "Gets", "a", "collection", "of", "user", "objects", "that", "represents", "all", "of", "the", "users", "in", "the", "group", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Group.php#L17-L23
vgrem/phpSPO
src/SharePoint/ClientContext.php
ClientContext.ensureFormDigest
public function ensureFormDigest(RequestOptions $request) { if (!isset($this->contextWebInformation)) { $this->requestFormDigest(); } $request->addCustomHeader("X-RequestDigest",$this->getContextWebInformation()->FormDigestValue); }
php
public function ensureFormDigest(RequestOptions $request) { if (!isset($this->contextWebInformation)) { $this->requestFormDigest(); } $request->addCustomHeader("X-RequestDigest",$this->getContextWebInformation()->FormDigestValue); }
[ "public", "function", "ensureFormDigest", "(", "RequestOptions", "$", "request", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "contextWebInformation", ")", ")", "{", "$", "this", "->", "requestFormDigest", "(", ")", ";", "}", "$", "request", "->", "addCustomHeader", "(", "\"X-RequestDigest\"", ",", "$", "this", "->", "getContextWebInformation", "(", ")", "->", "FormDigestValue", ")", ";", "}" ]
Ensure form digest value for POST request @param RequestOptions $request
[ "Ensure", "form", "digest", "value", "for", "POST", "request" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ClientContext.php#L53-L59
vgrem/phpSPO
src/SharePoint/ClientContext.php
ClientContext.requestFormDigest
public function requestFormDigest() { $request = new RequestOptions($this->getServiceRootUrl() . "contextinfo"); $request->Method = HttpMethod::Post; $response = $this->executeQueryDirect($request); if(!isset($this->contextWebInformation)) $this->contextWebInformation = new ContextWebInformation(); $result = new ClientResult($this->contextWebInformation); if ($this->getSerializerContext()->MetadataLevel == ODataMetadataLevel::Verbose) { $this->getSerializerContext()->RootElement = "GetContextWebInformation"; } $payload = json_decode($response); $result->fromJson($payload,$this->getSerializerContext()); }
php
public function requestFormDigest() { $request = new RequestOptions($this->getServiceRootUrl() . "contextinfo"); $request->Method = HttpMethod::Post; $response = $this->executeQueryDirect($request); if(!isset($this->contextWebInformation)) $this->contextWebInformation = new ContextWebInformation(); $result = new ClientResult($this->contextWebInformation); if ($this->getSerializerContext()->MetadataLevel == ODataMetadataLevel::Verbose) { $this->getSerializerContext()->RootElement = "GetContextWebInformation"; } $payload = json_decode($response); $result->fromJson($payload,$this->getSerializerContext()); }
[ "public", "function", "requestFormDigest", "(", ")", "{", "$", "request", "=", "new", "RequestOptions", "(", "$", "this", "->", "getServiceRootUrl", "(", ")", ".", "\"contextinfo\"", ")", ";", "$", "request", "->", "Method", "=", "HttpMethod", "::", "Post", ";", "$", "response", "=", "$", "this", "->", "executeQueryDirect", "(", "$", "request", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "contextWebInformation", ")", ")", "$", "this", "->", "contextWebInformation", "=", "new", "ContextWebInformation", "(", ")", ";", "$", "result", "=", "new", "ClientResult", "(", "$", "this", "->", "contextWebInformation", ")", ";", "if", "(", "$", "this", "->", "getSerializerContext", "(", ")", "->", "MetadataLevel", "==", "ODataMetadataLevel", "::", "Verbose", ")", "{", "$", "this", "->", "getSerializerContext", "(", ")", "->", "RootElement", "=", "\"GetContextWebInformation\"", ";", "}", "$", "payload", "=", "json_decode", "(", "$", "response", ")", ";", "$", "result", "->", "fromJson", "(", "$", "payload", ",", "$", "this", "->", "getSerializerContext", "(", ")", ")", ";", "}" ]
Request the SharePoint Context Info
[ "Request", "the", "SharePoint", "Context", "Info" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ClientContext.php#L64-L77
vgrem/phpSPO
src/SharePoint/View.php
View.getViewFields
public function getViewFields() { if(!$this->isPropertyAvailable('ViewFields')){ $this->setProperty("ViewFields", new ViewFieldCollection($this->getContext(), new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "ViewFields"))); } return $this->getProperty("ViewFields"); }
php
public function getViewFields() { if(!$this->isPropertyAvailable('ViewFields')){ $this->setProperty("ViewFields", new ViewFieldCollection($this->getContext(), new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "ViewFields"))); } return $this->getProperty("ViewFields"); }
[ "public", "function", "getViewFields", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'ViewFields'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"ViewFields\"", ",", "new", "ViewFieldCollection", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathEntity", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"ViewFields\"", ")", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"ViewFields\"", ")", ";", "}" ]
Gets a value that specifies the collection of fields in the list view. @return ViewFieldCollection
[ "Gets", "a", "value", "that", "specifies", "the", "collection", "of", "fields", "in", "the", "list", "view", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/View.php#L29-L35
vgrem/phpSPO
src/SharePoint/Utilities/Utility.php
Utility.createNewDiscussion
public static function createNewDiscussion(SPList $list, $title) { $discussionPayload = array( "Title" => $title, "FileSystemObjectType" => 1 ); $item = $list->addItem($discussionPayload); $item->getContext()->executeQuery(); //fix discussion folder name $item->setProperty("FileLeafRef",$title); $item->update(); $item->getContext()->executeQuery(); return $item; }
php
public static function createNewDiscussion(SPList $list, $title) { $discussionPayload = array( "Title" => $title, "FileSystemObjectType" => 1 ); $item = $list->addItem($discussionPayload); $item->getContext()->executeQuery(); //fix discussion folder name $item->setProperty("FileLeafRef",$title); $item->update(); $item->getContext()->executeQuery(); return $item; }
[ "public", "static", "function", "createNewDiscussion", "(", "SPList", "$", "list", ",", "$", "title", ")", "{", "$", "discussionPayload", "=", "array", "(", "\"Title\"", "=>", "$", "title", ",", "\"FileSystemObjectType\"", "=>", "1", ")", ";", "$", "item", "=", "$", "list", "->", "addItem", "(", "$", "discussionPayload", ")", ";", "$", "item", "->", "getContext", "(", ")", "->", "executeQuery", "(", ")", ";", "//fix discussion folder name", "$", "item", "->", "setProperty", "(", "\"FileLeafRef\"", ",", "$", "title", ")", ";", "$", "item", "->", "update", "(", ")", ";", "$", "item", "->", "getContext", "(", ")", "->", "executeQuery", "(", ")", ";", "return", "$", "item", ";", "}" ]
Creates a discussion item in Discussion Board @param SPList $list @param string $title @return ListItem @throws \Exception
[ "Creates", "a", "discussion", "item", "in", "Discussion", "Board" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Utilities/Utility.php#L22-L35
vgrem/phpSPO
src/SharePoint/Utilities/Utility.php
Utility.createNewDiscussionReply
public static function createNewDiscussionReply(ListItem $discussionItem,$subject){ $ctx = $discussionItem->getContext(); $list = $discussionItem->getParentList(); $contentTypes = $list->getContentTypes(); $ctx->load($contentTypes); $ctx->executeQuery(); $result = $contentTypes->findItems( function (ContentType $item){ return $item->getProperty("Name") === "Message"; }); if(count($result) == 0){ throw new \Exception("Message content type not found"); } $messagePayload = array( "Body" => $subject, "FileSystemObjectType" => 0, "ContentTypeId" => $result[0]->getProperty("Id") ); $messageItem = $list->addItem($messagePayload); $ctx->executeQuery(); //move message into discussion folder $ctx->load($discussionItem,array("FileRef")); $ctx->load($messageItem,array("FileRef","FileDirRef")); $ctx->executeQuery(); $sourceFileUrl = $messageItem->getProperty("FileRef"); $targetFileUrl = str_replace($messageItem->getProperty("FileDirRef"),$discussionItem->getProperty("FileRef"),$sourceFileUrl); $ctx->getWeb()->getFileByServerRelativeUrl($sourceFileUrl)->moveTo($targetFileUrl,1); $ctx->executeQuery(); return $messageItem; }
php
public static function createNewDiscussionReply(ListItem $discussionItem,$subject){ $ctx = $discussionItem->getContext(); $list = $discussionItem->getParentList(); $contentTypes = $list->getContentTypes(); $ctx->load($contentTypes); $ctx->executeQuery(); $result = $contentTypes->findItems( function (ContentType $item){ return $item->getProperty("Name") === "Message"; }); if(count($result) == 0){ throw new \Exception("Message content type not found"); } $messagePayload = array( "Body" => $subject, "FileSystemObjectType" => 0, "ContentTypeId" => $result[0]->getProperty("Id") ); $messageItem = $list->addItem($messagePayload); $ctx->executeQuery(); //move message into discussion folder $ctx->load($discussionItem,array("FileRef")); $ctx->load($messageItem,array("FileRef","FileDirRef")); $ctx->executeQuery(); $sourceFileUrl = $messageItem->getProperty("FileRef"); $targetFileUrl = str_replace($messageItem->getProperty("FileDirRef"),$discussionItem->getProperty("FileRef"),$sourceFileUrl); $ctx->getWeb()->getFileByServerRelativeUrl($sourceFileUrl)->moveTo($targetFileUrl,1); $ctx->executeQuery(); return $messageItem; }
[ "public", "static", "function", "createNewDiscussionReply", "(", "ListItem", "$", "discussionItem", ",", "$", "subject", ")", "{", "$", "ctx", "=", "$", "discussionItem", "->", "getContext", "(", ")", ";", "$", "list", "=", "$", "discussionItem", "->", "getParentList", "(", ")", ";", "$", "contentTypes", "=", "$", "list", "->", "getContentTypes", "(", ")", ";", "$", "ctx", "->", "load", "(", "$", "contentTypes", ")", ";", "$", "ctx", "->", "executeQuery", "(", ")", ";", "$", "result", "=", "$", "contentTypes", "->", "findItems", "(", "function", "(", "ContentType", "$", "item", ")", "{", "return", "$", "item", "->", "getProperty", "(", "\"Name\"", ")", "===", "\"Message\"", ";", "}", ")", ";", "if", "(", "count", "(", "$", "result", ")", "==", "0", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Message content type not found\"", ")", ";", "}", "$", "messagePayload", "=", "array", "(", "\"Body\"", "=>", "$", "subject", ",", "\"FileSystemObjectType\"", "=>", "0", ",", "\"ContentTypeId\"", "=>", "$", "result", "[", "0", "]", "->", "getProperty", "(", "\"Id\"", ")", ")", ";", "$", "messageItem", "=", "$", "list", "->", "addItem", "(", "$", "messagePayload", ")", ";", "$", "ctx", "->", "executeQuery", "(", ")", ";", "//move message into discussion folder", "$", "ctx", "->", "load", "(", "$", "discussionItem", ",", "array", "(", "\"FileRef\"", ")", ")", ";", "$", "ctx", "->", "load", "(", "$", "messageItem", ",", "array", "(", "\"FileRef\"", ",", "\"FileDirRef\"", ")", ")", ";", "$", "ctx", "->", "executeQuery", "(", ")", ";", "$", "sourceFileUrl", "=", "$", "messageItem", "->", "getProperty", "(", "\"FileRef\"", ")", ";", "$", "targetFileUrl", "=", "str_replace", "(", "$", "messageItem", "->", "getProperty", "(", "\"FileDirRef\"", ")", ",", "$", "discussionItem", "->", "getProperty", "(", "\"FileRef\"", ")", ",", "$", "sourceFileUrl", ")", ";", "$", "ctx", "->", "getWeb", "(", ")", "->", "getFileByServerRelativeUrl", "(", "$", "sourceFileUrl", ")", "->", "moveTo", "(", "$", "targetFileUrl", ",", "1", ")", ";", "$", "ctx", "->", "executeQuery", "(", ")", ";", "return", "$", "messageItem", ";", "}" ]
Creates a message item (reply) in Discussion Board @param ListItem $discussionItem @param string $subject @return ListItem @throws \Exception
[ "Creates", "a", "message", "item", "(", "reply", ")", "in", "Discussion", "Board" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/Utilities/Utility.php#L45-L76
vgrem/phpSPO
src/Runtime/Auth/SamlTokenProvider.php
SamlTokenProvider.acquireAuthenticationCookies
protected function acquireAuthenticationCookies($token) { $urlInfo = parse_url($this->authorityUrl); $url = $urlInfo['scheme'] . '://' . $urlInfo['host'] . self::$SignInPageUrl; if ($this->usingFederatedSTS) { $url = $urlInfo['scheme'] . '://' . $urlInfo['host'] . self::$IDCRLSVCPageUrl; $headers = array(); $headers['User-Agent'] = ''; $headers['X-IDCRL_ACCEPTED'] = 't'; $headers['Authorization'] = 'BPOSIDCRL ' . $token; $headers['Content-Type'] = 'application/x-www-form-urlencoded'; $response = Requests::head($url,$headers,true); $cookies = Requests::parseCookies($response); $this->SPOIDCRL = $cookies['SPOIDCRL']; } else { $response = Requests::post($url,null,$token,true); $cookies = Requests::parseCookies($response); $this->FedAuth = $cookies['FedAuth']; $this->rtFa = $cookies['rtFa']; } }
php
protected function acquireAuthenticationCookies($token) { $urlInfo = parse_url($this->authorityUrl); $url = $urlInfo['scheme'] . '://' . $urlInfo['host'] . self::$SignInPageUrl; if ($this->usingFederatedSTS) { $url = $urlInfo['scheme'] . '://' . $urlInfo['host'] . self::$IDCRLSVCPageUrl; $headers = array(); $headers['User-Agent'] = ''; $headers['X-IDCRL_ACCEPTED'] = 't'; $headers['Authorization'] = 'BPOSIDCRL ' . $token; $headers['Content-Type'] = 'application/x-www-form-urlencoded'; $response = Requests::head($url,$headers,true); $cookies = Requests::parseCookies($response); $this->SPOIDCRL = $cookies['SPOIDCRL']; } else { $response = Requests::post($url,null,$token,true); $cookies = Requests::parseCookies($response); $this->FedAuth = $cookies['FedAuth']; $this->rtFa = $cookies['rtFa']; } }
[ "protected", "function", "acquireAuthenticationCookies", "(", "$", "token", ")", "{", "$", "urlInfo", "=", "parse_url", "(", "$", "this", "->", "authorityUrl", ")", ";", "$", "url", "=", "$", "urlInfo", "[", "'scheme'", "]", ".", "'://'", ".", "$", "urlInfo", "[", "'host'", "]", ".", "self", "::", "$", "SignInPageUrl", ";", "if", "(", "$", "this", "->", "usingFederatedSTS", ")", "{", "$", "url", "=", "$", "urlInfo", "[", "'scheme'", "]", ".", "'://'", ".", "$", "urlInfo", "[", "'host'", "]", ".", "self", "::", "$", "IDCRLSVCPageUrl", ";", "$", "headers", "=", "array", "(", ")", ";", "$", "headers", "[", "'User-Agent'", "]", "=", "''", ";", "$", "headers", "[", "'X-IDCRL_ACCEPTED'", "]", "=", "'t'", ";", "$", "headers", "[", "'Authorization'", "]", "=", "'BPOSIDCRL '", ".", "$", "token", ";", "$", "headers", "[", "'Content-Type'", "]", "=", "'application/x-www-form-urlencoded'", ";", "$", "response", "=", "Requests", "::", "head", "(", "$", "url", ",", "$", "headers", ",", "true", ")", ";", "$", "cookies", "=", "Requests", "::", "parseCookies", "(", "$", "response", ")", ";", "$", "this", "->", "SPOIDCRL", "=", "$", "cookies", "[", "'SPOIDCRL'", "]", ";", "}", "else", "{", "$", "response", "=", "Requests", "::", "post", "(", "$", "url", ",", "null", ",", "$", "token", ",", "true", ")", ";", "$", "cookies", "=", "Requests", "::", "parseCookies", "(", "$", "response", ")", ";", "$", "this", "->", "FedAuth", "=", "$", "cookies", "[", "'FedAuth'", "]", ";", "$", "this", "->", "rtFa", "=", "$", "cookies", "[", "'rtFa'", "]", ";", "}", "}" ]
Acquire SharePoint Online authentication (FedAuth and rtFa) cookies @param mixed $token @throws Exception
[ "Acquire", "SharePoint", "Online", "authentication", "(", "FedAuth", "and", "rtFa", ")", "cookies" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/SamlTokenProvider.php#L111-L135
vgrem/phpSPO
src/Runtime/Auth/SamlTokenProvider.php
SamlTokenProvider.acquireSecurityToken
protected function acquireSecurityToken($username, $password) { $data = $this->prepareSecurityTokenRequest($username, $password, $this->authorityUrl); $response = Requests::post(self::$StsUrl,null,$data); try { $this->processSecurityTokenResponse($response); } catch (Exception $e) { // Try to get the token with a federated authentication. $response = $this->acquireSecurityTokenFromFederatedSTS($username, $password); } return $this->processSecurityTokenResponse($response); }
php
protected function acquireSecurityToken($username, $password) { $data = $this->prepareSecurityTokenRequest($username, $password, $this->authorityUrl); $response = Requests::post(self::$StsUrl,null,$data); try { $this->processSecurityTokenResponse($response); } catch (Exception $e) { // Try to get the token with a federated authentication. $response = $this->acquireSecurityTokenFromFederatedSTS($username, $password); } return $this->processSecurityTokenResponse($response); }
[ "protected", "function", "acquireSecurityToken", "(", "$", "username", ",", "$", "password", ")", "{", "$", "data", "=", "$", "this", "->", "prepareSecurityTokenRequest", "(", "$", "username", ",", "$", "password", ",", "$", "this", "->", "authorityUrl", ")", ";", "$", "response", "=", "Requests", "::", "post", "(", "self", "::", "$", "StsUrl", ",", "null", ",", "$", "data", ")", ";", "try", "{", "$", "this", "->", "processSecurityTokenResponse", "(", "$", "response", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "// Try to get the token with a federated authentication.", "$", "response", "=", "$", "this", "->", "acquireSecurityTokenFromFederatedSTS", "(", "$", "username", ",", "$", "password", ")", ";", "}", "return", "$", "this", "->", "processSecurityTokenResponse", "(", "$", "response", ")", ";", "}" ]
Acquire the service token from STS @param string $username @param string $password @return string @throws Exception
[ "Acquire", "the", "service", "token", "from", "STS" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/SamlTokenProvider.php#L146-L160
vgrem/phpSPO
src/Runtime/Auth/SamlTokenProvider.php
SamlTokenProvider.acquireSecurityTokenFromFederatedSTS
protected function acquireSecurityTokenFromFederatedSTS($username, $password) { $response = Requests::get(str_replace('{username}', $username, self::$RealmUrlTemplate),null); $federatedStsUrl = $this->getFederatedAuthenticationInformation($response); if ($federatedStsUrl) { $message_id = md5(uniqid($username . '-' . time() . '-' . rand() , true)); $data = $this->prepareSecurityFederatedTokenRequest($username, $password, $message_id, $federatedStsUrl->textContent); $headers = array(); $headers['Content-Type'] = 'application/soap+xml'; $response = Requests::post($federatedStsUrl->textContent, $headers, $data); $samlAssertion = $this->getSamlAssertion($response); if ($samlAssertion) { $samlAssertion_node = $samlAssertion->item(0); $data = $this->prepareRST2Request($samlAssertion_node); $response = Requests::post(self::$RST2Url, $headers, $data); $this->usingFederatedSTS = TRUE; return $response; } } return NULL; }
php
protected function acquireSecurityTokenFromFederatedSTS($username, $password) { $response = Requests::get(str_replace('{username}', $username, self::$RealmUrlTemplate),null); $federatedStsUrl = $this->getFederatedAuthenticationInformation($response); if ($federatedStsUrl) { $message_id = md5(uniqid($username . '-' . time() . '-' . rand() , true)); $data = $this->prepareSecurityFederatedTokenRequest($username, $password, $message_id, $federatedStsUrl->textContent); $headers = array(); $headers['Content-Type'] = 'application/soap+xml'; $response = Requests::post($federatedStsUrl->textContent, $headers, $data); $samlAssertion = $this->getSamlAssertion($response); if ($samlAssertion) { $samlAssertion_node = $samlAssertion->item(0); $data = $this->prepareRST2Request($samlAssertion_node); $response = Requests::post(self::$RST2Url, $headers, $data); $this->usingFederatedSTS = TRUE; return $response; } } return NULL; }
[ "protected", "function", "acquireSecurityTokenFromFederatedSTS", "(", "$", "username", ",", "$", "password", ")", "{", "$", "response", "=", "Requests", "::", "get", "(", "str_replace", "(", "'{username}'", ",", "$", "username", ",", "self", "::", "$", "RealmUrlTemplate", ")", ",", "null", ")", ";", "$", "federatedStsUrl", "=", "$", "this", "->", "getFederatedAuthenticationInformation", "(", "$", "response", ")", ";", "if", "(", "$", "federatedStsUrl", ")", "{", "$", "message_id", "=", "md5", "(", "uniqid", "(", "$", "username", ".", "'-'", ".", "time", "(", ")", ".", "'-'", ".", "rand", "(", ")", ",", "true", ")", ")", ";", "$", "data", "=", "$", "this", "->", "prepareSecurityFederatedTokenRequest", "(", "$", "username", ",", "$", "password", ",", "$", "message_id", ",", "$", "federatedStsUrl", "->", "textContent", ")", ";", "$", "headers", "=", "array", "(", ")", ";", "$", "headers", "[", "'Content-Type'", "]", "=", "'application/soap+xml'", ";", "$", "response", "=", "Requests", "::", "post", "(", "$", "federatedStsUrl", "->", "textContent", ",", "$", "headers", ",", "$", "data", ")", ";", "$", "samlAssertion", "=", "$", "this", "->", "getSamlAssertion", "(", "$", "response", ")", ";", "if", "(", "$", "samlAssertion", ")", "{", "$", "samlAssertion_node", "=", "$", "samlAssertion", "->", "item", "(", "0", ")", ";", "$", "data", "=", "$", "this", "->", "prepareRST2Request", "(", "$", "samlAssertion_node", ")", ";", "$", "response", "=", "Requests", "::", "post", "(", "self", "::", "$", "RST2Url", ",", "$", "headers", ",", "$", "data", ")", ";", "$", "this", "->", "usingFederatedSTS", "=", "TRUE", ";", "return", "$", "response", ";", "}", "}", "return", "NULL", ";", "}" ]
Acquire the service token from Federated STS @param string $username @param string $password @return string
[ "Acquire", "the", "service", "token", "from", "Federated", "STS" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/SamlTokenProvider.php#L169-L195
vgrem/phpSPO
src/Runtime/Auth/SamlTokenProvider.php
SamlTokenProvider.getSamlAssertion
protected function getSamlAssertion($response) { $xml = new \DOMDocument(); $xml->loadXML($response); $xpath = new \DOMXPath($xml); if ($xpath->query("//*[name()='saml:Assertion']")->length > 0) { $nodeToken = $xpath->query("//*[name()='saml:Assertion']"); if (!empty($nodeToken)) { return $nodeToken; } } return NULL; }
php
protected function getSamlAssertion($response) { $xml = new \DOMDocument(); $xml->loadXML($response); $xpath = new \DOMXPath($xml); if ($xpath->query("//*[name()='saml:Assertion']")->length > 0) { $nodeToken = $xpath->query("//*[name()='saml:Assertion']"); if (!empty($nodeToken)) { return $nodeToken; } } return NULL; }
[ "protected", "function", "getSamlAssertion", "(", "$", "response", ")", "{", "$", "xml", "=", "new", "\\", "DOMDocument", "(", ")", ";", "$", "xml", "->", "loadXML", "(", "$", "response", ")", ";", "$", "xpath", "=", "new", "\\", "DOMXPath", "(", "$", "xml", ")", ";", "if", "(", "$", "xpath", "->", "query", "(", "\"//*[name()='saml:Assertion']\"", ")", "->", "length", ">", "0", ")", "{", "$", "nodeToken", "=", "$", "xpath", "->", "query", "(", "\"//*[name()='saml:Assertion']\"", ")", ";", "if", "(", "!", "empty", "(", "$", "nodeToken", ")", ")", "{", "return", "$", "nodeToken", ";", "}", "}", "return", "NULL", ";", "}" ]
Get SAML assertion Node so it can be used within the RST2 template @param $response @return \DOMNodeList|null
[ "Get", "SAML", "assertion", "Node", "so", "it", "can", "be", "used", "within", "the", "RST2", "template" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/SamlTokenProvider.php#L202-L214
vgrem/phpSPO
src/Runtime/Auth/SamlTokenProvider.php
SamlTokenProvider.getFederatedAuthenticationInformation
protected function getFederatedAuthenticationInformation($response) { if ($response) { $xml = new \DOMDocument(); $xml->loadXML($response); $xpath = new \DOMXPath($xml); if ($xpath->query("//STSAuthURL")->length > 0) { return $xpath->query("//STSAuthURL")->item(0); } } return ''; }
php
protected function getFederatedAuthenticationInformation($response) { if ($response) { $xml = new \DOMDocument(); $xml->loadXML($response); $xpath = new \DOMXPath($xml); if ($xpath->query("//STSAuthURL")->length > 0) { return $xpath->query("//STSAuthURL")->item(0); } } return ''; }
[ "protected", "function", "getFederatedAuthenticationInformation", "(", "$", "response", ")", "{", "if", "(", "$", "response", ")", "{", "$", "xml", "=", "new", "\\", "DOMDocument", "(", ")", ";", "$", "xml", "->", "loadXML", "(", "$", "response", ")", ";", "$", "xpath", "=", "new", "\\", "DOMXPath", "(", "$", "xml", ")", ";", "if", "(", "$", "xpath", "->", "query", "(", "\"//STSAuthURL\"", ")", "->", "length", ">", "0", ")", "{", "return", "$", "xpath", "->", "query", "(", "\"//STSAuthURL\"", ")", "->", "item", "(", "0", ")", ";", "}", "}", "return", "''", ";", "}" ]
Retrieves the STS federated URL if any. @param $response @return string Federated STS Url
[ "Retrieves", "the", "STS", "federated", "URL", "if", "any", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/SamlTokenProvider.php#L221-L231
vgrem/phpSPO
src/Runtime/Auth/SamlTokenProvider.php
SamlTokenProvider.processSecurityTokenResponse
protected function processSecurityTokenResponse($response) { $xml = new \DOMDocument(); $xml->loadXML($response); $xpath = new \DOMXPath($xml); if ($xpath->query("//wsse:BinarySecurityToken")->length > 0) { $nodeToken = $xpath->query("//wsse:BinarySecurityToken")->item(0); if (!empty($nodeToken)) { return $nodeToken->nodeValue; } } if ($xpath->query("//S:Fault")->length > 0) { // Returning the full fault value in case any other response comes within the fault node. throw new \RuntimeException($xpath->query("//S:Fault")->item(0)->nodeValue); } throw new \RuntimeException('Error trying to get a token, check your URL or credentials'); }
php
protected function processSecurityTokenResponse($response) { $xml = new \DOMDocument(); $xml->loadXML($response); $xpath = new \DOMXPath($xml); if ($xpath->query("//wsse:BinarySecurityToken")->length > 0) { $nodeToken = $xpath->query("//wsse:BinarySecurityToken")->item(0); if (!empty($nodeToken)) { return $nodeToken->nodeValue; } } if ($xpath->query("//S:Fault")->length > 0) { // Returning the full fault value in case any other response comes within the fault node. throw new \RuntimeException($xpath->query("//S:Fault")->item(0)->nodeValue); } throw new \RuntimeException('Error trying to get a token, check your URL or credentials'); }
[ "protected", "function", "processSecurityTokenResponse", "(", "$", "response", ")", "{", "$", "xml", "=", "new", "\\", "DOMDocument", "(", ")", ";", "$", "xml", "->", "loadXML", "(", "$", "response", ")", ";", "$", "xpath", "=", "new", "\\", "DOMXPath", "(", "$", "xml", ")", ";", "if", "(", "$", "xpath", "->", "query", "(", "\"//wsse:BinarySecurityToken\"", ")", "->", "length", ">", "0", ")", "{", "$", "nodeToken", "=", "$", "xpath", "->", "query", "(", "\"//wsse:BinarySecurityToken\"", ")", "->", "item", "(", "0", ")", ";", "if", "(", "!", "empty", "(", "$", "nodeToken", ")", ")", "{", "return", "$", "nodeToken", "->", "nodeValue", ";", "}", "}", "if", "(", "$", "xpath", "->", "query", "(", "\"//S:Fault\"", ")", "->", "length", ">", "0", ")", "{", "// Returning the full fault value in case any other response comes within the fault node.", "throw", "new", "\\", "RuntimeException", "(", "$", "xpath", "->", "query", "(", "\"//S:Fault\"", ")", "->", "item", "(", "0", ")", "->", "nodeValue", ")", ";", "}", "throw", "new", "\\", "RuntimeException", "(", "'Error trying to get a token, check your URL or credentials'", ")", ";", "}" ]
Verify and extract security token from the HTTP response @param mixed $response @return mixed BinarySecurityToken or Exception when an error is present @throws Exception
[ "Verify", "and", "extract", "security", "token", "from", "the", "HTTP", "response" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/SamlTokenProvider.php#L239-L257
vgrem/phpSPO
src/Runtime/Auth/SamlTokenProvider.php
SamlTokenProvider.prepareSecurityTokenRequest
protected function prepareSecurityTokenRequest($username, $password, $address) { $fileName = __DIR__ . '/xml/SAML.xml'; if (!file_exists($fileName)) { throw new \Exception("The file $fileName does not exist"); } $template = file_get_contents($fileName); $template = str_replace('{username}', $username, $template); $template = str_replace('{password}', $password, $template); $template = str_replace('{address}', $address, $template); return $template; }
php
protected function prepareSecurityTokenRequest($username, $password, $address) { $fileName = __DIR__ . '/xml/SAML.xml'; if (!file_exists($fileName)) { throw new \Exception("The file $fileName does not exist"); } $template = file_get_contents($fileName); $template = str_replace('{username}', $username, $template); $template = str_replace('{password}', $password, $template); $template = str_replace('{address}', $address, $template); return $template; }
[ "protected", "function", "prepareSecurityTokenRequest", "(", "$", "username", ",", "$", "password", ",", "$", "address", ")", "{", "$", "fileName", "=", "__DIR__", ".", "'/xml/SAML.xml'", ";", "if", "(", "!", "file_exists", "(", "$", "fileName", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"The file $fileName does not exist\"", ")", ";", "}", "$", "template", "=", "file_get_contents", "(", "$", "fileName", ")", ";", "$", "template", "=", "str_replace", "(", "'{username}'", ",", "$", "username", ",", "$", "template", ")", ";", "$", "template", "=", "str_replace", "(", "'{password}'", ",", "$", "password", ",", "$", "template", ")", ";", "$", "template", "=", "str_replace", "(", "'{address}'", ",", "$", "address", ",", "$", "template", ")", ";", "return", "$", "template", ";", "}" ]
Construct the request body to acquire security token from STS endpoint @param string $username @param string $password @param string $address @return string @throws Exception
[ "Construct", "the", "request", "body", "to", "acquire", "security", "token", "from", "STS", "endpoint" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/SamlTokenProvider.php#L268-L280
vgrem/phpSPO
src/Runtime/Auth/SamlTokenProvider.php
SamlTokenProvider.prepareSecurityFederatedTokenRequest
protected function prepareSecurityFederatedTokenRequest($username, $password, $message_uuid, $federated_sts_url) { $fileName = __DIR__ . '/xml/federatedSAML.xml'; if (!file_exists($fileName)) { throw new \Exception("The file $fileName does not exist"); } $template = file_get_contents($fileName); $template = str_replace('{username}', $username, $template); $template = str_replace('{password}', $password, $template); $template = str_replace('{federated_sts_url}', $federated_sts_url, $template); $template = str_replace('{message_uuid}', $message_uuid, $template); return $template; }
php
protected function prepareSecurityFederatedTokenRequest($username, $password, $message_uuid, $federated_sts_url) { $fileName = __DIR__ . '/xml/federatedSAML.xml'; if (!file_exists($fileName)) { throw new \Exception("The file $fileName does not exist"); } $template = file_get_contents($fileName); $template = str_replace('{username}', $username, $template); $template = str_replace('{password}', $password, $template); $template = str_replace('{federated_sts_url}', $federated_sts_url, $template); $template = str_replace('{message_uuid}', $message_uuid, $template); return $template; }
[ "protected", "function", "prepareSecurityFederatedTokenRequest", "(", "$", "username", ",", "$", "password", ",", "$", "message_uuid", ",", "$", "federated_sts_url", ")", "{", "$", "fileName", "=", "__DIR__", ".", "'/xml/federatedSAML.xml'", ";", "if", "(", "!", "file_exists", "(", "$", "fileName", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"The file $fileName does not exist\"", ")", ";", "}", "$", "template", "=", "file_get_contents", "(", "$", "fileName", ")", ";", "$", "template", "=", "str_replace", "(", "'{username}'", ",", "$", "username", ",", "$", "template", ")", ";", "$", "template", "=", "str_replace", "(", "'{password}'", ",", "$", "password", ",", "$", "template", ")", ";", "$", "template", "=", "str_replace", "(", "'{federated_sts_url}'", ",", "$", "federated_sts_url", ",", "$", "template", ")", ";", "$", "template", "=", "str_replace", "(", "'{message_uuid}'", ",", "$", "message_uuid", ",", "$", "template", ")", ";", "return", "$", "template", ";", "}" ]
Construct the request body to acquire security token from Federated STS endpoint (sts.yourcompany.com) @param $username @param $password @param $message_uuid @param $federated_sts_url @return string @throws Exception
[ "Construct", "the", "request", "body", "to", "acquire", "security", "token", "from", "Federated", "STS", "endpoint", "(", "sts", ".", "yourcompany", ".", "com", ")" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/SamlTokenProvider.php#L292-L305
vgrem/phpSPO
src/Runtime/Auth/SamlTokenProvider.php
SamlTokenProvider.prepareRST2Request
protected function prepareRST2Request($samlAssertion) { $fileName = __DIR__ . '/xml/RST2.xml'; if (!file_exists($fileName)) { throw new \Exception("The file $fileName does not exist"); } $template = file_get_contents($fileName); $xml = new \DOMDocument(); $xml->loadXML($template); $xpath = new \DOMXPath($xml); $samlAssertion = $xml->importNode($samlAssertion, true); if ($xpath->query("//*[name()='wsse:Security']")->length > 0) { $parentNode = $xpath->query("//wsse:Security")->item(0); //append "saml assertion" node to <wsse:Security> node $parentNode->appendChild($samlAssertion); return $xml->saveXML(); } return NULL; }
php
protected function prepareRST2Request($samlAssertion) { $fileName = __DIR__ . '/xml/RST2.xml'; if (!file_exists($fileName)) { throw new \Exception("The file $fileName does not exist"); } $template = file_get_contents($fileName); $xml = new \DOMDocument(); $xml->loadXML($template); $xpath = new \DOMXPath($xml); $samlAssertion = $xml->importNode($samlAssertion, true); if ($xpath->query("//*[name()='wsse:Security']")->length > 0) { $parentNode = $xpath->query("//wsse:Security")->item(0); //append "saml assertion" node to <wsse:Security> node $parentNode->appendChild($samlAssertion); return $xml->saveXML(); } return NULL; }
[ "protected", "function", "prepareRST2Request", "(", "$", "samlAssertion", ")", "{", "$", "fileName", "=", "__DIR__", ".", "'/xml/RST2.xml'", ";", "if", "(", "!", "file_exists", "(", "$", "fileName", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"The file $fileName does not exist\"", ")", ";", "}", "$", "template", "=", "file_get_contents", "(", "$", "fileName", ")", ";", "$", "xml", "=", "new", "\\", "DOMDocument", "(", ")", ";", "$", "xml", "->", "loadXML", "(", "$", "template", ")", ";", "$", "xpath", "=", "new", "\\", "DOMXPath", "(", "$", "xml", ")", ";", "$", "samlAssertion", "=", "$", "xml", "->", "importNode", "(", "$", "samlAssertion", ",", "true", ")", ";", "if", "(", "$", "xpath", "->", "query", "(", "\"//*[name()='wsse:Security']\"", ")", "->", "length", ">", "0", ")", "{", "$", "parentNode", "=", "$", "xpath", "->", "query", "(", "\"//wsse:Security\"", ")", "->", "item", "(", "0", ")", ";", "//append \"saml assertion\" node to <wsse:Security> node", "$", "parentNode", "->", "appendChild", "(", "$", "samlAssertion", ")", ";", "return", "$", "xml", "->", "saveXML", "(", ")", ";", "}", "return", "NULL", ";", "}" ]
Prepare the request to be sent to RST2 endpoint with the saml assertion @param $samlAssertion @return bool|mixed|string @throws \Exception
[ "Prepare", "the", "request", "to", "be", "sent", "to", "RST2", "endpoint", "with", "the", "saml", "assertion" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/Auth/SamlTokenProvider.php#L313-L335
vgrem/phpSPO
src/SharePoint/File.php
File.checkIn
public function checkIn($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "checkIn", array( "comment" => $comment, "checkintype" => 0 )); $this->getContext()->addQuery($qry); }
php
public function checkIn($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "checkIn", array( "comment" => $comment, "checkintype" => 0 )); $this->getContext()->addQuery($qry); }
[ "public", "function", "checkIn", "(", "$", "comment", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"checkIn\"", ",", "array", "(", "\"comment\"", "=>", "$", "comment", ",", "\"checkintype\"", "=>", "0", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Checks the file in to a document library based on the check-in type. @param string $comment A comment for the check-in. Its length must be <= 1023.
[ "Checks", "the", "file", "in", "to", "a", "document", "library", "based", "on", "the", "check", "-", "in", "type", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L56-L63
vgrem/phpSPO
src/SharePoint/File.php
File.approve
public function approve($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "approve", array( "comment" => $comment )); $this->getContext()->addQuery($qry); }
php
public function approve($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "approve", array( "comment" => $comment )); $this->getContext()->addQuery($qry); }
[ "public", "function", "approve", "(", "$", "comment", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"approve\"", ",", "array", "(", "\"comment\"", "=>", "$", "comment", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Approves the file submitted for content approval with the specified comment. @param string $comment The comment for the approval.
[ "Approves", "the", "file", "submitted", "for", "content", "approval", "with", "the", "specified", "comment", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L70-L76
vgrem/phpSPO
src/SharePoint/File.php
File.deny
public function deny($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "deny", array( "comment" => $comment )); $this->getContext()->addQuery($qry); }
php
public function deny($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "deny", array( "comment" => $comment )); $this->getContext()->addQuery($qry); }
[ "public", "function", "deny", "(", "$", "comment", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"deny\"", ",", "array", "(", "\"comment\"", "=>", "$", "comment", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Denies approval for a file that was submitted for content approval. @param string $comment The comment for the denial.
[ "Denies", "approval", "for", "a", "file", "that", "was", "submitted", "for", "content", "approval", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L82-L88
vgrem/phpSPO
src/SharePoint/File.php
File.publish
public function publish($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "publish", array( "comment" => $comment )); $this->getContext()->addQuery($qry); }
php
public function publish($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "publish", array( "comment" => $comment )); $this->getContext()->addQuery($qry); }
[ "public", "function", "publish", "(", "$", "comment", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"publish\"", ",", "array", "(", "\"comment\"", "=>", "$", "comment", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Submits the file for content approval with the specified comment. @param string $comment The comment for the published file. Its length must be <= 1023.
[ "Submits", "the", "file", "for", "content", "approval", "with", "the", "specified", "comment", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L94-L100
vgrem/phpSPO
src/SharePoint/File.php
File.unpublish
public function unpublish($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "unpublish", array( "comment" => $comment )); $this->getContext()->addQuery($qry); }
php
public function unpublish($comment) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "unpublish", array( "comment" => $comment )); $this->getContext()->addQuery($qry); }
[ "public", "function", "unpublish", "(", "$", "comment", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"unpublish\"", ",", "array", "(", "\"comment\"", "=>", "$", "comment", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Removes the file from content approval or unpublish a major version. @param string $comment The comment for the unpublish operation. Its length must be <= 1023.
[ "Removes", "the", "file", "from", "content", "approval", "or", "unpublish", "a", "major", "version", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L107-L113
vgrem/phpSPO
src/SharePoint/File.php
File.copyTo
public function copyTo($strNewUrl, $bOverWrite) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "copyto", array( "strnewurl" => $strNewUrl, "boverwrite" => $bOverWrite )); $this->getContext()->addQuery($qry); }
php
public function copyTo($strNewUrl, $bOverWrite) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "copyto", array( "strnewurl" => $strNewUrl, "boverwrite" => $bOverWrite )); $this->getContext()->addQuery($qry); }
[ "public", "function", "copyTo", "(", "$", "strNewUrl", ",", "$", "bOverWrite", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"copyto\"", ",", "array", "(", "\"strnewurl\"", "=>", "$", "strNewUrl", ",", "\"boverwrite\"", "=>", "$", "bOverWrite", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Copies the file to the destination URL. @param string $strNewUrl The absolute URL or server relative URL of the destination file path to copy to. @param bool $bOverWrite true to overwrite a file with the same name in the same location; otherwise false.
[ "Copies", "the", "file", "to", "the", "destination", "URL", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L121-L128
vgrem/phpSPO
src/SharePoint/File.php
File.moveTo
public function moveTo($newUrl, $flags) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "moveto", array( "newurl" => $newUrl, "flags" => $flags )); $this->getContext()->addQuery($qry); }
php
public function moveTo($newUrl, $flags) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "moveto", array( "newurl" => $newUrl, "flags" => $flags )); $this->getContext()->addQuery($qry); }
[ "public", "function", "moveTo", "(", "$", "newUrl", ",", "$", "flags", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"moveto\"", ",", "array", "(", "\"newurl\"", "=>", "$", "newUrl", ",", "\"flags\"", "=>", "$", "flags", ")", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ")", ";", "}" ]
Moves the file to the specified destination URL. @param string $newUrl The absolute URL or server relative URL of the destination file path to move to. @param int $flags The bitwise SP.MoveOperations value for how to move the file. Overwrite = 1; AllowBrokenThickets (move even if supporting files are separated from the file) = 8.
[ "Moves", "the", "file", "to", "the", "specified", "destination", "URL", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L135-L142
vgrem/phpSPO
src/SharePoint/File.php
File.openBinary
public static function openBinary(ClientRuntimeContext $ctx, $serverRelativeUrl) { $serverRelativeUrl = rawurlencode($serverRelativeUrl); $url = $ctx->getServiceRootUrl() . "web/getfilebyserverrelativeurl('$serverRelativeUrl')/\$value"; $options = new RequestOptions($url); $data = $ctx->executeQueryDirect($options); return $data; }
php
public static function openBinary(ClientRuntimeContext $ctx, $serverRelativeUrl) { $serverRelativeUrl = rawurlencode($serverRelativeUrl); $url = $ctx->getServiceRootUrl() . "web/getfilebyserverrelativeurl('$serverRelativeUrl')/\$value"; $options = new RequestOptions($url); $data = $ctx->executeQueryDirect($options); return $data; }
[ "public", "static", "function", "openBinary", "(", "ClientRuntimeContext", "$", "ctx", ",", "$", "serverRelativeUrl", ")", "{", "$", "serverRelativeUrl", "=", "rawurlencode", "(", "$", "serverRelativeUrl", ")", ";", "$", "url", "=", "$", "ctx", "->", "getServiceRootUrl", "(", ")", ".", "\"web/getfilebyserverrelativeurl('$serverRelativeUrl')/\\$value\"", ";", "$", "options", "=", "new", "RequestOptions", "(", "$", "url", ")", ";", "$", "data", "=", "$", "ctx", "->", "executeQueryDirect", "(", "$", "options", ")", ";", "return", "$", "data", ";", "}" ]
Opens the file @param ClientRuntimeContext $ctx @param $serverRelativeUrl @return mixed|string @throws \Exception
[ "Opens", "the", "file" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L162-L169
vgrem/phpSPO
src/SharePoint/File.php
File.saveBinary
public static function saveBinary(ClientRuntimeContext $ctx, $serverRelativeUrl, $content) { $serverRelativeUrl = rawurlencode($serverRelativeUrl); $url = $ctx->getServiceRootUrl() . "web/getfilebyserverrelativeurl('$serverRelativeUrl')/\$value"; $request = new RequestOptions($url); $request->Method = HttpMethod::Post; $request->addCustomHeader('X-HTTP-Method', 'PUT'); $request->Data = $content; if ($ctx instanceof ClientContext) { $ctx->ensureFormDigest($request); } $ctx->executeQueryDirect($request); }
php
public static function saveBinary(ClientRuntimeContext $ctx, $serverRelativeUrl, $content) { $serverRelativeUrl = rawurlencode($serverRelativeUrl); $url = $ctx->getServiceRootUrl() . "web/getfilebyserverrelativeurl('$serverRelativeUrl')/\$value"; $request = new RequestOptions($url); $request->Method = HttpMethod::Post; $request->addCustomHeader('X-HTTP-Method', 'PUT'); $request->Data = $content; if ($ctx instanceof ClientContext) { $ctx->ensureFormDigest($request); } $ctx->executeQueryDirect($request); }
[ "public", "static", "function", "saveBinary", "(", "ClientRuntimeContext", "$", "ctx", ",", "$", "serverRelativeUrl", ",", "$", "content", ")", "{", "$", "serverRelativeUrl", "=", "rawurlencode", "(", "$", "serverRelativeUrl", ")", ";", "$", "url", "=", "$", "ctx", "->", "getServiceRootUrl", "(", ")", ".", "\"web/getfilebyserverrelativeurl('$serverRelativeUrl')/\\$value\"", ";", "$", "request", "=", "new", "RequestOptions", "(", "$", "url", ")", ";", "$", "request", "->", "Method", "=", "HttpMethod", "::", "Post", ";", "$", "request", "->", "addCustomHeader", "(", "'X-HTTP-Method'", ",", "'PUT'", ")", ";", "$", "request", "->", "Data", "=", "$", "content", ";", "if", "(", "$", "ctx", "instanceof", "ClientContext", ")", "{", "$", "ctx", "->", "ensureFormDigest", "(", "$", "request", ")", ";", "}", "$", "ctx", "->", "executeQueryDirect", "(", "$", "request", ")", ";", "}" ]
Saves the file Note: it is supported to update the existing file only. For adding a new file see FileCollection.add method @param ClientRuntimeContext $ctx @param string $serverRelativeUrl @param string $content file content @throws \Exception
[ "Saves", "the", "file", "Note", ":", "it", "is", "supported", "to", "update", "the", "existing", "file", "only", ".", "For", "adding", "a", "new", "file", "see", "FileCollection", ".", "add", "method" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L179-L191
vgrem/phpSPO
src/SharePoint/File.php
File.getLimitedWebPartManager
public function getLimitedWebPartManager($scope) { $manager = new LimitedWebPartManager($this->getContext(), new ResourcePathServiceOperation($this->getContext(), $this->getResourcePath(), "getlimitedwebpartmanager", array($scope) )); return $manager; }
php
public function getLimitedWebPartManager($scope) { $manager = new LimitedWebPartManager($this->getContext(), new ResourcePathServiceOperation($this->getContext(), $this->getResourcePath(), "getlimitedwebpartmanager", array($scope) )); return $manager; }
[ "public", "function", "getLimitedWebPartManager", "(", "$", "scope", ")", "{", "$", "manager", "=", "new", "LimitedWebPartManager", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getlimitedwebpartmanager\"", ",", "array", "(", "$", "scope", ")", ")", ")", ";", "return", "$", "manager", ";", "}" ]
Specifies the control set used to access, modify, or add Web Parts associated with this Web Part Page and view. An exception is thrown if the file is not an ASPX page. @param int $scope @return LimitedWebPartManager
[ "Specifies", "the", "control", "set", "used", "to", "access", "modify", "or", "add", "Web", "Parts", "associated", "with", "this", "Web", "Part", "Page", "and", "view", ".", "An", "exception", "is", "thrown", "if", "the", "file", "is", "not", "an", "ASPX", "page", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L200-L209
vgrem/phpSPO
src/SharePoint/File.php
File.getInformationRightsManagementSettings
public function getInformationRightsManagementSettings() { if (!$this->isPropertyAvailable('InformationRightsManagementSettings')) { $this->setProperty("InformationRightsManagementSettings", new InformationRightsManagementSettings($this->getContext(), $this->getResourcePath(), "InformationRightsManagementSettings")); } return $this->getProperty("InformationRightsManagementSettings"); }
php
public function getInformationRightsManagementSettings() { if (!$this->isPropertyAvailable('InformationRightsManagementSettings')) { $this->setProperty("InformationRightsManagementSettings", new InformationRightsManagementSettings($this->getContext(), $this->getResourcePath(), "InformationRightsManagementSettings")); } return $this->getProperty("InformationRightsManagementSettings"); }
[ "public", "function", "getInformationRightsManagementSettings", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'InformationRightsManagementSettings'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"InformationRightsManagementSettings\"", ",", "new", "InformationRightsManagementSettings", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"InformationRightsManagementSettings\"", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"InformationRightsManagementSettings\"", ")", ";", "}" ]
Returns IRM settings for given file. @return InformationRightsManagementSettings
[ "Returns", "IRM", "settings", "for", "given", "file", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L216-L222
vgrem/phpSPO
src/SharePoint/File.php
File.getVersions
public function getVersions() { if (!$this->isPropertyAvailable('Versions')) { $this->setProperty("Versions", new FileVersionCollection($this->getContext(), $this->getResourcePath(), "Versions")); } return $this->getProperty("Versions"); }
php
public function getVersions() { if (!$this->isPropertyAvailable('Versions')) { $this->setProperty("Versions", new FileVersionCollection($this->getContext(), $this->getResourcePath(), "Versions")); } return $this->getProperty("Versions"); }
[ "public", "function", "getVersions", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isPropertyAvailable", "(", "'Versions'", ")", ")", "{", "$", "this", "->", "setProperty", "(", "\"Versions\"", ",", "new", "FileVersionCollection", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"Versions\"", ")", ")", ";", "}", "return", "$", "this", "->", "getProperty", "(", "\"Versions\"", ")", ";", "}" ]
Gets a value that returns a collection of file version objects that represent the versions of the file. @return FileVersionCollection
[ "Gets", "a", "value", "that", "returns", "a", "collection", "of", "file", "version", "objects", "that", "represent", "the", "versions", "of", "the", "file", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L229-L235
vgrem/phpSPO
src/SharePoint/File.php
File.startUpload
public function startUpload($uploadId,$content) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "StartUpload", array('uploadId' => $uploadId->toString()), $content); $returnValue = new ClientResult(); $this->getContext()->addQuery($qry,$returnValue); return $returnValue; }
php
public function startUpload($uploadId,$content) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "StartUpload", array('uploadId' => $uploadId->toString()), $content); $returnValue = new ClientResult(); $this->getContext()->addQuery($qry,$returnValue); return $returnValue; }
[ "public", "function", "startUpload", "(", "$", "uploadId", ",", "$", "content", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"StartUpload\"", ",", "array", "(", "'uploadId'", "=>", "$", "uploadId", "->", "toString", "(", ")", ")", ",", "$", "content", ")", ";", "$", "returnValue", "=", "new", "ClientResult", "(", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "returnValue", ")", ";", "return", "$", "returnValue", ";", "}" ]
Starts a new chunk upload session and uploads the first fragment @param Guid $uploadId The unique identifier of the upload session. @param string $content @return ClientResult The size of the uploaded data in bytes.
[ "Starts", "a", "new", "chunk", "upload", "session", "and", "uploads", "the", "first", "fragment" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L274-L283
vgrem/phpSPO
src/SharePoint/File.php
File.continueUpload
public function continueUpload($uploadId,$fileOffset,$content) { $returnValue = new ClientResult(); $qry = new InvokePostMethodQuery($this->getResourcePath(), "ContinueUpload", array('uploadId' => $uploadId->toString(),'fileOffset' => $fileOffset), $content); $this->getContext()->addQuery($qry,$returnValue); return $returnValue; }
php
public function continueUpload($uploadId,$fileOffset,$content) { $returnValue = new ClientResult(); $qry = new InvokePostMethodQuery($this->getResourcePath(), "ContinueUpload", array('uploadId' => $uploadId->toString(),'fileOffset' => $fileOffset), $content); $this->getContext()->addQuery($qry,$returnValue); return $returnValue; }
[ "public", "function", "continueUpload", "(", "$", "uploadId", ",", "$", "fileOffset", ",", "$", "content", ")", "{", "$", "returnValue", "=", "new", "ClientResult", "(", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"ContinueUpload\"", ",", "array", "(", "'uploadId'", "=>", "$", "uploadId", "->", "toString", "(", ")", ",", "'fileOffset'", "=>", "$", "fileOffset", ")", ",", "$", "content", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "returnValue", ")", ";", "return", "$", "returnValue", ";", "}" ]
Continues the chunk upload session with an additional fragment @param Guid $uploadId The unique identifier of the upload session. @param int $fileOffset @param string $content @return ClientResult
[ "Continues", "the", "chunk", "upload", "session", "with", "an", "additional", "fragment" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L293-L302
vgrem/phpSPO
src/SharePoint/File.php
File.finishUpload
public function finishUpload($uploadId,$fileOffset,$content) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "finishupload", array('uploadId' => $uploadId->toString(),'fileOffset' => $fileOffset), $content); $this->getContext()->addQuery($qry,$this); return $this; }
php
public function finishUpload($uploadId,$fileOffset,$content) { $qry = new InvokePostMethodQuery($this->getResourcePath(), "finishupload", array('uploadId' => $uploadId->toString(),'fileOffset' => $fileOffset), $content); $this->getContext()->addQuery($qry,$this); return $this; }
[ "public", "function", "finishUpload", "(", "$", "uploadId", ",", "$", "fileOffset", ",", "$", "content", ")", "{", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"finishupload\"", ",", "array", "(", "'uploadId'", "=>", "$", "uploadId", "->", "toString", "(", ")", ",", "'fileOffset'", "=>", "$", "fileOffset", ")", ",", "$", "content", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "this", ")", ";", "return", "$", "this", ";", "}" ]
Uploads the last file fragment and commits the file. The current file content is changed when this method completes. @param Guid $uploadId @param int $fileOffset @param string $content @return File
[ "Uploads", "the", "last", "file", "fragment", "and", "commits", "the", "file", ".", "The", "current", "file", "content", "is", "changed", "when", "this", "method", "completes", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/File.php#L313-L321
vgrem/phpSPO
src/Runtime/OData/ODataRequest.php
ODataRequest.executeQuery
public function executeQuery() { try{ $request = $this->buildRequest(); if (is_callable($this->eventsList["BeforeExecuteQuery"])) { call_user_func_array($this->eventsList["BeforeExecuteQuery"], array( $request, $this->getCurrentAction() )); } $responseInfo = array(); $response = $this->executeQueryDirect($request, $responseInfo); if ($responseInfo['HttpCode'] >= 400) { $error = $this->extractError($response); throw new Exception($error['Message']); } if (!empty($response)) { $this->processResponse($response); } $this->requestStatus = ClientRequestStatus::CompletedSuccess; } catch(Exception $e){ $this->requestStatus = ClientRequestStatus::CompletedException; throw $e; } }
php
public function executeQuery() { try{ $request = $this->buildRequest(); if (is_callable($this->eventsList["BeforeExecuteQuery"])) { call_user_func_array($this->eventsList["BeforeExecuteQuery"], array( $request, $this->getCurrentAction() )); } $responseInfo = array(); $response = $this->executeQueryDirect($request, $responseInfo); if ($responseInfo['HttpCode'] >= 400) { $error = $this->extractError($response); throw new Exception($error['Message']); } if (!empty($response)) { $this->processResponse($response); } $this->requestStatus = ClientRequestStatus::CompletedSuccess; } catch(Exception $e){ $this->requestStatus = ClientRequestStatus::CompletedException; throw $e; } }
[ "public", "function", "executeQuery", "(", ")", "{", "try", "{", "$", "request", "=", "$", "this", "->", "buildRequest", "(", ")", ";", "if", "(", "is_callable", "(", "$", "this", "->", "eventsList", "[", "\"BeforeExecuteQuery\"", "]", ")", ")", "{", "call_user_func_array", "(", "$", "this", "->", "eventsList", "[", "\"BeforeExecuteQuery\"", "]", ",", "array", "(", "$", "request", ",", "$", "this", "->", "getCurrentAction", "(", ")", ")", ")", ";", "}", "$", "responseInfo", "=", "array", "(", ")", ";", "$", "response", "=", "$", "this", "->", "executeQueryDirect", "(", "$", "request", ",", "$", "responseInfo", ")", ";", "if", "(", "$", "responseInfo", "[", "'HttpCode'", "]", ">=", "400", ")", "{", "$", "error", "=", "$", "this", "->", "extractError", "(", "$", "response", ")", ";", "throw", "new", "Exception", "(", "$", "error", "[", "'Message'", "]", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "response", ")", ")", "{", "$", "this", "->", "processResponse", "(", "$", "response", ")", ";", "}", "$", "this", "->", "requestStatus", "=", "ClientRequestStatus", "::", "CompletedSuccess", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "$", "this", "->", "requestStatus", "=", "ClientRequestStatus", "::", "CompletedException", ";", "throw", "$", "e", ";", "}", "}" ]
Submit query to OData service @throws Exception
[ "Submit", "query", "to", "OData", "service" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/OData/ODataRequest.php#L38-L64
vgrem/phpSPO
src/Runtime/OData/ODataRequest.php
ODataRequest.processXmlResponse
private function processXmlResponse($response, $resultObject) { $payload = array(); $xml = simplexml_load_string($response); $xml->registerXPathNamespace('z', '#RowsetSchema'); $rows = $xml->xpath("//z:row"); foreach ($rows as $row) { $item = null; foreach ($row->attributes() as $k => $v) { $normalizedFieldName = str_replace('ows_', '', $k); $item[$normalizedFieldName] = (string)$v; } $payload[] = $item; } $this->getSerializationContext()->map($payload,$resultObject); }
php
private function processXmlResponse($response, $resultObject) { $payload = array(); $xml = simplexml_load_string($response); $xml->registerXPathNamespace('z', '#RowsetSchema'); $rows = $xml->xpath("//z:row"); foreach ($rows as $row) { $item = null; foreach ($row->attributes() as $k => $v) { $normalizedFieldName = str_replace('ows_', '', $k); $item[$normalizedFieldName] = (string)$v; } $payload[] = $item; } $this->getSerializationContext()->map($payload,$resultObject); }
[ "private", "function", "processXmlResponse", "(", "$", "response", ",", "$", "resultObject", ")", "{", "$", "payload", "=", "array", "(", ")", ";", "$", "xml", "=", "simplexml_load_string", "(", "$", "response", ")", ";", "$", "xml", "->", "registerXPathNamespace", "(", "'z'", ",", "'#RowsetSchema'", ")", ";", "$", "rows", "=", "$", "xml", "->", "xpath", "(", "\"//z:row\"", ")", ";", "foreach", "(", "$", "rows", "as", "$", "row", ")", "{", "$", "item", "=", "null", ";", "foreach", "(", "$", "row", "->", "attributes", "(", ")", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "normalizedFieldName", "=", "str_replace", "(", "'ows_'", ",", "''", ",", "$", "k", ")", ";", "$", "item", "[", "$", "normalizedFieldName", "]", "=", "(", "string", ")", "$", "v", ";", "}", "$", "payload", "[", "]", "=", "$", "item", ";", "}", "$", "this", "->", "getSerializationContext", "(", ")", "->", "map", "(", "$", "payload", ",", "$", "resultObject", ")", ";", "}" ]
Process Xml response from SharePoint REST service @param string $response @param ClientObject $resultObject
[ "Process", "Xml", "response", "from", "SharePoint", "REST", "service" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/OData/ODataRequest.php#L111-L126
vgrem/phpSPO
src/Runtime/OData/ODataRequest.php
ODataRequest.extractError
private function extractError($response) { $error = array(); $response = json_decode($response); if (property_exists($response, 'error')) { if (is_string($response->error->message)) { $message = $response->error->message; } elseif (is_object($response->error->message)) { $message = $response->error->message->value; } else { $message = "Unknown error"; } $error['Message'] = $message; return $error; } return null; }
php
private function extractError($response) { $error = array(); $response = json_decode($response); if (property_exists($response, 'error')) { if (is_string($response->error->message)) { $message = $response->error->message; } elseif (is_object($response->error->message)) { $message = $response->error->message->value; } else { $message = "Unknown error"; } $error['Message'] = $message; return $error; } return null; }
[ "private", "function", "extractError", "(", "$", "response", ")", "{", "$", "error", "=", "array", "(", ")", ";", "$", "response", "=", "json_decode", "(", "$", "response", ")", ";", "if", "(", "property_exists", "(", "$", "response", ",", "'error'", ")", ")", "{", "if", "(", "is_string", "(", "$", "response", "->", "error", "->", "message", ")", ")", "{", "$", "message", "=", "$", "response", "->", "error", "->", "message", ";", "}", "elseif", "(", "is_object", "(", "$", "response", "->", "error", "->", "message", ")", ")", "{", "$", "message", "=", "$", "response", "->", "error", "->", "message", "->", "value", ";", "}", "else", "{", "$", "message", "=", "\"Unknown error\"", ";", "}", "$", "error", "[", "'Message'", "]", "=", "$", "message", ";", "return", "$", "error", ";", "}", "return", "null", ";", "}" ]
Extract error from JSON payload response @param mixed $response @return array @throws Exception
[ "Extract", "error", "from", "JSON", "payload", "response" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/Runtime/OData/ODataRequest.php#L135-L151
vgrem/phpSPO
src/SharePoint/ViewCollection.php
ViewCollection.getByTitle
public function getByTitle($title) { return new View( $this->getContext(), new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getByTitle",array(rawurlencode($title))) ); }
php
public function getByTitle($title) { return new View( $this->getContext(), new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getByTitle",array(rawurlencode($title))) ); }
[ "public", "function", "getByTitle", "(", "$", "title", ")", "{", "return", "new", "View", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getByTitle\"", ",", "array", "(", "rawurlencode", "(", "$", "title", ")", ")", ")", ")", ";", "}" ]
Get View by title @param $title @return View
[ "Get", "View", "by", "title" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ViewCollection.php#L16-L22
vgrem/phpSPO
src/SharePoint/ViewCollection.php
ViewCollection.getById
public function getById($id) { return new View( $this->getContext(), new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getById",array($id)) ); }
php
public function getById($id) { return new View( $this->getContext(), new ResourcePathServiceOperation($this->getContext(),$this->getResourcePath(),"getById",array($id)) ); }
[ "public", "function", "getById", "(", "$", "id", ")", "{", "return", "new", "View", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getById\"", ",", "array", "(", "$", "id", ")", ")", ")", ";", "}" ]
Get View by id @param $id @return View
[ "Get", "View", "by", "id" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ViewCollection.php#L30-L36
vgrem/phpSPO
src/SharePoint/ViewCollection.php
ViewCollection.add
public function add(ViewCreationInformation $properties) { $view = new View($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null,$properties); $this->getContext()->addQuery($qry,$view); $this->addChild($view); return $view; }
php
public function add(ViewCreationInformation $properties) { $view = new View($this->getContext(),$this->getResourcePath()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null,$properties); $this->getContext()->addQuery($qry,$view); $this->addChild($view); return $view; }
[ "public", "function", "add", "(", "ViewCreationInformation", "$", "properties", ")", "{", "$", "view", "=", "new", "View", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "null", ",", "null", ",", "$", "properties", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "view", ")", ";", "$", "this", "->", "addChild", "(", "$", "view", ")", ";", "return", "$", "view", ";", "}" ]
Creates a View resource @param ViewCreationInformation $properties @return View
[ "Creates", "a", "View", "resource" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/ViewCollection.php#L46-L53
vgrem/phpSPO
src/SharePoint/GroupCollection.php
GroupCollection.add
public function add(GroupCreationInformation $parameters) { $group = new Group($this->getContext(), $this->getResourcePath()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null, $parameters); $this->getContext()->addQuery($qry, $group); $this->addChild($group); return $group; }
php
public function add(GroupCreationInformation $parameters) { $group = new Group($this->getContext(), $this->getResourcePath()); $qry = new InvokePostMethodQuery($this->getResourcePath(),null,null, $parameters); $this->getContext()->addQuery($qry, $group); $this->addChild($group); return $group; }
[ "public", "function", "add", "(", "GroupCreationInformation", "$", "parameters", ")", "{", "$", "group", "=", "new", "Group", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ")", ";", "$", "qry", "=", "new", "InvokePostMethodQuery", "(", "$", "this", "->", "getResourcePath", "(", ")", ",", "null", ",", "null", ",", "$", "parameters", ")", ";", "$", "this", "->", "getContext", "(", ")", "->", "addQuery", "(", "$", "qry", ",", "$", "group", ")", ";", "$", "this", "->", "addChild", "(", "$", "group", ")", ";", "return", "$", "group", ";", "}" ]
Create a group @param GroupCreationInformation $parameters @return Group
[ "Create", "a", "group" ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/GroupCollection.php#L23-L30
vgrem/phpSPO
src/SharePoint/GroupCollection.php
GroupCollection.getById
public function getById($id) { $group = new Group( $this->getContext(), new ResourcePathServiceOperation($this->getContext(), $this->getResourcePath(), "getById", array($id)) ); return $group; }
php
public function getById($id) { $group = new Group( $this->getContext(), new ResourcePathServiceOperation($this->getContext(), $this->getResourcePath(), "getById", array($id)) ); return $group; }
[ "public", "function", "getById", "(", "$", "id", ")", "{", "$", "group", "=", "new", "Group", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getById\"", ",", "array", "(", "$", "id", ")", ")", ")", ";", "return", "$", "group", ";", "}" ]
Returns a group from the collection based on the member ID of the group. @param int $id The ID of the group to get. @return Group The specified group. @throws \Exception
[ "Returns", "a", "group", "from", "the", "collection", "based", "on", "the", "member", "ID", "of", "the", "group", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/GroupCollection.php#L38-L45
vgrem/phpSPO
src/SharePoint/GroupCollection.php
GroupCollection.getByName
public function getByName($name) { $group = new Group( $this->getContext(), new ResourcePathServiceOperation($this->getContext(), $this->getResourcePath(), "getbyname", array($name)) ); return $group; }
php
public function getByName($name) { $group = new Group( $this->getContext(), new ResourcePathServiceOperation($this->getContext(), $this->getResourcePath(), "getbyname", array($name)) ); return $group; }
[ "public", "function", "getByName", "(", "$", "name", ")", "{", "$", "group", "=", "new", "Group", "(", "$", "this", "->", "getContext", "(", ")", ",", "new", "ResourcePathServiceOperation", "(", "$", "this", "->", "getContext", "(", ")", ",", "$", "this", "->", "getResourcePath", "(", ")", ",", "\"getbyname\"", ",", "array", "(", "$", "name", ")", ")", ")", ";", "return", "$", "group", ";", "}" ]
Returns a cross-site group from the collection based on the name of the group. @param string $name The name of the group. The group name is specified in its LoginName property. @return Group @throws \Exception
[ "Returns", "a", "cross", "-", "site", "group", "from", "the", "collection", "based", "on", "the", "name", "of", "the", "group", "." ]
train
https://github.com/vgrem/phpSPO/blob/4ec81109a154f88d188f9e87c7d7f004e91af666/src/SharePoint/GroupCollection.php#L53-L60