sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function dump_node($echo = true) { $string = $this->tag; if (count($this->attr) > 0) { $string .= '('; foreach ($this->attr as $k => $v) { $string .= "[$k]=>\"" . $this->$k . '", '; } $string .= ')'; } if (count($...
Debugging function to dump a single dom node with a bunch of information about it.
entailment
public function next_sibling() { if ($this->parent === null) { return null; } $idx = 0; $count = count($this->parent->children); while ($idx < $count && $this !== $this->parent->children[$idx]) { ++$idx; } if (++$idx >= $count) { ...
returns the next sibling of node
entailment
public function get_display_size() { global $debugObject; $width = -1; $height = -1; if ($this->tag !== 'img') { return false; } // See if there is aheight or width attribute in the tag itself. if (isset($this->attr['width'])) { $wid...
Function to try a few tricks to determine the displayed size of an img on the page. NOTE: This will ONLY work on an IMG tag. Returns FALSE on all other tag types. @author John Schlick @version April 19 2012 @return array an array containing the 'height' and 'width' of the image on the page or -1 if we can't figure it ...
entailment
protected function parse_charset() { global $debugObject; $charset = null; if (function_exists('get_last_retrieve_url_contents_content_type')) { $contentTypeHeader = get_last_retrieve_url_contents_content_type(); $success = preg_match('/charset=(.+)/', $contentTypeH...
(or the content_type header from the last transfer), we will parse THAT, and if a charset is specified, we will use it over any other mechanism.
entailment
protected function remove_noise($pattern, $remove_tag = false) { global $debugObject; if (is_object($debugObject)) { $debugObject->debugLogEntry(1); } $count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); for ($i = $count...
save the noise in the $this->noise array.
entailment
public function restore_noise($text) { global $debugObject; if (is_object($debugObject)) { $debugObject->debugLogEntry(1); } while (($pos = strpos($text, '___noise___')) !== false) { // Sometimes there is a broken piece of markup, and we don't GET the pos+11 ...
restore noise to html content
entailment
public function setDefaultResponse() { $error = [[ 'status' => $this->getStatusCode(), 'code' => $this->getCode(), 'source' => ['pointer' => $this->getDescription()], 'title' => strtolower(class_basename($this->exception)), 'detail' ...
Set the default response on $response attribute. Get default value from methods.
entailment
public function getDescription() { return class_basename($this->exception). ' line '.$this->exception->getLine(). ' in '.$this->exception->getFile(); }
Mount the description with exception class, line and file. @return string
entailment
public function getStatusCode() { if (method_exists($this->exception, 'getStatusCode')) { $httpCode = $this->exception->getStatusCode(); } else { $httpCode = config($this->configFile.'.http_code'); } return $httpCode; }
Get default http code. Check if exception has getStatusCode() methods. If not get from config file. @return int
entailment
public function getCode($type = 'default') { $code = $this->exception->getCode(); if (empty($this->exception->getCode())) { $code = config($this->configFile.'.codes.'.$type); } return $code; }
Get error code. If code is empty from config file based on type. @param string $type Code type from config file @return int
entailment
public function jsonResponse(Exception $exception) { $this->exception = $exception; $this->jsonApiResponse = new JsonApiResponse; if ($this->exceptionIsTreated()) { $this->callExceptionHandler(); } else { $this->setDefaultResponse(); } return...
Handle the json response. Check if exception is treated. If true call the specific handler. If false set the default response to be returned. @param Exception $exception @return JsonResponse
entailment
public function validationException(ValidationException $exception) { $this->jsonApiResponse->setStatus(422); $this->jsonApiResponse->setErrors($this->jsonApiFormatErrorMessages($exception)); }
Assign to response attribute the value to ValidationException. @param ValidationException $exception
entailment
public function notFoundHttpException(NotFoundHttpException $exception) { $statuCode = $exception->getStatusCode(); $error = [[ 'status' => $statuCode, 'code' => $this->getCode('not_found_http'), 'source' => ['pointer' => $exception->getFile().':'.$exception->ge...
Set response parameters to NotFoundHttpException. @param NotFoundHttpException $exception
entailment
public function getNotFoundMessage(NotFoundHttpException $exception) { $message = ! empty($exception->getMessage()) ? $exception->getMessage() : class_basename($exception); if (basename($exception->getFile()) === 'RouteCollection.php') { $message = __('exception::exceptions.not_found_htt...
Get message based on file. If file is RouteCollection return specific message. @param NotFoundHttpException $exception @return string
entailment
public function addObjectToFolder( $repositoryId, $objectId, $folderId, $allVersions = true, ExtensionDataInterface $extension = null ) { $url = $this->getObjectUrl($repositoryId, $objectId); $queryArray = [ Constants::CONTROL_CMISACTION => Co...
Adds an existing fileable non-folder object to a folder. @param string $repositoryId The identifier for the repository. @param string $objectId The identifier for the object. @param string $folderId The folder into which the object is to be filed. @param boolean $allVersions Add all versions of the object to the folde...
entailment
public function removeObjectFromFolder( $repositoryId, $objectId, $folderId = null, ExtensionDataInterface $extension = null ) { $url = $this->getObjectUrl($repositoryId, $objectId); $queryArray = [ Constants::CONTROL_CMISACTION => Constants::CMISACTI...
Removes an existing fileable non-folder object from a folder. @param string $repositoryId The identifier for the repository. @param string $objectId The identifier for the object. @param string|null $folderId The folder from which the object is to be removed. If no value is specified, then the repository MUST remove t...
entailment
function start($id, $group = 'default', $doNotTestCacheValidity = false) { $data = $this->get($id, $group, $doNotTestCacheValidity); if ($data !== false) { echo($data); return true; } ob_start(); ob_implicit_flush(false); return false; }
Start the cache @param string $id cache id @param string $group name of the cache group @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested @return boolean true if the cache is hit (false else) @access public
entailment
function end() { $data = ob_get_contents(); ob_end_clean(); $this->save($data, $this->_id, $this->_group); echo($data); }
Stop the cache @access public
entailment
public function decode($jwsString) { $components = explode('.', $jwsString); if (count($components) !== 3) { throw new MalformedSignatureException('JWS string must contain 3 dot separated component.'); } try { $headers = Json::decode(Base64Url::decode($compon...
Only decodes jws string and returns headers and payload. To verify signature use verify method. @throws MalformedSignatureException @param $jwsString @return array( 'headers' => array(), 'payload' => payload data )
entailment
public function verify($jwsString, $key, $expectedAlgorithm = null) { $jws = $this->decode($jwsString); $headers = $jws['headers']; list($dataToSign, $signature) = $this->extractSignature($jwsString); if (empty($headers['alg'])) { throw new UnspecifiedAlgorithmException...
@param $jwsString @param $key @param $expectedAlgorithm @throws UnspecifiedAlgorithmException @throws MalformedSignatureException @throws UnspecifiedAlgorithmException @throws InvalidSignatureException @throws UnexpectedAlgorithmException @return array( 'headers' => array(), 'payload' => mixed payload data )
entailment
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('akeneo_measure'); $rootNode->children() ->arrayNode('measures_config') ->prototype('array') ->children() // standard unit (used as ...
{@inheritDoc}
entailment
protected function addConvertNode() { $treeBuilder = new TreeBuilder(); $node = $treeBuilder->root('convert'); $node->requiresAtLeastOneElement() ->prototype('array') ->children() ->scalarNode('add') ->cannotBeEmpty() ...
Create a node definition for operations (could be extended to define new operations) @return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition| \Symfony\Component\Config\Definition\Builder\NodeDefinition
entailment
public function perform($targetDocument) { $pointer = new Pointer($targetDocument); try { $get = $pointer->get($this->getPath()); } catch (NonexistentValueReferencedException $e) { return $targetDocument; } $targetDocument = json_decode($targetDocumen...
@param string $targetDocument @throws \Rs\Json\Patch\InvalidOperationException @throws \Rs\Json\Pointer\InvalidJsonException @throws \Rs\Json\Pointer\InvalidPointerException @throws \Rs\Json\Pointer\NonWalkableJsonException @throws \RuntimeException @return string
entailment
public function all(array $params = array()) { $endpoint = '/admin/products.json'; $response = $this->request($endpoint, 'GET', $params); return $this->createCollection(Product::class, $response['products']); }
Receive a lists of all Products @link https://help.shopify.com/api/reference/product#index @param array $params @return Product[]
entailment
public function get($productId, array $fields = array()) { $params = array(); if (!empty($fields)) { $params['fields'] = $fields; } $endpoint = '/admin/products/'.$productId.'.json'; $response = $this->request($endpoint, 'GET', $params); return $this->crea...
Receive a single product @link https://help.shopify.com/api/reference/product#show @param integer $productId @param array $fields @return Product
entailment
public function create(Product &$product) { $data = $product->exportData(); $endpoint = '/admin/products.json'; $response = $this->request( $endpoint, 'POST', array( 'product' => $data ) ); $product->setData($response['product']); }
Create a new Product @link https://help.shopify.com/api/reference/product#create @param Product $product @return void
entailment
public function update(Product &$product) { $data = $product->exportData(); $endpoint = '/admin/products/'.$product->id.'.json'; $response = $this->request( $endpoint, 'PUT', array( 'product' => $data ) ); $product->setData($response['produ...
Modify an existing product @link https://help.shopify.com/api/reference/product#update @param Product $product @return void
entailment
public function createType($repositoryId, TypeDefinitionInterface $type, ExtensionDataInterface $extension = null) { $url = $this->getRepositoryUrl($repositoryId); $url->getQuery()->modify( [ Constants::CONTROL_CMISACTION => Constants::CMISACTION_CREATE_TYPE, ...
Creates a new type. @param string $repositoryId The identifier for the repository. @param TypeDefinitionInterface $type A fully populated type definition including all new property definitions. @param ExtensionDataInterface|null $extension @return TypeDefinitionInterface
entailment
public function deleteType($repositoryId, $typeId, ExtensionDataInterface $extension = null) { $url = $this->getRepositoryUrl($repositoryId); $url->getQuery()->modify( [ Constants::CONTROL_CMISACTION => Constants::CMISACTION_DELETE_TYPE, Constants::CONTRO...
Deletes a type. @param string $repositoryId The identifier for the repository. @param string $typeId The typeId of an object-type specified in the repository. @param ExtensionDataInterface|null $extension
entailment
public function getRepositoryInfo($repositoryId, ExtensionDataInterface $extension = null) { foreach ($this->getRepositoriesInternal($repositoryId) as $repositoryInfo) { if ($repositoryInfo->getId() === $repositoryId) { return $repositoryInfo; } } thr...
Returns information about the CMIS repository, the optional capabilities it supports and its access control information if applicable. @param string $repositoryId The identifier for the repository. @param ExtensionDataInterface|null $extension @throws CmisObjectNotFoundException @return RepositoryInfoInterface
entailment
public function getTypeChildren( $repositoryId, $typeId = null, $includePropertyDefinitions = false, $maxItems = null, $skipCount = 0, ExtensionDataInterface $extension = null ) { $url = $this->getRepositoryUrl($repositoryId, Constants::SELECTOR_TYPE_CHILDREN)...
Returns the list of object types defined for the repository that are children of the specified type. @param string $repositoryId the identifier for the repository @param string|null $typeId the typeId of an object type specified in the repository (if not specified the repository MUST return all base object types) @par...
entailment
public function getTypeDefinition( $repositoryId, $typeId, ExtensionDataInterface $extension = null, $useCache = true ) { $cache = null; $cacheKey = $repositoryId . '-' . $typeId; // if the cache should be used and the extension is not set, check the cache fi...
Gets the definition of the specified object type. @param string $repositoryId the identifier for the repository @param string $typeId he type definition @param ExtensionDataInterface|null $extension @param boolean $useCache @return TypeDefinitionInterface|null the newly created type
entailment
public function getTypeDescendants( $repositoryId, $typeId = null, $depth = null, $includePropertyDefinitions = false, ExtensionDataInterface $extension = null ) { $url = $this->getRepositoryUrl($repositoryId, Constants::SELECTOR_TYPE_DESCENDANTS); $url->getQu...
Returns the set of descendant object type defined for the repository under the specified type. @param string $repositoryId repositoryId - the identifier for the repository @param string|null $typeId the typeId of an object type specified in the repository (if not specified the repository MUST return all types and MUST...
entailment
public function updateType($repositoryId, TypeDefinitionInterface $type, ExtensionDataInterface $extension = null) { $url = $this->getRepositoryUrl($repositoryId); $url->getQuery()->modify( [ Constants::CONTROL_CMISACTION => Constants::CMISACTION_UPDATE_TYPE, ...
Updates a type. @param string $repositoryId the identifier for the repository @param TypeDefinitionInterface $type the type definition @param ExtensionDataInterface|null $extension @return TypeDefinitionInterface the updated type
entailment
public function getRenditionDocument(OperationContextInterface $context = null) { $renditionDocumentId = $this->getRenditionDocumentId(); if (empty($renditionDocumentId)) { return null; } if ($context === null) { $context = $this->session->getDefaultContext()...
Returns the rendition document using the provides OperationContext if the rendition is a stand-alone document. @param OperationContextInterface|null $context @return DocumentInterface|null the rendition document or <code>null</code> if there is no rendition document
entailment
public function getContentStream() { if (!$this->objectId || !$this->getStreamId()) { return null; } return $this->session->getBinding()->getObjectService()->getContentStream( $this->session->getRepositoryInfo()->getId(), $this->objectId, $thi...
Returns the content stream of the rendition. @return StreamInterface|null the content stream of the rendition or <code>null</code> if the rendition has no content
entailment
public function getContentUrl() { $objectService = $this->session->getBinding()->getObjectService(); if ($objectService instanceof LinkAccessInterface) { return $objectService->loadRenditionContentLink( $this->session->getRepositoryInfo()->getId(), $this->...
Returns the content URL of the rendition if the binding supports content URLs. Depending on the repository and the binding, the server might not return the content but an error message. Authentication data is not attached. That is, a user may have to re-authenticate to get the content. @return string|null the content...
entailment
protected function createObjectFactory() { try { if (isset($this->parameters[SessionParameter::OBJECT_FACTORY_CLASS])) { $objectFactoryClass = new $this->parameters[SessionParameter::OBJECT_FACTORY_CLASS]; } else { $objectFactoryClass = $this->createDe...
Create an object factory based on the SessionParameter::OBJECT_FACTORY_CLASS. If not set it returns an instance of ObjectFactory. @return ObjectFactoryInterface @throws \RuntimeException
entailment
protected function createCache() { try { if (isset($this->parameters[SessionParameter::CACHE_CLASS])) { $cache = new $this->parameters[SessionParameter::CACHE_CLASS]; } else { $cache = $this->createDefaultCacheInstance(); } if ...
Create a cache instance based on the given session parameter SessionParameter::CACHE_CLASS. If no session parameter SessionParameter::CACHE_CLASS is defined, the default Cache implementation will be used. @return Cache @throws \InvalidArgumentException
entailment
public function createDocument( array $properties, ObjectIdInterface $folderId = null, StreamInterface $contentStream = null, VersioningState $versioningState = null, array $policies = [], array $addAces = [], array $removeAces = [] ) { if (empty($prop...
Creates a new document. The stream in contentStream is consumed but not closed by this method. @param string[] $properties The property values that MUST be applied to the newly-created document object. @param ObjectIdInterface|null $folderId If specified, the identifier for the folder that MUST be the parent folder fo...
entailment
public function createDocumentFromSource( ObjectIdInterface $source, array $properties = [], ObjectIdInterface $folderId = null, VersioningState $versioningState = null, array $policies = [], array $addAces = [], array $removeAces = [] ) { if (!$source...
Creates a new document from a source document. @param ObjectIdInterface $source The identifier for the source document. @param string[] $properties The property values that MUST be applied to the object. This list of properties SHOULD only contain properties whose values differ from the source document. @param ObjectI...
entailment
public function createFolder( array $properties, ObjectIdInterface $folderId, array $policies = [], array $addAces = [], array $removeAces = [] ) { if (empty($properties)) { throw new CmisInvalidArgumentException('Properties must not be empty!'); }...
Creates a new folder. @param string[] $properties @param ObjectIdInterface $folderId @param PolicyInterface[] $policies @param AceInterface[] $addAces @param AceInterface[] $removeAces @return ObjectIdInterface the object ID of the new folder @throws CmisInvalidArgumentException Throws an <code>CmisInvalidArgumentExce...
entailment
public function createOperationContext( $filter = [], $includeAcls = false, $includeAllowableActions = true, $includePolicies = false, IncludeRelationships $includeRelationships = null, array $renditionFilter = [], $includePathSegments = true, $orderBy = n...
Creates a new operation context object with the given properties. @param string[] $filter the property filter, a comma separated string of query names or "*" for all properties or <code>null</code> to let the repository determine a set of properties @param boolean $includeAcls indicates whether ACLs should be included...
entailment
public function createQueryStatement( array $selectPropertyIds, array $fromTypes, $whereClause = null, array $orderByPropertyIds = [] ) { if (empty($selectPropertyIds)) { throw new CmisInvalidArgumentException('Select property IDs must not be empty'); } ...
Creates a query statement for a query of one primary type joined by zero or more secondary types. Generates something like this: `SELECT d.cmis:name,s.SecondaryStringProp FROM cmis:document AS d JOIN MySecondaryType AS s ON d.cmis:objectId=s.cmis:objectId WHERE d.cmis:name LIKE ? ORDER BY d.cmis:name,s.SecondaryIntege...
entailment
public function createRelationship( array $properties, array $policies = [], array $addAces = [], array $removeAces = [] ) { if (empty($properties)) { throw new CmisInvalidArgumentException('Properties must not be empty!'); } $newObjectId = $this-...
Creates a new relationship between 2 objects. @param string[] $properties @param PolicyInterface[] $policies @param AceInterface[] $addAces @param AceInterface[] $removeAces @return ObjectIdInterface|null the object ID of the new relationship or <code>null</code> if the relationship could not be created
entailment
public function createType(TypeDefinitionInterface $type) { if ($this->getRepositoryInfo()->getCmisVersion() == CmisVersion::cast(CmisVersion::CMIS_1_0)) { throw new CmisNotSupportedException('This method is not supported for CMIS 1.0 repositories.'); } return $this->convertType...
Creates a new type. @param TypeDefinitionInterface $type @return ObjectTypeInterface the new type definition @throws CmisNotSupportedException If repository version 1.0
entailment
public function delete(ObjectIdInterface $objectId, $allVersions = true) { $this->getBinding()->getObjectService()->deleteObject( $this->getRepositoryId(), $objectId->getId(), $allVersions ); $this->removeObjectFromCache($objectId); }
Deletes an object and, if it is a document, all versions in the version series. @param ObjectIdInterface $objectId the ID of the object @param boolean $allVersions if this object is a document this parameter defines if only this version or all versions should be deleted
entailment
public function deleteType($typeId) { if ($this->getRepositoryInfo()->getCmisVersion() == CmisVersion::cast(CmisVersion::CMIS_1_0)) { throw new CmisNotSupportedException('This method is not supported for CMIS 1.0 repositories.'); } $this->getBinding()->getRepositoryService()->de...
Deletes a type. @param string $typeId the ID of the type to delete @throws CmisNotSupportedException If repository version 1.0
entailment
public function getContentChanges( $changeLogToken, $includeProperties, $maxNumItems = null, OperationContextInterface $context = null ) { if ($context === null) { $context = $this->getDefaultContext(); } $objectList = $this->getBinding()->getDisc...
Returns the content changes. @param string $changeLogToken the change log token to start from or <code>null</code> to start from the first available event in the repository @param boolean $includeProperties indicates whether changed properties should be included in the result or not @param integer|null $maxNumItems ma...
entailment
public function getContentStream(ObjectIdInterface $docId, $streamId = null, $offset = null, $length = null) { return $this->getBinding()->getObjectService()->getContentStream( $this->getRepositoryId(), $docId->getId(), $streamId, $offset, $length ...
Retrieves the main content stream of a document. @param ObjectIdInterface $docId the ID of the document @param string|null $streamId the stream ID @param integer|null $offset the offset of the stream or <code>null</code> to read the stream from the beginning @param integer|null $length the maximum length of the stream...
entailment
public function getObjectByPath($path, OperationContextInterface $context = null) { if (empty($path)) { throw new CmisInvalidArgumentException('Path must not be empty.'); } if ($context === null) { $context = $this->getDefaultContext(); } $objectData...
Returns a CMIS object from the session cache. If the object is not in the cache or the given OperationContext has caching turned off, it will load the object from the repository and puts it into the cache. This method might return a stale object if the object has been found in the cache and has been changed in or remov...
entailment
public function getRelationships( ObjectIdInterface $objectId, $includeSubRelationshipTypes, RelationshipDirection $relationshipDirection, ObjectTypeInterface $type, OperationContextInterface $context = null ) { if ($context === null) { $context = $this->...
Fetches the relationships from or to an object from the repository. @param ObjectIdInterface $objectId @param boolean $includeSubRelationshipTypes @param RelationshipDirection $relationshipDirection @param ObjectTypeInterface $type @param OperationContextInterface|null $context @return RelationshipInterface[]
entailment
public function getRootFolder(OperationContextInterface $context = null) { $rootFolderId = $this->getRepositoryInfo()->getRootFolderId(); $rootFolder = $this->getObject( $this->createObjectId($rootFolderId), $context === null ? $this->getDefaultContext() : $context )...
Gets the root folder of the repository with the given OperationContext. @param OperationContextInterface|null $context @return FolderInterface the root folder object @throws CmisRuntimeException
entailment
public function getTypeChildren($typeId, $includePropertyDefinitions) { return $this->getBinding()->getRepositoryService()->getTypeChildren( $this->getRepositoryId(), $typeId, $includePropertyDefinitions, 999, // set max items to 999 - TODO: Implement Collecti...
Gets the type children of a type. @param string $typeId the type ID or <code>null</code> to request the base types @param boolean $includePropertyDefinitions indicates whether the property definitions should be included or not @return TypeDefinitionListInterface the type iterator @throws CmisObjectNotFoundException - ...
entailment
public function getTypeDefinition($typeId, $useCache = true) { // TODO: Implement cache! $typeDefinition = $this->getBinding()->getRepositoryService()->getTypeDefinition( $this->getRepositoryId(), $typeId ); return $this->convertTypeDefinition($typeDefinition...
Gets the definition of a type. @param string $typeId the ID of the type @param boolean $useCache specifies if the type definition should be first looked up in the type definition cache, if it is set to <code>false</code> or the type definition is not in the cache, the type definition is loaded from the repository @ret...
entailment
public function getTypeDescendants($typeId, $depth, $includePropertyDefinitions) { return $this->getBinding()->getRepositoryService()->getTypeDescendants( $this->getRepositoryId(), $typeId, (integer) $depth, $includePropertyDefinitions ); }
Gets the type descendants of a type. @param string $typeId the type ID or <code>null</code> to request the base types @param integer $depth indicates whether the property definitions should be included or not @param boolean $includePropertyDefinitions the tree depth, must be greater than 0 or -1 for infinite depth @re...
entailment
public function query($statement, $searchAllVersions = false, OperationContextInterface $context = null) { if (empty($statement)) { throw new CmisInvalidArgumentException('Statement must not be empty.'); } if ($context === null) { $context = $this->getDefaultContext(...
Sends a query to the repository using the given OperationContext. (See CMIS spec "2.1.10 Query".) @param string $statement the query statement (CMIS query language) @param boolean $searchAllVersions specifies whether non-latest document versions should be included or not, <code>true</code> searches all document versio...
entailment
public function queryObjects( $typeId, $where = null, $searchAllVersions = false, OperationContextInterface $context = null ) { if (empty($typeId)) { throw new CmisInvalidArgumentException('Type id must not be empty.'); } if ($context === null) { ...
Builds a CMIS query and returns the query results as an iterator of CmisObject objects. @param string $typeId the ID of the object type @param string|null $where the WHERE part of the query @param boolean $searchAllVersions specifies whether non-latest document versions should be included or not, <code>true</code> sea...
entailment
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 @link https://help.shopify.com/api/reference/product_variant#index @param integer $productId @param array $params @return ProductVariant[]
entailment
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); retu...
Receive a single product variant @link https://help.shopify.com/api/reference/product_variant#show @param integer $productVariantId @param array $fields @return ProductVariant
entailment
public function create($productId, ProductVariant &$productVariant) { $data = $productVariant->exportData(); $endpoint = '/admin/products/'.$productId.'/variants.json'; $response = $this->request( $endpoint, 'POST', array( 'variant' => $data ) ); ...
Create a new product variant @link https://help.shopify.com/api/reference/product_variant#create @param integer $productId @param ProductVariant $productVariant @return void
entailment
public function update(ProductVariant &$productVariant) { $data = $productVariant->exportData(); $endpoint = '/admin/variants/'.$productVariant->id.'.json'; $response = $this->request( $endpoint, 'PUT', array( 'variant' => $data ) ); $produ...
Modify an existing product variant @link https://help.shopify.com/api/reference/product_variant#update @param ProductVariant $productVariant @return void
entailment
public function delete($productId, ProductVariant &$productVariant) { $endpoint = '/admin/products/'.$productId.'/variants/'.$productVariant->id.'.json'; $response = $this->request($endpoint, 'DELETE'); }
Delete a product variant @link https://help.shopify.com/api/reference/product_variant#destroy @param integer $productId @param ProductVariant $productVariant @return void
entailment
public function perform($targetDocument) { $pointer = new Pointer($targetDocument); try { $get = $pointer->get($this->getFrom()); } catch (NonexistentValueReferencedException $e) { return $targetDocument; } if ($this->getFrom() === $this->getPath()) {...
@param string $targetDocument @throws \Rs\Json\Patch\InvalidOperationException @throws \Rs\Json\Pointer\InvalidJsonException @throws \Rs\Json\Pointer\InvalidPointerException @throws \Rs\Json\Pointer\NonWalkableJsonException @throws \RuntimeException @return string
entailment
public function getCheckedOutDocs( $repositoryId, $folderId, $filter = null, $orderBy = null, $includeAllowableActions = false, IncludeRelationships $includeRelationships = null, $renditionFilter = Constants::RENDITION_NONE, $maxItems = null, $skip...
Gets the list of documents that are checked out that the user has access to. @param string $repositoryId the identifier for the repository @param string $folderId the identifier for the folder @param string|null $filter a comma-separated list of query names that defines which properties must be returned by the reposit...
entailment
public function getFolderParent( $repositoryId, $folderId, $filter = null, ExtensionDataInterface $extension = null ) { $url = $this->getObjectUrl($repositoryId, $folderId, Constants::SELECTOR_PARENT); $url->getQuery()->modify( [ Constants:...
Gets the parent folder object for the specified folder object. @param string $repositoryId the identifier for the repository @param string $folderId the identifier for the folder @param string|null $filter a comma-separated list of query names that defines which properties must be returned by the repository (default i...
entailment
public function getFolderTree( $repositoryId, $folderId, $depth, $filter = null, $includeAllowableActions = false, IncludeRelationships $includeRelationships = null, $renditionFilter = Constants::RENDITION_NONE, $includePathSegment = false, Extensi...
Gets the set of descendant folder objects contained in the specified folder. @param string $repositoryId the identifier for the repository @param string $folderId the identifier for the folder @param integer $depth the number of levels of depth in the folder hierarchy from which to return results @param string|null $f...
entailment
public function getObjectParents( $repositoryId, $objectId, $filter = null, $includeAllowableActions = false, IncludeRelationships $includeRelationships = null, $renditionFilter = Constants::RENDITION_NONE, $includeRelativePathSegment = false, ExtensionDat...
Gets the parent folder(s) for the specified non-folder, fileable object @param string $repositoryId the identifier for the repository @param string $objectId the identifier for the object @param string|null $filter a comma-separated list of query names that defines which properties must be returned by the repository (...
entailment
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_CREAT...
Convert given object to a scalar representation or an array of scalar values. @param TypeMutabilityInterface $object @return boolean[] Array representation of object @throws CmisInvalidArgumentException thrown if given object does not implement expected TypeMutabilityInterface
entailment
public static function match($entry) { $entries = preg_split('/' . static::$separatorRegex .'/', $entry); if (count($entries) == 2) { foreach ($entries as $ent) { if (!static::matchIp(trim($ent))) { return false; } } ...
{@inheritdoc}
entailment
public function check($entry) { if (!self::matchIp($entry)) { return false; } $entryLong = $this->ip2long($entry); $range = $this->getRange(); return (bool) $this->IPLongCompare($range['begin'], $entryLong, '<=') && $this->IPLongCompare($range['end'], $...
{@inheritdoc}
entailment
protected function getRange($long = true) { $parts = $this->getParts(); $keys = array('begin', 'end'); $parts['ip_start'] = $this->ip2long($parts['ip_start']); $parts['ip_end'] = $this->ip2long($parts['ip_end']); natsort($parts); $parts = array_combine($keys, array...
Récupérer la plage d'IP valide sous forme d'entier @param boolean $long Retourner un entier plutot qu'une IP @return array
entailment
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[] = $th...
Calcul et retourne toutes les valeurs possible du range @return array
entailment
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 @link https://help.shopify.com/api/reference/province#index @param array $params @return Province[]
entailment
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 @link https://help.shopify.com/api/reference/province#show @param integer $countryId @param integer $provinceId @return Province
entailment
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 ) );...
Modify an existing province @link https://help.shopify.com/api/reference/province#update @param Province $province @return void
entailment
public function setObjects(array $objects) { foreach ($objects as $object) { $this->checkType(ObjectDataInterface::class, $object); } $this->objects = $objects; }
Sets given list of objects @param ObjectDataInterface[] $objects
entailment
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 @link https://help.shopify.com/api/reference/recurringapplicationcharge#index @param array $params @return RecurringApplicationCharge[]
entailment
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, $respo...
Receive a single recurring application charge @link https://help.shopify.com/api/reference/recurringapplicationcharge#show @param integer $recurringApplicationChargeId @param array $params @return RecurringApplicationCharge
entailment
public function create(RecurringApplicationCharge &$recurringApplicationCharge) { $data = $recurringApplicationCharge->exportData(); $endpoint = '/admin/recurring_application_charges.json'; $response = $this->request( $endpoint, 'POST', array( 'recurring_application_c...
Create a new recurring application charge @link https://help.shopify.com/api/reference/recurringapplicationcharge#create @param RecurringApplicationCharge $recurringApplicationCharge @return void
entailment
public function delete(RecurringApplicationCharge $recurringApplicationCharge) { $endpoint= '/admin/recurring_application_charges/'.$recurringApplicationCharge->id.'.json'; $response = $this->request($endpoint, 'DELETE'); }
Remove an existing recurring application charge @link https://help.shopify.com/api/reference/recurringapplicationcharge#destroy @param RecurringApplicationCharge $recurringApplicationCharge @return void
entailment
public function activate(RecurringApplicationCharge $recurringApplicationCharge) { $endpoint = '/admin/recurring_application_charges/'.$recurringApplicationCharge->id.'/activate.json'; $response = $this->request($endpoint, 'POST'); $recurringApplicationCharge->setData($response['recurring_ap...
Activate a recurring application charge @link https://help.shopify.com/api/reference/recurringapplicationcharge#activate @param RecurringApplicationCharge $recurringApplicationCharge @return boolean
entailment
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 @link https://help.shopify.com/api/reference/blog#index @param array $params @return Blog[]
entailment
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-...
Receive a single blog @link https://help.shopify.com/api/reference/blog#show @param integer $blogId @param array $fields @return Blog
entailment
public function create(Blog &$blog) { $data = $blog->exportData(); $endpoint = '/admin/blogs.json'; $response = $this->request( $endpoint, 'POST', array( 'blog' => $data ) ); $blog->setData($response['blog']); }
Create a new blog @link https://help.shopify.com/api/reference/blog#create @param Blog $blog @return void
entailment
public function setValues(array $values) { foreach ($values as $key => $value) { if (is_integer($value)) { // cast integer values silenty to a double value. $values[$key] = $value = (double) $value; } $this->checkType('double', $value, true...
{@inheritdoc} @param float[] $values
entailment
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; } ...
Get an entry list @param array $list List of entries @param bool $trusted Is list trusted? @return EntryList
entailment
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 @param array $source @param array &$dest
entailment
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 @link https://help.shopify.com/api/reference/report#index @param array $params @return Report[]
entailment
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 @link https://help.shopify.com/api/reference/report#show @param integer $reportId @param array $params @return Report
entailment
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 @link https://help.shopify.com/api/reference/report#create @param Report $report @return void
entailment
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 @link https://help.shopify.com/api/reference/report#update @param Report $report @return void
entailment
public function perform($targetDocument) { $pointer = new Pointer($targetDocument); try { $get = $pointer->get($this->getFrom()); } catch (NonexistentValueReferencedException $e) { return $targetDocument; } if ($this->getFrom() === $this->getPath()) {...
@param string $targetDocument @throws \Rs\Json\Patch\InvalidOperationException @throws \Rs\Json\Pointer\InvalidJsonException @throws \Rs\Json\Pointer\InvalidPointerException @throws \Rs\Json\Pointer\NonWalkableJsonException @throws \RuntimeException @return string
entailment
public function getContentChanges( $repositoryId, &$changeLogToken = null, $includeProperties = false, $includePolicyIds = false, $includeAcl = false, $maxItems = null, ExtensionDataInterface $extension = null ) { $url = $this->getRepositoryUrl($reposi...
Gets a list of content changes. @param string $repositoryId The identifier for the repository. @param string|null $changeLogToken If specified, then the repository MUST return the change event corresponding to the value of the specified change log token as the first result in the output. If not specified, then the rep...
entailment
public function query( $repositoryId, $statement, $searchAllVersions = false, IncludeRelationships $includeRelationships = null, $renditionFilter = Constants::RENDITION_NONE, $includeAllowableActions = false, $maxItems = null, $skipCount = 0, Exten...
Executes a CMIS query statement against the contents of the repository. @param string $repositoryId The identifier for the repository. @param string $statement CMIS query to be executed @param boolean $searchAllVersions If <code>true</code>, then the repository MUST include latest and non-latest versions of document o...
entailment
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 @link https://help.shopify.com/api/reference/country#index @param array $params @return Country[]
entailment
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); retu...
Receive a single country @link https://help.shopify.com/api/reference/country#show @param integer $countryId @param array $fields @return Country
entailment
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 @link https://help.shopify.com/api/reference/country#create @param Country $country @return void
entailment
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['coun...
Update a country @link https://help.shopify.com/api/reference/country#update @param Country $country @return void
entailment
protected function getObjectUrl($repositoryId, $objectId, $selector = null) { $result = $this->getRepositoryUrlCache()->getObjectUrl($repositoryId, $objectId, $selector); if ($result === null) { $this->getRepositoriesInternal($repositoryId); $result = $this->getRepositoryUrl...
Get the url for an object @param string $repositoryId @param string $objectId @param string|null $selector @throws CmisConnectionException @throws CmisObjectNotFoundException @return Url
entailment