idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
53,100
public function all ( $ productId , array $ params = array ( ) ) { $ endpoint = '/admin/products/' . $ productId . '/variants.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( ProductVariant :: class , $ response [ 'variants' ] ) ; }
Receive a list of Product Variants
53,101
public function get ( $ productVariantId , array $ fields = array ( ) ) { $ params = array ( ) ; if ( ! empty ( $ fields ) ) { $ params [ 'fields' ] = $ fields ; } $ endpoint = '/admin/variants/' . $ productVariantId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( ProductVariant :: class , $ response [ 'variant' ] ) ; }
Receive a single product variant
53,102
public function create ( $ productId , ProductVariant & $ productVariant ) { $ data = $ productVariant -> exportData ( ) ; $ endpoint = '/admin/products/' . $ productId . '/variants.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'variant' => $ data ) ) ; $ productVariant -> setData ( $ response [ 'variant' ] ) ; }
Create a new product variant
53,103
public function update ( ProductVariant & $ productVariant ) { $ data = $ productVariant -> exportData ( ) ; $ endpoint = '/admin/variants/' . $ productVariant -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'variant' => $ data ) ) ; $ productVariant -> setData ( $ response [ 'variant' ] ) ; }
Modify an existing product variant
53,104
public function delete ( $ productId , ProductVariant & $ productVariant ) { $ endpoint = '/admin/products/' . $ productId . '/variants/' . $ productVariant -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'DELETE' ) ; }
Delete a product variant
53,105
public function getCheckedOutDocs ( $ repositoryId , $ folderId , $ filter = null , $ orderBy = null , $ includeAllowableActions = false , IncludeRelationships $ includeRelationships = null , $ renditionFilter = Constants :: RENDITION_NONE , $ maxItems = null , $ skipCount = 0 , ExtensionDataInterface $ extension = null ) { $ url = $ this -> getObjectUrl ( $ repositoryId , $ folderId , Constants :: SELECTOR_CHECKEDOUT ) ; $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_ALLOWABLE_ACTIONS => $ includeAllowableActions ? 'true' : 'false' , Constants :: PARAM_RENDITION_FILTER => $ renditionFilter , Constants :: PARAM_SKIP_COUNT => ( string ) $ skipCount , Constants :: PARAM_SUCCINCT => $ this -> getSuccinct ( ) ? 'true' : 'false' , Constants :: PARAM_DATETIME_FORMAT => ( string ) $ this -> getDateTimeFormat ( ) ] ) ; if ( ! empty ( $ filter ) ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_FILTER => ( string ) $ filter ] ) ; } if ( ! empty ( $ orderBy ) ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_ORDER_BY => $ orderBy ] ) ; } if ( $ maxItems > 0 ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_MAX_ITEMS => ( string ) $ maxItems ] ) ; } if ( $ includeRelationships !== null ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_RELATIONSHIPS => ( string ) $ includeRelationships ] ) ; } $ responseData = ( array ) $ this -> readJson ( $ url ) ; return $ this -> getJsonConverter ( ) -> convertObjectList ( $ responseData ) ; }
Gets the list of documents that are checked out that the user has access to .
53,106
public function getFolderParent ( $ repositoryId , $ folderId , $ filter = null , ExtensionDataInterface $ extension = null ) { $ url = $ this -> getObjectUrl ( $ repositoryId , $ folderId , Constants :: SELECTOR_PARENT ) ; $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_SUCCINCT => $ this -> getSuccinct ( ) ? 'true' : 'false' , Constants :: PARAM_DATETIME_FORMAT => ( string ) $ this -> getDateTimeFormat ( ) ] ) ; if ( ! empty ( $ filter ) ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_FILTER => ( string ) $ filter ] ) ; } $ responseData = ( array ) $ this -> readJson ( $ url ) ; return $ this -> getJsonConverter ( ) -> convertObject ( $ responseData ) ; }
Gets the parent folder object for the specified folder object .
53,107
public function getFolderTree ( $ repositoryId , $ folderId , $ depth , $ filter = null , $ includeAllowableActions = false , IncludeRelationships $ includeRelationships = null , $ renditionFilter = Constants :: RENDITION_NONE , $ includePathSegment = false , ExtensionDataInterface $ extension = null ) { $ url = $ this -> getObjectUrl ( $ repositoryId , $ folderId , Constants :: SELECTOR_FOLDER_TREE ) ; $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_DEPTH => ( string ) $ depth , Constants :: PARAM_ALLOWABLE_ACTIONS => $ includeAllowableActions ? 'true' : 'false' , Constants :: PARAM_RENDITION_FILTER => $ renditionFilter , Constants :: PARAM_PATH_SEGMENT => $ includePathSegment ? 'true' : 'false' , Constants :: PARAM_SUCCINCT => $ this -> getSuccinct ( ) ? 'true' : 'false' , Constants :: PARAM_DATETIME_FORMAT => ( string ) $ this -> getDateTimeFormat ( ) ] ) ; if ( ! empty ( $ filter ) ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_FILTER => ( string ) $ filter ] ) ; } if ( $ includeRelationships !== null ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_RELATIONSHIPS => ( string ) $ includeRelationships ] ) ; } $ responseData = ( array ) $ this -> readJson ( $ url ) ; return $ this -> getJsonConverter ( ) -> convertDescendants ( $ responseData ) ; }
Gets the set of descendant folder objects contained in the specified folder .
53,108
public static function convertToSimpleType ( $ object ) { if ( ! $ object instanceof TypeMutabilityInterface ) { throw new CmisInvalidArgumentException ( 'Given object must be of type TypeMutabilityInterface' ) ; } $ result = [ ] ; $ result [ JSONConstants :: JSON_TYPE_TYPE_MUTABILITY_CREATE ] = $ object -> canCreate ( ) ; $ result [ JSONConstants :: JSON_TYPE_TYPE_MUTABILITY_UPDATE ] = $ object -> canUpdate ( ) ; $ result [ JSONConstants :: JSON_TYPE_TYPE_MUTABILITY_DELETE ] = $ object -> canDelete ( ) ; return $ result ; }
Convert given object to a scalar representation or an array of scalar values .
53,109
public function getMatchingEntries ( ) { $ limits = $ this -> getRange ( ) ; $ current = $ limits [ 'begin' ] ; $ entries [ ] = $ this -> long2ip ( $ current ) ; $ entries = array ( ) ; while ( $ current != $ limits [ 'end' ] ) { $ current = $ this -> IpLongAdd ( $ current , 1 ) ; $ entries [ ] = $ this -> long2ip ( $ current ) ; } return $ entries ; }
Calcul et retourne toutes les valeurs possible du range
53,110
public function all ( $ countryId , array $ params = array ( ) ) { $ endpoint = '/admin/countries/' . $ countryId . '/provinces.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Province :: class , $ response [ 'provinces' ] ) ; }
Receive a list of all Provinces
53,111
public function get ( $ countryId , $ provinceId ) { $ endpoint = '/admin/countries/' . $ countryId . '/provinces/' . $ provinceId . '.json' ; $ response = $ this -> request ( $ endpoint ) ; return $ this -> createObject ( Province :: class , $ response [ 'province' ] ) ; }
Receive a single province
53,112
public function update ( $ countryId , Province & $ province ) { $ data = $ province -> exportData ( ) ; $ endpoint = '/admin/countries/' . $ countryId . '/provinces/' . $ province -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'province' => $ data ) ) ; $ province -> setData ( $ response [ 'province' ] ) ; }
Modify an existing province
53,113
public function setObjects ( array $ objects ) { foreach ( $ objects as $ object ) { $ this -> checkType ( ObjectDataInterface :: class , $ object ) ; } $ this -> objects = $ objects ; }
Sets given list of objects
53,114
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/recurring_application_charges.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( RecurringApplicationCharge :: class , $ response [ 'recurring_application_charges' ] ) ; }
Retrieve all Recurring Application Charges
53,115
public function get ( $ recurringApplicationChargeId , array $ params = array ( ) ) { $ endpoint = '/admin/recurring_application_charges/' . $ recurringApplicationChargeId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( RecurringApplicationCharge :: class , $ response [ 'recurring_application_charge' ] ) ; }
Receive a single recurring application charge
53,116
public function create ( RecurringApplicationCharge & $ recurringApplicationCharge ) { $ data = $ recurringApplicationCharge -> exportData ( ) ; $ endpoint = '/admin/recurring_application_charges.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'recurring_application_charge' => $ data ) ) ; $ recurringApplicationCharge -> setData ( $ response [ 'recurring_application_charge' ] ) ; }
Create a new recurring application charge
53,117
public function delete ( RecurringApplicationCharge $ recurringApplicationCharge ) { $ endpoint = '/admin/recurring_application_charges/' . $ recurringApplicationCharge -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'DELETE' ) ; }
Remove an existing recurring application charge
53,118
public function activate ( RecurringApplicationCharge $ recurringApplicationCharge ) { $ endpoint = '/admin/recurring_application_charges/' . $ recurringApplicationCharge -> id . '/activate.json' ; $ response = $ this -> request ( $ endpoint , 'POST' ) ; $ recurringApplicationCharge -> setData ( $ response [ 'recurring_application_charge' ] ) ; }
Activate a recurring application charge
53,119
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/blogs.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Blog :: class , $ response [ 'blogs' ] ) ; }
Receive a list of all blogs
53,120
public function get ( $ blogId , array $ fields = array ( ) ) { $ params = array ( ) ; if ( ! empty ( $ fields ) ) { $ params [ 'fields' ] = implode ( ',' , $ fields ) ; } $ endpoint = '/admin/blogs/' . $ blogId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Blog :: class , $ response [ 'blog' ] ) ; }
Receive a single blog
53,121
public function getEntryList ( array $ list , $ trusted ) { $ flatten = array ( ) ; $ this -> flattenArray ( $ list , $ flatten ) ; $ entries = array ( ) ; foreach ( $ flatten as $ elm ) { $ entry = $ this -> getEntry ( $ elm ) ; if ( $ entry ) { $ entries [ ] = $ entry ; } } return new EntryList ( $ entries , $ trusted ) ; }
Get an entry list
53,122
protected function flattenArray ( array $ source , array & $ dest ) { foreach ( $ source as $ elm ) { if ( is_array ( $ elm ) ) { $ this -> flattenArray ( $ elm , $ dest ) ; } else { $ dest [ ] = $ elm ; } } }
Flatten the array
53,123
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/reports.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Report :: class , $ response [ 'reports' ] ) ; }
Retrieve a list of all Reports
53,124
public function get ( $ reportId , array $ params = array ( ) ) { $ endpoint = '/admin/reports/' . $ reportId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Report :: class , $ response [ 'report' ] ) ; }
Receive a single report
53,125
public function create ( Report & $ report ) { $ data = $ report -> exportData ( ) ; $ endpoint = '/admin/reports.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'report' => $ data ) ) ; $ report -> setData ( $ response [ 'report' ] ) ; }
Create a new Report
53,126
public function update ( Report & $ report ) { $ data = $ report -> exportData ( ) ; $ endpoint = '/admin/reports/' . $ report -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'report' => $ data ) ) ; $ report -> setData ( $ response [ 'report' ] ) ; }
Modify an existing Report
53,127
public function getContentChanges ( $ repositoryId , & $ changeLogToken = null , $ includeProperties = false , $ includePolicyIds = false , $ includeAcl = false , $ maxItems = null , ExtensionDataInterface $ extension = null ) { $ url = $ this -> getRepositoryUrl ( $ repositoryId , Constants :: SELECTOR_CONTENT_CHANGES ) ; $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_PROPERTIES => $ includeProperties ? 'true' : 'false' , Constants :: PARAM_POLICY_IDS => $ includePolicyIds ? 'true' : 'false' , Constants :: PARAM_ACL => $ includeAcl ? 'true' : 'false' , Constants :: PARAM_SUCCINCT => $ this -> getSuccinct ( ) ? 'true' : 'false' , ] ) ; if ( $ changeLogToken !== null ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_CHANGE_LOG_TOKEN => ( string ) $ changeLogToken ] ) ; } if ( $ maxItems > 0 ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_MAX_ITEMS => ( string ) $ maxItems ] ) ; } $ responseData = ( array ) $ this -> readJson ( $ url ) ; $ changeLogToken = $ responseData [ JSONConstants :: JSON_OBJECTLIST_CHANGE_LOG_TOKEN ] ?? null ; return $ this -> getJsonConverter ( ) -> convertObjectList ( $ responseData ) ; }
Gets a list of content changes .
53,128
public function query ( $ repositoryId , $ statement , $ searchAllVersions = false , IncludeRelationships $ includeRelationships = null , $ renditionFilter = Constants :: RENDITION_NONE , $ includeAllowableActions = false , $ maxItems = null , $ skipCount = 0 , ExtensionDataInterface $ extension = null ) { $ url = $ this -> getRepositoryUrl ( $ repositoryId ) ; $ url -> getQuery ( ) -> modify ( [ Constants :: CONTROL_CMISACTION => Constants :: CMISACTION_QUERY , Constants :: PARAM_STATEMENT => ( string ) $ statement , Constants :: PARAM_SEARCH_ALL_VERSIONS => $ searchAllVersions ? 'true' : 'false' , Constants :: PARAM_ALLOWABLE_ACTIONS => $ includeAllowableActions ? 'true' : 'false' , Constants :: PARAM_RENDITION_FILTER => $ renditionFilter , Constants :: PARAM_SKIP_COUNT => ( string ) $ skipCount , Constants :: PARAM_DATETIME_FORMAT => ( string ) $ this -> getDateTimeFormat ( ) ] ) ; if ( $ includeRelationships !== null ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_RELATIONSHIPS => ( string ) $ includeRelationships ] ) ; } if ( $ maxItems > 0 ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_MAX_ITEMS => ( string ) $ maxItems ] ) ; } return $ this -> getJsonConverter ( ) -> convertQueryResultList ( ( array ) $ this -> postJson ( $ url ) ) ; }
Executes a CMIS query statement against the contents of the repository .
53,129
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/countries.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Country :: class , $ response [ 'countries' ] ) ; }
Receive a list of countries
53,130
public function get ( $ countryId , array $ fields = array ( ) ) { $ params = array ( ) ; if ( ! empty ( $ fields ) ) { $ params [ 'fields' ] = implode ( ',' , $ fields ) ; } $ endpoint = '/admin/countrys/' . $ countryId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Country :: class , $ response [ 'country' ] ) ; }
Receive a single country
53,131
public function create ( Country & $ country ) { $ data = $ country -> exportData ( ) ; $ endpoint = '/admin/countries.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'country' => $ data ) ) ; $ country -> setData ( $ response [ 'country' ] ) ; }
Create a country
53,132
public function update ( Country & $ country ) { $ data = $ country -> exportData ( ) ; $ endpoint = '/admin/countries/' . $ country -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'country' => $ data ) ) ; $ country -> setData ( $ response [ 'country' ] ) ; }
Update a country
53,133
protected function getObjectUrl ( $ repositoryId , $ objectId , $ selector = null ) { $ result = $ this -> getRepositoryUrlCache ( ) -> getObjectUrl ( $ repositoryId , $ objectId , $ selector ) ; if ( $ result === null ) { $ this -> getRepositoriesInternal ( $ repositoryId ) ; $ result = $ this -> getRepositoryUrlCache ( ) -> getObjectUrl ( $ repositoryId , $ objectId , $ selector ) ; } if ( $ result === null ) { throw new CmisObjectNotFoundException ( sprintf ( 'Unknown Object! Repository: "%s" | Object: "%s" | Selector: "%s"' , $ repositoryId , $ objectId , $ selector ) ) ; } return $ result ; }
Get the url for an object
53,134
protected function getRepositoryUrlCache ( ) { $ repositoryUrlCache = $ this -> getSession ( ) -> get ( SessionParameter :: REPOSITORY_URL_CACHE ) ; if ( $ repositoryUrlCache === null ) { $ repositoryUrlCache = new RepositoryUrlCache ( ) ; $ this -> getSession ( ) -> put ( SessionParameter :: REPOSITORY_URL_CACHE , $ repositoryUrlCache ) ; } return $ repositoryUrlCache ; }
Returns the repository URL cache or creates a new cache if it doesn t exist .
53,135
protected function setSession ( BindingSessionInterface $ session ) { $ this -> session = $ session ; $ succinct = $ session -> get ( SessionParameter :: BROWSER_SUCCINCT ) ; $ this -> succinct = $ succinct ?? true ; $ this -> dateTimeFormat = DateTimeFormat :: cast ( $ session -> get ( SessionParameter :: BROWSER_DATETIME_FORMAT ) ) ; }
Sets the current session .
53,136
protected function getRepositoriesInternal ( $ repositoryId = null ) { $ repositoryUrlCache = $ this -> getRepositoryUrlCache ( ) ; if ( $ repositoryId === null ) { $ url = $ repositoryUrlCache -> buildUrl ( $ this -> getServiceUrl ( ) ) ; } else { $ url = $ repositoryUrlCache -> getRepositoryUrl ( $ repositoryId , Constants :: SELECTOR_REPOSITORY_INFO ) ?? $ repositoryUrlCache -> buildUrl ( $ this -> getServiceUrl ( ) ) ; } $ repositoryInfos = [ ] ; $ result = $ this -> readJson ( $ url ) ; if ( ! is_array ( $ result ) ) { throw new CmisConnectionException ( 'Could not fetch repository info! Response is not a valid JSON.' , 1416343166 ) ; } foreach ( $ result as $ item ) { if ( is_array ( $ item ) ) { $ repositoryInfo = $ this -> getJsonConverter ( ) -> convertRepositoryInfo ( $ item ) ; if ( $ repositoryInfo instanceof RepositoryInfoBrowserBinding ) { $ id = $ repositoryInfo -> getId ( ) ; $ repositoryUrl = $ repositoryInfo -> getRepositoryUrl ( ) ; $ rootUrl = $ repositoryInfo -> getRootUrl ( ) ; if ( empty ( $ id ) || empty ( $ repositoryUrl ) || empty ( $ rootUrl ) ) { throw new CmisConnectionException ( sprintf ( 'Found invalid Repository Info! (id: %s)' , $ id ) , 1415187765 ) ; } $ this -> getRepositoryUrlCache ( ) -> addRepository ( $ id , $ repositoryUrl , $ rootUrl ) ; $ repositoryInfos [ ] = $ repositoryInfo ; } } else { throw new CmisConnectionException ( sprintf ( 'Found invalid repository info! Value of type "array" was expected' . 'but value of type "%s" was given.' , gettype ( $ item ) ) , 1415187764 ) ; } } return $ repositoryInfos ; }
Retrieves the the repository info objects .
53,137
protected function read ( Url $ url ) { try { $ response = $ this -> getHttpInvoker ( ) -> get ( ( string ) $ url ) ; } catch ( RequestException $ exception ) { $ code = 0 ; $ message = null ; if ( $ exception -> getResponse ( ) ) { $ code = $ exception -> getResponse ( ) -> getStatusCode ( ) ; $ message = $ exception -> getResponse ( ) -> getBody ( ) ; } throw $ this -> convertStatusCode ( $ code , ( string ) $ message , $ exception ) ; } return $ response ; }
Do a get request for the given url
53,138
protected function convertStatusCode ( $ code , $ message , \ Exception $ exception = null ) { $ messageData = json_decode ( $ message , true ) ; if ( is_array ( $ messageData ) && ! empty ( $ messageData [ JSONConstants :: ERROR_EXCEPTION ] ) ) { $ jsonError = $ messageData [ JSONConstants :: ERROR_EXCEPTION ] ; if ( ! empty ( $ messageData [ JSONConstants :: ERROR_MESSAGE ] ) && is_string ( $ messageData [ JSONConstants :: ERROR_MESSAGE ] ) ) { $ message = $ messageData [ JSONConstants :: ERROR_MESSAGE ] ; } $ exceptionName = '\\Dkd\\PhpCmis\\Exception\\Cmis' . ucfirst ( $ jsonError ) . 'Exception' ; if ( class_exists ( $ exceptionName ) ) { return new $ exceptionName ( $ message , null , $ exception ) ; } } if ( empty ( $ message ) && $ exception !== null ) { $ message = $ exception -> getMessage ( ) ; } switch ( $ code ) { case 301 : case 302 : case 303 : case 307 : return new CmisConnectionException ( 'Redirects are not supported (HTTP status code ' . $ code . '): ' . $ message , null , $ exception ) ; case 400 : return new CmisInvalidArgumentException ( $ message , null , $ exception ) ; case 401 : return new CmisUnauthorizedException ( $ message , null , $ exception ) ; case 403 : return new CmisPermissionDeniedException ( $ message , null , $ exception ) ; case 404 : return new CmisObjectNotFoundException ( $ message , null , $ exception ) ; case 405 : return new CmisNotSupportedException ( $ message , null , $ exception ) ; case 407 : return new CmisProxyAuthenticationException ( $ message , null , $ exception ) ; case 409 : return new CmisConstraintException ( $ message , null , $ exception ) ; default : return new CmisRuntimeException ( $ message , null , $ exception ) ; } }
Converts an error message or a HTTP status code into an Exception .
53,139
protected function getPathUrl ( $ repositoryId , $ path , $ selector = null ) { $ result = $ this -> getRepositoryUrlCache ( ) -> getPathUrl ( $ repositoryId , $ path , $ selector ) ; if ( $ result === null ) { $ this -> getRepositoriesInternal ( $ repositoryId ) ; $ result = $ this -> getRepositoryUrlCache ( ) -> getPathUrl ( $ repositoryId , $ path , $ selector ) ; } if ( $ result === null ) { throw new CmisObjectNotFoundException ( sprintf ( 'Unknown path! Repository: "%s" | Path: "%s" | Selector: "%s"' , $ repositoryId , $ path , $ selector ) ) ; } return $ result ; }
Generate url for a given path of a given repository .
53,140
protected function post ( Url $ url , $ content = [ ] , array $ headers = [ ] ) { if ( is_resource ( $ content ) || is_object ( $ content ) ) { $ headers [ 'body' ] = $ content ; } elseif ( is_array ( $ content ) ) { $ headers [ 'multipart' ] = $ this -> convertQueryArrayToMultiPart ( $ content ) ; } try { return $ this -> getHttpInvoker ( ) -> post ( ( string ) $ url , $ headers ) ; } catch ( RequestException $ exception ) { throw $ this -> convertStatusCode ( $ exception -> getResponse ( ) -> getStatusCode ( ) , ( string ) $ exception -> getResponse ( ) -> getBody ( ) , $ exception ) ; } }
Performs a POST on an URL checks the response code and returns the result .
53,141
protected function getTypeDefinitionInternal ( $ repositoryId , $ typeId ) { if ( empty ( $ repositoryId ) ) { throw new CmisInvalidArgumentException ( 'Repository id must not be empty!' ) ; } if ( empty ( $ typeId ) ) { throw new CmisInvalidArgumentException ( 'Type id must not be empty!' ) ; } $ url = $ this -> getRepositoryUrl ( $ repositoryId , Constants :: SELECTOR_TYPE_DEFINITION ) ; $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_TYPE_ID => $ typeId ] ) ; return $ this -> getJsonConverter ( ) -> convertTypeDefinition ( ( array ) $ this -> readJson ( $ url ) ) ; }
Retrieves a type definition .
53,142
protected function getRepositoryUrl ( $ repositoryId , $ selector = null ) { $ result = $ this -> getRepositoryUrlCache ( ) -> getRepositoryUrl ( $ repositoryId , $ selector ) ; if ( $ result === null ) { $ this -> getRepositoriesInternal ( $ repositoryId ) ; $ result = $ this -> getRepositoryUrlCache ( ) -> getRepositoryUrl ( $ repositoryId , $ selector ) ; } if ( $ result === null ) { throw new CmisObjectNotFoundException ( sprintf ( 'Unknown repository! Repository: "%s" | Selector: "%s"' , $ repositoryId , $ selector ) ) ; } return $ result ; }
Get url for a repository
53,143
protected function convertPropertiesToQueryArray ( PropertiesInterface $ properties ) { $ propertiesArray = [ ] ; $ propertyCounter = 0 ; $ propertiesArray [ Constants :: CONTROL_PROP_ID ] = [ ] ; $ propertiesArray [ Constants :: CONTROL_PROP_VALUE ] = [ ] ; foreach ( $ properties -> getProperties ( ) as $ property ) { $ propertiesArray [ Constants :: CONTROL_PROP_ID ] [ $ propertyCounter ] = $ property -> getId ( ) ; $ propertyValues = $ property -> getValues ( ) ; if ( count ( $ propertyValues ) === 1 ) { $ propertiesArray [ Constants :: CONTROL_PROP_VALUE ] [ $ propertyCounter ] = $ this -> convertPropertyValueToSimpleType ( $ property -> getFirstValue ( ) ) ; } elseif ( count ( $ propertyValues ) > 1 ) { $ propertyValueCounter = 0 ; $ propertiesArray [ Constants :: CONTROL_PROP_VALUE ] [ $ propertyCounter ] = [ ] ; foreach ( $ propertyValues as $ propertyValue ) { $ propertiesArray [ Constants :: CONTROL_PROP_VALUE ] [ $ propertyCounter ] [ $ propertyValueCounter ] = $ this -> convertPropertyValueToSimpleType ( $ propertyValue ) ; $ propertyValueCounter ++ ; } } $ propertyCounter ++ ; } return $ propertiesArray ; }
Converts a Properties list into an array that can be used for the CMIS request .
53,144
protected function convertPropertyValueToSimpleType ( $ value ) { if ( $ value instanceof \ DateTime ) { $ value = $ value -> getTimestamp ( ) * 1000 ; } elseif ( is_bool ( $ value ) ) { $ value = $ value ? 'true' : 'false' ; } return $ value ; }
Converts values to a format that can be used for the CMIS Browser binding request .
53,145
protected function convertAclToQueryArray ( AclInterface $ acl , $ principalControl , $ permissionControl ) { $ acesArray = [ ] ; $ principalCounter = 0 ; foreach ( $ acl -> getAces ( ) as $ ace ) { $ permissions = $ ace -> getPermissions ( ) ; if ( $ ace -> getPrincipal ( ) !== null && $ ace -> getPrincipal ( ) -> getId ( ) && ! empty ( $ permissions ) ) { $ acesArray [ $ principalControl ] [ $ principalCounter ] = $ ace -> getPrincipal ( ) -> getId ( ) ; $ permissionCounter = 0 ; $ acesArray [ $ permissionControl ] [ $ principalCounter ] = [ ] ; foreach ( $ permissions as $ permission ) { $ acesArray [ $ permissionControl ] [ $ principalCounter ] [ $ permissionCounter ] = $ permission ; $ permissionCounter ++ ; } $ principalCounter ++ ; } } return $ acesArray ; }
Converts a Access Control list into an array that can be used for the CMIS request
53,146
protected function convertPolicyIdArrayToQueryArray ( array $ policies ) { $ policiesArray = [ ] ; $ policyCounter = 0 ; foreach ( $ policies as $ policy ) { $ policiesArray [ Constants :: CONTROL_POLICY ] [ $ policyCounter ] = ( string ) $ policy ; $ policyCounter ++ ; } return $ policiesArray ; }
Converts a policies array into an array that can be used for the CMIS request
53,147
protected function appendPoliciesToUrl ( Url $ url , array $ policies ) { if ( ! empty ( $ policies ) ) { $ url -> getQuery ( ) -> modify ( $ this -> convertPolicyIdArrayToQueryArray ( $ policies ) ) ; } }
Appends policies parameters to url
53,148
protected function appendAddAcesToUrl ( Url $ url , AclInterface $ addAces = null ) { if ( $ addAces !== null ) { $ url -> getQuery ( ) -> modify ( $ this -> convertAclToQueryArray ( $ addAces , Constants :: CONTROL_ADD_ACE_PRINCIPAL , Constants :: CONTROL_ADD_ACE_PERMISSION ) ) ; } }
Appends addAces parameters to url
53,149
protected function appendRemoveAcesToUrl ( Url $ url , AclInterface $ removeAces = null ) { if ( $ removeAces !== null ) { $ url -> getQuery ( ) -> modify ( $ this -> convertAclToQueryArray ( $ removeAces , Constants :: CONTROL_REMOVE_ACE_PRINCIPAL , Constants :: CONTROL_REMOVE_ACE_PERMISSION ) ) ; } }
Appends removeAces parameters to url
53,150
public function loadContentLink ( $ repositoryId , $ documentId ) { $ result = $ this -> getRepositoryUrlCache ( ) -> getObjectUrl ( $ repositoryId , $ documentId , Constants :: SELECTOR_CONTENT ) ; return $ result === null ? null : ( string ) $ result ; }
Gets the content link from the cache if it is there or loads it into the cache if it is not there .
53,151
public function loadRenditionContentLink ( $ repositoryId , $ documentId , $ streamId ) { $ result = $ this -> getRepositoryUrlCache ( ) -> getObjectUrl ( $ repositoryId , $ documentId , Constants :: SELECTOR_CONTENT ) ; if ( $ result !== null ) { $ result -> getQuery ( ) -> modify ( [ Constants :: PARAM_STREAM_ID => $ streamId ] ) ; $ result = ( string ) $ result ; } return $ result ; }
Gets a rendition content link from the cache if it is there or loads it into the cache if it is not there .
53,152
public function setExtensions ( array $ extensions ) { foreach ( $ extensions as $ extension ) { $ this -> checkType ( CmisExtensionElementInterface :: class , $ extension ) ; } $ this -> extensions = $ extensions ; }
Sets the list of top - level extension elements .
53,153
public function create ( $ recurringApplicationChargeId , UsageCharge $ usageCharge ) { $ data = $ usageCharge -> exportData ( ) ; $ endpoint = '/admin/recurring_application_charges/' . $ recurringApplicationChargeId . '/usage_charges.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'usage_charge' => $ data ) ) ; $ usageCharge -> setData ( $ response [ 'usage_charge' ] ) ; }
Create a usage charges
53,154
public function get ( $ recurringApplicationChargeId , $ usageChargeId , array $ params = array ( ) ) { $ endpoint = '/admin/recurring_application_charges/' . $ recurringApplicationChargeId . '/usage_charges/' . $ usageChargeId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( UsageCharge :: class , $ response [ 'usage_charge' ] ) ; }
Receive a single usage charge
53,155
public function all ( $ recurringApplicationChargeId , array $ params = array ( ) ) { $ endpoint = '/admin/recurring_application_charges/' . $ recurringApplicationChargeId . '/usage_charges.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( UsageCharge :: class , $ response [ 'usage_charges' ] ) ; }
Retrieve all usage charges
53,156
public function setObjects ( array $ objects ) { foreach ( $ objects as $ object ) { $ this -> checkType ( ObjectInFolderDataInterface :: class , $ object ) ; } $ this -> objects = $ objects ; }
checks input array for ObjectInFolderDataInterface and sets objects
53,157
public function addList ( array $ list , $ listName , $ state ) { if ( ! is_bool ( $ state ) ) { throw new \ InvalidArgumentException ( "Wrong parameter 'state' is not boolean" ) ; } $ entryList = $ this -> entryFactory -> getEntryList ( $ list , $ state ) ; $ this -> listMerger -> addList ( $ entryList , $ listName ) ; return $ this ; }
Add a list
53,158
public function getSpi ( BindingSessionInterface $ session ) { $ spi = $ session -> get ( self :: SPI_OBJECT ) ; if ( $ spi !== null ) { return $ spi ; } $ spiClass = $ session -> get ( SessionParameter :: BINDING_CLASS ) ; if ( empty ( $ spiClass ) || ! class_exists ( $ spiClass ) ) { throw new CmisRuntimeException ( sprintf ( 'The given binding class "%s" is not valid!' , $ spiClass ) ) ; } if ( ! is_a ( $ spiClass , CmisInterface :: class , true ) ) { throw new CmisRuntimeException ( sprintf ( 'The given binding class "%s" does not implement required CmisInterface!' , $ spiClass ) ) ; } try { $ spi = new $ spiClass ( $ session ) ; } catch ( \ Exception $ exception ) { throw new CmisRuntimeException ( sprintf ( 'Could not create object of type "%s"!' , $ spiClass ) , null , $ exception ) ; } $ session -> put ( self :: SPI_OBJECT , $ spi ) ; return $ spi ; }
Gets the SPI object for the given session . If there is already a SPI object in the session it will be returned . If there is no SPI object it will be created and put into the session .
53,159
public function getTypeDefinitionCache ( BindingSessionInterface $ session ) { $ cache = $ session -> get ( self :: TYPE_DEFINITION_CACHE ) ; if ( $ cache !== null ) { return $ cache ; } $ className = $ session -> get ( SessionParameter :: TYPE_DEFINITION_CACHE_CLASS ) ; try { $ cache = new $ className ( ) ; } catch ( \ Exception $ exception ) { throw new CmisRuntimeException ( sprintf ( 'Could not create object of type "%s"!' , $ className ) , null , $ exception ) ; } $ session -> put ( self :: TYPE_DEFINITION_CACHE , $ cache ) ; return $ cache ; }
Returns the type definition cache from the session .
53,160
public function addRepository ( $ repositoryId , $ repositoryUrl , $ rootUrl ) { if ( empty ( $ repositoryId ) || empty ( $ repositoryUrl ) || empty ( $ rootUrl ) ) { throw new CmisInvalidArgumentException ( 'Repository Id or Repository URL or Root URL is not set!' , 1408536098 ) ; } $ this -> repositoryUrls [ $ repositoryId ] = $ repositoryUrl ; $ this -> rootUrls [ $ repositoryId ] = $ rootUrl ; }
Adds the URLs of a repository to the cache .
53,161
public function getRepositoryUrl ( $ repositoryId , $ selector = null ) { $ baseUrl = $ this -> getRepositoryBaseUrl ( $ repositoryId ) ; if ( $ baseUrl === null ) { return null ; } $ repositoryUrl = $ this -> buildUrl ( $ baseUrl ) ; if ( $ selector !== null && $ selector !== '' ) { $ repositoryUrl -> getQuery ( ) -> modify ( [ Constants :: PARAM_SELECTOR => $ selector ] ) ; } return $ repositoryUrl ; }
Returns the repository URL of a repository .
53,162
public function getObjectUrl ( $ repositoryId , $ objectId , $ selector = null ) { if ( $ this -> getRootUrl ( $ repositoryId ) === null ) { return null ; } $ url = $ this -> buildUrl ( $ this -> getRootUrl ( $ repositoryId ) ) ; $ urlQuery = $ url -> getQuery ( ) ; $ urlQuery -> modify ( [ Constants :: PARAM_OBJECT_ID => ( string ) $ objectId ] ) ; if ( ! empty ( $ selector ) ) { $ urlQuery -> modify ( [ Constants :: PARAM_SELECTOR => ( string ) $ selector ] ) ; } return $ url ; }
Get URL for an object request
53,163
public function getPathUrl ( $ repositoryId , $ path , $ selector = null ) { if ( $ this -> getRootUrl ( $ repositoryId ) === null ) { return null ; } $ url = $ this -> buildUrl ( $ this -> getRootUrl ( $ repositoryId ) ) ; $ url -> getPath ( ) -> append ( $ path ) ; if ( ! empty ( $ selector ) ) { $ url -> getQuery ( ) -> modify ( [ Constants :: PARAM_SELECTOR => $ selector ] ) ; } return $ url ; }
Get Repository URL with given path
53,164
public function getSource ( OperationContextInterface $ context = null ) { $ sourceId = $ this -> getSourceId ( ) ; if ( $ sourceId === null ) { return null ; } $ context = $ this -> ensureContext ( $ context ) ; return $ this -> getSession ( ) -> getObject ( $ sourceId , $ context ) ; }
Gets the source object using the given OperationContext .
53,165
public function getTarget ( OperationContextInterface $ context = null ) { $ context = $ this -> ensureContext ( $ context ) ; $ targetId = $ this -> getTargetId ( ) ; if ( $ targetId === null ) { return null ; } return $ this -> getSession ( ) -> getObject ( $ targetId , $ context ) ; }
Gets the target object using the given OperationContext .
53,166
public function all ( $ priceRuleId , array $ params = array ( ) ) { $ endpoint = '/admin/price_rules/' . $ priceRuleId . '/discount_codes.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( DiscountCode :: class , $ response [ 'discount_codes' ] ) ; }
Receive a list of all discounts
53,167
public function get ( $ priceRuleId , $ discountCodeId ) { $ endpoint = '/admin/price_rules/' . $ priceRuleId . '/discount_codes/' . $ discountCodeId . '.json' ; $ response = $ this -> request ( $ endpoint ) ; return $ this -> createObject ( DiscountCode :: class , $ response [ 'discount_code' ] ) ; }
Receive a single discount
53,168
public function create ( $ priceRuleId , DiscountCode & $ discountCode ) { $ data = $ discountCode -> exportData ( ) ; $ endpoint = '/admin/price_rules/' . $ priceRuleId . '/discount_codes.json' ; $ response = $ this -> request ( $ endpoint , 'POST' , array ( 'discount_code' => $ data ) ) ; $ discountCode -> setData ( $ response [ 'discount_code' ] ) ; }
Create a new discount
53,169
public function delete ( $ priceRuleId , DiscountCode $ discountCode ) { $ endpoint = '/admin/price_rules/' . $ priceRuleId . '/discount_codes/' . $ discountCode -> id . '.json' ; $ this -> request ( $ endpoint , 'DELETE' ) ; return ; }
Delete a discount
53,170
public function update ( $ priceRuleId , DiscountCode & $ discountCode ) { $ data = $ discountCode -> exportData ( ) ; $ endpoint = '/admin/price_rules/' . $ priceRuleId . '/discount_codes/' . $ discountCode -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'PUT' , array ( 'discount_code' => $ data ) ) ; $ discountCode -> setData ( $ response [ 'discount_code' ] ) ; }
Update a Discount Code
53,171
function drop ( ) { $ id = $ this -> _makeId ( func_get_args ( ) ) ; return $ this -> remove ( $ id , $ this -> _defaultGroup ) ; }
Drop a cache file
53,172
function _makeId ( $ arguments ) { $ id = serialize ( $ arguments ) ; if ( ! $ this -> _fileNameProtection ) { $ id = md5 ( $ id ) ; } return $ id ; }
Make an id for the cache
53,173
function setOption ( $ name , $ value ) { $ availableOptions = array ( 'errorHandlingAPIBreak' , 'hashedDirectoryUmask' , 'hashedDirectoryLevel' , 'automaticCleaningFactor' , 'automaticSerialization' , 'fileNameProtection' , 'memoryCaching' , 'onlyMemoryCaching' , 'memoryCachingLimit' , 'cacheDir' , 'caching' , 'lifeTime' , 'fileLocking' , 'writeControl' , 'readControl' , 'readControlType' , 'pearErrorMode' , 'hashedDirectoryGroup' , 'cacheFileMode' , 'cacheFileGroup' ) ; if ( in_array ( $ name , $ availableOptions ) ) { $ property = '_' . $ name ; $ this -> $ property = $ value ; } }
Generic way to set a Cache_Lite option
53,174
function save ( $ data , $ id = NULL , $ group = 'default' ) { if ( $ this -> _caching ) { if ( $ this -> _automaticSerialization ) { $ data = serialize ( $ data ) ; } if ( isset ( $ id ) ) { $ this -> _setFileName ( $ id , $ group ) ; } if ( $ this -> _memoryCaching ) { $ this -> _memoryCacheAdd ( $ data ) ; if ( $ this -> _onlyMemoryCaching ) { return true ; } } if ( $ this -> _automaticCleaningFactor > 0 && ( $ this -> _automaticCleaningFactor == 1 || mt_rand ( 1 , $ this -> _automaticCleaningFactor ) == 1 ) ) { $ this -> clean ( false , 'old' ) ; } if ( $ this -> _writeControl ) { $ res = $ this -> _writeAndControl ( $ data ) ; if ( is_bool ( $ res ) ) { if ( $ res ) { return true ; } @ touch ( $ this -> _file , time ( ) - 2 * abs ( $ this -> _lifeTime ) ) ; return false ; } } else { $ res = $ this -> _write ( $ data ) ; } if ( is_object ( $ res ) ) { if ( ! ( $ this -> _errorHandlingAPIBreak ) ) { return false ; } } return $ res ; } return false ; }
Save some data in a cache file
53,175
function saveMemoryCachingState ( $ id , $ group = 'default' ) { if ( $ this -> _caching ) { $ array = array ( 'counter' => $ this -> _memoryCachingCounter , 'array' => $ this -> _memoryCachingArray ) ; $ data = serialize ( $ array ) ; $ this -> save ( $ data , $ id , $ group ) ; } }
Save the state of the caching memory array into a cache file cache
53,176
function getMemoryCachingState ( $ id , $ group = 'default' , $ doNotTestCacheValidity = false ) { if ( $ this -> _caching ) { if ( $ data = $ this -> get ( $ id , $ group , $ doNotTestCacheValidity ) ) { $ array = unserialize ( $ data ) ; $ this -> _memoryCachingCounter = $ array [ 'counter' ] ; $ this -> _memoryCachingArray = $ array [ 'array' ] ; } } }
Load the state of the caching memory array from a given cache file cache
53,177
function _setRefreshTime ( ) { if ( is_null ( $ this -> _lifeTime ) ) { $ this -> _refreshTime = null ; } else { $ this -> _refreshTime = time ( ) - $ this -> _lifeTime ; } }
Compute & set the refresh time
53,178
function _memoryCacheAdd ( $ data ) { $ this -> _touchCacheFile ( ) ; $ this -> _memoryCachingArray [ $ this -> _file ] = $ data ; if ( $ this -> _memoryCachingCounter >= $ this -> _memoryCachingLimit ) { $ key = key ( $ this -> _memoryCachingArray ) ; next ( $ this -> _memoryCachingArray ) ; unset ( $ this -> _memoryCachingArray [ $ key ] ) ; } else { $ this -> _memoryCachingCounter = $ this -> _memoryCachingCounter + 1 ; } }
Add some date in the memory caching array
53,179
function _read ( ) { $ fp = @ fopen ( $ this -> _file , "rb" ) ; if ( $ fp ) { if ( $ this -> _fileLocking ) @ flock ( $ fp , LOCK_SH ) ; clearstatcache ( ) ; $ length = @ filesize ( $ this -> _file ) ; $ mqr = get_magic_quotes_runtime ( ) ; if ( $ mqr ) { set_magic_quotes_runtime ( 0 ) ; } if ( $ this -> _readControl ) { $ hashControl = @ fread ( $ fp , 32 ) ; $ length = $ length - 32 ; } if ( $ length ) { $ data = '' ; while ( ! feof ( $ fp ) ) $ data .= fread ( $ fp , 8192 ) ; } else { $ data = '' ; } if ( $ mqr ) { set_magic_quotes_runtime ( $ mqr ) ; } if ( $ this -> _fileLocking ) @ flock ( $ fp , LOCK_UN ) ; @ fclose ( $ fp ) ; if ( $ this -> _readControl ) { $ hashData = $ this -> _hash ( $ data , $ this -> _readControlType ) ; if ( $ hashData != $ hashControl ) { if ( ! ( is_null ( $ this -> _lifeTime ) ) ) { @ touch ( $ this -> _file , time ( ) - 2 * abs ( $ this -> _lifeTime ) ) ; } else { @ unlink ( $ this -> _file ) ; } return false ; } } return $ data ; } return $ this -> raiseError ( 'Cache_Lite : Unable to read cache !' , - 2 ) ; }
Read the cache file and return the content
53,180
function _write ( $ data ) { if ( $ this -> _hashedDirectoryLevel > 0 ) { $ hash = md5 ( $ this -> _fileName ) ; $ root = $ this -> _cacheDir ; for ( $ i = 0 ; $ i < $ this -> _hashedDirectoryLevel ; $ i ++ ) { $ root = $ root . 'cache_' . substr ( $ hash , 0 , $ i + 1 ) . '/' ; if ( ! ( @ is_dir ( $ root ) ) ) { if ( @ mkdir ( $ root ) ) { @ chmod ( $ root , $ this -> _hashedDirectoryUmask ) ; if ( ! is_null ( $ this -> _hashedDirectoryGroup ) ) @ chgrp ( $ root , $ this -> _hashedDirectoryGroup ) ; } } } } $ is_newfile = ( ! is_null ( $ this -> _cacheFileMode ) || ! is_null ( $ this -> _cacheFileGroup ) ) && ! @ file_exists ( $ this -> _file ) ; $ fp = @ fopen ( $ this -> _file , "wb" ) ; if ( $ fp ) { if ( $ this -> _fileLocking ) @ flock ( $ fp , LOCK_EX ) ; if ( $ is_newfile ) { if ( ! is_null ( $ this -> _cacheFileMode ) ) @ chmod ( $ this -> _file , $ this -> _cacheFileMode ) ; if ( ! is_null ( $ this -> _cacheFileGroup ) ) @ chgrp ( $ this -> _file , $ this -> _cacheFileGroup ) ; } if ( $ this -> _readControl ) { @ fwrite ( $ fp , $ this -> _hash ( $ data , $ this -> _readControlType ) , 32 ) ; } $ mqr = get_magic_quotes_runtime ( ) ; if ( $ mqr ) { set_magic_quotes_runtime ( 0 ) ; } @ fwrite ( $ fp , $ data ) ; if ( $ mqr ) { set_magic_quotes_runtime ( $ mqr ) ; } if ( $ this -> _fileLocking ) @ flock ( $ fp , LOCK_UN ) ; @ fclose ( $ fp ) ; return true ; } return $ this -> raiseError ( 'Cache_Lite : Unable to write cache file : ' . $ this -> _file , - 1 ) ; }
Write the given data in the cache file
53,181
function _writeAndControl ( $ data ) { $ result = $ this -> _write ( $ data ) ; if ( is_object ( $ result ) ) { return $ result ; } $ dataRead = $ this -> _read ( ) ; if ( is_object ( $ dataRead ) ) { return $ dataRead ; } if ( ( is_bool ( $ dataRead ) ) && ( ! $ dataRead ) ) { return false ; } return ( $ dataRead == $ data ) ; }
Write the given data in the cache file and control it just after to avoir corrupted cache entries
53,182
public function all ( array $ params = array ( ) ) { $ endpoint = '/admin/redirects.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createCollection ( Redirect :: class , $ response [ 'redirects' ] ) ; }
Receive a list of all redirects
53,183
public function get ( $ redirectId , array $ params = array ( ) ) { $ endpoint = '/admin/redirects/' . $ redirectId . '.json' ; $ response = $ this -> request ( $ endpoint , 'GET' , $ params ) ; return $ this -> createObject ( Redirect :: class , $ response [ 'redirect' ] ) ; }
Receive a singel redirect
53,184
public function create ( Redirect & $ redirect ) { $ endpoint = '/admin/redirects.json' ; $ data = $ redirect -> exportData ( ) ; $ response = $ this -> request ( $ endpoint , "POST" , array ( 'redirect' => $ data ) ) ; $ redirect -> setData ( $ response [ 'redirect' ] ) ; }
Create a new redirect
53,185
public function update ( Redirect & $ redirect ) { $ endpoint = '/admin/redirects/' . $ redirect -> id . '.json' ; $ data = $ redirect -> exportData ( ) ; $ response = $ this -> request ( $ endpoint , "POST" , array ( 'redirect' => $ data ) ) ; $ redirect -> setData ( $ response [ 'redirect' ] ) ; }
Modify an existing redirect
53,186
public function delete ( Redirect $ redirect ) { $ endpoint = '/admin/redirect/' . $ redirect -> id . '.json' ; $ response = $ this -> request ( $ endpoint , 'DELETE' ) ; return ; }
Remove a redirect
53,187
public function getObjectRelationships ( $ repositoryId , $ objectId , $ includeSubRelationshipTypes = false , RelationshipDirection $ relationshipDirection = null , $ typeId = null , $ filter = null , $ includeAllowableActions = false , $ maxItems = null , $ skipCount = 0 , ExtensionDataInterface $ extension = null ) { $ url = $ this -> getObjectUrl ( $ repositoryId , $ objectId , Constants :: SELECTOR_RELATIONSHIPS ) ; $ query = $ url -> getQuery ( ) ; if ( $ relationshipDirection === null ) { $ relationshipDirection = RelationshipDirection :: cast ( RelationshipDirection :: SOURCE ) ; } $ query -> modify ( [ Constants :: PARAM_TYPE_ID => $ typeId , Constants :: PARAM_RELATIONSHIP_DIRECTION => ( string ) $ relationshipDirection , Constants :: PARAM_SUB_RELATIONSHIP_TYPES => $ includeSubRelationshipTypes ? 'true' : 'false' , Constants :: PARAM_ALLOWABLE_ACTIONS => $ includeAllowableActions ? 'true' : 'false' , Constants :: PARAM_SUCCINCT => $ this -> getSuccinct ( ) ? 'true' : 'false' , Constants :: PARAM_SKIP_COUNT => $ skipCount , Constants :: PARAM_DATETIME_FORMAT => ( string ) $ this -> getDateTimeFormat ( ) ] ) ; if ( $ filter !== null ) { $ query -> modify ( [ Constants :: PARAM_FILTER => $ filter ] ) ; } if ( $ maxItems !== null ) { $ query -> modify ( [ Constants :: PARAM_MAX_ITEMS => $ maxItems ] ) ; } $ responseData = ( array ) $ this -> readJson ( $ url ) ; return $ this -> getJsonConverter ( ) -> convertObjectList ( $ responseData ) ; }
Gets all or a subset of relationships associated with an independent object .
53,188
public function convertObject ( ObjectDataInterface $ objectData , OperationContextInterface $ context ) { $ type = $ this -> getTypeFromObjectData ( $ objectData ) ; if ( $ type === null ) { throw new CmisRuntimeException ( 'Could not get type from object data.' ) ; } $ baseTypeId = $ objectData -> getBaseTypeId ( ) ; if ( $ baseTypeId -> equals ( BaseTypeId :: CMIS_DOCUMENT ) ) { return new Document ( $ this -> session , $ type , $ context , $ objectData ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: CMIS_FOLDER ) ) { return new Folder ( $ this -> session , $ type , $ context , $ objectData ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: CMIS_POLICY ) ) { return new Policy ( $ this -> session , $ type , $ context , $ objectData ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: CMIS_RELATIONSHIP ) ) { return new Relationship ( $ this -> session , $ type , $ context , $ objectData ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: CMIS_ITEM ) ) { return new Item ( $ this -> session , $ type , $ context , $ objectData ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: CMIS_SECONDARY ) ) { throw new CmisRuntimeException ( 'Secondary type is used as object type: ' . $ baseTypeId ) ; } else { throw new CmisRuntimeException ( 'Unsupported base type: ' . $ baseTypeId ) ; } }
Convert given ObjectData to a high level API object
53,189
public function convertPolicies ( array $ policies ) { $ result = [ ] ; foreach ( $ policies as $ policy ) { if ( $ policy -> getId ( ) !== null ) { $ result [ ] = $ policy -> getId ( ) ; } } return $ result ; }
Converts a list of Policy objects into a list of there string representations
53,190
public function convertPropertiesDataToPropertyList ( ObjectTypeInterface $ objectType , array $ secondaryTypes , PropertiesInterface $ properties ) { if ( count ( $ objectType -> getPropertyDefinitions ( ) ) === 0 ) { throw new CmisInvalidArgumentException ( 'Object type has no property definitions!' ) ; } if ( count ( $ properties -> getProperties ( ) ) === 0 ) { throw new CmisInvalidArgumentException ( 'Properties must be set' ) ; } $ result = [ ] ; foreach ( $ properties -> getProperties ( ) as $ propertyKey => $ propertyData ) { $ apiProperty = $ this -> convertProperty ( $ objectType , $ secondaryTypes , $ propertyData ) ; $ result [ $ propertyKey ] = $ apiProperty ; } return $ result ; }
Convert Properties in Properties instance to a list of PropertyInterface objects
53,191
protected function convertProperty ( ObjectTypeInterface $ objectType , array $ secondaryTypes , PropertyDataInterface $ propertyData ) { $ definition = $ objectType -> getPropertyDefinition ( $ propertyData -> getId ( ) ) ; if ( $ definition === null && ! empty ( $ secondaryTypes ) ) { foreach ( $ secondaryTypes as $ secondaryType ) { $ propertyDefinitions = $ secondaryType -> getPropertyDefinitions ( ) ; if ( ! empty ( $ propertyDefinitions ) ) { $ definition = $ secondaryType -> getPropertyDefinition ( $ propertyData -> getId ( ) ) ; if ( $ definition !== null ) { break ; } } } } if ( $ definition === null ) { $ reloadedObjectType = $ this -> session -> getTypeDefinition ( $ objectType -> getId ( ) , false ) ; $ definition = $ reloadedObjectType -> getPropertyDefinition ( $ propertyData -> getId ( ) ) ; if ( $ definition === null && ! empty ( $ secondaryTypes ) ) { foreach ( $ secondaryTypes as $ secondaryType ) { $ reloadedSecondaryType = $ this -> session -> getTypeDefinition ( $ secondaryType -> getId ( ) , false ) ; $ propertyDefinitions = $ reloadedSecondaryType -> getPropertyDefinitions ( ) ; if ( ! empty ( $ propertyDefinitions ) ) { $ definition = $ reloadedSecondaryType -> getPropertyDefinition ( $ propertyData -> getId ( ) ) ; if ( $ definition !== null ) { break ; } } } } } if ( $ definition === null ) { throw new CmisRuntimeException ( sprintf ( 'Property "%s" doesn\'t exist!' , $ propertyData -> getId ( ) ) ) ; } return $ this -> createProperty ( $ definition , $ propertyData -> getValues ( ) ) ; }
Convert PropertyData into a property API object
53,192
private function getTypeDefinition ( $ objectTypeId ) { if ( empty ( $ objectTypeId ) || ! is_string ( $ objectTypeId ) ) { throw new CmisInvalidArgumentException ( 'Type property must be set and must be of type string but is empty or not a string.' ) ; } return $ this -> session -> getTypeDefinition ( $ objectTypeId ) ; }
Get a type definition for the given object type id . If an empty id is given throw an exception .
53,193
public function convertRendition ( $ objectId , RenditionDataInterface $ renditionData ) { $ rendition = new Rendition ( $ this -> session , $ objectId ) ; $ rendition -> populate ( $ renditionData ) ; return $ rendition ; }
Converts RenditionData to Rendition
53,194
public function convertTypeDefinition ( TypeDefinitionInterface $ typeDefinition ) { if ( $ typeDefinition instanceof DocumentTypeDefinitionInterface ) { return new DocumentType ( $ this -> session , $ typeDefinition ) ; } elseif ( $ typeDefinition instanceof FolderTypeDefinitionInterface ) { return new FolderType ( $ this -> session , $ typeDefinition ) ; } elseif ( $ typeDefinition instanceof RelationshipTypeDefinitionInterface ) { return new RelationshipType ( $ this -> session , $ typeDefinition ) ; } elseif ( $ typeDefinition instanceof PolicyTypeDefinitionInterface ) { return new PolicyType ( $ this -> session , $ typeDefinition ) ; } elseif ( $ typeDefinition instanceof ItemTypeDefinitionInterface ) { return new ItemType ( $ this -> session , $ typeDefinition ) ; } elseif ( $ typeDefinition instanceof SecondaryTypeDefinitionInterface ) { return new SecondaryType ( $ this -> session , $ typeDefinition ) ; } else { throw new CmisRuntimeException ( sprintf ( 'Unknown base type! Received "%s"' , get_class ( $ typeDefinition ) ) , 1422028427 ) ; } }
Convert a type definition to a type
53,195
public function getTypeFromObjectData ( ObjectDataInterface $ objectData ) { if ( $ objectData -> getProperties ( ) === null || count ( $ objectData -> getProperties ( ) -> getProperties ( ) ) === 0 ) { return null ; } $ typeProperty = $ objectData -> getProperties ( ) -> getProperties ( ) [ PropertyIds :: OBJECT_TYPE_ID ] ; if ( ! $ typeProperty instanceof PropertyId ) { return null ; } return $ this -> session -> getTypeDefinition ( $ typeProperty -> getFirstValue ( ) ) ; }
Try to determined what object type the given objectData belongs to and return that type .
53,196
public function createTypeDefinition ( $ id , $ localName , $ baseTypeIdString , $ parentId , $ creatable , $ fileable , $ queryable , $ controllablePolicy , $ controllableACL , $ fulltextIndexed , $ includedInSupertypeQuery , $ localNamespace = '' , $ queryName = '' , $ displayName = '' , $ description = '' , TypeMutabilityInterface $ typeMutability = null ) { $ typeDefinition = $ this -> getBindingsObjectFactory ( ) -> getTypeDefinitionByBaseTypeId ( $ baseTypeIdString , $ id ) ; $ typeDefinition -> setLocalName ( $ localName ) ; $ typeDefinition -> setParentTypeId ( $ parentId ) ; $ typeDefinition -> setIsCreatable ( $ creatable ) ; $ typeDefinition -> setIsFileable ( $ fileable ) ; $ typeDefinition -> setIsQueryable ( $ queryable ) ; $ typeDefinition -> setisControllablePolicy ( $ controllablePolicy ) ; $ typeDefinition -> setIsControllableAcl ( $ controllableACL ) ; $ typeDefinition -> setIsFulltextIndexed ( $ fulltextIndexed ) ; $ typeDefinition -> setIsIncludedInSupertypeQuery ( $ includedInSupertypeQuery ) ; $ typeDefinition -> setLocalNamespace ( $ localNamespace ) ; $ typeDefinition -> setQueryName ( $ queryName ) ; $ typeDefinition -> setDisplayName ( $ displayName ) ; $ typeDefinition -> setDescription ( $ description ) ; if ( $ typeMutability !== null ) { $ typeDefinition -> setTypeMutability ( $ typeMutability ) ; } return $ typeDefinition ; }
Create a type definition with all required properties .
53,197
public function getTypeDefinitionByBaseTypeId ( $ baseTypeIdString , $ typeId ) { $ baseTypeId = BaseTypeId :: cast ( $ baseTypeIdString ) ; if ( $ baseTypeId -> equals ( BaseTypeId :: cast ( BaseTypeId :: CMIS_FOLDER ) ) ) { $ baseType = new FolderTypeDefinition ( $ typeId ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: cast ( BaseTypeId :: CMIS_DOCUMENT ) ) ) { $ baseType = new DocumentTypeDefinition ( $ typeId ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: cast ( BaseTypeId :: CMIS_RELATIONSHIP ) ) ) { $ baseType = new RelationshipTypeDefinition ( $ typeId ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: cast ( BaseTypeId :: CMIS_POLICY ) ) ) { $ baseType = new PolicyTypeDefinition ( $ typeId ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: cast ( BaseTypeId :: CMIS_ITEM ) ) ) { $ baseType = new ItemTypeDefinition ( $ typeId ) ; } elseif ( $ baseTypeId -> equals ( BaseTypeId :: cast ( BaseTypeId :: CMIS_SECONDARY ) ) ) { $ baseType = new SecondaryTypeDefinition ( $ typeId ) ; } else { throw new CmisInvalidArgumentException ( sprintf ( 'The given type definition "%s" could not be converted.' , $ baseTypeId ) ) ; } $ baseType -> setBaseTypeId ( $ baseTypeId ) ; return $ baseType ; }
Get a type definition object by its base type id
53,198
public function createCmisBrowserBinding ( array $ sessionParameters , Cache $ typeDefinitionCache = null ) { $ this -> validateCmisBrowserBindingParameters ( $ sessionParameters ) ; return new CmisBinding ( new Session ( ) , $ sessionParameters , $ typeDefinitionCache ) ; }
Create a browser binding
53,199
protected function addDefaultSessionParameters ( array & $ sessionParameters ) { $ sessionParameters [ SessionParameter :: CACHE_SIZE_REPOSITORIES ] = $ sessionParameters [ SessionParameter :: CACHE_SIZE_REPOSITORIES ] ?? 10 ; $ sessionParameters [ SessionParameter :: CACHE_SIZE_TYPES ] = $ sessionParameters [ SessionParameter :: CACHE_SIZE_TYPES ] ?? 100 ; $ sessionParameters [ SessionParameter :: CACHE_SIZE_LINKS ] = $ sessionParameters [ SessionParameter :: CACHE_SIZE_LINKS ] ?? 400 ; $ sessionParameters [ SessionParameter :: HTTP_INVOKER_CLASS ] = $ sessionParameters [ SessionParameter :: HTTP_INVOKER_CLASS ] ?? Client :: class ; $ sessionParameters [ SessionParameter :: JSON_CONVERTER_CLASS ] = $ sessionParameters [ SessionParameter :: JSON_CONVERTER_CLASS ] ?? JsonConverter :: class ; $ sessionParameters [ SessionParameter :: TYPE_DEFINITION_CACHE_CLASS ] = $ sessionParameters [ SessionParameter :: TYPE_DEFINITION_CACHE_CLASS ] ?? ArrayCache :: class ; }
Sets some parameters to a default value if they are not already set