_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 83
13k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q600 | Grammar.getRulesFor | train | public function getRulesFor(Symbol $subject): array
{
$rules = [];
if (!$subject->isTerminal()) {
foreach ($this->rules as $rule) {
if (0 === Symbol::compare($rule->getSubject(), $subject)) {
$rules[] = $rule;
}
}
}
return $rules;
} | php | {
"resource": ""
} |
q601 | Document.getAttachment | train | public function getAttachment($attachmentName)
{
if ($attachmentName == '')
throw new Exception('Attachment Name not specified');
//build URI
$strURI = Product::$baseProductUri . '/email/' . $this->getFileName() . '/attachments/' . $attachmentName;
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
$outputFilename = $attachmentName;
Utils::saveFile($responseStream, AsposeApp::$outPutLocation . $outputFilename);
return $outputFilename;
} else {
return $v_output;
}
} | php | {
"resource": ""
} |
q602 | LineChart.addItem | train | public function addItem($item)
{
if (!is_numeric($item)) {
throw new \InvalidArgumentException(sprintf("Value '%s' must be a numeric value", $item));
}
$this->items[] = $item;
return $this;
} | php | {
"resource": ""
} |
q603 | LineChart.setColour | train | public function setColour($colour)
{
if (!preg_match('/^[a-f0-9]{6}$/i', $colour)) {
throw new \InvalidArgumentException(sprintf('Value %s must be a valid hex colour', $colour));
}
$this->colour = $colour;
return $this;
} | php | {
"resource": ""
} |
q604 | LineChart.getColour | train | public function getColour()
{
if (null === $this->colour) {
$this->colour = self::DEFAULT_COLOUR;
}
return $this->colour;
} | php | {
"resource": ""
} |
q605 | LineChart.setAxis | train | public function setAxis($dimension, $labels)
{
foreach ($labels as $label) {
$this->addLabel($dimension, $label);
}
return $this;
} | php | {
"resource": ""
} |
q606 | LineChart.addLabel | train | protected function addLabel($dimension, $label)
{
if (!in_array($dimension, array(self::DIMENSION_X, self::DIMENSION_Y))) {
throw new \InvalidArgumentException(sprintf("Value '%s' is not a valid dimension", $dimension));
}
$this->axis[$dimension][] = $label;
} | php | {
"resource": ""
} |
q607 | LineChart.getAxis | train | public function getAxis()
{
if (null === $this->axis) {
$this->axis[self::DIMENSION_X] = array();
$this->axis[self::DIMENSION_Y] = array();
}
return $this->axis;
} | php | {
"resource": ""
} |
q608 | DocumentBuilder.removeWatermark | train | public function removeWatermark($fileName)
{
//check whether files are set or not
if ($fileName == '')
throw new Exception('File not specified');
//build URI to insert watermark image
$strURI = Product::$baseProductUri . '/words/' . $fileName .
'/watermark';
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'DELETE', '', '');
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
//Save doc on server
$folder = new Folder();
$outputStream = $folder->GetFile($fileName);
$outputPath = AsposeApp::$outPutLocation . $fileName;
Utils::saveFile($outputStream, $outputPath);
return $outputPath;
} else
return $v_output;
} | php | {
"resource": ""
} |
q609 | DocumentBuilder.insertWatermarkText | train | public function insertWatermarkText($fileName, $text, $rotationAngle)
{
//check whether files are set or not
if ($fileName == '')
throw new Exception('File not specified');
//Build JSON to post
$fieldsArray = array('Text' => $text, 'RotationAngle' => $rotationAngle);
$json = json_encode($fieldsArray);
//build URI to insert watermark text
$strURI = Product::$baseProductUri . '/words/' . $fileName . '/watermark/insertText';
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'POST', 'json', $json);
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
//Save docs on server
$folder = new Folder();
$outputStream = $folder->GetFile($fileName);
$outputPath = AsposeApp::$outPutLocation . $fileName;
Utils::saveFile($outputStream, $outputPath);
return $outputPath;
} else
return $v_output;
} | php | {
"resource": ""
} |
q610 | DocumentBuilder.replaceText | train | public function replaceText($fileName, $oldValue, $newValue, $isMatchCase, $isMatchWholeWord)
{
//check whether files are set or not
if ($fileName == '')
throw new Exception('File not specified');
//Build JSON to post
$fieldsArray = array('OldValue' => $oldValue, 'NewValue' => $newValue,
'IsMatchCase' => $isMatchCase, 'IsMatchWholeWord' => $isMatchWholeWord);
$json = json_encode($fieldsArray);
//build URI to replace text
$strURI = Product::$baseProductUri . '/words/' . $fileName . '/replaceText';
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'POST', 'json', $json);
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
//Save docs on server
$folder = new Folder();
$outputStream = $folder->GetFile($fileName);
$outputPath = AsposeApp::$outPutLocation . $fileName;
Utils::saveFile($outputStream, $outputPath);
return $outputPath;
} else
return $v_output;
} | php | {
"resource": ""
} |
q611 | DestroyAttributeValue.handle | train | public function handle(AttributeValueRepository $attributeValueRepository, Dispatcher $event)
{
$attributeValue = $attributeValueRepository->find($this->id);
$attributeValueRepository->destroy($attributeValue);
$event->fire(new AttributeValueWasDestroyed($attributeValue));
return $attributeValue;
} | php | {
"resource": ""
} |
q612 | Validator.cleanUp | train | static function cleanUp( $string ) {
if ( NORMALIZE_INTL ) {
$string = self::replaceForNativeNormalize( $string );
$norm = normalizer_normalize( $string, Normalizer::FORM_C );
if ( $norm === null || $norm === false ) {
# normalizer_normalize will either return false or null
# (depending on which doc you read) if invalid utf8 string.
# quickIsNFCVerify cleans up invalid sequences.
if ( self::quickIsNFCVerify( $string ) ) {
# if that's true, the string is actually already normal.
return $string;
} else {
# Now we are valid but non-normal
return normalizer_normalize( $string, Normalizer::FORM_C );
}
} else {
return $norm;
}
} elseif ( self::quickIsNFCVerify( $string ) ) {
# Side effect -- $string has had UTF-8 errors cleaned up.
return $string;
} else {
return self::NFC( $string );
}
} | php | {
"resource": ""
} |
q613 | Validator.toNFC | train | static function toNFC( $string ) {
if ( NORMALIZE_INTL ) {
return normalizer_normalize( $string, Normalizer::FORM_C );
} elseif ( self::quickIsNFC( $string ) ) {
return $string;
} else {
return self::NFC( $string );
}
} | php | {
"resource": ""
} |
q614 | Validator.toNFD | train | static function toNFD( $string ) {
if ( NORMALIZE_INTL ) {
return normalizer_normalize( $string, Normalizer::FORM_D );
} elseif ( preg_match( '/[\x80-\xff]/', $string ) ) {
return self::NFD( $string );
} else {
return $string;
}
} | php | {
"resource": ""
} |
q615 | Validator.toNFKC | train | static function toNFKC( $string ) {
if ( NORMALIZE_INTL ) {
return normalizer_normalize( $string, Normalizer::FORM_KC );
} elseif ( preg_match( '/[\x80-\xff]/', $string ) ) {
return self::NFKC( $string );
} else {
return $string;
}
} | php | {
"resource": ""
} |
q616 | Validator.toNFKD | train | static function toNFKD( $string ) {
if ( NORMALIZE_INTL ) {
return normalizer_normalize( $string, Normalizer::FORM_KD );
} elseif ( preg_match( '/[\x80-\xff]/', $string ) ) {
return self::NFKD( $string );
} else {
return $string;
}
} | php | {
"resource": ""
} |
q617 | Validator.fastCombiningSort | train | static function fastCombiningSort( $string ) {
self::loadData();
$len = strlen( $string );
$out = '';
$combiners = [];
$lastClass = -1;
for ( $i = 0; $i < $len; $i++ ) {
$c = $string[$i];
$n = ord( $c );
if ( $n >= 0x80 ) {
if ( $n >= 0xf0 ) {
$c = substr( $string, $i, 4 );
$i += 3;
} elseif ( $n >= 0xe0 ) {
$c = substr( $string, $i, 3 );
$i += 2;
} elseif ( $n >= 0xc0 ) {
$c = substr( $string, $i, 2 );
$i++;
}
if ( isset( self::$utfCombiningClass[$c] ) ) {
$lastClass = self::$utfCombiningClass[$c];
if ( isset( $combiners[$lastClass] ) ) {
$combiners[$lastClass] .= $c;
} else {
$combiners[$lastClass] = $c;
}
continue;
}
}
if ( $lastClass ) {
ksort( $combiners );
$out .= implode( '', $combiners );
$combiners = [];
}
$out .= $c;
$lastClass = 0;
}
if ( $lastClass ) {
ksort( $combiners );
$out .= implode( '', $combiners );
}
return $out;
} | php | {
"resource": ""
} |
q618 | Validator.placebo | train | static function placebo( $string ) {
$len = strlen( $string );
$out = '';
for ( $i = 0; $i < $len; $i++ ) {
$out .= $string[$i];
}
return $out;
} | php | {
"resource": ""
} |
q619 | Validator.replaceForNativeNormalize | train | private static function replaceForNativeNormalize( $string ) {
$string = preg_replace(
'/[\x00-\x08\x0b\x0c\x0e-\x1f]/',
Constants::UTF8_REPLACEMENT,
$string );
$string = str_replace( Constants::UTF8_FFFE, Constants::UTF8_REPLACEMENT, $string );
$string = str_replace( Constants::UTF8_FFFF, Constants::UTF8_REPLACEMENT, $string );
return $string;
} | php | {
"resource": ""
} |
q620 | Redirects.seeRedirectBetween | train | public function seeRedirectBetween($oldUrl, $newUrl, $statusCode)
{
// We must not follow all redirects, so save current situation,
// force disable follow redirects, and revert at the end.
$followsRedirects = $this->isFollowingRedirects();
$this->followRedirects(false);
$response = $this->sendHeadAndGetResponse($oldUrl);
if (null !== $response) {
$responseCode = $response->getStatus();
$locationHeader = $response->getHeader('Location', true);
// Check for correct response code.
$this->assertEquals($statusCode, $responseCode, 'Response code was not ' . $statusCode . '.');
// Check location header URL contains submitted URL.
$this->assertContains($newUrl, $locationHeader, 'Redirect destination not found in Location header.');
}
$this->followRedirects($followsRedirects);
} | php | {
"resource": ""
} |
q621 | Redirects.urlDoesNotRedirect | train | public function urlDoesNotRedirect($url)
{
if ('/' === $url) {
$url = '';
}
// We must not follow all redirects, so save current situation,
// force disable follow redirects, and revert at the end.
$followsRedirects = $this->isFollowingRedirects();
$this->followRedirects(false);
$response = $this->sendHeadAndGetResponse($url);
if (null !== $response) {
$responseCode = $response->getStatus();
$locationHeader = $response->getHeader('Location', true);
// Check for 200 response code.
$this->assertEquals(200, $responseCode, 'Response code was not 200.');
// Check that destination URL does not try to redirect.
// Somewhat redundant, as this should never appear with a 200 HTTP Status code anyway.
$this->assertNull($locationHeader, 'Location header was found when it should not exist.');
}
$this->followRedirects($followsRedirects);
} | php | {
"resource": ""
} |
q622 | Redirects.sendHeadAndGetResponse | train | protected function sendHeadAndGetResponse($url)
{
/** @var REST $rest */
$rest = $this->getModule('REST');
$rest->sendHEAD($url);
return $rest->client->getInternalResponse();
} | php | {
"resource": ""
} |
q623 | FormFieldExtension.setCalendarConfig | train | public function setCalendarConfig($arg1, $arg2 = null)
{
if (is_array($arg1)) {
$this->calendarConfig = $arg1;
} else {
$this->calendarConfig[$arg1] = $arg2;
}
return $this;
} | php | {
"resource": ""
} |
q624 | FormFieldExtension.getCalendarConfig | train | public function getCalendarConfig($name = null)
{
if (!is_null($name)) {
return isset($this->calendarConfig[$name]) ? $this->calendarConfig[$name] : null;
}
return $this->calendarConfig;
} | php | {
"resource": ""
} |
q625 | FormFieldExtension.updateAttributes | train | public function updateAttributes(&$attributes)
{
$attributes['data-calendar-config'] = $this->owner->getCalendarConfigJSON();
$attributes['data-calendar-enabled'] = $this->owner->getCalendarEnabled();
} | php | {
"resource": ""
} |
q626 | FormFieldExtension.getCalendarEnabled | train | public function getCalendarEnabled()
{
if ($this->owner->isReadonly() || $this->owner->isDisabled()) {
return 'false';
}
return ($this->calendarDisabled || $this->owner->config()->calendar_disabled) ? 'false' : 'true';
} | php | {
"resource": ""
} |
q627 | Extractor.getImageCount | train | public function getImageCount($pageNumber)
{
$strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/images';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return count($json->Images->List);
} | php | {
"resource": ""
} |
q628 | Item.compare | train | public static function compare(Item $a, Item $b): int
{
return Symbol::compare($a->subject, $b->subject)
?: Symbol::compareList($a->passed, $b->passed)
?: Symbol::compareList($a->further, $b->further)
?: ($b->eof - $a->eof);
} | php | {
"resource": ""
} |
q629 | Item.createFromRule | train | public static function createFromRule(Rule $rule): self
{
return new static(
$rule->getSubject(),
[],
$rule->getDefinition(),
$rule->hasEofMark(),
$rule->getTag()
);
} | php | {
"resource": ""
} |
q630 | Item.shift | train | public function shift(): ?self
{
$further = $this->further;
if (!$further) {
return null;
}
$passed = $this->passed;
$passed[] = array_shift($further);
return new static($this->subject, $passed, $further, $this->eof, $this->tag);
} | php | {
"resource": ""
} |
q631 | Item.getAsRule | train | public function getAsRule(): Rule
{
return new Rule(
$this->subject,
array_merge($this->passed, $this->further),
$this->eof,
$this->tag
);
} | php | {
"resource": ""
} |
q632 | WeChatAudioDriver.getAudio | train | private function getAudio()
{
$audioUrl = 'http://file.api.wechat.com/cgi-bin/media/get?access_token='.$this->getAccessToken().'&media_id='.$this->event->get('MediaId');
return [new Audio($audioUrl, $this->event)];
} | php | {
"resource": ""
} |
q633 | File.getFile | train | public function getFile($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
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$outputPath = AsposeApp::$outPutLocation . basename($fileName);
Utils::saveFile($responseStream, $outputPath);
return $outputPath;
} | php | {
"resource": ""
} |
q634 | File.copyFile | train | public function copyFile($fileName, $storageName = '', $newDest)
{
//check whether file is set or not
if ($fileName == '' || $newDest == '') {
AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
throw new Exception(Exception::MSG_NO_FILENAME);
}
//build URI
$strURI = $this->strURIFile . $fileName . '?newdest=' . $newDest;
if ($storageName != '') {
$strURI .= '&storage=' . $storageName;
}
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'PUT', '', '');
$json = json_decode($responseStream);
if ($json->Code === 200) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q635 | TextEditor.findText | train | public function findText()
{
$parameters = func_get_args();
//set parameter values
if (count($parameters) == 1) {
$text = $parameters[0];
} else if (count($parameters) == 2) {
$WorkSheetName = $parameters[0];
$text = $parameters[1];
} else {
throw new Exception('Invalid number of arguments');
}
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . ((count($parameters) == 2) ? '/worksheets/' . $WorkSheetName : '') . '/findText?text=' . $text;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'POST', '', '');
$json = json_decode($responseStream);
return $json->TextItems->TextItemList;
} | php | {
"resource": ""
} |
q636 | TextEditor.getTextItems | train | public function getTextItems()
{
$parameters = func_get_args();
//set parameter values
if (count($parameters) > 0) {
$worksheetName = $parameters[0];
}
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . ((isset($parameters[0])) ? '/worksheets/' . $worksheetName . '/textItems' : '/textItems');
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->TextItems->TextItemList;
} | php | {
"resource": ""
} |
q637 | Product.getMaximumInstallmentQuantity | train | public function getMaximumInstallmentQuantity()
{
$product = $this->getProduct() ? $this->getProduct() : $this->getParentBlock()->getProduct();
$maximumInstallment = $this->getMaximumInstallment($product);
return $maximumInstallment->getMaximumInstallmentsQuantity();
} | php | {
"resource": ""
} |
q638 | Parser.parse | train | public function parse(string $input, $actions = []): TreeNodeInterface
{
if ($actions instanceof ActionsMap) {
$actions_map = $actions;
} elseif ($actions) {
$actions_map = new ActionsMap($actions);
} else {
$actions_map = null;
}
$stack = new Stack($this->table, $actions_map);
$pos = 0;
$token = null;
try {
while (true) {
while ($stack->getStateRow()->isReduceOnly()) {
$stack->reduce();
}
$expected_terms = array_keys($stack->getStateRow()->terminalActions);
$match = $this->grammar->parseOne($input, $pos, $expected_terms);
if ($match) {
/** @var Token $token */
$token = $match->token;
$pos = $match->nextOffset;
$symbol_name = $token->getType();
} else {
$token = null;
$symbol_name = null;
}
while (true) {
if ($token) {
$terminal_actions = $stack->getStateRow()->terminalActions;
if (isset($terminal_actions[$symbol_name])) {
$stack->shift($token, $terminal_actions[$symbol_name]);
goto NEXT_SYMBOL;
}
}
if ($stack->getStateRow()->eofAction) {
if ($token) {
throw new UnexpectedInputAfterEndException(
$this->dumpTokenForError($token),
$token->getOffset()
);
}
goto DONE;
}
$stack->reduce();
}
NEXT_SYMBOL:
}
DONE:
} catch (AbortParsingException $e) {
throw new AbortedException($e->getMessage(), $e->getOffset(), $e->getPrevious());
} catch (NoReduceException $e) {
// This unexpected reduce (no rule to reduce) may happen only
// when current terminal is not expected. So, some terminals
// are expected here.
$expected_terminals = [];
foreach ($stack->getStateRow()->terminalActions as $name => $_) {
$expected_terminals[] = Symbol::dumpType($name);
}
throw new UnexpectedTokenException(
$this->dumpTokenForError($token),
$expected_terminals,
$token ? $token->getOffset() : strlen($input)
);
} catch (StateException $e) {
throw new InternalException('Unexpected state fail', 0, $e);
}
$tokens_gen = null;
return $stack->done();
} | php | {
"resource": ""
} |
q639 | ChartEditor.addChart | train | public function addChart($chartType, $upperLeftRow, $upperLeftColumn, $lowerRightRow, $lowerRightColumn)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/charts?chartType=' . $chartType . '&upperLeftRow=' . $upperLeftRow . '&upperLeftColumn=' . $upperLeftColumn . '&lowerRightRow=' . $lowerRightRow . '&lowerRightColumn=' . $lowerRightColumn;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'PUT', '', '');
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
//Save doc on server
$folder = new Folder();
$outputStream = $folder->GetFile($this->getFileName());
$outputPath = AsposeApp::$outPutLocation . $this->getFileName();
Utils::saveFile($outputStream, $outputPath);
return $outputPath;
} else
return $v_output;
} | php | {
"resource": ""
} |
q640 | ChartEditor.deleteCharts | train | public function deleteCharts()
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/charts/';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'DELETE', '', '');
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
//Save doc on server
$folder = new Folder();
$outputStream = $folder->GetFile($this->getFileName());
$outputPath = AsposeApp::$outPutLocation . $this->getFileName();
Utils::saveFile($outputStream, $outputPath);
return $outputPath;
} else
return $v_output;
} | php | {
"resource": ""
} |
q641 | ChartEditor.readChartLegend | train | public function readChartLegend($chartIndex)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/charts/' . $chartIndex . '/legend';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', 'json', '');
$json = json_decode($responseStream);
return $json->Legend;
} | php | {
"resource": ""
} |
q642 | ChartEditor.getChartArea | train | public function getChartArea($chartIndex)
{
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/charts/' . $chartIndex . '/chartArea';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->ChartArea;
} | php | {
"resource": ""
} |
q643 | ChartEditor.getFillFormat | train | public function getFillFormat($chartIndex)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/charts/' . $chartIndex . '/chartArea/fillFormat';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->FillFormat;
} | php | {
"resource": ""
} |
q644 | ChartEditor.getBorder | train | public function getBorder($chartIndex)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/charts/' . $chartIndex . '/chartArea/border';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->Line;
} | php | {
"resource": ""
} |
q645 | ChartEditor.setChartTitle | train | public function setChartTitle($chartIndex, $strXML)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
if (!isset($chartIndex))
throw new Exception('Chart Index not specified');
if ($strXML == '')
throw new Exception('XML data not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/charts/' . $chartIndex . '/title';
$signedURI = Utils::sign($strURI);
$response = Utils::processCommand($signedURI, 'PUT', 'xml', $strXML);
$xml = simplexml_load_string($response);
if ($xml->Status == 'OK')
return true;
else
return false;
} | php | {
"resource": ""
} |
q646 | ChartEditor.deleteChartTitle | train | public function deleteChartTitle($chartIndex)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
if (!isset($chartIndex))
throw new Exception('Chart Index not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/charts/' . $chartIndex . '/title';
$signedURI = Utils::sign($strURI);
$response = Utils::processCommand($signedURI, 'DELETE', '', '');
$json = json_decode($response);
if ($json->Code == 200)
return true;
else
return false;
} | php | {
"resource": ""
} |
q647 | ConnectionPool.close | train | public function close()
{
$this->closed = true;
foreach ($this->connections as $connection) {
$connection->close();
}
$this->idle = new \SplQueue;
if ($this->deferred instanceof Deferred) {
$deferred = $this->deferred;
$this->deferred = null;
$deferred->fail(new FailureException("Connection pool closed"));
}
} | php | {
"resource": ""
} |
q648 | ConnectionPool.prepareStatement | train | private function prepareStatement(string $sql): \Generator
{
$connection = yield from $this->pop();
\assert($connection instanceof Link);
try {
$statement = yield $connection->prepare($sql);
\assert($statement instanceof Statement);
} catch (\Throwable $exception) {
$this->push($connection);
throw $exception;
}
return $this->createStatement($statement, function () use ($connection) {
$this->push($connection);
});
} | php | {
"resource": ""
} |
q649 | Table.prepareStates | train | protected function prepareStates(Grammar $grammar): void
{
/** @var TableRow[] $rows */
$rows = [];
/** @var ItemSet[] $states */
$states = [];
$item = Item::createFromRule($grammar->getMainRule());
$item_set = ItemSet::createFromItems([$item], $grammar);
/** @var ItemSet[][] $add_states_map */
$add_states_map = [0 => ['' => $item_set]];
while ($add_states_map) {
$next_states_map = [];
foreach ($add_states_map as $from_state_index => $to_states_list) {
foreach ($to_states_list as $from_symbol_name => $new_state) {
$from_symbol_term = false;
$from_symbol_non_term = false;
if ('' !== $from_symbol_name) {
$from_symbol = $grammar->getSymbol($from_symbol_name);
if ($from_symbol->isTerminal()) {
$from_symbol_term = true;
} else {
$from_symbol_non_term = true;
}
}
foreach ($states as $i => $state) {
if ($new_state->isSame($state)) {
$row = $rows[$from_state_index];
if ($from_symbol_term) {
$row->terminalActions[$from_symbol_name] = $i;
} elseif ($from_symbol_non_term) {
$row->gotoSwitches[$from_symbol_name] = $i;
}
goto NEXT_NEW_STATE;
}
}
$state_index = count($states);
$states[] = $new_state;
$rows[] = new TableRow();
if ($new_state->hasFinalItem()) {
$rows[$state_index]->eofAction = true;
}
$next_states_map[$state_index] = $new_state->getNextSets($grammar);
$row = $rows[$from_state_index];
if ($from_symbol_term) {
$row->terminalActions[$from_symbol_name] = $state_index;
} elseif ($from_symbol_non_term) {
$row->gotoSwitches[$from_symbol_name] = $state_index;
}
NEXT_NEW_STATE:
}
}
$add_states_map = $next_states_map;
}
foreach ($states as $index => $state) {
$rule = $state->getReduceRule();
if ($rule) {
$rows[$index]->reduceRule = $rule;
}
}
$this->rows = $rows;
$this->states = $states;
} | php | {
"resource": ""
} |
q650 | DestroyProductType.handle | train | public function handle(ProductTypeRepository $productTypeRepository, Dispatcher $event)
{
$productType = $productTypeRepository->find($this->id);
// TODO : Check if the product type is in use
$productTypeRepository->destroy($productType);
$event->fire(new ProductTypeWasDestroyed($productType));
return $productType;
} | php | {
"resource": ""
} |
q651 | UserHasAccount.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;
}
return true;
} | php | {
"resource": ""
} |
q652 | RouteServiceProvider.loadCachedRoutes | train | protected function loadCachedRoutes()
{
$this->app['events']->fire('routes.loading');
require $this->app->getCachedRoutesPath();
$this->app['events']->fire('routes.loaded');
} | php | {
"resource": ""
} |
q653 | CasAuthenticator.start | train | public function start(Request $request, AuthenticationException $authException = null)
{
//The URL have to be completed by the current request uri,
// because Cas Server need to know where redirect user after authentication.
return new RedirectResponse($this->cas->getUri().$request->getUri());
} | php | {
"resource": ""
} |
q654 | CasAuthenticator.onLogoutSuccess | train | public function onLogoutSuccess(Request $request)
{
phpCAS::setDebug($this->cas->getDebug());
phpCAS::setVerbose($this->cas->isVerbose());
if (!phpCAS::isInitialized()) {
phpCAS::client(
$this->cas->getVersion(),
$this->cas->getHostname(),
$this->cas->getPort(),
$this->cas->getUrl()
);
}
phpCAS::setLang($this->cas->getLanguage());
if ($this->cas->isRedirectingAfterLogout()) {
$uri = $this->router->generate(
$this->cas->getRouteLogout(),
[],
UrlGeneratorInterface::ABSOLUTE_URL
);
phpCAS::logoutWithRedirectService($uri);
} else {
//simple logout
phpCAS::logout();
}
} | php | {
"resource": ""
} |
q655 | Converter.convert | train | public function convert($folder = null)
{
//build URI
$strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '?format=' . $this->saveFormat;
if ($folder) {
$strURI = $strURI . "&folder=" . urlencode($folder);
}
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
if ($this->saveFormat == 'html') {
$save_format = 'zip';
} else {
$save_format = $this->saveFormat;
}
$outputPath = AsposeApp::$outPutLocation . Utils::getFileName($this->getFileName()) . '.' . $save_format;
Utils::saveFile($responseStream, $outputPath);
return $outputPath;
} else {
return $v_output;
}
} | php | {
"resource": ""
} |
q656 | Converter.convertLocalFile | train | public function convertLocalFile($inputPath, $outputPath, $outputFormat)
{
$str_uri = Product::$baseProductUri . '/words/convert?format=' . $outputFormat;
$signed_uri = Utils::sign($str_uri);
$responseStream = Utils::uploadFileBinary($signed_uri, $inputPath, 'xml');
$v_output = Utils::validateOutput($responseStream);
if ($v_output === '') {
if ($outputFormat == 'html') {
$saveFormat = 'zip';
} else {
$saveFormat = $outputFormat;
}
if ($outputPath == '') {
$outputPath = AsposeApp::$outPutLocation . Utils::getFileName($inputPath) . '.' . $saveFormat;
}
Utils::saveFile($responseStream, $outputPath);
return $outputPath;
}
else
return $v_output;
} | php | {
"resource": ""
} |
q657 | Converter.convertWebPages | train | public function convertWebPages($strXML)
{
if ($strXML == '')
throw new Exception('XML not specified');
//build URI
$strURI = Product::$baseProductUri . '/words/loadWebDocument';
//sign URI
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'POST', 'XML', $strXML);
$xml = simplexml_load_string($responseStream);
if ($xml->Status == 'OK') {
$fileName = $xml->SaveResult->Dest['href'];
$strURI = Product::$baseProductUri . '/storage/file/' . $fileName;
$signedURI = Utils::Sign($strURI);
$responseStream = Utils::processCommand($signedURI, "GET", "", "");
$outputPath = AsposeApp::$outPutLocation . $fileName;
Utils::saveFile($responseStream, $outputPath);
return $outputPath;
} else {
return false;
}
} | php | {
"resource": ""
} |
q658 | UpdateProduct.handle | train | public function handle(ProductRepository $productRepository, Dispatcher $event)
{
$product = $productRepository->find($this->id)->fill(array_except(get_object_vars($this), ['attributes']));
$productRepository->save($product, $this->attributes);
$event->fire(new ProductWasUpdated($product));
return $product;
} | php | {
"resource": ""
} |
q659 | Logger.log | train | public function log($level, $message, array $context = array())
{
if ($this->outputIsUrgent($level) || $this->isEnabled()) {
$this->dispatch($message, $context);
}
} | php | {
"resource": ""
} |
q660 | Logger.formatFileLine | train | private function formatFileLine($string)
{
$format = $this->getOption('dateFormat') . $this->getOption('delimiter');
return date($format) . $string;
} | php | {
"resource": ""
} |
q661 | Logger.dispatch | train | private function dispatch($message, $context)
{
$output = $this->interpolate($message, $context) . PHP_EOL;
if ($this->getOption('outputToFile') === true) {
$file = $this->getOption('logFile');
if (!is_writable($file)) {
throw new AsposeCloudException('The file '.$file.' either does not exist or is not writeable');
}
// Output to file
file_put_contents($file, $this->formatFileLine($output), FILE_APPEND);
} else {
echo $output;
}
} | php | {
"resource": ""
} |
q662 | MessageDefaults.allKeys | train | public static function allKeys()
{
static $allKeys = null;
if (is_null($allKeys)) {
$allKeys = array_values((new ReflectionClass(get_called_class()))->getConstants());
}
return $allKeys;
} | php | {
"resource": ""
} |
q663 | WebHookHandler.setLogger | train | public function setLogger($logger) {
if(!in_array('Psr\Log\LoggerInterface', class_implements($logger, true))) {
throw new \InvalidArgumentException('Logger object does not implement Psr\Log\LoggerInterface');
}
$this->logger = $logger;
} | php | {
"resource": ""
} |
q664 | WebHookHandler.setInput | train | public function setInput($input, $isDecoded = false) {
if(!$isDecoded)
$input = json_decode($input, true);
if(!$input) {
if($this->logger) $this->logger->error('Could not decode input', array('input' => $input));
throw new WebHookHandlerException('Could not decode input', WebHookHandlerException::INPUT_DECODE_FAILED);
}
if(empty($input['payload'])) {
if($this->logger)
$this->logger->error('No payload in input data');
throw new WebHookHandlerException('No payload in input data', WebHookHandlerException::NO_PAYLOAD);
}
if(empty($input['payloadEncrypted']))
$input['payloadEncrypted'] = false;
if($input['payloadEncrypted']) {
if(empty($this->privateKey)) {
if($this->logger)
$this->logger->error('No private key supplied for encrypted payload. Please pass the private key in the constructor');
throw new WebHookHandlerException('No private key supplied for encrypted payload. Please pass the private key in the constructor', WebHookHandlerException::NO_PRIVATE_KEY);
}
if(empty($input['envKey'])) {
if($this->logger)
$this->logger->error('No envelope key in input payload');
throw new WebHookHandlerException('No envelope key in input payload', WebHookHandlerException::NO_ENVELOPE_KEY);
}
}
$this->input = $input;
return $this;
} | php | {
"resource": ""
} |
q665 | WebHookHandler.getInputFromHTTP | train | private function getInputFromHTTP() {
if($this->logger) $this->logger->debug('Getting and decoding HTTP request body');
$input = file_get_contents('php://input');
$this->setInput($input);
return $this->input;
} | php | {
"resource": ""
} |
q666 | WebHookHandler.ensureInput | train | private function ensureInput() {
if(!$this->input) {
$this->getInputFromHTTP();
if(!$this->input) throw new WebHookHandlerException('Could not fetch input', WebHookHandlerException::INPUT_FETCH_FAILED);
}
} | php | {
"resource": ""
} |
q667 | WebHookHandler.getTimestamp | train | public function getTimestamp($format = self::TIMESTAMP_FORMAT_RFC1123) {
$this->ensureInput();
if(!isset($this->input['timestamp'])) return null;
switch($format) {
case static::TIMESTAMP_FORMAT_UNIX:
return strtotime($this->input['timestamp']);
case static::TIMESTAMP_FORMAT_RFC1123:
default:
return $this->input['timestamp'];
}
} | php | {
"resource": ""
} |
q668 | WebHookHandler.getPayload | train | public function getPayload() {
if($this->payload) return $this->payload;
$this->ensureInput();
if(empty($this->input['payload'])) {
if($this->logger)
$this->logger->error('No payload in input data');
throw new WebHookHandlerException('No payload in input data', WebHookHandlerException::NO_PAYLOAD);
}
if($this->input['payloadEncrypted']) {
$privKey = openssl_pkey_get_private($this->privateKey, $this->passphrase);
$envKey = base64_decode($this->input['envKey']);
$encryptedPayload = base64_decode($this->input['payload']);
$payloadJSON = '';
if(openssl_open($encryptedPayload, $payloadJSON, $envKey, $privKey)) {
if($this->logger)
$this->logger->debug('Decrypted JSON string', array('json' => $payloadJSON));
$decrypted = json_decode($payloadJSON, true);
if($decrypted) {
$this->payload = $decrypted;
$this->payloadJSONString = $payloadJSON;
} else {
if($this->logger)
$this->logger->error('Invalid decrypted json');
throw new WebHookHandlerException('Invalid decrypted json', WebHookHandlerException::INVALID_DECRYPTED_JSON);
}
} else {
if($this->logger)
$this->logger->error('Could not decrypt payload', array('error' => openssl_error_string()));
throw new WebHookHandlerException('Could not decrypt payload', WebHookHandlerException::DECRYPTION_FAILED);
}
openssl_free_key($privKey);
} else {
$this->payload = $this->input['payload'];
$this->payloadJSONString = json_encode($this->payload);
}
return $this->payload;
} | php | {
"resource": ""
} |
q669 | WebHookHandler.verifyHash | train | public function verifyHash() {
$this->ensureInput();
if(empty($this->input['hash']))
throw new WebHookHandlerException('No hash provided in input payload', WebHookHandlerException::NO_INPUT_HASH);
if($this->input['payloadEncrypted']) {
if(!$this->payloadJSONString && !$this->getPayload()) return false;
} else {
if(!$this->payloadJSONString) $this->payloadJSONString = json_encode($this->input['payload']);
}
$webHookSalt = substr($this->input['hash'], 0, self::SALT_LENGTH);
return $this->input['hash'] === $webHookSalt.hash(self::HASH_METHOD, $webHookSalt.$this->secret.$this->payloadJSONString);
} | php | {
"resource": ""
} |
q670 | WebHookHandler.sendExceptionResponse | train | public function sendExceptionResponse(WebHookHandlerException $e) {
$httpCode = '400 Bad Request';
switch($e->getCode()) {
case WebHookHandlerException::NO_PRIVATE_KEY:
$httpCode = '500 Internal Server Error';
break;
case WebHookHandlerException::INVALID_DECRYPTED_JSON:
case WebHookHandlerException::DECRYPTION_FAILED:
case WebHookHandlerException::INPUT_FETCH_FAILED:
case WebHookHandlerException::INPUT_DECODE_FAILED:
case WebHookHandlerException::NO_ENVELOPE_KEY:
case WebHookHandlerException::NO_PAYLOAD:
case WebHookHandlerException::NO_INPUT_HASH:
$httpCode = '400 Bad Request';
break;
}
$this->sendHTTPResponse($httpCode, ['success' => false, 'errorCode' => $e->getCode(), 'errorDescription' => $e->getMessage()]);
return $this;
} | php | {
"resource": ""
} |
q671 | QuoteToOrder.execute | train | public function execute(Observer $observer)
{
$quote = $observer->getQuote();
$order = $observer->getOrder();
$order
->setGabrielqsInstallmentsQty($quote->getGabrielqsInstallmentsQty())
->setGabrielqsInstallmentsInterestRate($quote->getGabrielqsInstallmentsInterestRate())
->setGabrielqsInstallmentsInterestAmount($quote->getGabrielqsInstallmentsInterestAmount())
->setBaseGabrielqsInstallmentsInterestAmount($quote->getBaseGabrielqsInstallmentsInterestAmount());
} | php | {
"resource": ""
} |
q672 | ItemSet.createFromItems | train | public static function createFromItems(array $items, Grammar $grammar): self
{
$final_items = [];
$new_items = $items;
/** @var Symbol $known_next_symbols */
$known_next_symbols = [];
while ($new_items) {
/** @var Symbol $next_symbols */
$next_symbols = [];
foreach ($new_items as $new_item) {
foreach ($final_items as $item) {
if (0 === Item::compare($item, $new_item)) {
goto NEXT_NEW_ITEM;
}
}
$final_items[] = $new_item;
$next_symbol = $new_item->getExpected();
if (!$next_symbol || $next_symbol->isTerminal()) {
continue;
}
$name = $next_symbol->getName();
if (isset($known_next_symbols[$name])) {
continue;
}
$next_symbols[$name] = $next_symbol;
NEXT_NEW_ITEM:
}
$known_next_symbols += $next_symbols;
$new_items = [];
foreach ($next_symbols as $next_symbol) {
$rules = $grammar->getRulesFor($next_symbol);
foreach ($rules as $rule) {
$new_items[] = Item::createFromRule($rule);
}
}
}
return new static($final_items, $items, $grammar);
} | php | {
"resource": ""
} |
q673 | ItemSet.getNextSets | train | public function getNextSets(Grammar $grammar): array
{
$next_map = [];
foreach ($this->items as $item) {
$symbol = $item->getExpected();
if (!$symbol) {
continue;
}
$name = $symbol->getName();
$next_item = $item->shift();
if (isset($next_map[$name])) {
foreach ($next_map[$name] as $known_item) {
if (0 === Item::compare($next_item, $known_item)) {
goto NEXT_ITEM;
}
}
$next_map[$name][] = $next_item;
} else {
$next_map[$name] = [$next_item];
}
NEXT_ITEM:
}
$sets = [];
foreach ($next_map as $name => $items) {
$sets[$name] = static::createFromItems($items, $grammar);
}
return $sets;
} | php | {
"resource": ""
} |
q674 | ItemSet.hasItem | train | public function hasItem(Item $item, bool $initialOnly = true): bool
{
$list = ($initialOnly) ? $this->initialItems : $this->items;
foreach ($list as $my_item) {
if (0 === Item::compare($my_item, $item)) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q675 | ItemSet.hasFinalItem | train | public function hasFinalItem(): bool
{
foreach ($this->items as $item) {
if ($item->hasEofMark() && !$item->hasFurther()) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q676 | ItemSet.getReduceRule | train | public function getReduceRule(): ?Rule
{
foreach ($this->items as $item) {
if (!$item->hasFurther()) {
return $item->getAsRule();
}
}
return null;
} | php | {
"resource": ""
} |
q677 | ItemSet.isSame | train | public function isSame(ItemSet $that): bool
{
if (count($this->items) !== count($that->items)) {
return false;
}
foreach ($this->items as $i => $item) {
if (0 !== Item::compare($item, $that->items[$i])) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q678 | ItemSet.validateDeterministic | train | private function validateDeterministic(Grammar $grammar): void
{
/** @var Item[] */
$finite = [];
$terminals = [];
$non_terminals = [];
foreach ($this->items as $item) {
$next_symbol = $item->getExpected();
if (!$next_symbol) {
$finite[] = $item;
} elseif ($next_symbol->isTerminal()) {
$terminals[] = $item;
} else {
$non_terminals[] = $item;
}
}
$this->validateDeterministicShiftReduce(
$finite,
$terminals,
$non_terminals,
$grammar
);
$this->validateDeterministicReduceReduce($finite);
} | php | {
"resource": ""
} |
q679 | ItemSet.validateDeterministicShiftReduce | train | private function validateDeterministicShiftReduce(
array $finite,
array $terminals,
array $nonTerminals,
Grammar $grammar
): void {
if ($finite && $terminals) {
$left_terminals = $grammar->getTerminals();
foreach ($terminals as $item) {
unset($left_terminals[$item->getExpected()->getName()]);
}
if (!$left_terminals) {
throw new ConflictShiftReduceException(
array_merge($finite, $terminals, $nonTerminals)
);
}
}
} | php | {
"resource": ""
} |
q680 | Worksheet.getCellsList | train | public function getCellsList($offset, $count)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/cells?offset=' .
$offset . '&count=' . $count;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
$listCells = array();
foreach ($json->Cells->CellList as $cell) {
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/cells' . $cell->link->Href;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
array_push($listCells, $json->Cell);
}
return $listCells;
} | php | {
"resource": ""
} |
q681 | Worksheet.getRowsList | train | public function getRowsList()
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/cells/rows';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
$listRows = array();
foreach ($json->Rows->RowsList as $row) {
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/cells/rows' . $row->link->Href;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
array_push($listRows, $json->Row);
}
return $listRows;
} | php | {
"resource": ""
} |
q682 | Worksheet.getColumnsList | train | public function getColumnsList()
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/cells/columns';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
$listColumns = array();
foreach ($json->Columns->ColumnsList as $column) {
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/cells/columns' . $column->link->Href;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
array_push($listColumns, $json->Column);
}
return $listColumns;
} | php | {
"resource": ""
} |
q683 | Worksheet.getMaxColumn | train | public function getMaxColumn($offset, $count)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/cells?offset=' .
$offset . '&count=' . $count;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->Cells->MaxColumn;
} | php | {
"resource": ""
} |
q684 | Worksheet.getAutoShapesCount | train | public function getAutoShapesCount()
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/autoshapes';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return count($json->AutoShapes->AutoShapeList);
} | php | {
"resource": ""
} |
q685 | Worksheet.getAutoShapeByIndex | train | public function getAutoShapeByIndex($index)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/autoshapes/' . $index;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->AutoShape;
} | php | {
"resource": ""
} |
q686 | Worksheet.getChartsCount | train | public function getChartsCount()
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/charts';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return Count($json->Charts->ChartList);
} | php | {
"resource": ""
} |
q687 | Worksheet.getChartByIndex | train | public function getChartByIndex($index)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/charts/' . $index;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->Chart;
} | php | {
"resource": ""
} |
q688 | Worksheet.getHyperlinksCount | train | public function getHyperlinksCount()
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/hyperlinks';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return Count($json->Hyperlinks->HyperlinkList);
} | php | {
"resource": ""
} |
q689 | Worksheet.getHyperlinkByIndex | train | public function getHyperlinkByIndex($index)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/hyperlinks/' . $index;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->Hyperlink;
} | php | {
"resource": ""
} |
q690 | Worksheet.deleteHyperlinkByIndex | train | public function deleteHyperlinkByIndex($index)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/hyperlinks/' . $index;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'DELETE', '', '');
$json = json_decode($responseStream);
if ($json->Status == 'OK') {
return true;
} else {
return false;
}
} | php | {
"resource": ""
} |
q691 | Worksheet.addHyperlink | train | public function addHyperlink($firstRow, $firstColumn, $totalRows, $totalColumns, $url)
{
//check whether worksheet name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
if ($firstRow == '')
throw new Exception('First Row not specified');
if ($firstColumn == '')
throw new Exception('First Column not specified');
if ($totalRows == '')
throw new Exception('Total Rows not specified');
if ($totalColumns == '')
throw new Exception('Total Columns not specified');
if ($url == '')
throw new Exception('URL not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/hyperlinks?firstRow=' . $firstRow .
'&firstColumn=' . $firstColumn . '&totalRows=' . $totalRows . '&totalColumns=' . $totalColumns .
'&address=' . $url;
$signedURI = Utils::sign($strURI);
$response = Utils::processCommand($signedURI, 'PUT', '', '');
$json = json_decode($response);
if ($json->Code == 200)
return true;
else
return false;
} | php | {
"resource": ""
} |
q692 | Worksheet.updateHyperlink | train | public function updateHyperlink($hyperlinkIndex, $url, $screenTip, $displayText)
{
//check whether worksheet name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
if ($hyperlinkIndex == '')
throw new Exception('Hyperlink Index not specified');
if ($url == '')
throw new Exception('URL not specified');
if ($screenTip == '')
throw new Exception('Screen Tip not specified');
if ($displayText == '')
throw new Exception('Display Text not specified');
$data = array('address' => $url, 'ScreenTip' => $screenTip, 'TextToDisplay' => $displayText);
$json_data = json_encode($data);
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/hyperlinks/' . $hyperlinkIndex;
$signedURI = Utils::sign($strURI);
$response = Utils::processCommand($signedURI, 'POST', 'json', $json_data);
$json = json_decode($response);
if ($json->Code == 200)
return true;
else
return false;
} | php | {
"resource": ""
} |
q693 | Worksheet.getComment | train | public function getComment($cellName)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/comments/' . $cellName;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->Comment->HtmlNote;
} | php | {
"resource": ""
} |
q694 | Worksheet.getOleObjectByIndex | train | public function getOleObjectByIndex($index)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/oleobjects/' . $index;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->OleObject;
} | php | {
"resource": ""
} |
q695 | Worksheet.getPictureByIndex | train | public function getPictureByIndex($index)
{
//check whether worksheet name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/pictures/' . $index;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->Picture;
} | php | {
"resource": ""
} |
q696 | Worksheet.getValidationByIndex | train | public function getValidationByIndex($index)
{
//check whether worksheet name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/validations/' . $index;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->Validation;
} | php | {
"resource": ""
} |
q697 | Worksheet.getMergedCellByIndex | train | public function getMergedCellByIndex($index)
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/mergedCells/' . $index;
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->MergedCell;
} | php | {
"resource": ""
} |
q698 | Worksheet.getMergedCellsCount | train | public function getMergedCellsCount()
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/mergedCells';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return $json->MergedCells->Count;
} | php | {
"resource": ""
} |
q699 | Worksheet.getValidationsCount | train | public function getValidationsCount()
{
//check whether workshett name is set or not
if ($this->worksheetName == '')
throw new Exception('Worksheet name not specified');
$strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
'/worksheets/' . $this->worksheetName . '/validations';
$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, 'GET', '', '');
$json = json_decode($responseStream);
return count($json->Validations->ValidationList);
} | php | {
"resource": ""
} |