_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 33
8k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q500
|
Client.getActionsByResource
|
train
|
public function getActionsByResource($resource)
{
if (!isset($this->resources[$resource])) {
return null; // no resource found
|
php
|
{
"resource": ""
}
|
q501
|
Client.getMethodByAction
|
train
|
public function getMethodByAction($action)
{
foreach ($this->methods as $method => $actions) {
if (in_array($action, $actions)) {
|
php
|
{
"resource": ""
}
|
q502
|
Client.isMultiPartAction
|
train
|
public function isMultiPartAction($resource, $action)
{
return isset($this->multiPartActions[$resource]) &&
|
php
|
{
"resource": ""
}
|
q503
|
Client.getRequestPath
|
train
|
private function getRequestPath($resource, $action, &$params)
{
if (!isset($this->resources[$resource]) || !isset($this->resources[$resource][$action])) {
throw new \UnexpectedValueException('Resource path not found');
}
// get path
$path = $this->resources[$resource][$action];
// replace variables
$matchCount = preg_match_all("/:(\w*)/", $path, $variables);
if ($matchCount) {
foreach ($variables[0] as $index => $placeholder) {
if (!isset($params[$variables[1][$index]])) {
|
php
|
{
"resource": ""
}
|
q504
|
Client.callApi
|
train
|
private function callApi($method, $path, $params, $isMultiPart)
{
// init session
$ch = curl_init();
// request settings
curl_setopt_array($ch, $this->curlSettings); // basic settings
// url
$url = $this->endpoint . $path;
$url .= $method == 'get' ? $this->getAuthQueryStringWithParams($params) : $this->getAuthQueryString();
curl_setopt($ch, CURLOPT_URL, $url);
// http header
$requestHeaders = $this->httpHeaders;
if (!$isMultiPart) {
$requestHeaders[] = "Content-Type: application/json";
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders);
// method specific settings
switch ($method) {
case 'post':
curl_setopt($ch, CURLOPT_POST, 1);
// request body
if ($isMultiPart) {
if (version_compare(PHP_VERSION, '5.5.0') === -1) {
// fallback to old method
$params['file'] = '@' . $params['file'];
} else {
// make use of CURLFile
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
$params['file'] = new \CURLFile($params['file']);
}
$postBody = $params;
} else {
$postBody = json_encode($params);
}
|
php
|
{
"resource": ""
}
|
q505
|
Data.getConfigData
|
train
|
public function getConfigData($field, $storeId = null)
{
if (null === $storeId) {
$storeId = $this->_storeManager->getStore(null);
}
$path
|
php
|
{
"resource": ""
}
|
q506
|
Data.getAllInstallmentPaymentMethodCodes
|
train
|
public function getAllInstallmentPaymentMethodCodes()
{
$return = [];
$paymentMethods = (array) $this->_scopeConfig->getValue('installments/payment_methods');
foreach
|
php
|
{
"resource": ""
}
|
q507
|
Data._getInstallmentsHelperFromPaymentMethod
|
train
|
protected function _getInstallmentsHelperFromPaymentMethod($methodCode)
{
$helperClassName = $this->_scopeConfig->getValue('installments/payment_methods/'
. $methodCode . '/installments_helper');
$helper = $this->_helperFactory->get($helperClassName);
if (false === $helper instanceof \Magento\Framework\App\Helper\AbstractHelper) {
|
php
|
{
"resource": ""
}
|
q508
|
Converter.convertLocalFile
|
train
|
public function convertLocalFile($inputPath, $outputFormat)
{
//check whether files are set or not
if ($inputPath == '')
throw new Exception('Input file not specified');
if ($outputFormat == '')
throw new Exception('Format not specified');
//build URI
$strURI = Product::$baseProductUri . '/imaging/' . $this->getFileName() . '/saveAs?format=' . $outputFormat;
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::uploadFileBinary($signedURI, $inputPath, 'xml', 'POST');
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
if ($outputFormat == 'html') {
|
php
|
{
"resource": ""
}
|
q509
|
ProductsServiceProvider.bindRepositories
|
train
|
protected function bindRepositories()
{
$bindings = [
AttributeRepositoryContract::class => AttributeRepository::class,
AttributeValueRepositoryContract::class => AttributeValueRepository::class,
ProductRepositoryContract::class => ProductRepository::class,
ProductTypeRepositoryContract::class
|
php
|
{
"resource": ""
}
|
q510
|
InterestAmount.collect
|
train
|
public function collect(
Quote $quote,
ShippingAssignmentInterface $shippingAssignment,
Total $total
) {
parent::collect($quote, $shippingAssignment, $total);
$baseInterest = (float) $quote->getBaseGabrielqsInstallmentsInterestAmount();
$interest = (float) $quote->getGabrielqsInstallmentsInterestAmount();
$total->addTotalAmount('gabrielqs_installments_interest_amount', $interest);
|
php
|
{
"resource": ""
}
|
q511
|
Method.checkPermission
|
train
|
public function checkPermission($method, $context)
{
if (!is_string($method)) {
throw new \TypeError('The method parameter must be a string.');
}
if (!$method) {
|
php
|
{
"resource": ""
}
|
q512
|
Ip.checkPermission
|
train
|
public function checkPermission($ip, $context)
{
if (!is_string($ip)) {
throw new \TypeError('The ip parameter must be a string.');
}
if (!$ip) {
throw new \InvalidArgumentException('The ip parameter cannot be empty.');
}
|
php
|
{
"resource": ""
}
|
q513
|
InterestAmount.initTotals
|
train
|
public function initTotals()
{
if ($value = $this->_getInterestAmount()) {
$installmentInterest = new DataObject(
[
'code' => 'gabrielqs_installments_interest_amount',
'strong' => false,
'value' => $value,
'label' => __('Interest'),
|
php
|
{
"resource": ""
}
|
q514
|
Host.checkPermission
|
train
|
public function checkPermission($host, $context)
{
if (!is_string($host)) {
throw new \TypeError('The host parameter must be a string.');
}
if (!$host) {
throw new \InvalidArgumentException('The host parameter cannot be empty.');
|
php
|
{
"resource": ""
}
|
q515
|
ModuleContainer.loadConfig
|
train
|
public function loadConfig()
{
$path = $this->getConfigPath();
if (!is_dir($path)) {
return [];
}
$configs = Cache::remember("moduleConfig::{$path}", Carbon::now()->addMinutes(10), function () use ($path) {
$configs = [];
foreach (new \DirectoryIterator($path) as $file) {
if ($file->isDot() or strpos($file->getFilename(), '.php') === false) {
continue;
}
|
php
|
{
"resource": ""
}
|
q516
|
Folder.fileExists
|
train
|
public function fileExists($fileName, $storageName = '')
{
//check whether file is set or not
if ($fileName == '') {
AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
throw new Exception(Exception::MSG_NO_FILENAME);
}
//build URI
$strURI = $this->strURIExist . $fileName;
if ($storageName != '') {
$strURI .= '?storage=' . $storageName;
}
//sign URI
|
php
|
{
"resource": ""
}
|
q517
|
Folder.deleteFile
|
train
|
public function deleteFile($fileName, $storageName = '')
{
//check whether file is set or not
if ($fileName == '') {
AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
throw new Exception(Exception::MSG_NO_FILENAME);
}
//build URI
$strURI = $this->strURIFile . $fileName;
if ($storageName != '') {
$strURI .= '?storage=' . $storageName;
}
//sign URI
|
php
|
{
"resource": ""
}
|
q518
|
Folder.createFolder
|
train
|
public function createFolder($strFolder, $storageName = '')
{
//build URI
$strURIRequest = $this->strURIFolder . $strFolder;
if ($storageName != '') {
$strURIRequest .= '?storage=' . $storageName;
}
//sign URI
$signedURI = Utils::sign($strURIRequest);
|
php
|
{
"resource": ""
}
|
q519
|
Folder.deleteFolder
|
train
|
public function deleteFolder($folderName, $recursive = false)
{
//check whether folder is set or not
if ($folderName == '')
throw new Exception('No folder name specified');
//build URI
$strURI = $this->strURIFolder . $folderName;
|
php
|
{
"resource": ""
}
|
q520
|
Folder.getFilesList
|
train
|
public function getFilesList($strFolder, $storageName = '')
{
//build URI
$strURI = $this->strURIFolder;
//check whether file is set or not
if (!$strFolder == '') {
$strURI .= $strFolder;
|
php
|
{
"resource": ""
}
|
q521
|
Converter.convertByUrl
|
train
|
public function convertByUrl($url = '', $format = '', $outputFilename = '')
{
//check whether file is set or not
if ($url == '')
throw new Exception('Url not specified');
$strURI = Product::$baseProductUri . '/pdf/convert?url=' . $url . '&format=' . $format;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'PUT', '', '');
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
if ($this->saveFormat == 'html') {
$saveFormat = 'zip';
|
php
|
{
"resource": ""
}
|
q522
|
Converter.convertLocalFile
|
train
|
public function convertLocalFile($inputFile = '', $outputFilename = '', $outputFormat = '')
{
//check whether file is set or not
if ($inputFile == '')
throw new Exception('No file name specified');
if ($outputFormat == '')
throw new Exception('output format not specified');
$strURI = Product::$baseProductUri . '/pdf/convert?format=' . $outputFormat;
if (!file_exists($inputFile)) {
throw new Exception('input file doesnt exist.');
|
php
|
{
"resource": ""
}
|
q523
|
Rule.compare
|
train
|
public static function compare(Rule $a, Rule $b, bool $checkTag = false): int
{
return Symbol::compare($a->subject, $b->subject)
|
php
|
{
"resource": ""
}
|
q524
|
UserCanBypassAccess.checkFlag
|
train
|
public function checkFlag(array $context): bool
{
if (!isset($context['user'])) {
throw new \InvalidArgumentException(sprintf('The context parameter must contain a "user" key to be able to evaluate the %s flag.', $this->getName()));
}
$user = $context['user'];
if (is_string($user)) { //Anonymous user
return false;
|
php
|
{
"resource": ""
}
|
q525
|
Cart.getMaximumInstallment
|
train
|
public function getMaximumInstallment()
{
if ($this->_maximumInstallment === null) {
$grandTotal = $this->getCartGrandTotal();
|
php
|
{
"resource": ""
}
|
q526
|
Import.read
|
train
|
public function read(string $filename): array
{
$lines = ['total' => 0, 'read' => 0];
// Open file as SPL object
$file = new \SplFileObject($filename);
// Read line by line
while (!$file->eof()) {
|
php
|
{
"resource": ""
}
|
q527
|
Import.parse
|
train
|
public function parse(): ConfigInterface
{
$config = new Config();
array_map(
function($line) use ($config) {
if (preg_match('/^(\S+)\ (.*)/', $line, $matches)) {
switch ($matches[1]) {
case 'push':
$config->addPush($matches[2]);
break;
case 'ca':
case 'cert':
case 'key':
case 'dh':
case 'tls-auth':
|
php
|
{
"resource": ""
}
|
q528
|
Document.getPageCount
|
train
|
public function getPageCount()
{
//build URI
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages';
//sign URI
|
php
|
{
"resource": ""
}
|
q529
|
Document.appendDocument
|
train
|
public function appendDocument($basePdf, $newPdf, $startPage = 0, $endPage = 0, $sourceFolder = '')
{
//check whether files are set or not
if ($basePdf == '')
throw new Exception('Base file not specified');
if ($newPdf == '')
throw new Exception('File to merge is not specified');
//build URI to merge PDFs
if ($sourceFolder == '')
$strURI = Product::$baseProductUri . '/pdf/' . $basePdf .
'/appendDocument?appendFile=' . $newPdf . ($startPage > 0 ? '&startPage=' . $startPage : '') .
($endPage > 0 ? '&endPage=' . $endPage : '');
else
$strURI = Product::$baseProductUri . '/pdf/' . $basePdf .
'/appendDocument?appendFile=' . $sourceFolder . '/' . $newPdf .
($startPage > 0 ? '&startPage=' . $startPage : '') .
($endPage > 0 ? '&endPage=' . $endPage : '') .
'&folder=' . $sourceFolder;
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'POST', '', '');
|
php
|
{
"resource": ""
}
|
q530
|
Document.mergeDocuments
|
train
|
public function mergeDocuments(array $sourceFiles = array())
{
$mergedFileName = $this->getFileName();
//check whether files are set or not
if ($mergedFileName == '')
throw new Exception('Output file not specified');
if (empty($sourceFiles))
throw new Exception('File to merge are not specified');
if (count($sourceFiles) < 2)
throw new Exception('Two or more files are requred to merge');
//Build JSON to post
$documentsList = array('List' => $sourceFiles);
$json = json_encode($documentsList);
$strURI =
|
php
|
{
"resource": ""
}
|
q531
|
Document.getFormFieldCount
|
train
|
public function getFormFieldCount()
{
//build URI
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/fields';
//sign URI
|
php
|
{
"resource": ""
}
|
q532
|
Document.getFormField
|
train
|
public function getFormField($fieldName)
{
//build URI
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/fields/' . $fieldName;
//sign URI
$signedURI = Utils::sign($strURI);
//get response stream
|
php
|
{
"resource": ""
}
|
q533
|
Document.updateFormFields
|
train
|
public function updateFormFields(array $fieldArray, $documentFolder = '')
{
if (count($fieldArray) === 0)
throw new Exception('Field array cannot be empty');
//build URI
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/fields?folder=' . $documentFolder;
//sign URI
$signedURI = Utils::sign($strURI);
$postData = json_encode(array(
'List' => $fieldArray
));
//get response stream
$responseStream = Utils::processCommand($signedURI, 'PUT', 'JSON', $postData);
$json = json_decode($responseStream);
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
//Save docs on server
|
php
|
{
"resource": ""
}
|
q534
|
Document.updateFormField
|
train
|
public function updateFormField($fieldName, $fieldType, $fieldValue)
{
if ($fieldName == '')
throw new Exception('Field name not specified');
if ($fieldType == '')
throw new Exception('Field type not specified');
if ($fieldValue == '')
throw new Exception('Field value not specified');
//build URI
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/fields/' . $fieldName;
|
php
|
{
"resource": ""
}
|
q535
|
Document.getDocumentProperties
|
train
|
public function getDocumentProperties()
{
//build URI to replace image
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/documentProperties';
|
php
|
{
"resource": ""
}
|
q536
|
Document.getDocumentProperty
|
train
|
public function getDocumentProperty($propertyName = '')
{
if ($propertyName == '')
throw new Exception('Property name not specified');
//build URI to replace image
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/documentProperties/' . $propertyName;
//sign URI
$signedURI = Utils::sign($strURI);
|
php
|
{
"resource": ""
}
|
q537
|
Document.setDocumentProperty
|
train
|
public function setDocumentProperty($propertyName = '', $propertyValue = '')
{
if ($propertyName == '')
throw new Exception('Property name not specified');
//build URI to replace image
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/documentProperties/' . $propertyName;
$putArray['Value'] = $propertyValue;
$json = json_encode($putArray);
|
php
|
{
"resource": ""
}
|
q538
|
Document.splitPages
|
train
|
public function splitPages($from, $to)
{
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/split?from=' . $from . '&to=' . $to;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'POST', '', '');
$json = json_decode($responseStream);
$dispatcher = AsposeApp::getEventDispatcher();
$pageNumber = 1;
foreach ($json->Result->Documents as $splitPage) {
$splitFileName = basename($splitPage->Href);
$strURI = Product::$baseProductUri . '/storage/file/' . $splitFileName;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
|
php
|
{
"resource": ""
}
|
q539
|
Message.setClient
|
train
|
public function setClient($client)
{
if ($client instanceof Client && $this->client != $client) {
|
php
|
{
"resource": ""
}
|
q540
|
Message.setChannel
|
train
|
public function setChannel($channel)
{
$this->removeTarget();
if ($channel) {
|
php
|
{
"resource": ""
}
|
q541
|
Message.setUser
|
train
|
public function setUser($user)
{
$this->removeTarget();
if ($user) {
|
php
|
{
"resource": ""
}
|
q542
|
Message.setAttachmentDefaults
|
train
|
public function setAttachmentDefaults($defaults)
{
if ($this->attachmentDefaults != ($defaults = (array) $defaults)) {
$this->attachmentDefaults = $defaults;
|
php
|
{
"resource": ""
}
|
q543
|
Message.getAttachmentPayload
|
train
|
protected function getAttachmentPayload($text = null, $title = null, $images = null, $color = null)
{
$attachment = [];
if ($text) {
$attachment['text'] = $this->stringValue($text);
}
if ($title) {
$attachment['title'] = $this->stringValue($title);
|
php
|
{
"resource": ""
}
|
q544
|
Message.getImagesPayload
|
train
|
protected function getImagesPayload($value)
{
$images = [];
foreach ((array) $value as $img) {
if (! empty($img['url'])) {
$img = $img['url'];
}
|
php
|
{
"resource": ""
}
|
q545
|
Message.stringValue
|
train
|
protected function stringValue($value, $jsonOptions = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
{
if (is_string($value)) {
return $value;
}
if (method_exists($value, '__toString')) {
return (string) $value;
|
php
|
{
"resource": ""
}
|
q546
|
Message.addImage
|
train
|
public function addImage($image, $desc = null, $title =
|
php
|
{
"resource": ""
}
|
q547
|
Message.configureDefaults
|
train
|
public function configureDefaults(array $defaults, $force = false)
{
if ($force || empty($this->toArray())) {
$attachmentDefaults = $this->attachmentDefaults;
foreach (MessageDefaults::allKeys() as $key) {
if (isset($defaults[$key]) && ! is_null($value = $defaults[$key])) {
if (strpos($key, 'attachment_') !== false) {
if ($key = substr($key, strlen('attachment_'))) {
|
php
|
{
"resource": ""
}
|
q548
|
Message.fillDefaults
|
train
|
protected function fillDefaults($key, $value)
{
if (
($key === MessageDefaults::USER || $key === MessageDefaults::CHANNEL) &&
(! is_null($this->getTarget()))
) {
return;
}
if ($suffix = $this->studlyCase($key)) {
|
php
|
{
"resource": ""
}
|
q549
|
Message.content
|
train
|
public function content()
{
$arguments = func_get_args();
$count = count($arguments);
if ($count > 0) {
$this->setText($arguments[0]);
}
if ($count > 1) {
if (is_bool($arguments[1])) {
|
php
|
{
"resource": ""
}
|
q550
|
Message.toArray
|
train
|
public function toArray()
{
return array_filter(
[
'text' => $this->getText(),
'notification' => $this->getNotification(),
'markdown' => $this->getMarkdown(),
'channel' => $this->getChannel(),
'user' => $this->getUser(),
'attachments' => $this->getAttachments(),
],
function ($value, $key) {
|
php
|
{
"resource": ""
}
|
q551
|
AttributeRepository.syncWithProductType
|
train
|
public function syncWithProductType(ProductTypeContract $productType, $attributeIds, array $requiredAttributes = [])
{
$attributeIds = is_array($attributeIds) ? $attributeIds : [$attributeIds];
$pivot = [];
foreach ($attributeIds as $id) {
|
php
|
{
"resource": ""
}
|
q552
|
LeaderBoard.getData
|
train
|
public function getData($order = self::SORT_DESC)
{
return array(
'items' => array_map(
function (Item $item) {
/*
* @var Item $item
*/
|
php
|
{
"resource": ""
}
|
q553
|
Config.generate
|
train
|
public function generate(): string
{
// Init the variable
$config = '';
foreach ($this->getParams() as $key => $value) {
$config .= $key . ((\strlen($value) > 0) ? ' ' . $value : '') . "\n";
}
$certs = $this->getCerts();
if (\count($certs) > 0) {
$config .= "\n### Certificates\n";
foreach ($this->getCerts() as $key => $value) {
$config .= isset($value['content'])
? "<$key>\n{$value['content']}\n</$key>\n"
|
php
|
{
"resource": ""
}
|
q554
|
Config.addCert
|
train
|
public function addCert(string $type, string $pathOrContent, bool $isContent = false): ConfigInterface
{
$type = mb_strtolower($type);
$this->throwIfNotInArray($type, self::CERTS);
if (true === $isContent) {
|
php
|
{
"resource": ""
}
|
q555
|
Config.delCert
|
train
|
public function delCert(string $type): ConfigInterface
{
$type = mb_strtolower($type);
$this->throwIfNotInArray($type,
|
php
|
{
"resource": ""
}
|
q556
|
Config.getCert
|
train
|
public function getCert(string $type): array
{
$type = mb_strtolower($type);
$this->throwIfNotInArray($type,
|
php
|
{
"resource": ""
}
|
q557
|
Config.add
|
train
|
public function add(string $name, $value = null): ConfigInterface
{
$name = mb_strtolower($name);
// Check if key is certificate or push, or classic parameter
if (\in_array($name, self::CERTS, true)) {
$this->addCert($name, $value);
} elseif ($name === 'push') {
|
php
|
{
"resource": ""
}
|
q558
|
Config.del
|
train
|
public function del(string $name): ConfigInterface
{
// Check if key is certificate or push, or classic parameter
if (\in_array($name, self::CERTS, true)) {
$this->delCert($name);
} elseif ($name === 'push') {
|
php
|
{
"resource": ""
}
|
q559
|
Document.getStats
|
train
|
public function getStats(array $options = array())
{
$resolver = new OptionsResolver();
$resolver
->setDefaults(array(
'includeTextInShapes' => 'true',
))
->setDefined(array(
'includeFootnotes', 'includeComments',
))
;
$options = $resolver->resolve($options);
//build URI to get document statistics including resolved parameters
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/statistics?' . http_build_query($options);
AsposeApp::getLogger()->info('WordsDocument getStats call will be made', array(
'call-uri' => $strURI,
));
//sign URI
|
php
|
{
"resource": ""
}
|
q560
|
Document.appendDocument
|
train
|
public function appendDocument($appendDocs, $importFormatModes, $sourceFolder)
{
//check whether required information is complete
if (count($appendDocs) != count($importFormatModes))
throw new Exception('Please specify complete documents and import format modes');
$post_array = array();
$i = 0;
foreach ($appendDocs as $doc) {
$post_array[] = array("Href" => (($sourceFolder != "" ) ? $sourceFolder . "\\" . $doc : $doc), "ImportFormatMode" => $importFormatModes[$i]);
$i++;
}
$data = array("DocumentEntries" => $post_array);
$json = json_encode($data);
|
php
|
{
"resource": ""
}
|
q561
|
Document.unprotectDocument
|
train
|
public function unprotectDocument(array $options)
{
$resolver = new OptionsResolver();
$resolver->setRequired('Password')
->setDefaults(array(
'ProtectionType' => 'AllowOnlyComments'
))
->setAllowedValues('ProtectionType', array(
'AllowOnlyComments',
'AllowOnlyFormFields',
'AllowOnlyRevisions',
'ReadOnly',
'NoProtection',
));
$options = $resolver->resolve($options);
$json = json_encode($options);
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/protection';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'DELETE', 'json', $json);
$v_output = Utils::validateOutput($responseStream);
|
php
|
{
"resource": ""
}
|
q562
|
Document.updateProtection
|
train
|
public function updateProtection($oldPassword, $newPassword, $protectionType = 'AllowOnlyComments')
{
if ($oldPassword == '') {
throw new Exception('Please Specify Old Password');
}
if ($newPassword == '') {
throw new Exception('Please Specify New Password');
}
$fieldsArray = array('Password' => $oldPassword, 'NewPassword' => $newPassword, 'ProtectionType' => $protectionType);
$json = json_encode($fieldsArray);
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/protection';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'POST', 'json', $json);
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
$strURI = Product::$baseProductUri .
|
php
|
{
"resource": ""
}
|
q563
|
Document.getPageSetup
|
train
|
public function getPageSetup($sectionid = '')
{
if ($sectionid == '')
throw new Exception('No Section Id specified');
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/sections/'.$sectionid.'/pageSetup';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET','');
$json = json_decode($responseStream);
|
php
|
{
"resource": ""
}
|
q564
|
Document.getAllParagraphs
|
train
|
public function getAllParagraphs()
{
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/paragraphs';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET','');
$json = json_decode($responseStream);
if ($json->Code == 200) {
|
php
|
{
"resource": ""
}
|
q565
|
Document.getParagraph
|
train
|
public function getParagraph($paragraphid = '')
{
if ($paragraphid == '')
throw new Exception('No Paragraph Id specified');
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/paragraphs/'.$paragraphid.'';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET','');
$json = json_decode($responseStream);
|
php
|
{
"resource": ""
}
|
q566
|
Document.updateParagraphRunFont
|
train
|
public function updateParagraphRunFont($options_xml = '', $paragraphid = '', $runid = '')
{
if ($options_xml == '')
throw new Exception('Options not specified.');
if ($paragraphid == '')
throw new Exception('No Paragraph Id specified');
if ($runid == '')
throw new Exception('No Run Id specified');
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/paragraphs/'.$paragraphid.'/runs/'.$runid.'/font';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'POST', 'XML', $options_xml,'json');
|
php
|
{
"resource": ""
}
|
q567
|
Document.getHyperlinks
|
train
|
public function getHyperlinks()
{
//build URI
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/hyperlinks';
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
if ($json->Code == 200)
|
php
|
{
"resource": ""
}
|
q568
|
Document.getHyperlink
|
train
|
public function getHyperlink($hyperlinkIndex)
{
if ($hyperlinkIndex == '')
throw new Exception('Hyperlink index not specified');
//build URI
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/hyperlinks/' . $hyperlinkIndex;
//sign URI
|
php
|
{
"resource": ""
}
|
q569
|
Document.getBookmarks
|
train
|
public function getBookmarks()
{
//build URI
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/bookmarks';
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
|
php
|
{
"resource": ""
}
|
q570
|
Document.getBookmark
|
train
|
public function getBookmark($bookmarkName)
{
if ($bookmarkName == '')
throw new Exception('Bookmark name not specified');
//build URI
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/bookmarks/' . $bookmarkName;
//sign URI
|
php
|
{
"resource": ""
}
|
q571
|
Document.updateBookmark
|
train
|
public function updateBookmark($bookmarkName, $bookmarkText)
{
if ($bookmarkName == '')
throw new Exception('Bookmark name not specified');
if ($bookmarkText == '')
throw new Exception('Bookmark text not specified');
//build URI
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/bookmarks/' . $bookmarkName;
//sign URI
$signedURI = Utils::sign($strURI);
$post_data_arr['Text'] = $bookmarkText;
$postData = json_encode($post_data_arr);
$responseStream = Utils::processCommand($signedURI, 'POST', 'JSON', $postData);
|
php
|
{
"resource": ""
}
|
q572
|
Extractor.getComments
|
train
|
public function getComments($slideNo = '', $storageName = '', $folder = '')
{
//check whether file is set or not
if ($slideNo == '')
throw new Exception('Missing required parameter slideNo');
$strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNo . '/comments';
if ($folder != '') {
$strURI .= '?folder=' . $folder;
}
if ($storageName != '') {
$strURI .= '&storage=' . $storageName;
|
php
|
{
"resource": ""
}
|
q573
|
Extractor.getImageCount
|
train
|
public function getImageCount($storageName = '', $folder = '')
{
$strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/images';
if ($folder != '') {
$strURI .= '?folder=' . $folder;
|
php
|
{
"resource": ""
}
|
q574
|
Extractor.getShapes
|
train
|
public function getShapes($slidenumber, $storageName = '', $folder = '')
{
$strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slidenumber . '/shapes';
if ($folder != '') {
$strURI .= '?folder=' . $folder;
}
if ($storageName != '') {
$strURI .= '&storage=' . $storageName;
|
php
|
{
"resource": ""
}
|
q575
|
Extractor.getShape
|
train
|
public function getShape($slideNumber, $shapeIndex, $storageName = '', $folderName = '') {
$strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '/shapes/' . $shapeIndex;
if ($folderName != '') {
$strURI .= '?folder=' . $folderName;
}
if ($storageName != '') {
$strURI .= '&storage=' . $storageName;
}
$signedURI = Utils::sign($strURI);
|
php
|
{
"resource": ""
}
|
q576
|
Extractor.getColorScheme
|
train
|
public function getColorScheme($slideNumber, $storageName = '')
{
//Build URI to get color scheme
$strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '/theme/colorScheme';
if ($storageName != '') {
$strURI .= '?storage=' . $storageName;
|
php
|
{
"resource": ""
}
|
q577
|
Extractor.getFontScheme
|
train
|
public function getFontScheme($slideNumber, $storageName = '')
{
//Build URI to get font scheme
$strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '/theme/fontScheme';
if ($storageName != '') {
$strURI .= '?storage=' . $storageName;
|
php
|
{
"resource": ""
}
|
q578
|
Extractor.getFormatScheme
|
train
|
public function getFormatScheme($slideNumber, $storageName = '')
{
//Build URI to get format scheme
$strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '/theme/formatScheme';
if ($storageName != '') {
$strURI .= '?storage=' . $storageName;
|
php
|
{
"resource": ""
}
|
q579
|
Extractor.getPlaceholderCount
|
train
|
public function getPlaceholderCount($slideNumber, $storageName = '', $folder = '')
{
$strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '/placeholders';
if ($folder != '') {
$strURI .= '?folder=' . $folder;
}
if ($storageName != '') {
$strURI .= '&storage=' . $storageName;
}
//Build URI to get placeholders
$signedURI
|
php
|
{
"resource": ""
}
|
q580
|
Extractor.getPlaceholder
|
train
|
public function getPlaceholder($slideNumber, $placeholderIndex, $storageName = '', $folder = '')
{
$strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '/placeholders/' . $placeholderIndex;
if ($folder != '') {
$strURI .= '?folder=' . $folder;
}
if ($storageName != '') {
$strURI .= '&storage=' . $storageName;
}
|
php
|
{
"resource": ""
}
|
q581
|
Assignment.getAssignments
|
train
|
public function getAssignments()
{
//build URI
$strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/assignments/';
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
|
php
|
{
"resource": ""
}
|
q582
|
Assignment.getAssignment
|
train
|
public function getAssignment($assignmentId)
{
if ($assignmentId == '')
throw new Exception('Assignment ID not specified');
//build URI
$strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/assignments/' . $assignmentId;
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream
|
php
|
{
"resource": ""
}
|
q583
|
Assignment.addAssignment
|
train
|
public function addAssignment($taskUid, $resourceUid, $units, $changedFileName = '')
{
if ($taskUid == '')
throw new Exception('Task Uid not specified');
if ($resourceUid == '')
throw new Exception('Resource Uid not specified');
//build URI
$strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/assignments?taskUid=' . $taskUid . '&resourceUid=' . $resourceUid . '&units' . $units;
if ($changedFileName != '') {
$strURI .= '&fileName=' . $changedFileName;
$this->setFileName($changedFileName);
}
//sign URI
$signedURI = Utils::sign($strURI);
|
php
|
{
"resource": ""
}
|
q584
|
Document.getTasks
|
train
|
public function getTasks()
{
//build URI
$strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/tasks';
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
|
php
|
{
"resource": ""
}
|
q585
|
Document.getTask
|
train
|
public function getTask($taskId)
{
if ($taskId == '')
throw new Exception('Task ID not specified');
//build URI
$strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/tasks/' . $taskId;
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream
|
php
|
{
"resource": ""
}
|
q586
|
Document.addLink
|
train
|
public function addLink($link, $index, $predecessorUid, $successorUid, $linkType, $lag, $lagFormat)
{
if ($link == '')
throw new Exception('Link not specified');
if ($index == '')
throw new Exception('Index not specified');
if ($predecessorUid == '')
throw new Exception('Predecessor UID not specified');
if ($successorUid == '')
throw new Exception('Successor UID not specified');
if ($linkType == '')
throw new Exception('Link Type not specified');
if (!isset($lag))
throw new Exception('Lag not specified');
if ($lagFormat == '')
throw new Exception('Lag Format not specified');
//build URI
$strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/taskLinks';
//sign URI
$signedURI = Utils::sign($strURI);
$data =
|
php
|
{
"resource": ""
}
|
q587
|
Document.getOutlineCode
|
train
|
public function getOutlineCode($outlineCodeId)
{
if ($outlineCodeId == '')
throw new Exception('Outline Code ID not specified');
//build URI
$strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/outlineCodes/' . $outlineCodeId;
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream
|
php
|
{
"resource": ""
}
|
q588
|
Document.getExtendedAttribute
|
train
|
public function getExtendedAttribute($extendedAttributeId)
{
if ($extendedAttributeId == '')
throw new Exception('Extended Attribute ID not specified');
//build URI
$strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/extendedAttributes/' . $extendedAttributeId;
//sign URI
$signedURI = Utils::sign($strURI);
|
php
|
{
"resource": ""
}
|
q589
|
Document.deleteExtendedAttribute
|
train
|
public function deleteExtendedAttribute($extendedAttributeId, $changedFileName)
{
if ($extendedAttributeId == '')
throw new Exception('Extended Attribute ID not specified');
//build URI
$strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/extendedAttributes/' . $extendedAttributeId;
if ($changedFileName != '') {
$strURI .= '?fileName=' . $changedFileName;
$this->setFileName($changedFileName);
}
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'DELETE', '', '');
$v_output = Utils::validateOutput($responseStream);
|
php
|
{
"resource": ""
}
|
q590
|
BaseRule.compareTag
|
train
|
public static function compareTag(?string $a, ?string $b): int
{
if (null === $a) {
return null ===
|
php
|
{
"resource": ""
}
|
q591
|
Document.updateBMPPropertiesFromLocalFile
|
train
|
public function updateBMPPropertiesFromLocalFile($inputPath, $bitsPerPixel, $horizontalResolution, $verticalResolution, $outPath)
{
//check whether files are set or not
if ($inputPath == '')
throw new Exception('Input file not specified');
if ($bitsPerPixel == '')
throw new Exception('Color Depth not specified');
if ($horizontalResolution == '')
throw new Exception('Horizontal Resolution not specified');
if ($verticalResolution == '')
throw new Exception('Vertical Resolution not specified');
if ($outPath == '')
throw new Exception('Output file name not specified');
//build URI
$strURI = Product::$baseProductUri . '/imaging/bmp?bitsPerPixel=' . $bitsPerPixel . '&horizontalResolution=' . $horizontalResolution
|
php
|
{
"resource": ""
}
|
q592
|
Document.updateGIFProperties
|
train
|
public function updateGIFProperties($backgroundColorIndex, $pixelAspectRatio, $interlaced, $outPath)
{
if ($backgroundColorIndex == '')
throw new Exception('Background color index not specified');
if ($pixelAspectRatio == '')
throw new Exception('Pixel aspect ratio not specified');
if ($outPath == '')
throw new Exception('Output file name not specified');
//build URI
$strURI = Product::$baseProductUri . '/imaging/' . $this->getFileName()
|
php
|
{
"resource": ""
}
|
q593
|
Document.updateGIFPropertiesFromLocalFile
|
train
|
public function updateGIFPropertiesFromLocalFile($inputPath, $backgroundColorIndex, $pixelAspectRatio, $interlaced, $outPath)
{
//check whether files are set or not
if ($inputPath == '')
throw new Exception('Input file not specified');
if ($backgroundColorIndex == '')
throw new Exception('Background color index not specified');
if ($pixelAspectRatio == '')
throw new Exception('Pixel aspect ratio not specified');
if ($outPath == '')
throw new Exception('Output file name not specified');
//build URI
$strURI = Product::$baseProductUri . '/imaging/gif?backgroundColorIndex=' . $backgroundColorIndex . '&pixelAspectRatio=' . $pixelAspectRatio;
|
php
|
{
"resource": ""
}
|
q594
|
Document.updateJPGPropertiesFromLocalFile
|
train
|
public function updateJPGPropertiesFromLocalFile($inputPath, $quality, $compressionType, $outPath)
{
//check whether files are set or not
if ($inputPath == '')
throw new Exception('Input file not specified');
if ($quality == '')
throw new Exception('Quality not specified');
if ($compressionType == '')
throw new Exception('Compression Type not specified');
if ($outPath == '')
throw new Exception('Output file name not specified');
//build URI
$strURI = Product::$baseProductUri . '/imaging/jpg?quality=' . $quality . '&compressionType=' . $compressionType . '&outPath=' . $outPath;
//sign URI
|
php
|
{
"resource": ""
}
|
q595
|
Document.updateTIFFPropertiesFromLocalFile
|
train
|
public function updateTIFFPropertiesFromLocalFile($inputPath, $compression, $resolutionUnit, $newWidth, $newHeight, $horizontalResolution, $verticalResolution, $outPath)
{
if ($inputPath == '')
throw new Exception('Input file not specified');
if ($compression == '')
throw new Exception('Compression not specified');
if ($resolutionUnit == '')
throw new Exception('Resolution unit not specified');
if ($newWidth == '')
throw new Exception('New image width not specified');
if ($newHeight == '')
throw new Exception('New image height not specified');
if ($horizontalResolution == '')
throw new Exception('Horizontal resolution not specified');
if ($verticalResolution == '')
throw new Exception('Vertical resolution not specified');
if ($outPath == '')
throw new Exception('Output file name not specified');
|
php
|
{
"resource": ""
}
|
q596
|
Document.updatePSDPropertiesFromLocalFile
|
train
|
public function updatePSDPropertiesFromLocalFile($inputPath, $channelsCount, $compression, $outPath)
{
if ($channelsCount == '')
throw new Exception('Channels count not specified');
if ($compression == '')
throw new Exception('Compression method not specified');
if ($outPath == '')
throw new Exception('Output file name not specified');
//build URI
$strURI = Product::$baseProductUri . '/imaging/psd?channelsCount=' . $channelsCount . '&compression=' . $compression . '&outPath=' . $outPath;
//sign URI
$signedURI = Utils::sign($strURI);
|
php
|
{
"resource": ""
}
|
q597
|
LogicalAuthorizationExtension.checkRouteAccess
|
train
|
public function checkRouteAccess(string $routeName, $user = null): bool
|
php
|
{
"resource": ""
}
|
q598
|
LogicalAuthorizationExtension.checkModelAccess
|
train
|
public function checkModelAccess($model, string $action, $user = null):
|
php
|
{
"resource": ""
}
|
q599
|
LogicalAuthorizationExtension.checkFieldAccess
|
train
|
public function checkFieldAccess($model, string $fieldName, string $action, $user =
|
php
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.