_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q700
Worksheet.getPicturesCount
train
public function getPicturesCount() { //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 . '/pictures'; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q701
Worksheet.getOleObjectsCount
train
public function getOleObjectsCount() { //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'; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q702
Worksheet.getCommentsCount
train
public function getCommentsCount() { //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'; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q703
Worksheet.freezePanes
train
public function freezePanes($row = 1, $col = 1, $freezedRows = 1, $freezedCols = 1) { //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 . '/FreezePanes?row=' . $row . '&column=' . $col . '&freezedRows=' . $freezedRows . '&freezedColumns=' . $freezedCols;
php
{ "resource": "" }
q704
Worksheet.updateProperties
train
public function updateProperties($properties = array()) { //check whether worksheet name is set or not if ($this->worksheetName == '') throw new Exception('Worksheet name not specified'); $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/workbook/worksheets/' . $this->worksheetName; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q705
Worksheet.moveWorksheet
train
public function moveWorksheet($worksheetName, $position) { //check whether worksheet name is set or not if ($this->worksheetName == '') throw new Exception('Worksheet name not specified'); $fieldsArray['DestinationWorsheet'] = $worksheetName; $fieldsArray['Position'] = $position; $jsonData = json_encode($fieldsArray); $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
php
{ "resource": "" }
q706
Worksheet.calculateFormula
train
public function calculateFormula($formula) { //check whether worksheet name is set or not if ($this->worksheetName == '') throw new Exception('Worksheet name not specified'); $strURI = Product::$baseProductUri . '/cells/'
php
{ "resource": "" }
q707
Worksheet.setCellValue
train
public function setCellValue($cellName, $valueType, $value) { //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 . '/cells/' . $cellName . '?value=' . $value . '&type=' . $valueType;
php
{ "resource": "" }
q708
Worksheet.getRowsCount
train
public function getRowsCount($offset, $count) { //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 . '/cells/rows?offset=' . $offset . '&count=' . $count;
php
{ "resource": "" }
q709
Worksheet.copyRows
train
public function copyRows($sourceRowIndex = 1, $destRowIndex = 1, $rowNumber = 1) { //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 . '/cells/rows/copy?sourceRowIndex=' . $sourceRowIndex . '&destinationRowIndex=' . $destRowIndex . '&rowNumber=' . $rowNumber;
php
{ "resource": "" }
q710
Worksheet.getRow
train
public function getRow($rowIndex) { //check whether worksheet name is set or not if ($this->worksheetName == '') throw new Exception('Worksheet name not specified'); $strURI = Product::$baseProductUri . '/cells/'
php
{ "resource": "" }
q711
Worksheet.getColumn
train
public function getColumn($columnIndex) { //check whether worksheet name is set or not if ($this->worksheetName == '') throw new Exception('Worksheet name not specified'); $strURI = Product::$baseProductUri . '/cells/'
php
{ "resource": "" }
q712
Worksheet.sortData
train
public function sortData(array $dataSort, $cellArea = '') { //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 . '/sort?cellArea=' . $cellArea; $json_array = json_encode($dataSort);
php
{ "resource": "" }
q713
Worksheet.setCellStyle
train
public function setCellStyle($cellName, array $style) { //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 . '/cells/' . $cellName . '/style'; $jsonArray = json_encode($style);
php
{ "resource": "" }
q714
Worksheet.getCell
train
public function getCell($cellName) { if ($this->worksheetName == '') { throw new Exception('No Worksheet Specified'); } $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/cells/' . $cellName; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q715
Worksheet.addPicture
train
public function addPicture($picturePath, $pictureLocation, $upperLeftRow = 0, $upperLeftColumn = 0, $lowerRightRow = 0, $lowerRightColumn = 0) { if ($this->worksheetName == '') { throw new Exception('No Worksheet Specified'); } if ($pictureLocation == 'Server' || $pictureLocation == 'server') { $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/pictures?upperLeftRow=' . $upperLeftRow . '&upperLeftColumn=' . $upperLeftColumn . '&lowerRightRow=' . $lowerRightRow . '&lowerRightColumn=' . $lowerRightColumn . '&picturePath=' . $picturePath;
php
{ "resource": "" }
q716
Worksheet.addOleObject
train
public function addOleObject($oleFile = '', $imageFile = '', $upperLeftRow = 0, $upperLeftColumn = 0, $height = 0, $width = 0) { if ($this->worksheetName == '') { throw new Exception('No Worksheet Specified'); } $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/oleobjects?upperLeftRow=' .
php
{ "resource": "" }
q717
Worksheet.updateOleObject
train
public function updateOleObject($objectIndex, $object_data) { //Build URI $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/oleobjects/' . $objectIndex; //Sign URI $signedURI = Utils::sign($strURI); //Send request and receive response
php
{ "resource": "" }
q718
Worksheet.updatePicture
train
public function updatePicture($pictureIndex, $picture_data) { //Build URI $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/pictures/' . $pictureIndex; //Sign URI $signedURI = Utils::sign($strURI); //Send request and receive response
php
{ "resource": "" }
q719
Worksheet.addEmptyRow
train
public function addEmptyRow($rowId) { if ($rowId == '') throw new Exception('Row ID not specified'); //Build URI $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/cells/rows/' . $rowId; //Sign URI $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q720
Worksheet.setFormula
train
public function setFormula($cellName, $formula) { if ($cellName == '') throw new Exception('Cell Name not specified'); if ($formula == '') throw new Exception('Formula not specified'); //Build URI $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/cells/' . $cellName . '?formula=' . $formula; //Sign URI $signedURI = Utils::sign($strURI); //Send request
php
{ "resource": "" }
q721
Worksheet.clearCellsContents
train
public function clearCellsContents($range) { if ($range == '') throw new Exception('Range not specified'); //Build URI $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/cells/clearcontents?range=' . $range; //Sign URI $signedURI = Utils::sign($strURI); //Send request and receive response
php
{ "resource": "" }
q722
Worksheet.mergeCells
train
public function mergeCells($startRow, $startColumn, $totalRows, $totalColumns) { if ($startRow == '') throw new Exception('Start Row not specified'); if ($startColumn == '') throw new Exception('Start Column not specified'); if ($totalRows == '') throw new Exception('Total Rows not specified'); if ($totalColumns == '') throw new Exception('Total Columns not specified'); //Build URI $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName .
php
{ "resource": "" }
q723
Worksheet.setRangeValue
train
public function setRangeValue($cellarea, $value, $type) { if ($cellarea == '') throw new Exception('Cellarea not specified'); if ($value == '') throw new Exception('Value not specified'); if ($type == '') throw new Exception('Type not specified'); //Build URI $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/cells?cellarea=' . $cellarea . '&value=' . $value . '&type=' . $type; //Sign URI $signedURI = Utils::sign($strURI); //Send request and receive response stream $responseStream = Utils::processCommand($signedURI, 'POST', '', '');
php
{ "resource": "" }
q724
Worksheet.clearCellsFormatting
train
public function clearCellsFormatting($startRow, $startColumn, $endRow, $endColumn) { if ($startRow == '') throw new Exception('Start Row not specified'); if ($startColumn == '') throw new Exception('Start Column not specified'); if ($endRow == '') throw new Exception('End Row not specified'); if ($endColumn == '') throw new Exception('End Column not specified'); //Build URI $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/cells/ClearFormats?startRow=' . $startRow . '&startColumn=' . $startColumn . '&endRow=' . $endRow . '&endColumn=' . $endColumn; //Sign URI $signedURI = Utils::sign($strURI); //Send request and receive response stream $responseStream = Utils::processCommand($signedURI, 'POST', '', ''); $v_output = Utils::validateOutput($responseStream);
php
{ "resource": "" }
q725
TableRow.isReduceOnly
train
public function isReduceOnly(): bool { return !$this->eofAction && !$this->terminalActions
php
{ "resource": "" }
q726
WeChatLocationDriver.getLocation
train
private function getLocation() { return new Location($this->event->get('Location_X'),
php
{ "resource": "" }
q727
TextEditor.getText
train
public function getText() { $parameters = func_get_args(); //set parameter values if (count($parameters) > 0) { $pageNumber = $parameters[0]; } $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . ((isset($parameters[0])) ? '/pages/' . $pageNumber . '/TextItems' : '/TextItems'); $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q728
TextEditor.getTextItems
train
public function getTextItems() { $parameters = func_get_args(); //set parameter values if (count($parameters) == 1) { $pageNumber = $parameters[0]; } else if (count($parameters) == 2) { $pageNumber = $parameters[0]; $fragmentNumber = $parameters[1]; } $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName(); if (isset($parameters[0])) { $strURI .= '/pages/' . $pageNumber; if (isset($parameters[1])) { $strURI .= '/fragments/' . $fragmentNumber;
php
{ "resource": "" }
q729
TextEditor.getPagesWordCount
train
public function getPagesWordCount() { try { $strURI = Product::$baseProductUri . "/pdf/" . $this->getFileName() . "/pages/wordCount"; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, "GET", "", ""); $json = json_decode($responseStream);
php
{ "resource": "" }
q730
TextEditor.getSegmentCount
train
public function getSegmentCount($pageNumber = '', $fragmentNumber = '') { if ($pageNumber == '') throw new Exception('page number not specified'); if ($fragmentNumber == '') throw new Exception('fragment number not specified'); $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/fragments/' . $fragmentNumber;
php
{ "resource": "" }
q731
TextEditor.getTextFormat
train
public function getTextFormat() { $args = func_get_args(); if (count($args) == 2) { $pageNumber = $args[0]; $fragmentNumber = $args[1]; } if (count($args) == 3) { $pageNumber = $args[0]; $fragmentNumber = $args[1]; $segamentNumber = $args[2]; } $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/fragments/' . $fragmentNumber; if (isset($segamentNumber)) { $strURI .= '/segments/' . '/textformat';
php
{ "resource": "" }
q732
Client.getMessageDefaults
train
public function getMessageDefaults($key = null) { if (is_null($key)) { return $this->messageDefaults; }
php
{ "resource": "" }
q733
Client.sendMessage
train
public function sendMessage($message) { if ($payload = $this->getJsonPayload($message)) { $response = $this->getHttpClient() ->post($this->getWebhook(), [ 'headers' => ['Content-Type' => 'application/json'],
php
{ "resource": "" }
q734
Client.getJsonPayload
train
protected function getJsonPayload($message) { if (is_array($message) || $message instanceof JsonSerializable) { return json_encode($message); } elseif (method_exists($message, 'toJson')) { return $message->toJson(); } elseif (method_exists($message, 'toArray')) {
php
{ "resource": "" }
q735
Document.changeSlidePosition
train
public function changeSlidePosition($old_position = '', $new_position = '', $storageName = '', $folder = '') { if ($old_position == '' || $new_position == '') throw new Exception('Missing Required Params'); $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides?OldPosition=' . $old_position . '&NewPosition=' . $new_position; if ($folder != '') { $strURI .= 'folder=' . $folder; } if ($storageName != '') { $strURI .= '&storage='
php
{ "resource": "" }
q736
Document.cloneSlide
train
public function cloneSlide($slideno = '', $position = '', $storageName = '', $folder = '') { if ($position == '') throw new Exception('Position not speciefied.'); if ($slideno == '') throw new Exception('Slide not speciefied.'); $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides?SlideToClone=' . $slideno . '&Position=' . $position; if ($folder != '') { $strURI .= 'folder=' . $folder; } if ($storageName != '') {
php
{ "resource": "" }
q737
Document.splitPresentation
train
public function splitPresentation($from = '', $to = '', $destination = '', $format = '', $storageName = '', $folder = '') { $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/split?'; if ($folder != '') { $strURI .= '&folder=' . $folder; } if ($storageName != '') { $strURI .= '&storage=' . $storageName; } if ($from != '') { $strURI .= '&from=' . $from; } if ($to != '') { $strURI .= '&to=' . $to; } if ($destination != '') { $strURI .= '&destFolder=' . $destination; } if ($format != '') { $strURI .= '&format=' . $format; } $strURI = rtrim($strURI, '?'); $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'POST', '', ''); $json = json_decode($responseStream); if ($json->Code == 200) { foreach ($json->SplitResult->Slides as $splitPage) { $splitFileName = basename($splitPage->Href);
php
{ "resource": "" }
q738
Document.mergePresentations
train
public function mergePresentations($presentationsList = array(), $storageName = '', $folder = '') { if (!is_array($presentationsList) || empty($presentationsList)) throw new Exception('Presentation list not speciefied'); $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/merge'; if ($folder != '') { $strURI .= '?folder=' . $folder; } if ($storageName != '') { $strURI .= '&storage=' . $storageName; }
php
{ "resource": "" }
q739
Document.createEmptyPresentation
train
public function createEmptyPresentation($storageName = '', $folder = '') { //Build URI to get a list of slides $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName(); if ($folder != '') { $strURI .= '?folder=' . $folder; } if ($storageName != '') { $strURI .= '&storage=' . $storageName; } $signedURI = Utils::sign($strURI); $responseStream
php
{ "resource": "" }
q740
Document.getSlideCount
train
public function getSlideCount($storageName = '', $folder = '') { //Build URI to get a list of slides $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides'; if ($folder != '') {
php
{ "resource": "" }
q741
Document.getAllTextItems
train
public function getAllTextItems() { $parameters = func_get_args(); //set parameter values if (count($parameters) == 2) { $slideNumber = $parameters[0]; $withEmpty = $parameters[1]; } //Build URI to get all text items $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . ((isset($parameters[0])) ? '/slides/' . $slideNumber . '/textItems?withEmpty='
php
{ "resource": "" }
q742
Document.addCustomProperty
train
public function addCustomProperty($propertiesList) { if ($propertiesList == '') throw new Exception('Properties not specified'); //build URI to merge Docs $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/documentProperties'; $put_data = json_encode($propertiesList); //sign URI
php
{ "resource": "" }
q743
Document.saveAs
train
public function saveAs($outputPath, $saveFormat, $jpegQuality = '', $storageName = '', $folder = '') { if ($outputPath == '') throw new Exception('Output path not specified'); if ($saveFormat == '') throw new Exception('Save format not specified'); $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '?format=' . $saveFormat; if ($folder != '') { $strURI .= '&folder=' . $folder; } if ($storageName != '') { $strURI .= '&storage=' . $storageName; } if ($jpegQuality != '') {
php
{ "resource": "" }
q744
Document.saveSlideAs
train
public function saveSlideAs($slideNumber, $outputPath, $saveFormat) { if ($outputPath == '') throw new Exception('Output path not specified'); if ($saveFormat == '') throw new Exception('Save format not specified'); if ($slideNumber == '') throw new Exception('Slide number not specified'); $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '?format=' . $saveFormat; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI,
php
{ "resource": "" }
q745
Document.aspectRatio
train
public function aspectRatio($slideNumber) { if ($slideNumber == '') throw new Exception('Slide number not specified'); //build URI $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber; //sign URI $signedURI = Utils::sign($strURI); $response
php
{ "resource": "" }
q746
TextLoader.wantSymbol
train
private function wantSymbol(string $name, bool $isHidden = false, bool $isInline = false): Symbol { if ($isInline) { if (!isset($this->inline[$name]) && isset($this->symbols[$name])) { throw new GrammarException( "Inline '$name' conflicts with token <$name> defined previously" ); } if (isset($this->defines[$name])) { throw new GrammarException("Inline '$name' conflicts with DEFINE"); } $this->inline[$name] = $name; $isHidden = true; } else { if (isset($this->inline[$name]))
php
{ "resource": "" }
q747
Calendar.getCalendars
train
public function getCalendars() { //build URI $strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/calendars/'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
php
{ "resource": "" }
q748
Calendar.getCalendar
train
public function getCalendar($calendarUid) { if ($calendarUid == '') throw new Exception('Calendar Uid not specified'); //build URI $strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/calendars/' . $calendarUid; //sign URI $signedURI = Utils::sign($strURI); $responseStream
php
{ "resource": "" }
q749
Calendar.addCalendar
train
public function addCalendar($jsonData) { if ($jsonData == '') throw new Exception('Data not specified'); //build URI $strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/calendars/'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI,
php
{ "resource": "" }
q750
Lexer.defines
train
public function defines(array $defines): self { if (!$defines) { return $this; } $dup_keys = array_intersect_key($this->defines, $defines); if ($dup_keys) { throw new \InvalidArgumentException(
php
{ "resource": "" }
q751
Lexer.whitespaces
train
public function whitespaces(array $whitespaces): self { if (!$whitespaces) { return $this;
php
{ "resource": "" }
q752
Lexer.fixed
train
public function fixed(array $fixed): self { if (!$fixed) { return $this; } $new_fixed = $this->addNamedTokens($this->fixed, $fixed, 'fixed');
php
{ "resource": "" }
q753
Lexer.inline
train
public function inline(array $inline): self { if (!$inline) { return $this;
php
{ "resource": "" }
q754
Lexer.terminals
train
public function terminals(array $terminals): self { if (!$terminals) { return $this; }
php
{ "resource": "" }
q755
Lexer.modifiers
train
public function modifiers(string $modifiers): self { if ('' === $modifiers) { return $this; } $copy = clone $this;
php
{ "resource": "" }
q756
Lexer.addNamedTokens
train
private function addNamedTokens(array $oldTokens, array $addTokens, string $errorType): array { $dup_keys = array_intersect_key($oldTokens, $addTokens); if ($dup_keys) { throw new \InvalidArgumentException(
php
{ "resource": "" }
q757
AnnotationEditor.getAllAnnotations
train
public function getAllAnnotations($pageNumber) { $iTotalAnnotation = $this->GetAnnotationsCount($pageNumber); $listAnnotations = array();
php
{ "resource": "" }
q758
AnnotationEditor.getAnnotationsCount
train
public function getAnnotationsCount($pageNumber) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/annotations'; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q759
AnnotationEditor.getAnnotation
train
public function getAnnotation($pageNumber, $annotationIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/annotations/' . $annotationIndex; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q760
AnnotationEditor.getChildBookmarksCount
train
public function getChildBookmarksCount($parent) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/bookmarks/' . $parent . '/bookmarks'; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q761
AnnotationEditor.getChildBookmark
train
public function getChildBookmark($parentIndex, $childIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/bookmarks/' . $parentIndex . '/bookmarks/' . $childIndex; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q762
AnnotationEditor.isChildBookmark
train
public function isChildBookmark($bookmarkIndex) { if ($bookmarkIndex === '') throw new Exception('bookmark index not specified'); $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/bookmarks/' . $bookmarkIndex; $signedURI =
php
{ "resource": "" }
q763
AnnotationEditor.getAllBookmarks
train
public function getAllBookmarks() { $iTotalBookmarks = $this->GetBookmarksCount(); $listBookmarks = array(); for ($index = 1; $index <= $iTotalBookmarks; $index++) {
php
{ "resource": "" }
q764
AnnotationEditor.getAllAttachments
train
public function getAllAttachments() { $iTotalAttachments = $this->GetAttachmentsCount(); $listAttachments = array(); for ($index = 1; $index <= $iTotalAttachments; $index++) {
php
{ "resource": "" }
q765
AnnotationEditor.getAttachmentsCount
train
public function getAttachmentsCount() { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/attachments'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET',
php
{ "resource": "" }
q766
AnnotationEditor.getAttachment
train
public function getAttachment($attachmentIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/attachments/' . $attachmentIndex; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q767
AnnotationEditor.downloadAttachment
train
public function downloadAttachment($attachmentIndex) { $fileInformation = $this->GetAttachment($attachmentIndex); //build URI to download attachment $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/attachments/' . $attachmentIndex . '/download'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '',
php
{ "resource": "" }
q768
AnnotationEditor.getAllLinks
train
public function getAllLinks($pageNumber) { $iTotalLinks = $this->GetLinksCount($pageNumber); $listLinks = array();
php
{ "resource": "" }
q769
AnnotationEditor.getLinksCount
train
public function getLinksCount($pageNumber) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/links'; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q770
AnnotationEditor.getLink
train
public function getLink($pageNumber, $linkIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/links/' . $linkIndex; $signedURI = Utils::sign($strURI);
php
{ "resource": "" }
q771
Role.checkPermission
train
public function checkPermission($role, $context) { if (!is_string($role)) { throw new \TypeError('The role parameter must be a string.'); } if (!$role) { throw new \InvalidArgumentException('The role parameter cannot be empty.'); } if (!is_array($context)) { throw new \TypeError('The context parameter must be an array.'); } 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": "" }
q772
Connect2PayClient.getAccountInformation
train
public function getAccountInformation() { $url = $this->url . self::$API_ROUTES['ACCOUNT_INFO']; $url .= '?apiVersion=' . $this->apiVersion; $result = $this->doGet($url, array(), false); if ($result !== null && is_object($result)) {
php
{ "resource": "" }
q773
Connect2PayClient.preparePayment
train
public function preparePayment() { if ($this->validate()) { $trans = array(); foreach ($this->fieldsJSON as $fieldName) { if (is_array($this->{$fieldName}) || !C2PValidate::isEmpty($this->{$fieldName})) { $trans[$fieldName] = $this->{"get" . ucfirst($fieldName)}(); } } // Only PHP >= 5.4 has JSON_UNESCAPED_SLASHES option $post_data = str_replace('\\/', '/', json_encode($trans)); $url = $this->url . Connect2PayClient::$API_ROUTES['TRANS_PREPARE']; $result = $this->doPost($url, $post_data); if ($result != null &&
php
{ "resource": "" }
q774
Connect2PayClient.getPaymentStatus
train
public function getPaymentStatus($merchantToken) { if ($merchantToken != null && strlen(trim($merchantToken)) > 0) { $url = $this->url . str_replace(":merchantToken", $merchantToken, Connect2PayClient::$API_ROUTES['PAYMENT_STATUS']);
php
{ "resource": "" }
q775
Connect2PayClient.refundTransaction
train
public function refundTransaction($transactionID, $amount) { if ($transactionID !== null && $amount !== null && (is_int($amount) || ctype_digit($amount))) { $url = $this->url . str_replace(":transactionID", $transactionID, Connect2PayClient::$API_ROUTES['TRANS_REFUND']); $trans = array(); $trans['apiVersion'] = $this->apiVersion; $trans['amount'] = intval($amount); $result = $this->doPost($url, json_encode($trans)); $this->status = null; if ($result != null && is_array($result)) { $this->status = new RefundStatus(); if (isset($result['code'])) { $this->status->setCode($result['code']); } if (isset($result['message'])) { $this->status->setMessage($result['message']);
php
{ "resource": "" }
q776
Connect2PayClient.cancelSubscription
train
public function cancelSubscription($subscriptionID, $cancelReason) { if ($subscriptionID != null && is_numeric($subscriptionID) && isset($cancelReason) && is_numeric($cancelReason)) { $url = $this->url . str_replace(":subscriptionID", $subscriptionID, Connect2PayClient::$API_ROUTES['SUB_CANCEL']); $trans = array(); $trans['apiVersion'] = $this->apiVersion; $trans['cancelReason'] = intval($cancelReason); $result = $this->doPost($url, json_encode($trans));
php
{ "resource": "" }
q777
Connect2PayClient.directAliPayProcess
train
public function directAliPayProcess($customerToken, $request) { if ($customerToken !== null && $request !== null) { $url = $this->url . str_replace(":customerToken", $customerToken, Connect2PayClient::$API_ROUTES['ALIPAY_DIRECT_PROCESS']); $request->setApiVersion($this->getApiVersion()); $result = $this->doPost($url, json_encode($request), false); if ($result != null && is_object($result)) { $apiResponse = AliPayDirectProcessResponse::getFromJson($result);
php
{ "resource": "" }
q778
Connect2PayClient.validate
train
public function validate() { $arrErrors = array(); $arrErrors = $this->validateFields(); if (sizeof($arrErrors) > 0) { foreach ($arrErrors as $error) {
php
{ "resource": "" }
q779
Connect2PayClient.addCartProduct
train
public function addCartProduct($cartProduct) { if ($this->orderCartContent == null || !is_array($this->orderCartContent)) { $this->orderCartContent = array(); }
php
{ "resource": "" }
q780
Connect2PayClient.setDefaultOrderCartContent
train
public function setDefaultOrderCartContent() { $this->orderCartContent = array(); $product = new CartProduct(); $product->setCartProductId(0)->setCartProductName("NA"); $product->setCartProductUnitPrice(0)->setCartProductQuantity(1);
php
{ "resource": "" }
q781
Connect2PayClient.validateFields
train
private function validateFields() { $fieldsRequired = $this->fieldsRequired; $returnError = array(); foreach ($fieldsRequired as $field) { if (C2PValidate::isEmpty($this->{$field}) && (!is_numeric($this->{$field}))) $returnError[] = $field . ' is empty'; } foreach ($this->fieldsSize as $field => $size) { if (isset($this->{$field}) && C2PValidate::strlen($this->{$field}) > $size) $returnError[] = $field . ' Length ' . $size;
php
{ "resource": "" }
q782
PaymentStatus.getLastInitialTransactionAttempt
train
public function getLastInitialTransactionAttempt() { $lastAttempt = null; if (isset($this->transactions) && is_array($this->transactions) && count($this->transactions) > 0) { // Return the entry with the highest timestamp with type sale, authorize, // or submission foreach ($this->transactions as $transaction) {
php
{ "resource": "" }
q783
PaymentStatus.getReferringTransactionAttempt
train
public function getReferringTransactionAttempt($refTransactionId, $transactionOperation) { $attempts = $this->getReferringTransactionAttempts($refTransactionId,
php
{ "resource": "" }
q784
PaymentStatus.getReferringTransactionAttempts
train
public function getReferringTransactionAttempts($refTransactionId, $transactionOperation = null) { $attempts = array(); if ($refTransactionId !== null && isset($this->transactions) && is_array($this->transactions) && count($this->transactions) > 0) { foreach ($this->transactions as $transaction) { if ($refTransactionId === $transaction->getRefTransactionId() && ($transactionOperation == null || $transactionOperation === $transaction->getOperation())) { $attempts[] = $transaction; } } // Sort the array by transaction date ascending if (count($attempts) > 1) { usort($attempts,
php
{ "resource": "" }
q785
Connect2PayCurrencyHelper.getISO4217CurrencyFromCode
train
public static function getISO4217CurrencyFromCode($code) { foreach (Connect2PayCurrencyHelper::$currencies as $currency => $data) {
php
{ "resource": "" }
q786
Connect2PayCurrencyHelper.getISO4217CurrencyCode
train
public static function getISO4217CurrencyCode($currency) { return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ?
php
{ "resource": "" }
q787
Connect2PayCurrencyHelper.getCurrencySymbol
train
public static function getCurrencySymbol($currency) { return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ?
php
{ "resource": "" }
q788
Connect2PayCurrencyHelper.getCurrencyName
train
public static function getCurrencyName($currency) { return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ?
php
{ "resource": "" }
q789
Connect2PayCurrencyHelper.getRate
train
public static function getRate($from, $to) { // Check if currencies exists if (!Connect2PayCurrencyHelper::currencyIsAvailable($from) || !Connect2PayCurrencyHelper::currencyIsAvailable($to)) { return null; } // Build the request URL $url = Connect2PayCurrencyHelper::$APIIO_SERVICE_URL . date("Y-m-d") . "?base=" . $from . "&symbols=" . $to; // Do the request $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); if (Connect2PayCurrencyHelper::$proxy_host != null && Connect2PayCurrencyHelper::$proxy_port != null) { curl_setopt($curl, CURLOPT_PROXY, Connect2PayCurrencyHelper::$proxy_host); curl_setopt($curl, CURLOPT_PROXYPORT, Connect2PayCurrencyHelper::$proxy_port); if (Connect2PayCurrencyHelper::$proxy_username != null && Connect2PayCurrencyHelper::$proxy_password != null) { curl_setopt($curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_PROXYUSERPWD, Connect2PayCurrencyHelper::$proxy_username . ":" . Connect2PayCurrencyHelper::$proxy_password); }
php
{ "resource": "" }
q790
Connect2PayCurrencyHelper.convert
train
public static function convert($amount, $from, $to, $cent = true) { // Get the conversion rate $rate = Connect2PayCurrencyHelper::getRate($from, $to); if ($rate != null) { $convert = $amount * $rate; // If the amount was in cent, truncate the digit after the comma
php
{ "resource": "" }
q791
C2PValidate.isPaymentMethod
train
static public function isPaymentMethod($paymentMethod) { return ((string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_CREDITCARD || (string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_TODITOCASH || (string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_BANKTRANSFER || (string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_DIRECTDEBIT ||
php
{ "resource": "" }
q792
C2PValidate.isPaymentNetwork
train
static public function isPaymentNetwork($paymentNetwork) { return ((string) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_SOFORT || (string) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_PRZELEWY24 || (string) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_IDEAL || (string) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_GIROPAY || (string) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_EPS || (string)
php
{ "resource": "" }
q793
C2PValidate.isPaymentMode
train
static public function isPaymentMode($paymentMode) { return ((string) $paymentMode == Connect2PayClient::PAYMENT_MODE_SINGLE || (string) $paymentMode
php
{ "resource": "" }
q794
C2PValidate.isSubscriptionType
train
static public function isSubscriptionType($subscriptionType) { return ((string) $subscriptionType == Connect2PayClient::SUBSCRIPTION_TYPE_NORMAL || (string) $subscriptionType
php
{ "resource": "" }
q795
C2PValidate.strlen
train
public static function strlen($str) { if (is_array($str)) return false; if (function_exists('mb_strlen'))
php
{ "resource": "" }
q796
ModulesInstaller.migrateModule
train
public function migrateModule(ModuleContainerInterface $module) { $path = $module->getPath(['database', 'migrations']); $files = $this->migrator->getMigrationFiles($path); // Once we grab all of the migration files for the path, we will compare them // against the migrations that have already been run for this package then // run each of the outstanding migrations against a database connection.
php
{ "resource": "" }
q797
ModulesInstaller.addModuleToReset
train
public function addModuleToReset(ModuleContainerInterface $module) { $path = $module->getPath(['database', 'migrations']);
php
{ "resource": "" }
q798
ModulesInstaller.seedModule
train
public function seedModule(ModuleContainerInterface $module, array $data = []) { $className = $module->getNamespace().'\\database\\seeds\\DatabaseSeeder'; if (!class_exists($className)) { return false; }
php
{ "resource": "" }
q799
Workbook.removeAllProperties
train
public function removeAllProperties() { //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/documentProperties'; //sign URI $signedURI = Utils::sign($strURI);
php
{ "resource": "" }