idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
53,300
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/pages.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Page :: class , $ response [ 'pages' ] ) ; }
Receive a list of all pages
53,301
public function get ( $ pageId , array $ params = array ( ) ) { $ endpoint = '/admin/pages/' . $ pageId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Page :: class , $ response [ 'page' ] ) ; }
Receive a single
53,302
public function update ( Page & $ page ) { $ data = $ page -> exportData ( ) ; $ endpoint = '/admin/pages/' . $ page -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'page' => $ data ) ) ; $ page -> setData ( $ response [ 'page' ] ) ; }
Modify an existing page
53,303
public function delete ( Page $ page ) { $ endpoint = '/admin/pages/' . $ page -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'DELETE' ) ; return ; }
Delete an existing page
53,304
public function getUnitSymbolsForFamily ( $ family ) { $ familyConfig = $ this -> getFamilyConfig ( $ family ) ; $ unitsConfig = $ familyConfig [ 'units' ] ; return array_map ( function ( $ unit ) { return $ unit [ 'symbol' ] ; } , $ unitsConfig ) ; }
Get unit symbols for a measure family
53,305
protected function getFamilyConfig ( $ family ) { if ( ! isset ( $ this -> config [ $ family ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Undefined measure family "%s"' , $ family ) ) ; } return $ this -> config [ $ family ] ; }
Get the family config
53,306
public function search ( array $ params = array ( ) ) { $ endpoint = '/admin/customers/search.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Customer :: class , $ response [ 'customers' ] ) ; }
Search for customers matching suppliied query
53,307
public function get ( $ customerId , array $ params = array ( ) ) { $ endpoint = '/admin/customers/' . $ customerId . '.json' ; ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Customer :: class , $ response [ 'customer' ] ) ; }
Receive a single customer
53,308
public function update ( Customer & $ customer ) { $ data = $ customer -> exportData ( ) ; $ endpoint = '/admin/customers/' . $ customer -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'customer' => $ data ) ) ; $ customer -> setData ( $ response [ 'customer' ] ) ; }
Update a customer
53,309
public function sendInvite ( $ customerId , CustomerInvite $ invite = null ) { $ data = is_null ( $ invite ) ? array ( ) : $ invite -> exportData ( ) ; $ endpoint = '/admin/customers/' . $ customerId . '/send_invite.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'custom_invite' => $ data ) ) ; return $ response [ 'customer_invite' ] ; }
Send an invite
53,310
public function all ( $ blogId , array $ params = array ( ) ) { $ endpoint = '/admin/blogs/' . $ blogId . '/articles.json' ; $ data = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Article :: class , $ data [ 'articles' ] ) ; }
Receive a list of Articles
53,311
public function count ( $ blogId , array $ params = array ( ) ) { $ endpoint = '/admin/blogs/' . $ blogId . '/articles/count.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ response [ 'count' ] ; }
Receive acount of all Articles
53,312
public function get ( $ blogId , $ articleId , array $ fields = array ( ) ) { $ params = array ( ) ; if ( ! empty ( $ fields ) ) { $ params [ 'fields' ] = implode ( ',' , $ fields ) ; } $ endpoint = '/admin/blogs/' . $ blogId . '/articles/' . $ articleId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Article :: class , $ response [ 'article' ] ) ; }
Receive a single article
53,313
public function create ( $ blogId , Article & $ article ) { $ data = $ article -> exportData ( ) ; $ endpoint = '/admin/blogs/' . $ blogId . '/articles.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'article' => $ data ) ) ; $ article -> setData ( $ response [ 'article' ] ) ; }
Create a new Article
53,314
public function update ( $ blogId , Article & $ article ) { $ data = $ article -> exportData ( ) ; $ endpoint = '/admin/blogs/' . $ blogId . '/articles/' . $ article -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'article' => $ data ) ) ; $ article -> setData ( $ response [ 'article' ] ) ; }
Modify an existing article
53,315
public function delete ( $ blogId , Article & $ article ) { $ articleId = $ article -> getId ( ) ; $ endpoint = '/admin/blogs/' . $ blogId . '/articles/' . $ articleId . '.json' ; $ this -> request ( $ endpoint , 'DELETE' ) ; }
Remove an article from the database
53,316
public function all ( $ orderId , array $ params = array ( ) ) { $ endpoint = '/admin/orders/' . $ orderId . '/refunds.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Refund :: class , $ response [ 'refunds' ] ) ; }
Receive a list of all Refunds
53,317
public function get ( $ orderId , $ refundId , array $ params = array ( ) ) { $ endpoint = '/admin/orders/' . $ orderId . '/refunds/' . $ refundId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Refund :: class , $ response [ 'refund' ] ) ; }
Receive a single Refund
53,318
public function all ( ) { $ endpoint = '/admin/policies.json' ; $ response = $ this -> request ( $ endpoint ) ; return $ this -> createCollection ( Policy :: class , $ response [ 'policies' ] ) ; }
Receive a list of all Policies
53,319
protected function applyOperation ( $ value , $ operator , $ operand ) { $ processedValue = $ value ; switch ( $ operator ) { case "div" : if ( $ operand !== 0 ) { $ processedValue = $ processedValue / $ operand ; } break ; case "mul" : $ processedValue = $ processedValue * $ operand ; break ; case "add" : $ processedValue = $ processedValue + $ operand ; break ; case "sub" : $ processedValue = $ processedValue - $ operand ; break ; default : throw new UnknownOperatorException ( ) ; } return $ processedValue ; }
Apply operation between value and operand by using operator
53,320
protected function applyReversedOperation ( $ value , $ operator , $ operand ) { $ processedValue = $ value ; switch ( $ operator ) { case "div" : $ processedValue = $ processedValue * $ operand ; break ; case "mul" : if ( $ operand !== 0 ) { $ processedValue = $ processedValue / $ operand ; } break ; case "add" : $ processedValue = $ processedValue - $ operand ; break ; case "sub" : $ processedValue = $ processedValue + $ operand ; break ; default : throw new UnknownOperatorException ( ) ; } return $ processedValue ; }
Apply reversed operation between value and operand by using operator
53,321
public function all ( array $ params = array ( ) ) { $ data = $ this -> request ( '/admin/script_tags.json' , 'GET' , $ params ) ; return $ this -> createCollection ( ScriptTag :: class , $ data [ 'script_tags' ] ) ; }
Get a list of all ScriptTags
53,322
public function get ( $ scriptTagId , array $ fields = array ( ) ) { $ params = array ( ) ; if ( ! empty ( $ fields ) ) { $ params [ 'fields' ] = implode ( ',' , $ fields ) ; } $ data = $ this -> request ( '/admin/script_tags/' . $ scriptTagId . '.json' , 'GET' , $ params ) ; return $ this -> createObject ( ScriptTag :: class , $ data [ 'script_tag' ] ) ; }
Receive a single Script Tag
53,323
public function create ( ScriptTag & $ scriptTag ) { $ data = $ scriptTag -> exportData ( ) ; $ response = $ this -> request ( '/admin/script_tags.json' , 'POST' , array ( 'script_tag' => $ data ) ) ; $ scriptTag -> setData ( $ response [ 'script_tag' ] ) ; }
Create a new script tag
53,324
public function update ( ScriptTag $ scriptTag ) { $ data = $ scriptTag -> exportData ( ) ; $ response = $ this -> request ( '/admin/script_tags/' . $ scriptTag -> id . '.json' , 'PUT' , array ( 'script_tag' => $ data ) ) ; $ scriptTag -> setData ( $ response [ 'script_tag' ] ) ; }
Update a script tag
53,325
public function setPolicyIds ( array $ policyIds ) { foreach ( $ policyIds as $ key => $ policyId ) { $ policyIds [ $ key ] = $ this -> castValueToSimpleType ( 'string' , $ policyId ) ; } $ this -> policyIds = $ policyIds ; }
Sets list of policy ids
53,326
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/locations.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Location :: class , $ response [ 'locations' ] ) ; }
Get all locations
53,327
public function get ( $ locationId , array $ params = array ( ) ) { $ endpoint = '/admin/locations/' . $ locationId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Location :: class , $ response [ 'location' ] ) ; }
Get a single location
53,328
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/events.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Event :: class , $ response [ 'events' ] ) ; }
Get a list of all events
53,329
public function get ( $ eventId , array $ params = array ( ) ) { $ endpoint = '/admin/events/' . $ eventId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Event :: class , $ response [ 'event' ] ) ; }
Receive a single event
53,330
private function getReplacementValue ( ) { $ value = $ this -> getValue ( ) ; return ( is_array ( $ value ) || is_object ( $ value ) ) ? array ( $ value ) : $ value ; }
Returns the replacement value .
53,331
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/marketing_events.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( MarketingEvent :: class , $ response [ 'marketing_events' ] ) ; }
Receieve a list of all Marketing Events
53,332
public function get ( $ marketingEventId ) { $ endpoint = '/admin/marketing_events/' . $ marketingEventId . '.json' ; $ response = $ this -> request ( $ endpoint ) ; return $ this -> createObject ( MarketingEvent :: class , $ response [ 'marketing_event' ] ) ; }
Receive a single Marketing events
53,333
public function create ( MarketingEvent & $ marketingEvent ) { $ data = $ marketingEvent -> exportData ( ) ; $ endpoint = '/admin/marketing_events.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'marketing_event' => $ data ) ) ; $ marketingEvent -> setData ( $ response [ 'marketing_event' ] ) ; }
Create a marketing event
53,334
public function update ( MarketingEvent & $ marketingEvent ) { $ data = $ marketingEvent -> exportData ( ) ; $ endpoint = '/admin/marketing_events/' . $ marketingEvent -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'marketing_event' => $ data ) ) ; $ marketingEvent -> setData ( $ response [ 'marketing_event' ] ) ; }
Modify a marketing events
53,335
public function delete ( MarketingEvent & $ marketingEvent ) { $ endpoint = '/admin/marketing_events/' . $ marketingEvent -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'DELETE' ) ; return ; }
Remove a marketing event
53,336
protected function checkType ( $ expectedType , $ value , $ nullAllowed = false ) { $ invalidType = null ; $ valueType = gettype ( $ value ) ; $ nullAllowed = ( boolean ) $ nullAllowed ; if ( $ valueType === 'object' ) { if ( ! is_a ( $ value , $ expectedType ) ) { $ invalidType = get_class ( $ value ) ; } } elseif ( $ expectedType !== $ valueType ) { $ invalidType = $ valueType ; } if ( $ invalidType !== null && ( $ nullAllowed === false || ( $ nullAllowed === true && $ value !== null ) ) ) { throw new CmisInvalidArgumentException ( sprintf ( 'Argument of type "%s" given but argument of type "%s" was expected.' , $ invalidType , $ expectedType ) , 1413440336 ) ; } return true ; }
Check if the given value is the expected object type
53,337
protected function castValueToSimpleType ( $ expectedType , $ value , $ nullIsValidValue = false ) { try { $ this -> checkType ( $ expectedType , $ value , $ nullIsValidValue ) ; } catch ( CmisInvalidArgumentException $ exception ) { if ( PHP_INT_SIZE == 4 && $ expectedType == 'integer' && is_double ( $ value ) ) { settype ( $ value , $ expectedType ) ; } else { trigger_error ( sprintf ( 'Given value is of type "%s" but a value of type "%s" was expected.' . ' Value has been casted to the expected type.' , gettype ( $ value ) , $ expectedType ) , E_USER_NOTICE ) ; settype ( $ value , $ expectedType ) ; } } return $ value ; }
Ensure that a value is an instance of the expected type . If not the value is casted to the expected type and a log message is triggered .
53,338
public function get ( ) { $ request = $ this -> createRequest ( '/admin/shop.json' ) ; $ response = $ this -> send ( $ request ) ; return $ this -> createObject ( Shop :: class , $ response [ 'shop' ] ) ; }
Receive a single shop
53,339
public function getPropertyDefinition ( $ id ) { return ( isset ( $ this -> propertyDefinitions [ $ id ] ) ? $ this -> propertyDefinitions [ $ id ] : null ) ; }
Returns the property definitions for the given id of this type .
53,340
protected function long2ip ( $ long , $ abbr = true ) { switch ( static :: NB_BITS ) { case 128 : return $ this -> long2ip6 ( $ long , $ abbr ) ; default : return strval ( long2ip ( $ long ) ) ; } }
Convert a Long to IP Notation
53,341
protected function IPLongCompare ( $ long1 , $ long2 , $ operator = '=' ) { $ operators = preg_split ( '//' , $ operator ) ; $ diff = bccomp ( $ long1 , $ long2 ) ; foreach ( $ operators as $ operator ) { switch ( true ) { case ( ( $ operator === '=' ) && ( $ diff == 0 ) ) : case ( ( $ operator === '<' ) && ( $ diff < 0 ) ) : case ( ( $ operator === '>' ) && ( $ diff > 0 ) ) : return true ; } } return false ; }
Compare 2 IP Long
53,342
protected function IPLongAnd ( $ long1 , $ long2 ) { $ result = 0 ; for ( $ bit = 0 ; $ bit < static :: NB_BITS ; $ bit ++ ) { $ div = bcpow ( 2 , $ bit ) ; $ and = bcmod ( bcdiv ( $ long1 , $ div , 0 ) , 2 ) && bcmod ( bcdiv ( $ long2 , $ div , 0 ) , 2 ) ; $ result = bcadd ( $ result , bcmul ( $ and , $ div ) ) ; } return $ result ; }
Logic AND between two IP Longs
53,343
protected function IPLongBaseConvert ( $ long , $ fromBase = 10 , $ toBase = 36 ) { $ str = trim ( $ long ) ; if ( intval ( $ fromBase ) != 10 ) { $ len = strlen ( $ str ) ; $ q = 0 ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ r = base_convert ( $ str [ $ i ] , $ fromBase , 10 ) ; $ q = bcadd ( bcmul ( $ q , $ fromBase ) , $ r ) ; } } else { $ q = $ str ; } if ( intval ( $ toBase ) != 10 ) { $ s = '' ; while ( bccomp ( $ q , '0' , 0 ) > 0 ) { $ r = intval ( bcmod ( $ q , $ toBase ) ) ; $ s = base_convert ( $ r , 10 , $ toBase ) . $ s ; $ q = bcdiv ( $ q , $ toBase , 0 ) ; } } else { $ s = $ q ; } return $ s ; }
Convert Long base
53,344
public function getPaths ( ) { $ folderType = $ this -> getSession ( ) -> getTypeDefinition ( ( string ) BaseTypeId :: cast ( BaseTypeId :: CMIS_FOLDER ) ) ; $ propertyDefinition = $ folderType -> getPropertyDefinition ( PropertyIds :: PATH ) ; $ pathQueryName = ( $ propertyDefinition === null ) ? null : $ propertyDefinition -> getQueryName ( ) ; $ bindingParents = $ this -> getBinding ( ) -> getNavigationService ( ) -> getObjectParents ( $ this -> getRepositoryId ( ) , $ this -> getId ( ) , $ pathQueryName , false , IncludeRelationships :: cast ( IncludeRelationships :: NONE ) , Constants :: RENDITION_NONE , true , null ) ; $ paths = [ ] ; foreach ( $ bindingParents as $ parent ) { if ( $ parent -> getObject ( ) -> getProperties ( ) === null ) { throw new CmisRuntimeException ( 'Repository sent invalid data! No properties given.' ) ; } $ parentProperties = $ parent -> getObject ( ) -> getProperties ( ) -> getProperties ( ) ; $ pathProperty = null ; if ( isset ( $ parentProperties [ PropertyIds :: PATH ] ) ) { $ pathProperty = $ parentProperties [ PropertyIds :: PATH ] ; } if ( ! $ pathProperty instanceof PropertyStringInterface ) { throw new CmisRuntimeException ( 'Repository sent invalid data! Path is not set!' ) ; } if ( $ parent -> getRelativePathSegment ( ) === null ) { throw new CmisRuntimeException ( 'Repository sent invalid data! No relative path segement!' ) ; } $ folderPath = rtrim ( ( string ) $ pathProperty -> getFirstValue ( ) , '/' ) . '/' ; $ paths [ ] = $ folderPath . $ parent -> getRelativePathSegment ( ) ; } return $ paths ; }
Returns the paths of this object .
53,345
public function move ( ObjectIdInterface $ sourceFolderId , ObjectIdInterface $ targetFolderId , OperationContextInterface $ context = null ) { $ context = $ this -> ensureContext ( $ context ) ; $ originalId = $ this -> getId ( ) ; $ newObjectId = $ this -> getId ( ) ; $ this -> getBinding ( ) -> getObjectService ( ) -> moveObject ( $ this -> getRepositoryId ( ) , $ newObjectId , $ targetFolderId -> getId ( ) , $ sourceFolderId -> getId ( ) , null ) ; $ this -> getSession ( ) -> removeObjectFromCache ( $ this -> getSession ( ) -> createObjectId ( $ originalId ) ) ; if ( empty ( $ newObjectId ) ) { return null ; } $ movedObject = $ this -> getSession ( ) -> getObject ( $ this -> getSession ( ) -> createObjectId ( ( string ) $ newObjectId ) , $ context ) ; if ( ! $ movedObject instanceof FileableCmisObjectInterface ) { throw new CmisRuntimeException ( 'Moved object is invalid because it must be of type FileableCmisObjectInterface but is not.' ) ; } return $ movedObject ; }
Moves this object .
53,346
public function addToFolder ( ObjectIdInterface $ folderId , $ allVersions = true ) { $ objectId = $ this -> getId ( ) ; $ this -> getBinding ( ) -> getMultiFilingService ( ) -> addObjectToFolder ( $ this -> getRepositoryId ( ) , $ objectId , $ folderId -> getId ( ) , $ allVersions ) ; $ this -> getSession ( ) -> removeObjectFromCache ( $ this -> getSession ( ) -> createObjectId ( $ objectId ) ) ; }
Adds this object to a folder .
53,347
public function removeFromFolder ( ObjectIdInterface $ folderId ) { $ objectId = $ this -> getId ( ) ; $ this -> getBinding ( ) -> getMultiFilingService ( ) -> removeObjectFromFolder ( $ this -> getRepositoryId ( ) , $ objectId , $ folderId -> getId ( ) , null ) ; $ this -> getSession ( ) -> removeObjectFromCache ( $ this -> getSession ( ) -> createObjectId ( $ objectId ) ) ; }
Removes this object from a folder .
53,348
public function getPropertyById ( $ id ) { return isset ( $ this -> propertiesById [ $ id ] ) ? $ this -> propertiesById [ $ id ] : null ; }
Returns a property by ID .
53,349
public function getPropertyByQueryName ( $ queryName ) { return isset ( $ this -> propertiesByQueryName [ $ queryName ] ) ? $ this -> propertiesByQueryName [ $ queryName ] : null ; }
Returns a property by query name or alias .
53,350
public function getPropertyMultivalueById ( $ id ) { $ property = $ this -> getPropertyById ( $ id ) ; return $ property !== null ? $ property -> getValues ( ) : null ; }
Returns a property multi - value by ID .
53,351
public function getPropertyMultivalueByQueryName ( $ queryName ) { $ property = $ this -> getPropertyByQueryName ( $ queryName ) ; return $ property !== null ? $ property -> getValues ( ) : null ; }
Returns a property multi - value by query name or alias .
53,352
public function appendContentStream ( StreamInterface $ contentStream , $ isLastChunk , $ refresh = true ) { if ( $ this -> getSession ( ) -> getRepositoryInfo ( ) -> getCmisVersion ( ) -> equals ( CmisVersion :: CMIS_1_0 ) ) { throw new CmisNotSupportedException ( 'This method is not supported for CMIS 1.0 repositories.' ) ; } $ newObjectId = $ this -> getId ( ) ; $ changeToken = $ this -> getPropertyValue ( PropertyIds :: CHANGE_TOKEN ) ; $ this -> getBinding ( ) -> getObjectService ( ) -> appendContentStream ( $ this -> getRepositoryId ( ) , $ newObjectId , $ this -> getObjectFactory ( ) -> convertContentStream ( $ contentStream ) , $ isLastChunk , $ changeToken ) ; if ( $ refresh ) { $ this -> refresh ( ) ; } if ( $ newObjectId === null ) { return null ; } return $ this -> getSession ( ) -> createObjectId ( $ newObjectId ) ; }
Appends a content stream to the content stream of the document and refreshes this object afterwards . If the repository created a new version this new document is returned . Otherwise the current document is returned . The stream in contentStream is consumed but not closed by this method .
53,353
public function copy ( ObjectIdInterface $ targetFolderId = null , array $ properties = [ ] , VersioningState $ versioningState = null , array $ policies = [ ] , array $ addAces = [ ] , array $ removeAces = [ ] , OperationContextInterface $ context = null ) { try { $ newObjectId = $ this -> getSession ( ) -> createDocumentFromSource ( $ this , $ properties , $ targetFolderId , $ versioningState , $ policies , $ addAces , $ removeAces ) ; } catch ( CmisNotSupportedException $ notSupportedException ) { $ newObjectId = $ this -> copyViaClient ( $ targetFolderId , $ properties , $ versioningState , $ policies , $ addAces , $ removeAces ) ; } $ document = $ this -> getNewlyCreatedObject ( $ newObjectId , $ context ) ; if ( $ document === null ) { return null ; } elseif ( ! $ document instanceof DocumentInterface ) { throw new CmisRuntimeException ( 'Newly created object is not a document! New id: ' . $ document -> getId ( ) ) ; } return $ document ; }
Creates a copy of this document including content .
53,354
protected function copyViaClient ( ObjectIdInterface $ targetFolderId = null , array $ properties = [ ] , VersioningState $ versioningState = null , array $ policies = [ ] , array $ addAces = [ ] , array $ removeAces = [ ] ) { $ newProperties = [ ] ; $ allPropertiesContext = $ this -> getSession ( ) -> createOperationContext ( ) ; $ allPropertiesContext -> setFilterString ( '*' ) ; $ allPropertiesContext -> setIncludeAcls ( false ) ; $ allPropertiesContext -> setIncludeAllowableActions ( false ) ; $ allPropertiesContext -> setIncludePathSegments ( false ) ; $ allPropertiesContext -> setIncludePolicies ( false ) ; $ allPropertiesContext -> setIncludeRelationships ( IncludeRelationships :: cast ( IncludeRelationships :: NONE ) ) ; $ allPropertiesContext -> setRenditionFilterString ( Constants :: RENDITION_NONE ) ; $ allPropertiesDocument = $ this -> getSession ( ) -> getObject ( $ this , $ allPropertiesContext ) ; if ( ! $ allPropertiesDocument instanceof DocumentInterface ) { throw new CmisRuntimeException ( 'Returned object is not of expected type DocumentInterface' ) ; } foreach ( $ allPropertiesDocument -> getProperties ( ) as $ property ) { if ( Updatability :: cast ( Updatability :: READWRITE ) -> equals ( $ property -> getDefinition ( ) -> getUpdatability ( ) ) || Updatability :: cast ( Updatability :: ONCREATE ) -> equals ( $ property -> getDefinition ( ) -> getUpdatability ( ) ) ) { $ newProperties [ $ property -> getId ( ) ] = $ property -> isMultiValued ( ) ? $ property -> getValues ( ) : $ property -> getFirstValue ( ) ; } } $ newProperties = array_merge ( $ newProperties , $ properties ) ; $ contentStream = $ allPropertiesDocument -> getContentStream ( ) ; return $ this -> getSession ( ) -> createDocument ( $ newProperties , $ targetFolderId , $ contentStream , $ versioningState , $ policies , $ addAces , $ removeAces ) ; }
Copies the document manually . The content is streamed from the repository and back .
53,355
public function deleteContentStream ( $ refresh = true ) { $ newObjectId = $ this -> getId ( ) ; $ changeToken = $ this -> getPropertyValue ( PropertyIds :: CHANGE_TOKEN ) ; $ this -> getBinding ( ) -> getObjectService ( ) -> deleteContentStream ( $ this -> getRepositoryId ( ) , $ newObjectId , $ changeToken ) ; if ( $ refresh === true ) { $ this -> refresh ( ) ; } if ( $ newObjectId === null ) { return null ; } return $ this -> getSession ( ) -> getObject ( $ this -> getSession ( ) -> createObjectId ( $ newObjectId ) , $ this -> getCreationContext ( ) ) ; }
Removes the current content stream from the document and refreshes this object afterwards .
53,356
public function getAllVersions ( OperationContextInterface $ context = null ) { $ context = $ this -> ensureContext ( $ context ) ; $ versions = $ this -> getBinding ( ) -> getVersioningService ( ) -> getAllVersions ( $ this -> getRepositoryId ( ) , $ this -> getId ( ) , $ this -> getVersionSeriesId ( ) , $ context -> getQueryFilterString ( ) , $ context -> isIncludeAllowableActions ( ) ) ; $ objectFactory = $ this -> getSession ( ) -> getObjectFactory ( ) ; $ result = [ ] ; if ( count ( $ versions ) ) { foreach ( $ versions as $ objectData ) { $ document = $ objectFactory -> convertObject ( $ objectData , $ context ) ; if ( ! ( $ document instanceof DocumentInterface ) ) { throw new CmisVersioningException ( sprintf ( 'Repository yielded non-Document %s as version of Document %s - unsupported repository response' , $ document -> getId ( ) , $ this -> getId ( ) ) ) ; } $ result [ ] = $ document ; } } return $ result ; }
Fetches all versions of this document using the given OperationContext . The behavior of this method is undefined if the document is not versionable and can be different for each repository .
53,357
public function getContentUrl ( $ streamId = null ) { $ objectService = $ this -> getBinding ( ) -> getObjectService ( ) ; if ( $ objectService instanceof LinkAccessInterface ) { if ( $ streamId === null ) { return $ objectService -> loadContentLink ( $ this -> getRepositoryId ( ) , $ this -> getId ( ) ) ; } else { return $ objectService -> loadRenditionContentLink ( $ this -> getRepositoryId ( ) , $ this -> getId ( ) , $ streamId ) ; } } return null ; }
Returns the content URL of the document or a rendition if the binding supports content URLs .
53,358
public function getContentStream ( $ streamId = null , $ offset = null , $ length = null ) { return $ this -> getSession ( ) -> getContentStream ( $ this , $ streamId , $ offset , $ length ) ; }
Retrieves the content stream that is associated with the given stream ID . This is usually a rendition of the document .
53,359
public function setContentStream ( StreamInterface $ contentStream , $ overwrite , $ refresh = true ) { $ newObjectId = $ this -> getId ( ) ; $ changeToken = $ this -> getPropertyValue ( PropertyIds :: CHANGE_TOKEN ) ; $ this -> getBinding ( ) -> getObjectService ( ) -> setContentStream ( $ this -> getRepositoryId ( ) , $ newObjectId , $ this -> getObjectFactory ( ) -> convertContentStream ( $ contentStream ) , $ overwrite , $ changeToken ) ; if ( $ refresh === true ) { $ this -> refresh ( ) ; } if ( $ newObjectId === null ) { return null ; } return $ this -> getSession ( ) -> createObjectId ( $ newObjectId ) ; }
Sets a new content stream for the document . If the repository created a new version the object ID of this new version is returned . Otherwise the object ID of the current document is returned . The stream in contentStream is consumed but not closed by this method .
53,360
public function isAllowed ( $ entry , $ defaultState ) { $ whited = false ; $ blacked = false ; if ( is_array ( $ this -> lists ) ) { foreach ( $ this -> lists as $ list ) { $ allowed = $ list -> isAllowed ( $ entry ) ; if ( $ allowed !== null ) { if ( $ allowed ) { $ whited = true ; } else { $ blacked = true ; } } } } return ( $ defaultState ? ( ! $ blacked || $ whited ) : ( $ whited && ! $ blacked ) ) ; }
Check if a string is allowed
53,361
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/smart_collections.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( SmartCollection :: class , $ response [ 'smart_collections' ] ) ; }
Receive a list of all SmartCollection
53,362
public function get ( $ smartCollectionId , array $ params = array ( ) ) { $ endpoint = '/admin/smart_collections/' . $ smartCollectionId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( SmartCollection :: class , $ response [ 'smart_collection' ] ) ; }
Receive a single smart collection
53,363
public function create ( SmartCollection & $ smartCollection ) { $ data = $ smartCollection -> exportData ( ) ; $ endpoint = '/admin/smart_collections.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'smart_collection' => $ data ) ) ; $ smartCollection -> setData ( $ response [ 'smart_collection' ] ) ; }
Create a new smart collection
53,364
public function update ( SmartCollection & $ smartCollection ) { $ data = $ smartCollection -> exportData ( ) ; $ endpoint = '/admin/smart_collections/' . $ smart_collection -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'smart_collection' => $ data ) ) ; $ smartCollection -> setData ( $ response [ 'smart_collection' ] ) ; }
Modify an existing smart collection
53,365
public function delete ( SmartCollection $ smartCollection ) { $ request = $ this -> createRequest ( '/admin/smart_collections/' . $ smartCollection -> getId ( ) . '.json' , static :: REQUEST_METHOD_DELETE ) ; $ this -> send ( $ request ) ; }
Delete an existing smart_collection
53,366
public function applyAcl ( $ repositoryId , $ objectId , AclInterface $ addAces = null , AclInterface $ removeAces = null , AclPropagation $ aclPropagation = null , ExtensionDataInterface $ extension = null ) { }
Adds or removes the given ACEs to or from the ACL of the object .
53,367
public function convertNewTypeSettableAttributes ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ object = new NewTypeSettableAttributes ( ) ; $ object -> populate ( $ data , array_combine ( JSONConstants :: getCapabilityNewTypeSettableAttributeKeys ( ) , array_map ( function ( $ key ) { return 'canSet' . ucfirst ( $ key ) ; } , JSONConstants :: getCapabilityNewTypeSettableAttributeKeys ( ) ) ) , true ) ; $ object -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getCapabilityNewTypeSettableAttributeKeys ( ) ) ) ; return $ object ; }
Create NewTypeSettableAttributes object and populate given data to it
53,368
public function convertCreatablePropertyTypes ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ object = new CreatablePropertyTypes ( ) ; $ canCreate = [ ] ; foreach ( $ data [ JSONConstants :: JSON_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE ] ?? [ ] as $ canCreateItem ) { try { $ canCreate [ ] = PropertyType :: cast ( $ canCreateItem ) ; } catch ( InvalidEnumerationValueException $ exception ) { } } $ object -> setCanCreate ( $ canCreate ) ; $ object -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getCapabilityCreatablePropertyKeys ( ) ) ) ; return $ object ; }
Create CreatablePropertyTypes object and populate given data to it
53,369
public function convertTypeDefinition ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } if ( empty ( $ data [ JSONConstants :: JSON_TYPE_ID ] ) ) { throw new CmisInvalidArgumentException ( 'Id of type definition is empty but must not be empty!' ) ; } $ typeDefinition = $ this -> getBindingsObjectFactory ( ) -> getTypeDefinitionByBaseTypeId ( $ data [ JSONConstants :: JSON_TYPE_BASE_ID ] ?? '' , $ data [ JSONConstants :: JSON_TYPE_ID ] ?? '' ) ; $ data = $ this -> convertTypeDefinitionSpecificData ( $ data , $ typeDefinition ) ; $ data [ JSONConstants :: JSON_TYPE_TYPE_MUTABILITY ] = $ this -> convertTypeMutability ( $ data [ JSONConstants :: JSON_TYPE_TYPE_MUTABILITY ] ?? null ) ; foreach ( $ data [ JSONConstants :: JSON_TYPE_PROPERTY_DEFINITIONS ] ?? [ ] as $ propertyDefinitionData ) { if ( is_array ( $ propertyDefinitionData ) ) { $ propertyDefinition = $ this -> convertPropertyDefinition ( $ propertyDefinitionData ) ; if ( $ propertyDefinition !== null ) { $ typeDefinition -> addPropertyDefinition ( $ propertyDefinition ) ; } } } unset ( $ data [ JSONConstants :: JSON_TYPE_BASE_ID ] , $ data [ JSONConstants :: JSON_TYPE_ID ] , $ data [ JSONConstants :: JSON_TYPE_PROPERTY_DEFINITIONS ] ) ; $ typeDefinition -> populate ( array_filter ( $ data , function ( $ item ) { return ! empty ( $ item ) ; } ) , array_merge ( array_combine ( JSONConstants :: getTypeKeys ( ) , JSONConstants :: getTypeKeys ( ) ) , [ JSONConstants :: JSON_TYPE_PARENT_ID => 'parentTypeId' , JSONConstants :: JSON_TYPE_ALLOWED_TARGET_TYPES => 'allowedTargetTypeIds' , JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES => 'allowedSourceTypeIds' , ] ) , true ) ; $ typeDefinition -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getTypeKeys ( ) ) ) ; return $ typeDefinition ; }
Convert an array to a type definition object
53,370
private function convertTypeDefinitionSpecificData ( array $ data , MutableTypeDefinitionInterface $ typeDefinition ) { if ( $ typeDefinition instanceof MutableDocumentTypeDefinitionInterface ) { if ( ! empty ( $ data [ JSONConstants :: JSON_TYPE_CONTENTSTREAM_ALLOWED ] ) ) { $ data [ JSONConstants :: JSON_TYPE_CONTENTSTREAM_ALLOWED ] = ContentStreamAllowed :: cast ( $ data [ JSONConstants :: JSON_TYPE_CONTENTSTREAM_ALLOWED ] ) ; } } elseif ( $ typeDefinition instanceof MutableRelationshipTypeDefinitionInterface ) { $ data [ JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES ] = array_map ( 'strval' , array_filter ( $ data [ JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES ] ?? [ ] , function ( $ item ) { return ! empty ( $ item ) ; } ) ) ; $ data [ JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES ] = array_map ( 'strval' , array_filter ( $ data [ JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES ] ?? [ ] , function ( $ item ) { return ! empty ( $ item ) ; } ) ) ; $ data [ JSONConstants :: JSON_TYPE_ALLOWED_TARGET_TYPES ] = array_map ( 'strval' , array_filter ( $ data [ JSONConstants :: JSON_TYPE_ALLOWED_TARGET_TYPES ] ?? [ ] , function ( $ item ) { return ! empty ( $ item ) ; } ) ) ; } return $ data ; }
Convert specific type definition data so it can be populated to the type definition
53,371
public function convertTypeMutability ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ typeMutability = new TypeMutability ( ) ; $ typeMutability -> populate ( $ data , array_combine ( JSONConstants :: getTypeTypeMutabilityKeys ( ) , array_map ( function ( $ key ) { return 'can' . ucfirst ( $ key ) ; } , JSONConstants :: getTypeTypeMutabilityKeys ( ) ) ) , true ) ; $ typeMutability -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getTypeTypeMutabilityKeys ( ) ) ) ; return $ typeMutability ; }
Convert an array to a type mutability object
53,372
protected function preparePropertyDefinitionData ( array $ data ) { $ data [ JSONConstants :: JSON_PROPERTY_TYPE_PROPERTY_TYPE ] = PropertyType :: cast ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_PROPERTY_TYPE ] ) ; if ( isset ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_DEAULT_VALUE ] ) ) { $ data [ JSONConstants :: JSON_PROPERTY_TYPE_DEAULT_VALUE ] = ( array ) $ data [ JSONConstants :: JSON_PROPERTY_TYPE_DEAULT_VALUE ] ; } if ( isset ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_RESOLUTION ] ) ) { $ data [ JSONConstants :: JSON_PROPERTY_TYPE_RESOLUTION ] = DateTimeResolution :: cast ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_RESOLUTION ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_PRECISION ] ) ) { $ data [ JSONConstants :: JSON_PROPERTY_TYPE_PRECISION ] = DecimalPrecision :: cast ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_PRECISION ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_CARDINALITY ] ) ) { $ data [ JSONConstants :: JSON_PROPERTY_TYPE_CARDINALITY ] = Cardinality :: cast ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_CARDINALITY ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_UPDATABILITY ] ) ) { $ data [ JSONConstants :: JSON_PROPERTY_TYPE_UPDATABILITY ] = Updatability :: cast ( $ data [ JSONConstants :: JSON_PROPERTY_TYPE_UPDATABILITY ] ) ; } return $ data ; }
Cast data values to the expected type
53,373
public function convertObject ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ object = new ObjectData ( ) ; $ acl = $ this -> convertAcl ( $ data [ JSONConstants :: JSON_OBJECT_ACL ] ?? [ ] , ( boolean ) ( $ data [ JSONConstants :: JSON_OBJECT_EXACT_ACL ] ?? false ) ) ; if ( $ acl !== null ) { $ object -> setAcl ( $ acl ) ; } $ allowableActions = $ this -> convertAllowableActions ( $ data [ JSONConstants :: JSON_OBJECT_ALLOWABLE_ACTIONS ] ?? [ ] ) ; if ( $ allowableActions !== null ) { $ object -> setAllowableActions ( $ allowableActions ) ; } if ( isset ( $ data [ JSONConstants :: JSON_OBJECT_CHANGE_EVENT_INFO ] ) && is_array ( $ data [ JSONConstants :: JSON_OBJECT_CHANGE_EVENT_INFO ] ) ) { $ changeEventInfoData = $ data [ JSONConstants :: JSON_OBJECT_CHANGE_EVENT_INFO ] ; $ changeEventInfo = new ChangeEventInfo ( ) ; $ changeEventInfo -> setChangeTime ( $ this -> convertDateTimeValue ( $ changeEventInfoData [ JSONConstants :: JSON_CHANGE_EVENT_TIME ] ) ) ; $ changeEventInfo -> setChangeType ( ChangeType :: cast ( $ changeEventInfoData [ JSONConstants :: JSON_CHANGE_EVENT_TYPE ] ) ) ; $ changeEventInfo -> setExtensions ( $ this -> convertExtension ( $ changeEventInfoData , JSONConstants :: getChangeEventKeys ( ) ) ) ; $ object -> setChangeEventInfo ( $ changeEventInfo ) ; } $ object -> setIsExactAcl ( ( boolean ) ( $ data [ JSONConstants :: JSON_OBJECT_EXACT_ACL ] ?? false ) ) ; $ object -> setPolicyIds ( $ this -> convertPolicyIdList ( $ data [ JSONConstants :: JSON_OBJECT_POLICY_IDS ] ?? null ) ) ; if ( isset ( $ data [ JSONConstants :: JSON_OBJECT_SUCCINCT_PROPERTIES ] ) ) { $ properties = $ this -> convertSuccinctProperties ( $ data [ JSONConstants :: JSON_OBJECT_SUCCINCT_PROPERTIES ] ?? [ ] , ( array ) ( $ data [ JSONConstants :: JSON_OBJECT_PROPERTIES_EXTENSION ] ?? [ ] ) ) ; } else { $ properties = $ this -> convertProperties ( $ data [ JSONConstants :: JSON_OBJECT_PROPERTIES ] ?? [ ] , ( array ) ( $ data [ JSONConstants :: JSON_OBJECT_PROPERTIES_EXTENSION ] ?? [ ] ) ) ; } $ object -> setProperties ( $ properties ?? [ ] ) ; $ object -> setRelationships ( $ this -> convertObjects ( $ data [ JSONConstants :: JSON_OBJECT_RELATIONSHIPS ] ?? null ) ) ; $ object -> setRenditions ( $ this -> convertRenditions ( $ data [ JSONConstants :: JSON_OBJECT_RENDITIONS ] ?? [ ] ) ) ; $ object -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getObjectKeys ( ) ) ) ; return $ object ; }
Converts an object .
53,374
public function convertRendition ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ rendition = new RenditionData ( ) ; if ( isset ( $ data [ JSONConstants :: JSON_RENDITION_HEIGHT ] ) ) { $ rendition -> setHeight ( ( integer ) $ data [ JSONConstants :: JSON_RENDITION_HEIGHT ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_RENDITION_KIND ] ) ) { $ rendition -> setKind ( ( string ) $ data [ JSONConstants :: JSON_RENDITION_KIND ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_RENDITION_LENGTH ] ) ) { $ rendition -> setLength ( ( integer ) $ data [ JSONConstants :: JSON_RENDITION_LENGTH ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_RENDITION_MIMETYPE ] ) ) { $ rendition -> setMimeType ( ( string ) $ data [ JSONConstants :: JSON_RENDITION_MIMETYPE ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_RENDITION_DOCUMENT_ID ] ) ) { $ rendition -> setRenditionDocumentId ( ( string ) $ data [ JSONConstants :: JSON_RENDITION_DOCUMENT_ID ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_RENDITION_STREAM_ID ] ) ) { $ rendition -> setStreamId ( ( string ) $ data [ JSONConstants :: JSON_RENDITION_STREAM_ID ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_RENDITION_TITLE ] ) ) { $ rendition -> setTitle ( ( string ) $ data [ JSONConstants :: JSON_RENDITION_TITLE ] ) ; } if ( isset ( $ data [ JSONConstants :: JSON_RENDITION_WIDTH ] ) ) { $ rendition -> setWidth ( ( integer ) $ data [ JSONConstants :: JSON_RENDITION_WIDTH ] ) ; } $ rendition -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getRenditionKeys ( ) ) ) ; return $ rendition ; }
Convert given input data to a RenditionData object
53,375
public function convertRenditions ( array $ data = null ) { return array_filter ( array_map ( [ $ this , 'convertRendition' ] , array_filter ( $ data , 'is_array' ) ) , function ( $ item ) { return ! empty ( $ item ) ; } ) ; }
Convert given input data to a list of RenditionData objects
53,376
public function convertExtension ( array $ data = null , array $ cmisKeys = [ ] ) { $ extensions = [ ] ; foreach ( array_diff_key ( ( array ) $ data , array_flip ( $ cmisKeys ) ) as $ key => $ value ) { if ( ! is_array ( $ value ) ) { $ value = ( empty ( $ value ) ) ? null : ( string ) $ value ; $ extensions [ ] = new CmisExtensionElement ( null , $ key , [ ] , $ value ) ; } else { $ extension = $ this -> convertExtension ( $ value , $ cmisKeys ) ; if ( ! empty ( $ extension ) ) { $ extensions [ ] = new CmisExtensionElement ( null , $ key , [ ] , null , $ extension ) ; } } } return $ extensions ; }
Convert given input data to an Extension object
53,377
public function convertExtensionFeatures ( array $ data = null ) { $ features = [ ] ; $ extendedFeatures = array_filter ( array_filter ( ( array ) $ data , 'is_array' ) , function ( $ item ) { return ! empty ( $ item ) ; } ) ; foreach ( $ extendedFeatures as $ extendedFeature ) { $ feature = new ExtensionFeature ( ) ; $ feature -> setId ( ( string ) $ extendedFeature [ JSONConstants :: JSON_FEATURE_ID ] ) ; $ feature -> setUrl ( ( string ) $ extendedFeature [ JSONConstants :: JSON_FEATURE_URL ] ) ; $ feature -> setCommonName ( ( string ) $ extendedFeature [ JSONConstants :: JSON_FEATURE_COMMON_NAME ] ) ; $ feature -> setVersionLabel ( ( string ) $ extendedFeature [ JSONConstants :: JSON_FEATURE_VERSION_LABEL ] ) ; $ feature -> setDescription ( ( string ) $ extendedFeature [ JSONConstants :: JSON_FEATURE_DESCRIPTION ] ) ; $ featureData = [ ] ; foreach ( $ extendedFeature [ JSONConstants :: JSON_FEATURE_DATA ] ?? [ ] as $ key => $ value ) { $ featureData [ $ key ] = $ value ; } $ feature -> setFeatureData ( $ featureData ) ; $ feature -> setExtensions ( $ this -> convertExtension ( $ extendedFeature , JSONConstants :: getFeatureKeys ( ) ) ) ; $ features [ ] = $ feature ; } return $ features ; }
Convert given input data to an ExtensionFeature object
53,378
public function convertPolicyIdList ( array $ data = null ) { $ policyIdsList = new PolicyIdList ( ) ; $ policyIdsList -> setPolicyIds ( array_filter ( array_filter ( $ data [ JSONConstants :: JSON_OBJECT_POLICY_IDS_IDS ] ?? [ ] , 'is_string' ) , function ( $ item ) { return ! empty ( $ item ) ; } ) ) ; $ policyIdsList -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getPolicyIdsKeys ( ) ) ) ; return $ policyIdsList ; }
Converts a list of policy ids .
53,379
public function convertFromTypeDefinition ( TypeDefinitionInterface $ typeDefinition ) { $ propertyList = [ 'baseTypeId' => JSONConstants :: JSON_TYPE_BASE_ID , 'parentTypeId' => JSONConstants :: JSON_TYPE_PARENT_ID ] ; if ( $ typeDefinition instanceof RelationshipTypeDefinitionInterface ) { $ propertyList [ 'allowedTargetTypeIds' ] = JSONConstants :: JSON_TYPE_ALLOWED_TARGET_TYPES ; $ propertyList [ 'allowedSourceTypeIds' ] = JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES ; } $ data = $ typeDefinition -> exportGettableProperties ( $ propertyList ) ; $ data = $ this -> castArrayValuesToSimpleTypes ( $ data ) ; return json_encode ( $ data , JSON_FORCE_OBJECT ) ; }
Convert a type definition object to a custom format
53,380
protected function castArrayValuesToSimpleTypes ( array $ data ) { foreach ( $ data as $ key => $ item ) { if ( is_array ( $ item ) ) { $ data [ $ key ] = $ this -> castArrayValuesToSimpleTypes ( $ item ) ; } elseif ( is_object ( $ item ) ) { $ data [ $ key ] = $ this -> convertObjectToSimpleType ( $ item ) ; } } return $ data ; }
Cast values of an array to simple types
53,381
protected function convertObjectToSimpleType ( $ data ) { $ converterClassName = null ; if ( class_exists ( $ this -> buildConverterClassName ( get_class ( $ data ) ) ) ) { $ converterClassName = $ this -> buildConverterClassName ( get_class ( $ data ) ) ; } else { $ classInterfaces = class_implements ( $ data ) ; foreach ( ( array ) $ classInterfaces as $ classInterface ) { if ( class_exists ( $ this -> buildConverterClassName ( $ classInterface ) ) ) { $ converterClassName = $ this -> buildConverterClassName ( $ classInterface ) ; break ; } } if ( $ converterClassName === null ) { $ classParents = class_parents ( $ data ) ; foreach ( ( array ) $ classParents as $ classParent ) { if ( class_exists ( $ this -> buildConverterClassName ( $ classParent ) ) ) { $ converterClassName = $ this -> buildConverterClassName ( $ classParent ) ; break ; } } } } if ( $ converterClassName === null ) { throw new CmisRuntimeException ( 'Could not find a converter that converts "' . get_class ( $ data ) . '" to a simple type.' ) ; } return $ converterClassName :: convertToSimpleType ( $ data ) ; }
Convert an object to a simple type representation
53,382
public function convertTypeChildren ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ result = new TypeDefinitionList ( ) ; $ types = [ ] ; $ typesList = $ data [ JSONConstants :: JSON_TYPESLIST_TYPES ] ?? [ ] ; foreach ( array_filter ( $ typesList , 'is_array' ) as $ typeData ) { $ type = $ this -> convertTypeDefinition ( $ typeData ) ; if ( $ type !== null ) { $ types [ ] = $ type ; } } $ result -> setList ( $ types ) ; $ result -> setHasMoreItems ( ( boolean ) ( $ data [ JSONConstants :: JSON_TYPESLIST_HAS_MORE_ITEMS ] ?? false ) ) ; $ result -> setNumItems ( $ data [ JSONConstants :: JSON_TYPESLIST_NUM_ITEMS ] ?? 0 ) ; $ result -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getTypesListKeys ( ) ) ) ; return $ result ; }
Convert given input data to a TypeChildren object
53,383
public function convertTypeDescendants ( array $ data = null ) { $ result = [ ] ; if ( empty ( $ data ) ) { return $ result ; } foreach ( array_filter ( $ data , 'is_array' ) as $ itemData ) { $ container = new TypeDefinitionContainer ( ) ; $ typeDefinition = $ this -> convertTypeDefinition ( $ itemData [ JSONConstants :: JSON_TYPESCONTAINER_TYPE ] ?? [ ] ) ; if ( $ typeDefinition !== null ) { $ container -> setTypeDefinition ( $ typeDefinition ) ; } $ container -> setChildren ( $ this -> convertTypeDescendants ( $ itemData [ JSONConstants :: JSON_TYPESCONTAINER_CHILDREN ] ?? [ ] ) ) ; $ container -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getTypesContainerKeys ( ) ) ) ; $ result [ ] = $ container ; } return $ result ; }
Convert given input data to a TypeDescendants object
53,384
public function convertObjectInFolderList ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ objects = array_filter ( array_map ( [ $ this , 'convertObjectInFolder' ] , $ data [ JSONConstants :: JSON_OBJECTINFOLDERLIST_OBJECTS ] ?? [ ] ) , function ( $ item ) { return ! empty ( $ item ) ; } ) ; $ objectInFolderList = new ObjectInFolderList ( ) ; $ objectInFolderList -> setObjects ( $ objects ) ; $ objectInFolderList -> setHasMoreItems ( ( boolean ) ( $ data [ JSONConstants :: JSON_OBJECTINFOLDERLIST_HAS_MORE_ITEMS ] ?? false ) ) ; $ objectInFolderList -> setNumItems ( ( integer ) ( $ data [ JSONConstants :: JSON_OBJECTINFOLDERLIST_NUM_ITEMS ] ?? count ( $ objects ) ) ) ; $ objectInFolderList -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getObjectInFolderListKeys ( ) ) ) ; return $ objectInFolderList ; }
Convert given input data to a ObjectInFolderList object
53,385
public function convertObjectInFolder ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ objectInFolderData = new ObjectInFolderData ( ) ; $ object = $ this -> convertObject ( $ data [ JSONConstants :: JSON_OBJECTINFOLDER_OBJECT ] ?? [ ] ) ; if ( $ object !== null ) { $ objectInFolderData -> setObject ( $ object ) ; } $ objectInFolderData -> setPathSegment ( ( string ) $ data [ JSONConstants :: JSON_OBJECTINFOLDER_PATH_SEGMENT ] ?? null ) ; $ objectInFolderData -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getObjectInFolderKeys ( ) ) ) ; return $ objectInFolderData ; }
Convert given input data to a ObjectInFolderData object
53,386
public function convertObjectParents ( array $ data = null ) { return array_filter ( array_map ( [ $ this , 'convertObjectParentData' ] , ( array ) ( $ data ?? [ ] ) ) , function ( $ item ) { return ! empty ( $ item ) ; } ) ; }
Convert given input data to a list of ObjectParentData objects
53,387
public function convertObjectParentData ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ parent = new ObjectParentData ( ) ; $ object = $ this -> convertObject ( $ data [ JSONConstants :: JSON_OBJECTPARENTS_OBJECT ] ?? null ) ; if ( $ object !== null ) { $ parent -> setObject ( $ object ) ; } $ parent -> setRelativePathSegment ( ( string ) ( $ data [ JSONConstants :: JSON_OBJECTPARENTS_RELATIVE_PATH_SEGMENT ] ?? '' ) ) ; $ parent -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getObjectParentsKeys ( ) ) ) ; return $ parent ; }
Convert given input data to a ObjectParentData object
53,388
public function convertQueryResultList ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ objectList = new ObjectList ( ) ; $ objects = [ ] ; foreach ( ( array ) ( $ data [ JSONConstants :: JSON_QUERYRESULTLIST_RESULTS ] ?? [ ] ) as $ objectData ) { $ object = $ this -> convertObject ( $ objectData ) ; if ( $ object !== null ) { $ objects [ ] = $ object ; } } $ objectList -> setObjects ( $ objects ) ; $ objectList -> setHasMoreItems ( ( boolean ) ( $ data [ JSONConstants :: JSON_QUERYRESULTLIST_HAS_MORE_ITEMS ] ?? false ) ) ; if ( isset ( $ data [ JSONConstants :: JSON_QUERYRESULTLIST_NUM_ITEMS ] ) ) { $ objectList -> setNumItems ( ( integer ) $ data [ JSONConstants :: JSON_QUERYRESULTLIST_NUM_ITEMS ] ) ; } $ objectList -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getQueryResultListKeys ( ) ) ) ; return $ objectList ; }
Convert given input data array from query result to a ObjectList object
53,389
public function convertDescendant ( array $ data = null ) { if ( empty ( $ data ) ) { return null ; } $ object = $ this -> convertObjectInFolder ( $ data [ JSONConstants :: JSON_OBJECTINFOLDERCONTAINER_OBJECT ] ?? null ) ; if ( $ object === null ) { throw new CmisRuntimeException ( 'Given data could not be converted to ObjectInFolder!' ) ; } $ objectInFolderContainer = new ObjectInFolderContainer ( $ object ) ; $ objectInFolderContainer -> setChildren ( array_filter ( array_map ( [ $ this , 'convertDescendant' ] , ( array ) ( $ data [ JSONConstants :: JSON_OBJECTINFOLDERCONTAINER_CHILDREN ] ?? [ ] ) ) , function ( $ item ) { return ! empty ( $ item ) ; } ) ) ; $ objectInFolderContainer -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getObjectInFolderContainerKeys ( ) ) ) ; return $ objectInFolderContainer ; }
Convert given input data array to a ObjectInFolderContainer object
53,390
public function convertFailedToDelete ( array $ data = null ) { $ result = new FailedToDeleteData ( ) ; if ( empty ( $ data ) ) { return $ result ; } $ result -> setIds ( array_map ( 'strval' , $ data [ JSONConstants :: JSON_FAILEDTODELETE_ID ] ?? [ ] ) ) ; $ result -> setExtensions ( $ this -> convertExtension ( $ data , JSONConstants :: getFailedToDeleteKeys ( ) ) ) ; return $ result ; }
Converts FailedToDelete ids .
53,391
public function get ( $ orderId , $ transactionId , array $ params = array ( ) ) { $ endpoint = '/admin/orders/' . $ orderId . '/transactions/' . $ transactionId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Transaction :: class , $ response [ 'transaction' ] ) ; }
Get a single Transaction
53,392
public function get ( $ themeId , array $ params = array ( ) ) { $ endpoint = '/admin/themes/' . $ themeId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Theme :: class , $ response [ 'theme' ] ) ; }
Receive a single theme
53,393
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/themes.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Theme :: class , $ response [ 'themes' ] ) ; }
Receive a list of all themes
53,394
public function create ( Theme & $ theme ) { $ data = $ theme -> exportData ( ) ; $ endpoint = '/admin/themes.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'theme' => $ data ) ) ; $ theme -> setData ( $ response [ 'theme' ] ) ; }
Create a new theme
53,395
public function update ( Theme & $ theme ) { $ data = $ theme -> exportData ( ) ; $ endpoint = '/admin/themes/' . $ theme -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'theme' => $ data ) ) ; $ theme -> setData ( $ response [ 'theme' ] ) ; }
Update a theme
53,396
public function getBindingType ( ) { $ bindingType = $ this -> session -> get ( SessionParameter :: BINDING_TYPE ) ; if ( ! is_string ( $ bindingType ) ) { return BindingType :: cast ( BindingType :: CUSTOM ) ; } try { return BindingType :: cast ( $ bindingType ) ; } catch ( InvalidEnumerationValueException $ exception ) { return BindingType :: cast ( BindingType :: CUSTOM ) ; } }
Returns the binding type .
53,397
private function search ( string $ parameter , string $ value ) : SeriesData { $ options = [ 'query' => [ $ parameter => $ value , ] , 'http_errors' => false ] ; $ json = $ this -> client -> performApiCallWithJsonResponse ( 'get' , '/search/series' , $ options ) ; return ResponseHandler :: create ( $ json , ResponseHandler :: METHOD_SEARCH_SERIES ) -> handle ( ) ; }
Search for a series based on parameter and value .
53,398
public function isImage ( ) { $ mime = $ this -> getMimeType ( ) ; foreach ( $ this -> image_mimes as $ image_mime ) { if ( in_array ( $ mime , ( array ) $ image_mime ) ) { return true ; } } return false ; }
Utility method for detecing whether a given file upload is an image .
53,399
protected function resizeCustom ( UploadedFile $ file , $ callable , $ enlarge = true ) { return call_user_func_array ( $ callable , [ $ file , $ this -> imagine , $ enlarge ] ) ; }
Resize an image using a user defined callback .