idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
3,800
public function getSequenceName ( Table $ table ) { static $ longNamesMap = array ( ) ; $ result = null ; if ( $ table -> getIdMethod ( ) == IDMethod :: NATIVE ) { $ idMethodParams = $ table -> getIdMethodParameters ( ) ; $ maxIdentifierLength = $ this -> getMaxColumnNameLength ( ) ; if ( empty ( $ idMethodParams ) ) {...
Gets the name to use for creating a sequence for a table .
3,801
public function getDropPrimaryKeyDDL ( Table $ table ) { $ pattern = "ALTER TABLE %s DROP CONSTRAINT %s;" ; return sprintf ( $ pattern , $ this -> quoteIdentifier ( $ table -> getName ( ) ) , $ this -> quoteIdentifier ( $ this -> getPrimaryKeyName ( $ table ) ) ) ; }
Builds the DDL SQL to drop the primary key of a table .
3,802
public function getAddPrimaryKeyDDL ( Table $ table ) { $ pattern = "ALTER TABLE %s ADD %s;" ; return sprintf ( $ pattern , $ this -> quoteIdentifier ( $ table -> getName ( ) ) , $ this -> getPrimaryKeyDDL ( $ table ) ) ; }
Builds the DDL SQL to add the primary key of a table .
3,803
public function getDropForeignKeyDDL ( ForeignKey $ fk ) { if ( $ fk -> isSkipSql ( ) ) { return ; } $ pattern = "ALTER TABLE %s DROP CONSTRAINT %s;" ; return sprintf ( $ pattern , $ this -> quoteIdentifier ( $ fk -> getTable ( ) -> getName ( ) ) , $ this -> quoteIdentifier ( $ fk -> getName ( ) ) ) ; }
Builds the DDL SQL to drop a foreign key .
3,804
public function getModifyDatabaseDDL ( PropelDatabaseDiff $ databaseDiff ) { $ ret = $ this -> getBeginDDL ( ) ; foreach ( $ databaseDiff -> getRemovedTables ( ) as $ table ) { $ ret .= $ this -> getDropTableDDL ( $ table ) ; } foreach ( $ databaseDiff -> getRenamedTables ( ) as $ fromTableName => $ toTableName ) { $ r...
Builds the DDL SQL to modify a database based on a PropelDatabaseDiff instance
3,805
public function getModifyTableDDL ( PropelTableDiff $ tableDiff ) { $ ret = '' ; if ( $ tableDiff -> hasModifiedPk ( ) ) { $ ret .= $ this -> getDropPrimaryKeyDDL ( $ tableDiff -> getFromTable ( ) ) ; } foreach ( $ tableDiff -> getRemovedFks ( ) as $ fk ) { $ ret .= $ this -> getDropForeignKeyDDL ( $ fk ) ; } foreach (...
Builds the DDL SQL to alter a table based on a PropelTableDiff instance
3,806
public function getRenameColumnDDL ( $ fromColumn , $ toColumn ) { $ pattern = "ALTER TABLE %s RENAME COLUMN %s TO %s;" ; return sprintf ( $ pattern , $ this -> quoteIdentifier ( $ fromColumn -> getTable ( ) -> getName ( ) ) , $ this -> quoteIdentifier ( $ fromColumn -> getName ( ) ) , $ this -> quoteIdentifier ( $ toC...
Builds the DDL SQL to rename a column
3,807
public function getModifyColumnDDL ( PropelColumnDiff $ columnDiff ) { $ toColumn = $ columnDiff -> getToColumn ( ) ; $ pattern = "ALTER TABLE %s MODIFY %s;" ; return sprintf ( $ pattern , $ this -> quoteIdentifier ( $ toColumn -> getTable ( ) -> getName ( ) ) , $ this -> getColumnDDL ( $ toColumn ) ) ; }
Builds the DDL SQL to modify a column
3,808
public function getBooleanString ( $ b ) { $ b = ( $ b === true || strtolower ( $ b ) === 'true' || $ b === 1 || $ b === '1' || strtolower ( $ b ) === 'y' || strtolower ( $ b ) === 'yes' ) ; return ( $ b ? '1' : '0' ) ; }
Returns the boolean value for the RDBMS .
3,809
public function actionTemplates ( ) { $ foundTemplates = $ this -> findTemplatesFiles ( ) ; if ( ! $ foundTemplates ) { $ this -> notifyNoTemplatesFound ( ) ; } else { $ this -> notifyTemplatesCanBeGenerated ( $ foundTemplates ) ; } }
Lists all available fixtures template files .
3,810
public function actionGenerate ( ) { $ templatesInput = func_get_args ( ) ; if ( empty ( $ templatesInput ) ) { throw new Exception ( 'You should specify input fixtures template files' ) ; } $ foundTemplates = $ this -> findTemplatesFiles ( $ templatesInput ) ; $ notFoundTemplates = array_diff ( $ templatesInput , $ fo...
Generates fixtures and fill them with Faker data . For example
3,811
public function actionGenerateAll ( ) { $ foundTemplates = $ this -> findTemplatesFiles ( ) ; if ( ! $ foundTemplates ) { $ this -> notifyNoTemplatesFound ( ) ; return static :: EXIT_CODE_NORMAL ; } if ( ! $ this -> confirmGeneration ( $ foundTemplates ) ) { return static :: EXIT_CODE_NORMAL ; } $ templatePath = Yii ::...
Generates all fixtures template path that can be found .
3,812
protected function notifyNotFoundTemplates ( $ templatesNames ) { $ this -> stdout ( "The following fixtures templates were NOT found:\n\n" , Console :: FG_RED ) ; foreach ( $ templatesNames as $ name ) { $ this -> stdout ( "\t * $name \n" , Console :: FG_GREEN ) ; } $ this -> stdout ( "\n" ) ; }
Notifies user that given fixtures template files were not found .
3,813
protected function notifyNoTemplatesFound ( ) { $ this -> stdout ( "No fixtures template files matching input conditions were found under the path:\n\n" , Console :: FG_RED ) ; $ this -> stdout ( "\t " . Yii :: getAlias ( $ this -> templatePath ) . " \n\n" , Console :: FG_GREEN ) ; }
Notifies user that there was not found any files matching given input conditions .
3,814
protected function notifyTemplatesGenerated ( $ templatesNames ) { $ this -> stdout ( "The following fixtures template files were generated:\n\n" , Console :: FG_YELLOW ) ; foreach ( $ templatesNames as $ name ) { $ this -> stdout ( "\t* " . $ name . "\n" , Console :: FG_GREEN ) ; } $ this -> stdout ( "\n" ) ; }
Notifies user that given fixtures template files were generated .
3,815
protected function notifyTemplatesCanBeGenerated ( $ templatesNames ) { $ this -> stdout ( "Template files path: " , Console :: FG_YELLOW ) ; $ this -> stdout ( Yii :: getAlias ( $ this -> templatePath ) . "\n\n" , Console :: FG_GREEN ) ; foreach ( $ templatesNames as $ name ) { $ this -> stdout ( "\t* " . $ name . "\n...
Notifies user about templates which could be generated .
3,816
protected function findTemplatesFiles ( array $ templatesNames = [ ] ) { $ findAll = ( $ templatesNames == [ ] ) ; if ( $ findAll ) { $ files = FileHelper :: findFiles ( Yii :: getAlias ( $ this -> templatePath ) , [ 'only' => [ '*.php' ] ] ) ; } else { $ filesToSearch = [ ] ; foreach ( $ templatesNames as $ fileName )...
Returns array containing fixtures templates file names . You can specify what files to find by the given parameter .
3,817
public function getGenerator ( ) { if ( $ this -> _generator === null ) { $ language = $ this -> language === null ? Yii :: $ app -> language : $ this -> language ; $ this -> _generator = \ Faker \ Factory :: create ( str_replace ( '-' , '_' , $ language ) ) ; } return $ this -> _generator ; }
Returns Faker generator instance . Getter for private property .
3,818
public function checkPaths ( ) { $ path = Yii :: getAlias ( $ this -> templatePath , false ) ; if ( ! $ path || ! is_dir ( $ path ) ) { throw new Exception ( "The template path \"{$this->templatePath}\" does not exist" ) ; } }
Check if the template path and migrations path exists and writable .
3,819
public function addProviders ( ) { foreach ( $ this -> providers as $ provider ) { $ this -> generator -> addProvider ( new $ provider ( $ this -> generator ) ) ; } }
Adds users providers to the faker generator .
3,820
public function generateFixtureFile ( $ templateName , $ templatePath , $ fixtureDataPath ) { $ fixtures = [ ] ; for ( $ i = 0 ; $ i < $ this -> count ; $ i ++ ) { $ fixtures [ $ templateName . $ i ] = $ this -> generateFixture ( $ templatePath . '/' . $ templateName . '.php' , $ i ) ; } $ content = $ this -> exportFix...
Generates fixture file by the given fixture template file .
3,821
public function confirmGeneration ( $ files ) { $ this -> stdout ( "Fixtures will be generated under the path: \n" , Console :: FG_YELLOW ) ; $ this -> stdout ( "\t" . Yii :: getAlias ( $ this -> fixtureDataPath ) . "\n\n" , Console :: FG_GREEN ) ; $ this -> stdout ( "Templates will be taken from path: \n" , Console ::...
Prompts user with message if he confirm generation with given fixture templates files .
3,822
public function getCommand ( $ name , array $ args = [ ] ) { if ( ! $ this -> description -> hasOperation ( $ name ) ) { $ name = ucfirst ( $ name ) ; if ( ! $ this -> description -> hasOperation ( $ name ) ) { throw new \ InvalidArgumentException ( "No operation found named {$name}" ) ; } } $ args += $ this -> getConf...
Returns the command if valid ; otherwise an Exception
3,823
private function getDeserializer ( $ responseToResultTransformer ) { $ process = ( ! isset ( $ this -> config [ 'process' ] ) || $ this -> config [ 'process' ] === true ) ; return $ responseToResultTransformer == ! null ? $ responseToResultTransformer : new Deserializer ( $ this -> description , $ process ) ; }
Returns the passed Deserializer when set a new instance otherwise
3,824
protected function addXml ( \ XMLWriter $ writer , Parameter $ param , $ value ) { $ value = $ param -> filter ( $ value ) ; $ type = $ param -> getType ( ) ; $ name = $ param -> getWireName ( ) ; $ prefix = null ; $ namespace = $ param -> getData ( 'xmlNamespace' ) ; if ( false !== strpos ( $ name , ':' ) ) { list ( $...
Recursively build the XML body
3,825
public function getData ( $ name = null ) { if ( $ name === null ) { return $ this -> config [ 'data' ] ; } elseif ( isset ( $ this -> config [ 'data' ] [ $ name ] ) ) { return $ this -> config [ 'data' ] [ $ name ] ; } else { return null ; } }
Get extra data from the operation
3,826
private function resolveParameters ( ) { foreach ( $ this -> config [ 'parameters' ] as $ name => $ param ) { if ( ! is_array ( $ param ) ) { throw new \ InvalidArgumentException ( "Parameters must be arrays, {$this->config['name']}.$name is " . gettype ( $ param ) ) ; } $ param [ 'name' ] = $ name ; $ this -> paramete...
Process the description and extract the parameter config
3,827
private function visitOuterObject ( Parameter $ model , ResultInterface $ result , ResponseInterface $ response , array & $ context ) { $ parentLocation = $ model -> getLocation ( ) ; $ additional = $ model -> getAdditionalProperties ( ) ; if ( $ additional instanceof Parameter ) { $ location = $ additional -> getLocat...
Visits the outer object
3,828
private function visitOuterArray ( Parameter $ model , ResultInterface $ result , ResponseInterface $ response , array & $ context ) { if ( ! ( $ location = $ model -> getLocation ( ) ) ) { return ; } if ( ! isset ( $ context [ 'visitors' ] [ $ location ] ) ) { $ result = $ this -> triggerBeforeVisitor ( $ location , $...
Visits the outer array
3,829
protected function handleErrorResponses ( ResponseInterface $ response , RequestInterface $ request , CommandInterface $ command , Operation $ operation ) { $ errors = $ operation -> getErrorResponses ( ) ; $ bestException = null ; foreach ( $ errors as $ error ) { $ code = ( int ) $ error [ 'code' ] ; if ( $ response ...
Reads the errorResponses from commands and trigger appropriate exceptions
3,830
public function filter ( $ value ) { if ( $ this -> format ) { if ( ! $ this -> serviceDescription ) { throw new \ RuntimeException ( 'No service description was set so ' . 'the value cannot be formatted.' ) ; } return $ this -> serviceDescription -> format ( $ this -> format , $ value ) ; } if ( $ this -> type == 'boo...
Run a value through the filters OR format attribute associated with the parameter .
3,831
public function getProperties ( ) { if ( ! $ this -> propertiesCache ) { $ this -> propertiesCache = [ ] ; foreach ( array_keys ( $ this -> properties ) as $ name ) { $ this -> propertiesCache [ $ name ] = $ this -> getProperty ( $ name ) ; } } return $ this -> propertiesCache ; }
Get the properties of the parameter
3,832
public function getAdditionalProperties ( ) { if ( is_array ( $ this -> additionalProperties ) ) { $ this -> additionalProperties = new static ( $ this -> additionalProperties , [ 'description' => $ this -> serviceDescription ] ) ; } return $ this -> additionalProperties ; }
Get the additionalProperties value of the parameter
3,833
private function addFilter ( $ filter ) { if ( is_array ( $ filter ) ) { if ( ! isset ( $ filter [ 'method' ] ) ) { throw new \ InvalidArgumentException ( 'A [method] value must be specified for each complex filter' ) ; } } if ( ! $ this -> filters ) { $ this -> filters = [ $ filter ] ; } else { $ this -> filters [ ] =...
Add a filter to the parameter
3,834
public function has ( $ var ) { if ( ! is_string ( $ var ) ) { throw new \ InvalidArgumentException ( 'Expected a string. Got: ' . ( is_object ( $ var ) ? get_class ( $ var ) : gettype ( $ var ) ) ) ; } return isset ( $ this -> { $ var } ) && ! empty ( $ this -> { $ var } ) ; }
Check if a parameter has a specific variable and if it set .
3,835
private static function xmlToArray ( \ SimpleXMLElement $ xml , $ ns = null , $ nesting = 0 ) { $ result = [ ] ; $ children = $ xml -> children ( $ ns , true ) ; foreach ( $ children as $ name => $ child ) { $ attributes = ( array ) $ child -> attributes ( $ ns , true ) ; if ( ! isset ( $ result [ $ name ] ) ) { $ chil...
Convert an XML document to an array .
3,836
public function getOperation ( $ name ) { if ( ! $ this -> hasOperation ( $ name ) ) { throw new \ InvalidArgumentException ( "No operation found named $name" ) ; } if ( ! ( $ this -> operations [ $ name ] instanceof Operation ) ) { $ this -> operations [ $ name ] [ 'name' ] = $ name ; $ this -> operations [ $ name ] =...
Get an API operation by name
3,837
public function getModel ( $ id ) { if ( ! $ this -> hasModel ( $ id ) ) { throw new \ InvalidArgumentException ( "No model found named $id" ) ; } if ( ! ( $ this -> models [ $ id ] instanceof Parameter ) ) { $ this -> models [ $ id ] = new Parameter ( $ this -> models [ $ id ] , [ 'description' => $ this ] ) ; } retur...
Get a shared definition structure .
3,838
public function getModels ( ) { $ models = [ ] ; foreach ( $ this -> models as $ name => $ model ) { $ models [ $ name ] = $ this -> getModel ( $ name ) ; } return $ models ; }
Get all models of the service description .
3,839
public function getData ( $ key = null ) { if ( $ key === null ) { return $ this -> extraData ; } elseif ( isset ( $ this -> extraData [ $ key ] ) ) { return $ this -> extraData [ $ key ] ; } else { return null ; } }
Get arbitrary data from the service description that is not part of the Guzzle service description specification .
3,840
private function checkRowConsistency ( $ row ) { if ( $ this -> strict === false ) { return ; } $ current = count ( $ row ) ; if ( $ this -> rowConsistency === null ) { $ this -> rowConsistency = $ current ; } if ( $ current !== $ this -> rowConsistency ) { throw new StrictViolationException ( ) ; } $ this -> rowConsis...
Check if the column count is consistent with comparing other rows
3,841
public function fputcsv ( $ fields , $ delimiter = null , $ enclosure = null , $ escape = null ) { $ fp = fopen ( 'php://temp' , 'w+' ) ; $ arguments = func_get_args ( ) ; array_unshift ( $ arguments , $ fp ) ; call_user_func_array ( 'fputcsv' , $ arguments ) ; rewind ( $ fp ) ; $ line = '' ; while ( feof ( $ fp ) === ...
Write a field array as a CSV line
3,842
public static function register ( ) { if ( self :: $ hasBeenRegistered === true ) { return ; } if ( stream_filter_register ( self :: getFilterName ( ) , __CLASS__ ) === false ) { throw new RuntimeException ( 'Failed to register stream filter: ' . self :: getFilterName ( ) ) ; } self :: $ hasBeenRegistered = true ; }
Register this class as a stream filter
3,843
public static function getFilterURL ( $ filename , $ fromCharset , $ toCharset = null ) { if ( $ toCharset === null ) { return sprintf ( 'php://filter/convert.mbstring.encoding.%s/resource=%s' , $ fromCharset , $ filename ) ; } else { return sprintf ( 'php://filter/convert.mbstring.encoding.%s:%s/resource=%s' , $ fromC...
Return filter URL
3,844
private function notify ( $ line ) { $ observers = $ this -> observers ; foreach ( $ observers as $ observer ) { $ this -> delegate ( $ observer , $ line ) ; } }
notify to observers
3,845
public function send ( $ filename = null , $ contentType , $ inline = false ) { header ( 'Pragma: public' ) ; header ( 'Expires: 0' ) ; header ( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ) ; header ( 'Content-Type: ' . $ contentType ) ; header ( 'Content-Transfer-Encoding: binary' ) ; $ isIOS = preg_m...
Send tmp file to client either inline or as download
3,846
public function acquireToken ( $ parameters ) { $ request = $ this -> createRequest ( $ parameters ) ; $ response = Requests :: execute ( $ request ) ; $ this -> parseToken ( $ response ) ; }
Acquires the access token
3,847
private function parseToken ( $ tokenValue ) { $ tokenPayload = json_decode ( $ tokenValue ) ; if ( is_object ( $ tokenPayload ) ) { $ this -> accessToken = $ tokenPayload ; if ( isset ( $ tokenPayload -> id_token ) ) { $ idToken = $ tokenPayload -> id_token ; $ idTokenPayload = base64_decode ( explode ( '.' , $ idToke...
Parse the id token that represents a JWT token that contains information about the user
3,848
public function createMessage ( ) { $ message = new Message ( $ this -> getContext ( ) ) ; $ this -> addChild ( $ message ) ; $ qry = new CreateEntityQuery ( $ message ) ; $ this -> getContext ( ) -> addQuery ( $ qry , $ message ) ; return $ message ; }
Creates a Draft Message resource
3,849
public function createEvent ( ) { $ event = new Event ( $ this -> getContext ( ) , null ) ; $ this -> addChild ( $ event ) ; $ qry = new CreateEntityQuery ( $ event ) ; $ this -> getContext ( ) -> addQuery ( $ qry , $ event ) ; return $ event ; }
Create an event in the user s primary calendar or a specific calendar by posting to the calendar s events endpoint .
3,850
public function addItem ( array $ listItemCreationInformation ) { $ items = new ListItemCollection ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "items" ) ) ; $ listItem = new ListItem ( $ this -> getContext ( ) ) ; $ listItem -> parentCollection = $ it...
The recommended way to add a list item is to send a POST request to the ListItemCollection resource endpoint as shown in ListItemCollection request examples .
3,851
public function getItemById ( $ id ) { return new ListItem ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "items({$id})" ) ) ; }
Returns the list item with the specified list item identifier .
3,852
public function getItems ( CamlQuery $ camlQuery = null ) { $ items = new ListItemCollection ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "items" ) ) ; if ( isset ( $ camlQuery ) ) { $ qry = new InvokePostMethodQuery ( $ this -> getResourcePath ( ) , "...
Returns a collection of items from the list based on the specified query .
3,853
public function deleteObject ( ) { $ qry = new DeleteEntityQuery ( $ this ) ; $ this -> getContext ( ) -> addQuery ( $ qry ) ; $ this -> removeFromParentCollection ( ) ; }
The recommended way to delete a list is to send a DELETE request to the List resource endpoint as shown in List request examples .
3,854
public function getUserEffectivePermissions ( $ loginName ) { $ permissions = new BasePermissions ( ) ; $ qry = new InvokeMethodQuery ( $ this -> getResourcePath ( ) , "GetUserEffectivePermissions" , array ( rawurlencode ( $ loginName ) ) ) ; $ this -> getContext ( ) -> addQuery ( $ qry , $ permissions ) ; return $ per...
Gets the set of permissions for the specified user
3,855
public function getGroups ( ) { if ( ! $ this -> isPropertyAvailable ( 'Groups' ) ) { $ this -> setProperty ( "Groups" , new GroupCollection ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "groups" ) ) ) ; } return $ this -> getProperty ( "Groups" ) ; }
Gets the collection of groups of which the user is a member .
3,856
public function getLists ( ) { if ( ! $ this -> isPropertyAvailable ( 'Lists' ) ) { $ this -> setProperty ( "Lists" , new ListCollection ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "Lists" ) ) ) ; } return $ this -> getProperty ( "Lists" ) ; }
Gets the collection of all lists that are contained in the Web site available to the current user based on the permissions of the current user .
3,857
public function getWebs ( ) { if ( ! $ this -> isPropertyAvailable ( 'Webs' ) ) { $ this -> setProperty ( "Webs" , new WebCollection ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "webs" ) ) ) ; } return $ this -> getProperty ( "Webs" ) ; }
Gets a Web site collection object that represents all Web sites immediately beneath the Web site excluding children of those Web sites .
3,858
public function getFolders ( ) { if ( ! isset ( $ this -> Folders ) ) { $ this -> Folders = new FolderCollection ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "folders" ) ) ; } return $ this -> Folders ; }
Gets the collection of all first - level folders in the Web site .
3,859
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 .
3,860
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 .
3,861
public function getRoleDefinitions ( ) { if ( ! $ this -> isPropertyAvailable ( 'RoleDefinitions' ) ) { $ this -> setProperty ( "RoleDefinitions" , new RoleDefinitionCollection ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "roledefinitions" ) ) ) ; } re...
Gets the collection of role definitions for the Web site .
3,862
public function getUserCustomActions ( ) { if ( ! $ this -> isPropertyAvailable ( 'UserCustomActions' ) ) { $ this -> setProperty ( "UserCustomActions" , new UserCustomActionCollection ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "UserCustomActions" ) ...
Gets a value that specifies the collection of user custom actions for the site .
3,863
public function getFileByServerRelativeUrl ( $ serverRelativeUrl ) { $ path = new ResourcePathServiceOperation ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "getfilebyserverrelativeurl" , array ( rawurlencode ( $ serverRelativeUrl ) ) ) ; $ file = new File ( $ this -> getContext ( ) , $ path ) ; return $...
Returns the file object located at the specified server - relative URL .
3,864
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 .
3,865
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 ) $...
Maps response payload to client object
3,866
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 ( fun...
Normalize request payload
3,867
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
3,868
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
3,869
public function createType ( ) { $ clientObjectType = $ this -> getItemTypeName ( ) ; $ clientObject = new $ clientObjectType ( $ this -> getContext ( ) ) ; $ clientObject -> parentCollection = $ this ; return $ clientObject ; }
Creates resource for a collection
3,870
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 .
3,871
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 .
3,872
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 .
3,873
public function getUserProfilePropertyFor ( $ accountName , $ propertyName ) { $ clientResult = new ClientResult ( ) ; $ qry = new InvokeMethodQuery ( $ this -> getResourcePath ( ) , "GetUserProfilePropertyFor" , array ( "accountname" => rawurlencode ( $ accountName ) , "propertyname" => $ propertyName ) ) ; $ this -> ...
Gets the specified user profile property for the specified user .
3,874
public function add ( FileCreationInformation $ fileCreationInformation ) { $ file = new File ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) ) ; $ qry = new InvokePostMethodQuery ( $ this -> getResourcePath ( ) , "add" , array ( "overwrite" => $ fileCreationInformation -> Overwrite , "url" => rawurlencode (...
Creates a File resource
3,875
public function addTemplateFile ( $ urlOfFile , $ templateFileType ) { $ file = new File ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) ) ; $ qry = new InvokePostMethodQuery ( $ this -> getResourcePath ( ) , "addTemplateFile" , array ( "urlOfFile" => $ urlOfFile , "templateFileType" => ( int ) $ templateFil...
Adds a ghosted file to an existing list or document library .
3,876
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 .
3,877
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
3,878
public function getAuthorizationRequestUrl ( $ authorizeUrl , $ clientId , $ redirectUrl , $ parameters = [ ] ) { $ parameters = array_merge ( $ parameters , array ( 'response_type' => 'code' , 'client_id' => $ clientId , 'redirect_uri' => $ redirectUrl , ) ) ; return $ authorizeUrl . "?" . http_build_query ( $ paramet...
Gets URL of the authorize endpoint including the query parameters .
3,879
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
3,880
private static function init ( RequestOptions $ options ) { $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ options -> Url ) ; curl_setopt_array ( $ ch , self :: $ defaultOptions ) ; curl_setopt ( $ ch , CURLOPT_HEADER , $ options -> IncludeHeaders ) ; curl_setopt ( $ ch , CURLOPT_NOBODY , ! $ options -> In...
Init Curl with the default parameters
3,881
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 ...
Create an video channel
3,882
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
3,883
public function isPropertyAvailable ( $ name ) { return isset ( $ this -> properties [ $ name ] ) && ! isset ( $ this -> properties [ $ name ] -> __deferred ) ; }
Determine whether client object property has been loaded
3,884
public function setProperty ( $ name , $ value , $ persistChanges = true ) { $ this -> propertiesMetadata [ $ name ] = array ( "Serializable" => $ persistChanges ) ; $ this -> { $ name } = $ value ; if ( $ name === "Id" ) { if ( is_null ( $ this -> getResourcePath ( ) ) ) { if ( is_int ( $ value ) ) { $ entityKey = "({...
A preferred way of setting the client object property
3,885
public function getByTitle ( $ title ) { return new SPList ( $ this -> getContext ( ) , new ResourcePathServiceOperation ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "getByTitle" , array ( rawurlencode ( $ title ) ) ) ) ; }
Get List by title
3,886
public function getById ( $ id ) { return new SPList ( $ this -> getContext ( ) , new ResourcePathServiceOperation ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , "getById" , array ( $ id ) ) ) ; }
Get List by id
3,887
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
3,888
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 .
3,889
public function forward ( $ comment , $ toRecipients ) { $ parameter = new ClientValueObject ( ) ; $ parameter -> setProperty ( "Comment" , $ comment ) ; $ parameter -> setProperty ( "ToRecipients" , $ toRecipients ) ; $ qry = new InvokePostMethodQuery ( $ this -> getResourcePath ( ) , "Forward" , null , $ parameter ) ...
Forward a message by using the Forward method and optionally specifying a comment .
3,890
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 .
3,891
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 .
3,892
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
3,893
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 .
3,894
public function addChild ( $ value ) { if ( is_null ( $ this -> data ) ) $ this -> data = array ( ) ; $ this -> data [ ] = $ value ; }
Adds property to collection
3,895
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 ( ...
Creates a ContentType resource
3,896
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 .
3,897
public function add ( AttachmentCreationInformation $ information ) { $ attachment = new Attachment ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) ) ; $ qry = new InvokePostMethodQuery ( $ this -> getResourcePath ( ) , "add" , array ( "FileName" => rawurlencode ( $ information -> FileName ) ) , $ informatio...
Creates a Attachment resource
3,898
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
3,899
function getById ( $ contactId ) { return new Contact ( $ this -> getContext ( ) , new ResourcePathEntity ( $ this -> getContext ( ) , $ this -> getResourcePath ( ) , $ contactId ) ) ; }
Get a contact by using the contact ID .