repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Slides/Document.php
Document.addCustomProperty
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 $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'PUT', 'json', $put_data); $json = json_decode($responseStream); return $json; }
php
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 $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'PUT', 'json', $put_data); $json = json_decode($responseStream); return $json; }
[ "public", "function", "addCustomProperty", "(", "$", "propertiesList", ")", "{", "if", "(", "$", "propertiesList", "==", "''", ")", "throw", "new", "Exception", "(", "'Properties not specified'", ")", ";", "//build URI to merge Docs", "$", "strURI", "=", "Product"...
Add custom document properties. @param array $propertiesList The list of property. @return array @throws Exception
[ "Add", "custom", "document", "properties", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Slides/Document.php#L651-L671
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Slides/Document.php
Document.saveAs
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 != '') { $strURI .= '&jpegQuality=' . $jpegQuality; } $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { $output = $outputPath . Utils::getFileName($this->getFileName()) . '.' . $saveFormat; Utils::saveFile($responseStream, $output); return $output; } else return $v_output; }
php
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 != '') { $strURI .= '&jpegQuality=' . $jpegQuality; } $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { $output = $outputPath . Utils::getFileName($this->getFileName()) . '.' . $saveFormat; Utils::saveFile($responseStream, $output); return $output; } else return $v_output; }
[ "public", "function", "saveAs", "(", "$", "outputPath", ",", "$", "saveFormat", ",", "$", "jpegQuality", "=", "''", ",", "$", "storageName", "=", "''", ",", "$", "folder", "=", "''", ")", "{", "if", "(", "$", "outputPath", "==", "''", ")", "throw", ...
saves the document into various formats. @param string $outputPath The output directory path. @param string $saveFormat Return the presentation in the specified format. @return string Returns the file path. @throws Exception
[ "saves", "the", "document", "into", "various", "formats", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Slides/Document.php#L682-L715
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Slides/Document.php
Document.saveSlideAs
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, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { $output = $outputPath . Utils::getFileName($this->getFileName()) . '_' . $slideNumber . '.' . $saveFormat; Utils::saveFile($responseStream, $output); return $output; } else return $v_output; }
php
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, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { $output = $outputPath . Utils::getFileName($this->getFileName()) . '_' . $slideNumber . '.' . $saveFormat; Utils::saveFile($responseStream, $output); return $output; } else return $v_output; }
[ "public", "function", "saveSlideAs", "(", "$", "slideNumber", ",", "$", "outputPath", ",", "$", "saveFormat", ")", "{", "if", "(", "$", "outputPath", "==", "''", ")", "throw", "new", "Exception", "(", "'Output path not specified'", ")", ";", "if", "(", "$"...
Saves a particular slide into various formats. @param integer $slideNumber The slide number. @param string $outputPath The output directory path. @param string $saveFormat Return the presentation in the specified format. @return string Returns the file path. @throws Exception
[ "Saves", "a", "particular", "slide", "into", "various", "formats", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Slides/Document.php#L727-L755
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Slides/Document.php
Document.aspectRatio
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 = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($response); if ($json->Code == 200) return $json->Slide->Width / $json->Slide->Height; else return false; }
php
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 = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($response); if ($json->Code == 200) return $json->Slide->Width / $json->Slide->Height; else return false; }
[ "public", "function", "aspectRatio", "(", "$", "slideNumber", ")", "{", "if", "(", "$", "slideNumber", "==", "''", ")", "throw", "new", "Exception", "(", "'Slide number not specified'", ")", ";", "//build URI", "$", "strURI", "=", "Product", "::", "$", "base...
Get Aspect Ratio of a PowerPoint Slide @param type $slideNumber The number of slide. @return float|boolean @throws Exception
[ "Get", "Aspect", "Ratio", "of", "a", "PowerPoint", "Slide" ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Slides/Document.php#L821-L840
train
Vovan-VE/parser
src/grammar/loaders/TextLoader.php
TextLoader.wantSymbol
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])) { throw new GrammarException( "Token <$name> conflicts with inline '$name' defined previously" ); } if (isset($this->defines[$name])) { throw new GrammarException("Token <$name> conflicts with DEFINE"); } } return $this->symbols[$name][$isHidden] ?? ($this->symbols[$name][$isHidden] = new Symbol($name, true, $isHidden)); }
php
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])) { throw new GrammarException( "Token <$name> conflicts with inline '$name' defined previously" ); } if (isset($this->defines[$name])) { throw new GrammarException("Token <$name> conflicts with DEFINE"); } } return $this->symbols[$name][$isHidden] ?? ($this->symbols[$name][$isHidden] = new Symbol($name, true, $isHidden)); }
[ "private", "function", "wantSymbol", "(", "string", "$", "name", ",", "bool", "$", "isHidden", "=", "false", ",", "bool", "$", "isInline", "=", "false", ")", ":", "Symbol", "{", "if", "(", "$", "isInline", ")", "{", "if", "(", "!", "isset", "(", "$...
Register a Symbol @param string $name Symbol name @param bool $isHidden Whether the hidden symbol is needed @param bool $isInline Whether the symbol is inline string @return Symbol @throws GrammarException
[ "Register", "a", "Symbol" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/grammar/loaders/TextLoader.php#L496-L523
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Tasks/Calendar.php
Calendar.getCalendars
public function getCalendars() { //build URI $strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/calendars/'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); if ($json->Code == 200) return $json->Calendars->List; else return false; }
php
public function getCalendars() { //build URI $strURI = Product::$baseProductUri . '/tasks/' . $this->getFileName() . '/calendars/'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); if ($json->Code == 200) return $json->Calendars->List; else return false; }
[ "public", "function", "getCalendars", "(", ")", "{", "//build URI", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/tasks/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/calendars/'", ";", "//sign URI", "$", "signedURI", "=",...
Get project calendar items. Each calendar item has a link to get full calendar representation in the project. @return array Returns the calendar items. @throws Exception
[ "Get", "project", "calendar", "items", ".", "Each", "calendar", "item", "has", "a", "link", "to", "get", "full", "calendar", "representation", "in", "the", "project", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Tasks/Calendar.php#L30-L46
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Tasks/Calendar.php
Calendar.getCalendar
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 = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); if ($json->Code == 200) return $json->Calendar; else return false; }
php
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 = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); if ($json->Code == 200) return $json->Calendar; else return false; }
[ "public", "function", "getCalendar", "(", "$", "calendarUid", ")", "{", "if", "(", "$", "calendarUid", "==", "''", ")", "throw", "new", "Exception", "(", "'Calendar Uid not specified'", ")", ";", "//build URI", "$", "strURI", "=", "Product", "::", "$", "base...
Get project calendar. @param integer $calendarUid The uid of the project calendar. @return array Returns the calendar. @throws Exception
[ "Get", "project", "calendar", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Tasks/Calendar.php#L56-L77
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Tasks/Calendar.php
Calendar.addCalendar
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, 'POST', 'json', $jsonData); $json = json_decode($responseStream); if ($json->Status == 'Created') return $json->CalendarItem; else return false; }
php
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, 'POST', 'json', $jsonData); $json = json_decode($responseStream); if ($json->Status == 'Created') return $json->CalendarItem; else return false; }
[ "public", "function", "addCalendar", "(", "$", "jsonData", ")", "{", "if", "(", "$", "jsonData", "==", "''", ")", "throw", "new", "Exception", "(", "'Data not specified'", ")", ";", "//build URI", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ...
Add Calendar to Project @param JSON $jsonData Data in JSON format. @return object|boolean @throws Exception
[ "Add", "Calendar", "to", "Project" ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Tasks/Calendar.php#L87-L106
train
Vovan-VE/parser
src/lexer/Lexer.php
Lexer.defines
public function defines(array $defines): self { if (!$defines) { return $this; } $dup_keys = array_intersect_key($this->defines, $defines); if ($dup_keys) { throw new \InvalidArgumentException( "Cannot redefine defines: " . join(', ', array_keys($dup_keys)) ); } $copy = clone $this; $copy->defines += $defines; return $copy; }
php
public function defines(array $defines): self { if (!$defines) { return $this; } $dup_keys = array_intersect_key($this->defines, $defines); if ($dup_keys) { throw new \InvalidArgumentException( "Cannot redefine defines: " . join(', ', array_keys($dup_keys)) ); } $copy = clone $this; $copy->defines += $defines; return $copy; }
[ "public", "function", "defines", "(", "array", "$", "defines", ")", ":", "self", "{", "if", "(", "!", "$", "defines", ")", "{", "return", "$", "this", ";", "}", "$", "dup_keys", "=", "array_intersect_key", "(", "$", "this", "->", "defines", ",", "$",...
Create new Lexer extending this one with DEFINEs DEFINEs are named regexps to be used as from terminals and whitespaces with named recursion `(?&name)` to simplify regexp code duplication. DEFINEs can refer to each other. Order should not matter. > Note: Returned object can be the same one in case of empty additions. @param array $defines Additional DEFINEs regexps. Duplicating names is restricted. @return static @since 1.4.0
[ "Create", "new", "Lexer", "extending", "this", "one", "with", "DEFINEs" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/Lexer.php#L71-L87
train
Vovan-VE/parser
src/lexer/Lexer.php
Lexer.whitespaces
public function whitespaces(array $whitespaces): self { if (!$whitespaces) { return $this; } $copy = clone $this; $copy->whitespaces = array_merge($copy->whitespaces, $whitespaces); return $copy; }
php
public function whitespaces(array $whitespaces): self { if (!$whitespaces) { return $this; } $copy = clone $this; $copy->whitespaces = array_merge($copy->whitespaces, $whitespaces); return $copy; }
[ "public", "function", "whitespaces", "(", "array", "$", "whitespaces", ")", ":", "self", "{", "if", "(", "!", "$", "whitespaces", ")", "{", "return", "$", "this", ";", "}", "$", "copy", "=", "clone", "$", "this", ";", "$", "copy", "->", "whitespaces"...
Create new Lexer extending this one with whitespaces Whitespaces are searched between all actual tokens and completely ignored. > Note: Returned object can be the same one in case of empty additions. @param string[] $whitespaces Additional whitespaces regexps. Duplicating currently is not checked, so it on your own. @return static @since 1.4.0
[ "Create", "new", "Lexer", "extending", "this", "one", "with", "whitespaces" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/Lexer.php#L100-L109
train
Vovan-VE/parser
src/lexer/Lexer.php
Lexer.fixed
public function fixed(array $fixed): self { if (!$fixed) { return $this; } $new_fixed = $this->addNamedTokens($this->fixed, $fixed, 'fixed'); $copy = clone $this; $copy->fixed = $new_fixed; return $copy; }
php
public function fixed(array $fixed): self { if (!$fixed) { return $this; } $new_fixed = $this->addNamedTokens($this->fixed, $fixed, 'fixed'); $copy = clone $this; $copy->fixed = $new_fixed; return $copy; }
[ "public", "function", "fixed", "(", "array", "$", "fixed", ")", ":", "self", "{", "if", "(", "!", "$", "fixed", ")", "{", "return", "$", "this", ";", "}", "$", "new_fixed", "=", "$", "this", "->", "addNamedTokens", "(", "$", "this", "->", "fixed", ...
Create new Lexer extending this one with fixed tokens Named tokens defined with fixed strings to parse as is. > Note: Returned object can be the same one in case of empty additions. @param string[] $fixed Additional fixed tokens. Duplicating names are restricted. @return static @throws \InvalidArgumentException In case of name duplication. @since 1.5.0
[ "Create", "new", "Lexer", "extending", "this", "one", "with", "fixed", "tokens" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/Lexer.php#L122-L133
train
Vovan-VE/parser
src/lexer/Lexer.php
Lexer.inline
public function inline(array $inline): self { if (!$inline) { return $this; } $copy = clone $this; $copy->inlines = array_merge($this->inlines, $inline); return $copy; }
php
public function inline(array $inline): self { if (!$inline) { return $this; } $copy = clone $this; $copy->inlines = array_merge($this->inlines, $inline); return $copy; }
[ "public", "function", "inline", "(", "array", "$", "inline", ")", ":", "self", "{", "if", "(", "!", "$", "inline", ")", "{", "return", "$", "this", ";", "}", "$", "copy", "=", "clone", "$", "this", ";", "$", "copy", "->", "inlines", "=", "array_m...
Create new Lexer extending this one with inline tokens Inline tokens defined only with fixed strings without names. Inline tokens are always hidden. > Note: Returned object can be the same one in case of empty additions. @param string[] $inline Additional inline tokens. Duplication is not permitted. @return static @since 1.5.0
[ "Create", "new", "Lexer", "extending", "this", "one", "with", "inline", "tokens" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/Lexer.php#L146-L155
train
Vovan-VE/parser
src/lexer/Lexer.php
Lexer.terminals
public function terminals(array $terminals): self { if (!$terminals) { return $this; } $new_terminals = $this->addNamedTokens($this->regexpMap, $terminals, 'terminal'); $copy = clone $this; $copy->regexpMap = $new_terminals; return $copy; }
php
public function terminals(array $terminals): self { if (!$terminals) { return $this; } $new_terminals = $this->addNamedTokens($this->regexpMap, $terminals, 'terminal'); $copy = clone $this; $copy->regexpMap = $new_terminals; return $copy; }
[ "public", "function", "terminals", "(", "array", "$", "terminals", ")", ":", "self", "{", "if", "(", "!", "$", "terminals", ")", "{", "return", "$", "this", ";", "}", "$", "new_terminals", "=", "$", "this", "->", "addNamedTokens", "(", "$", "this", "...
Create new Lexer extending this one with terminals Named tokens defined with regexps. Named regexps from DEFINEs can be referenced here with named recursion `(?&name)`. > Note: Returned object can be the same one in case of empty additions. @param string[] $terminals Additional terminals. Only named are acceptable. is restricted. @return static @since 1.4.0
[ "Create", "new", "Lexer", "extending", "this", "one", "with", "terminals" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/Lexer.php#L169-L180
train
Vovan-VE/parser
src/lexer/Lexer.php
Lexer.modifiers
public function modifiers(string $modifiers): self { if ('' === $modifiers) { return $this; } $copy = clone $this; $copy->modifiers .= $modifiers; return $copy; }
php
public function modifiers(string $modifiers): self { if ('' === $modifiers) { return $this; } $copy = clone $this; $copy->modifiers .= $modifiers; return $copy; }
[ "public", "function", "modifiers", "(", "string", "$", "modifiers", ")", ":", "self", "{", "if", "(", "''", "===", "$", "modifiers", ")", "{", "return", "$", "this", ";", "}", "$", "copy", "=", "clone", "$", "this", ";", "$", "copy", "->", "modifie...
Create new Lexer extending this one with RegExp modifiers Same modifiers will be applied both to tokens and whitespaces regexps. Here only "global" modifiers like `u`, `x`, `D`, etc. should be used. Other modifiers like `i` should (but not required) be used locally in specific parts like `(?i)[a-z]` or `(?i:[a-z])`. > Note: Returned object can be the same one in case of empty additions. @param string $modifiers Additional modifiers to whole regexps. @return static @since 1.4.0
[ "Create", "new", "Lexer", "extending", "this", "one", "with", "RegExp", "modifiers" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/Lexer.php#L196-L205
train
Vovan-VE/parser
src/lexer/Lexer.php
Lexer.addNamedTokens
private function addNamedTokens(array $oldTokens, array $addTokens, string $errorType): array { $dup_keys = array_intersect_key($oldTokens, $addTokens); if ($dup_keys) { throw new \InvalidArgumentException( "Cannot redefine $errorType: " . join(', ', array_keys($dup_keys)) ); } return $oldTokens + $addTokens; }
php
private function addNamedTokens(array $oldTokens, array $addTokens, string $errorType): array { $dup_keys = array_intersect_key($oldTokens, $addTokens); if ($dup_keys) { throw new \InvalidArgumentException( "Cannot redefine $errorType: " . join(', ', array_keys($dup_keys)) ); } return $oldTokens + $addTokens; }
[ "private", "function", "addNamedTokens", "(", "array", "$", "oldTokens", ",", "array", "$", "addTokens", ",", "string", "$", "errorType", ")", ":", "array", "{", "$", "dup_keys", "=", "array_intersect_key", "(", "$", "oldTokens", ",", "$", "addTokens", ")", ...
Extends array of named tokens @param string[] $oldTokens Existing tokens @param string[] $addTokens New tokens to add @param string $errorType Tokens type to insert in error message @return string[] New merged array of tokens @throws \InvalidArgumentException In case of name duplication. @since 1.5.0
[ "Extends", "array", "of", "named", "tokens" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/Lexer.php#L216-L226
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getAllAnnotations
public function getAllAnnotations($pageNumber) { $iTotalAnnotation = $this->GetAnnotationsCount($pageNumber); $listAnnotations = array(); for ($index = 1; $index <= $iTotalAnnotation; $index++) { array_push($listAnnotations, $this->GetAnnotation($pageNumber, $index)); } return $listAnnotations; }
php
public function getAllAnnotations($pageNumber) { $iTotalAnnotation = $this->GetAnnotationsCount($pageNumber); $listAnnotations = array(); for ($index = 1; $index <= $iTotalAnnotation; $index++) { array_push($listAnnotations, $this->GetAnnotation($pageNumber, $index)); } return $listAnnotations; }
[ "public", "function", "getAllAnnotations", "(", "$", "pageNumber", ")", "{", "$", "iTotalAnnotation", "=", "$", "this", "->", "GetAnnotationsCount", "(", "$", "pageNumber", ")", ";", "$", "listAnnotations", "=", "array", "(", ")", ";", "for", "(", "$", "in...
Gets list of all the annotations on a specified document page. @param integer $pageNumber Number of the page. @return array @throws Exception
[ "Gets", "list", "of", "all", "the", "annotations", "on", "a", "specified", "document", "page", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L30-L39
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getAnnotationsCount
public function getAnnotationsCount($pageNumber) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/annotations'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Annotations->List); }
php
public function getAnnotationsCount($pageNumber) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/annotations'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Annotations->List); }
[ "public", "function", "getAnnotationsCount", "(", "$", "pageNumber", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/pdf/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/pages/'", ".", "$", "pageNumber", ".", "'/an...
Gets number of annotations on a specified document page. @param integer $pageNumber Number of the page. @return integer @throws Exception
[ "Gets", "number", "of", "annotations", "on", "a", "specified", "document", "page", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L49-L57
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getAnnotation
public function getAnnotation($pageNumber, $annotationIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/annotations/' . $annotationIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Annotation; }
php
public function getAnnotation($pageNumber, $annotationIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/annotations/' . $annotationIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Annotation; }
[ "public", "function", "getAnnotation", "(", "$", "pageNumber", ",", "$", "annotationIndex", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/pdf/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/pages/'", ".", "$", ...
Gets a specfied annotation on a specified document page. @param integer $pageNumber Number of the page. @param integer $annotationIndex Index of th annotation. @return object @throws Exception
[ "Gets", "a", "specfied", "annotation", "on", "a", "specified", "document", "page", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L68-L76
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getChildBookmarksCount
public function getChildBookmarksCount($parent) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/bookmarks/' . $parent . '/bookmarks'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Bookmarks->List); }
php
public function getChildBookmarksCount($parent) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/bookmarks/' . $parent . '/bookmarks'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Bookmarks->List); }
[ "public", "function", "getChildBookmarksCount", "(", "$", "parent", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/pdf/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/bookmarks/'", ".", "$", "parent", ".", "'/boo...
Gets number of child bookmarks in a specfied parent bookmark. @param integer $parent @return integer @throws Exception
[ "Gets", "number", "of", "child", "bookmarks", "in", "a", "specfied", "parent", "bookmark", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L86-L94
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getChildBookmark
public function getChildBookmark($parentIndex, $childIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/bookmarks/' . $parentIndex . '/bookmarks/' . $childIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Bookmark; }
php
public function getChildBookmark($parentIndex, $childIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/bookmarks/' . $parentIndex . '/bookmarks/' . $childIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Bookmark; }
[ "public", "function", "getChildBookmark", "(", "$", "parentIndex", ",", "$", "childIndex", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/pdf/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/bookmarks/'", ".", "$"...
Gets a specfied child Bookmark for selected parent bookmark in Pdf document. @param integer $parentIndex Parent index. @param integer $childIndex Child index. @return object @throws Exception
[ "Gets", "a", "specfied", "child", "Bookmark", "for", "selected", "parent", "bookmark", "in", "Pdf", "document", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L105-L113
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.isChildBookmark
public function isChildBookmark($bookmarkIndex) { if ($bookmarkIndex === '') throw new Exception('bookmark index not specified'); $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/bookmarks/' . $bookmarkIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Bookmark; }
php
public function isChildBookmark($bookmarkIndex) { if ($bookmarkIndex === '') throw new Exception('bookmark index not specified'); $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/bookmarks/' . $bookmarkIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Bookmark; }
[ "public", "function", "isChildBookmark", "(", "$", "bookmarkIndex", ")", "{", "if", "(", "$", "bookmarkIndex", "===", "''", ")", "throw", "new", "Exception", "(", "'bookmark index not specified'", ")", ";", "$", "strURI", "=", "Product", "::", "$", "baseProduc...
Checks whether selected bookmark is parent or child Gets a specfied child Bookmark for selected parent bookmark in Pdf document. @param integer $bookmarkIndex Index of the bookmark. @return object @throws Exception
[ "Checks", "whether", "selected", "bookmark", "is", "parent", "or", "child", "Gets", "a", "specfied", "child", "Bookmark", "for", "selected", "parent", "bookmark", "in", "Pdf", "document", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L124-L134
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getAllBookmarks
public function getAllBookmarks() { $iTotalBookmarks = $this->GetBookmarksCount(); $listBookmarks = array(); for ($index = 1; $index <= $iTotalBookmarks; $index++) { array_push($listBookmarks, $this->GetBookmark($index)); } return $listBookmarks; }
php
public function getAllBookmarks() { $iTotalBookmarks = $this->GetBookmarksCount(); $listBookmarks = array(); for ($index = 1; $index <= $iTotalBookmarks; $index++) { array_push($listBookmarks, $this->GetBookmark($index)); } return $listBookmarks; }
[ "public", "function", "getAllBookmarks", "(", ")", "{", "$", "iTotalBookmarks", "=", "$", "this", "->", "GetBookmarksCount", "(", ")", ";", "$", "listBookmarks", "=", "array", "(", ")", ";", "for", "(", "$", "index", "=", "1", ";", "$", "index", "<=", ...
Gets list of all the Bookmarks in a Pdf document. @return array @throws Exception
[ "Gets", "list", "of", "all", "the", "Bookmarks", "in", "a", "Pdf", "document", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L142-L151
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getAllAttachments
public function getAllAttachments() { $iTotalAttachments = $this->GetAttachmentsCount(); $listAttachments = array(); for ($index = 1; $index <= $iTotalAttachments; $index++) { array_push($listAttachments, $this->GetAttachment($index)); } return $listAttachments; }
php
public function getAllAttachments() { $iTotalAttachments = $this->GetAttachmentsCount(); $listAttachments = array(); for ($index = 1; $index <= $iTotalAttachments; $index++) { array_push($listAttachments, $this->GetAttachment($index)); } return $listAttachments; }
[ "public", "function", "getAllAttachments", "(", ")", "{", "$", "iTotalAttachments", "=", "$", "this", "->", "GetAttachmentsCount", "(", ")", ";", "$", "listAttachments", "=", "array", "(", ")", ";", "for", "(", "$", "index", "=", "1", ";", "$", "index", ...
Gets List of all the attachments in Pdf document. @return array @throws Exception
[ "Gets", "List", "of", "all", "the", "attachments", "in", "Pdf", "document", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L193-L201
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getAttachmentsCount
public function getAttachmentsCount() { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/attachments'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Attachments->List); }
php
public function getAttachmentsCount() { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/attachments'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Attachments->List); }
[ "public", "function", "getAttachmentsCount", "(", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/pdf/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/attachments'", ";", "$", "signedURI", "=", "Utils", "::", "sign...
Gets number of attachments in the Pdf document. @return integer @throws Exception
[ "Gets", "number", "of", "attachments", "in", "the", "Pdf", "document", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L209-L216
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getAttachment
public function getAttachment($attachmentIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/attachments/' . $attachmentIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Attachment; }
php
public function getAttachment($attachmentIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/attachments/' . $attachmentIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Attachment; }
[ "public", "function", "getAttachment", "(", "$", "attachmentIndex", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/pdf/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/attachments/'", ".", "$", "attachmentIndex", ";...
Gets selected attachment from Pdf document. @param integer $attachmentIndex Index of the attachment. @return object @throws Exception
[ "Gets", "selected", "attachment", "from", "Pdf", "document", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L226-L234
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.downloadAttachment
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', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { Utils::saveFile($responseStream, AsposeApp::$outPutLocation . $fileInformation->Name); return ''; } else return $v_output; }
php
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', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { Utils::saveFile($responseStream, AsposeApp::$outPutLocation . $fileInformation->Name); return ''; } else return $v_output; }
[ "public", "function", "downloadAttachment", "(", "$", "attachmentIndex", ")", "{", "$", "fileInformation", "=", "$", "this", "->", "GetAttachment", "(", "$", "attachmentIndex", ")", ";", "//build URI to download attachment", "$", "strURI", "=", "Product", "::", "$...
Download the selected attachment from Pdf document. @param string $attachmentIndex Index of the attachment. @return string Returns the file path. @throws Exception
[ "Download", "the", "selected", "attachment", "from", "Pdf", "document", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L244-L258
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getAllLinks
public function getAllLinks($pageNumber) { $iTotalLinks = $this->GetLinksCount($pageNumber); $listLinks = array(); for ($index = 1; $index <= $iTotalLinks; $index++) { array_push($listLinks, $this->GetLink($pageNumber, $index)); } return $listLinks; }
php
public function getAllLinks($pageNumber) { $iTotalLinks = $this->GetLinksCount($pageNumber); $listLinks = array(); for ($index = 1; $index <= $iTotalLinks; $index++) { array_push($listLinks, $this->GetLink($pageNumber, $index)); } return $listLinks; }
[ "public", "function", "getAllLinks", "(", "$", "pageNumber", ")", "{", "$", "iTotalLinks", "=", "$", "this", "->", "GetLinksCount", "(", "$", "pageNumber", ")", ";", "$", "listLinks", "=", "array", "(", ")", ";", "for", "(", "$", "index", "=", "1", "...
Gets list of all the links on a specified document page. @param integer $pageNumber Number of the page. @return array @throws Exception
[ "Gets", "list", "of", "all", "the", "links", "on", "a", "specified", "document", "page", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L268-L277
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getLinksCount
public function getLinksCount($pageNumber) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/links'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Links->List); }
php
public function getLinksCount($pageNumber) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/links'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Links->List); }
[ "public", "function", "getLinksCount", "(", "$", "pageNumber", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/pdf/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/pages/'", ".", "$", "pageNumber", ".", "'/links'",...
Gets number of links on a specified document page. @param integer $pageNumber Number of the page. @return integer @throws Exception
[ "Gets", "number", "of", "links", "on", "a", "specified", "document", "page", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L287-L295
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Pdf/AnnotationEditor.php
AnnotationEditor.getLink
public function getLink($pageNumber, $linkIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/links/' . $linkIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Link; }
php
public function getLink($pageNumber, $linkIndex) { $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/links/' . $linkIndex; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Link; }
[ "public", "function", "getLink", "(", "$", "pageNumber", ",", "$", "linkIndex", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/pdf/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/pages/'", ".", "$", "pageNumber...
Gets a specfied link on a specified document page @param integer $pageNumber Number of the page. @param integer $linkIndex Index of the link. @return object @throws Exception
[ "Gets", "a", "specfied", "link", "on", "a", "specified", "document", "page" ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Pdf/AnnotationEditor.php#L306-L314
train
ordermind/symfony-logical-authorization-bundle
PermissionTypes/Role/Role.php
Role.checkPermission
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; } if (!($user instanceof SecurityUserInterface)) { throw new \InvalidArgumentException('The user class must implement Symfony\Component\Security\Core\User\UserInterface to be able to evaluate the user role.'); } $roles = $user->getRoles(); // Use Symfony Security Role class to make roles compatible with RoleHierarchy::getReachableRoles(). foreach ($roles as $i => $thisRole) { if (is_string($thisRole)) { $roles[$i] = new SecurityRole($thisRole); } elseif (!($thisRole instanceof SecurityRole)) { throw new \InvalidArgumentException('One of the roles of this user is neither a string nor an instance of Symfony\Component\Security\Core\Role\Role.'); } } $roles = $this->roleHierarchy->getReachableRoles($roles); foreach ($roles as $thisRole) { $strRole = (string) $thisRole->getRole(); if ($role === $strRole) { return true; } } return false; }
php
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; } if (!($user instanceof SecurityUserInterface)) { throw new \InvalidArgumentException('The user class must implement Symfony\Component\Security\Core\User\UserInterface to be able to evaluate the user role.'); } $roles = $user->getRoles(); // Use Symfony Security Role class to make roles compatible with RoleHierarchy::getReachableRoles(). foreach ($roles as $i => $thisRole) { if (is_string($thisRole)) { $roles[$i] = new SecurityRole($thisRole); } elseif (!($thisRole instanceof SecurityRole)) { throw new \InvalidArgumentException('One of the roles of this user is neither a string nor an instance of Symfony\Component\Security\Core\Role\Role.'); } } $roles = $this->roleHierarchy->getReachableRoles($roles); foreach ($roles as $thisRole) { $strRole = (string) $thisRole->getRole(); if ($role === $strRole) { return true; } } return false; }
[ "public", "function", "checkPermission", "(", "$", "role", ",", "$", "context", ")", "{", "if", "(", "!", "is_string", "(", "$", "role", ")", ")", "{", "throw", "new", "\\", "TypeError", "(", "'The role parameter must be a string.'", ")", ";", "}", "if", ...
Checks if a role is present on a user in a given context @param string $role The name of the role to evaluate @param array $context The context for evaluating the role. The context must contain a 'user' key which references either a user string (to signify an anonymous user) or an object implementing Symfony\Component\Security\Core\User\UserInterface. You can get the current user by calling getCurrentUser() from the service 'logauth.service.helper'. @return bool TRUE if the role is present on the user or FALSE if it is not present
[ "Checks", "if", "a", "role", "is", "present", "on", "a", "user", "in", "a", "given", "context" ]
3b051f0984dcf3527024b64040bfc4b2b0855f3b
https://github.com/ordermind/symfony-logical-authorization-bundle/blob/3b051f0984dcf3527024b64040bfc4b2b0855f3b/PermissionTypes/Role/Role.php#L48-L92
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.getAccountInformation
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)) { $accountInfo = AccountInformation::getFromJson($result); if ($accountInfo != null) { return $accountInfo; } } return null; }
php
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)) { $accountInfo = AccountInformation::getFromJson($result); if ($accountInfo != null) { return $accountInfo; } } return null; }
[ "public", "function", "getAccountInformation", "(", ")", "{", "$", "url", "=", "$", "this", "->", "url", ".", "self", "::", "$", "API_ROUTES", "[", "'ACCOUNT_INFO'", "]", ";", "$", "url", ".=", "'?apiVersion='", ".", "$", "this", "->", "apiVersion", ";",...
Get information about the API account.
[ "Get", "information", "about", "the", "API", "account", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L1183-L1198
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.preparePayment
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 && is_array($result)) { $this->returnCode = $result['code']; $this->returnMessage = $result['message']; if ($this->returnCode == "200") { $this->merchantToken = $result['merchantToken']; $this->customerToken = $result['customerToken']; return true; } else { $this->clientErrorMessage = $this->returnMessage; } } } return false; }
php
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 && is_array($result)) { $this->returnCode = $result['code']; $this->returnMessage = $result['message']; if ($this->returnCode == "200") { $this->merchantToken = $result['merchantToken']; $this->customerToken = $result['customerToken']; return true; } else { $this->clientErrorMessage = $this->returnMessage; } } } return false; }
[ "public", "function", "preparePayment", "(", ")", "{", "if", "(", "$", "this", "->", "validate", "(", ")", ")", "{", "$", "trans", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "fieldsJSON", "as", "$", "fieldName", ")", "{", "if",...
Prepare a new payment on the payment page application. This method will validate the payment data and call the payment page application to create a new payment. The fields returnCode, returnMessage, merchantToken and customerToken will be populated according to the call result. @return boolean true if creation is successful, false otherwise
[ "Prepare", "a", "new", "payment", "on", "the", "payment", "page", "application", ".", "This", "method", "will", "validate", "the", "payment", "data", "and", "call", "the", "payment", "page", "application", "to", "create", "a", "new", "payment", ".", "The", ...
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L1218-L1250
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.getPaymentStatus
public function getPaymentStatus($merchantToken) { if ($merchantToken != null && strlen(trim($merchantToken)) > 0) { $url = $this->url . str_replace(":merchantToken", $merchantToken, Connect2PayClient::$API_ROUTES['PAYMENT_STATUS']); $url .= '?apiVersion=' . $this->apiVersion; $result = $this->doGet($url, array(), false); if ($result !== null && is_object($result)) { $this->initStatus($result); if (isset($this->status)) { return $this->status; } } } return null; }
php
public function getPaymentStatus($merchantToken) { if ($merchantToken != null && strlen(trim($merchantToken)) > 0) { $url = $this->url . str_replace(":merchantToken", $merchantToken, Connect2PayClient::$API_ROUTES['PAYMENT_STATUS']); $url .= '?apiVersion=' . $this->apiVersion; $result = $this->doGet($url, array(), false); if ($result !== null && is_object($result)) { $this->initStatus($result); if (isset($this->status)) { return $this->status; } } } return null; }
[ "public", "function", "getPaymentStatus", "(", "$", "merchantToken", ")", "{", "if", "(", "$", "merchantToken", "!=", "null", "&&", "strlen", "(", "trim", "(", "$", "merchantToken", ")", ")", ">", "0", ")", "{", "$", "url", "=", "$", "this", "->", "u...
Do a transaction status request on the payment page application. @param string $merchantToken The merchant token related to this payment @return PaymentStatus The PaymentStatus object of the payment or null on error
[ "Do", "a", "transaction", "status", "request", "on", "the", "payment", "page", "application", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L1297-L1314
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.refundTransaction
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']); } if (isset($result['transactionID'])) { $this->status->setTransactionID($result['transactionID']); } if (isset($result['operation'])) { $this->status->setOperation($result['operation']); } return $this->status; } else { $this->clientErrorMessage = 'No result received from refund call'; } } else { $this->clientErrorMessage = '"transactionID" must not be null, "amount" must be a positive integer'; } return null; }
php
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']); } if (isset($result['transactionID'])) { $this->status->setTransactionID($result['transactionID']); } if (isset($result['operation'])) { $this->status->setOperation($result['operation']); } return $this->status; } else { $this->clientErrorMessage = 'No result received from refund call'; } } else { $this->clientErrorMessage = '"transactionID" must not be null, "amount" must be a positive integer'; } return null; }
[ "public", "function", "refundTransaction", "(", "$", "transactionID", ",", "$", "amount", ")", "{", "if", "(", "$", "transactionID", "!==", "null", "&&", "$", "amount", "!==", "null", "&&", "(", "is_int", "(", "$", "amount", ")", "||", "ctype_digit", "("...
Refund a transaction. @param string $transactionID Identifier of the transaction to refund @param int $amount The amount to refund @return RefundStatus The RefundStatus filled with values returned from the operation or null on failure (in that case call getClientErrorMessage())
[ "Refund", "a", "transaction", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L1327-L1361
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.cancelSubscription
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)); if ($result != null && is_array($result)) { $this->clientErrorMessage = $result['message']; return $result['code']; } } else { $this->clientErrorMessage = 'subscriptionID and cancelReason must be not null and numeric'; } return null; }
php
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)); if ($result != null && is_array($result)) { $this->clientErrorMessage = $result['message']; return $result['code']; } } else { $this->clientErrorMessage = 'subscriptionID and cancelReason must be not null and numeric'; } return null; }
[ "public", "function", "cancelSubscription", "(", "$", "subscriptionID", ",", "$", "cancelReason", ")", "{", "if", "(", "$", "subscriptionID", "!=", "null", "&&", "is_numeric", "(", "$", "subscriptionID", ")", "&&", "isset", "(", "$", "cancelReason", ")", "&&...
Do a subscription cancellation. @param int $subscriptionID Identifier of the subscription to cancel @param int $cancelReason Identifier of the cancelReason (see _SUBSCRIPTION_CANCEL_* constants) @return string The result code of the operation (200 for success) or null on failure
[ "Do", "a", "subscription", "cancellation", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L1469-L1487
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.directAliPayProcess
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); return $apiResponse; } else { $this->clientErrorMessage = 'No result received from direct AliPay processing call: ' . $this->clientErrorMessage; } } else { $this->clientErrorMessage = '"customerToken" and "request" must not be null'; } return null; }
php
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); return $apiResponse; } else { $this->clientErrorMessage = 'No result received from direct AliPay processing call: ' . $this->clientErrorMessage; } } else { $this->clientErrorMessage = '"customerToken" and "request" must not be null'; } return null; }
[ "public", "function", "directAliPayProcess", "(", "$", "customerToken", ",", "$", "request", ")", "{", "if", "(", "$", "customerToken", "!==", "null", "&&", "$", "request", "!==", "null", ")", "{", "$", "url", "=", "$", "this", "->", "url", ".", "str_r...
Direct AliPay transaction process. Must be preceded by a payment prepare call. @param string $customerToken Customer token of the payment returned by the previous prepare call @param AliPayDirectProcessRequest $request The AliPayDirectProcessRequest object with call parameters @return AliPayDirectProcessResponse The AliPayDirectProcessResponse filled with values returned from the operation or null on failure (in that case call getClientErrorMessage())
[ "Direct", "AliPay", "transaction", "process", ".", "Must", "be", "preceded", "by", "a", "payment", "prepare", "call", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L1539-L1559
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.validate
public function validate() { $arrErrors = array(); $arrErrors = $this->validateFields(); if (sizeof($arrErrors) > 0) { foreach ($arrErrors as $error) { $this->clientErrorMessage .= $error . " * "; } return false; } return true; }
php
public function validate() { $arrErrors = array(); $arrErrors = $this->validateFields(); if (sizeof($arrErrors) > 0) { foreach ($arrErrors as $error) { $this->clientErrorMessage .= $error . " * "; } return false; } return true; }
[ "public", "function", "validate", "(", ")", "{", "$", "arrErrors", "=", "array", "(", ")", ";", "$", "arrErrors", "=", "$", "this", "->", "validateFields", "(", ")", ";", "if", "(", "sizeof", "(", "$", "arrErrors", ")", ">", "0", ")", "{", "foreach...
Validate the current transaction data. @return boolean True if transaction data are valid, false otherwise
[ "Validate", "the", "current", "transaction", "data", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L1641-L1654
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.addCartProduct
public function addCartProduct($cartProduct) { if ($this->orderCartContent == null || !is_array($this->orderCartContent)) { $this->orderCartContent = array(); } if ($cartProduct instanceof CartProduct) { $this->orderCartContent[] = $cartProduct; } return $this; }
php
public function addCartProduct($cartProduct) { if ($this->orderCartContent == null || !is_array($this->orderCartContent)) { $this->orderCartContent = array(); } if ($cartProduct instanceof CartProduct) { $this->orderCartContent[] = $cartProduct; } return $this; }
[ "public", "function", "addCartProduct", "(", "$", "cartProduct", ")", "{", "if", "(", "$", "this", "->", "orderCartContent", "==", "null", "||", "!", "is_array", "(", "$", "this", "->", "orderCartContent", ")", ")", "{", "$", "this", "->", "orderCartConten...
Add a CartProduct in the orderCartContent. @param CartProduct $cartProduct The product to add to the cart @return Connect2PayClient
[ "Add", "a", "CartProduct", "in", "the", "orderCartContent", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L2145-L2155
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.setDefaultOrderCartContent
public function setDefaultOrderCartContent() { $this->orderCartContent = array(); $product = new CartProduct(); $product->setCartProductId(0)->setCartProductName("NA"); $product->setCartProductUnitPrice(0)->setCartProductQuantity(1); $product->setCartProductBrand("NA")->setCartProductMPN("NA"); $product->setCartProductCategoryName("NA")->setCartProductCategoryID(0); $this->orderCartContent[] = $product; }
php
public function setDefaultOrderCartContent() { $this->orderCartContent = array(); $product = new CartProduct(); $product->setCartProductId(0)->setCartProductName("NA"); $product->setCartProductUnitPrice(0)->setCartProductQuantity(1); $product->setCartProductBrand("NA")->setCartProductMPN("NA"); $product->setCartProductCategoryName("NA")->setCartProductCategoryID(0); $this->orderCartContent[] = $product; }
[ "public", "function", "setDefaultOrderCartContent", "(", ")", "{", "$", "this", "->", "orderCartContent", "=", "array", "(", ")", ";", "$", "product", "=", "new", "CartProduct", "(", ")", ";", "$", "product", "->", "setCartProductId", "(", "0", ")", "->", ...
Set a default cart content, to be used when anti fraud system is enabled and no real cart is known
[ "Set", "a", "default", "cart", "content", "to", "be", "used", "when", "anti", "fraud", "system", "is", "enabled", "and", "no", "real", "cart", "is", "known" ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L2411-L2420
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayClient.validateFields
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; } foreach ($this->fieldsValidate as $field => $method) { if (!C2PValidate::isEmpty($this->{$field}) && !call_user_func(array('PayXpert\Connect2Pay\C2PValidate', $method), $this->{$field})) $returnError[] = $field . ' = ' . $this->{$field}; } return $returnError; }
php
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; } foreach ($this->fieldsValidate as $field => $method) { if (!C2PValidate::isEmpty($this->{$field}) && !call_user_func(array('PayXpert\Connect2Pay\C2PValidate', $method), $this->{$field})) $returnError[] = $field . ' = ' . $this->{$field}; } return $returnError; }
[ "private", "function", "validateFields", "(", ")", "{", "$", "fieldsRequired", "=", "$", "this", "->", "fieldsRequired", ";", "$", "returnError", "=", "array", "(", ")", ";", "foreach", "(", "$", "fieldsRequired", "as", "$", "field", ")", "{", "if", "(",...
Check for fields validity @return array empty if everything is OK or as many elements as errors matched
[ "Check", "for", "fields", "validity" ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L2428-L2448
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
PaymentStatus.getLastInitialTransactionAttempt
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) { if (in_array($transaction->getOperation(), array("sale", "authorize", "submission")) && $transaction->getRefTransactionID() == null) { if ($lastAttempt == null || $lastAttempt->getDate() < $transaction->getDate()) { $lastAttempt = $transaction; } } } } return $lastAttempt; }
php
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) { if (in_array($transaction->getOperation(), array("sale", "authorize", "submission")) && $transaction->getRefTransactionID() == null) { if ($lastAttempt == null || $lastAttempt->getDate() < $transaction->getDate()) { $lastAttempt = $transaction; } } } } return $lastAttempt; }
[ "public", "function", "getLastInitialTransactionAttempt", "(", ")", "{", "$", "lastAttempt", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "transactions", ")", "&&", "is_array", "(", "$", "this", "->", "transactions", ")", "&&", "count", "(...
Return the last initial transaction attempt done for this payment. Only returns sale, authorize or submission. Transactions with a referral are not considered by this method, only initial transactions done by the customer to complete the payment. @return TransactionAttempt The last transaction attempt done for this payment
[ "Return", "the", "last", "initial", "transaction", "attempt", "done", "for", "this", "payment", ".", "Only", "returns", "sale", "authorize", "or", "submission", ".", "Transactions", "with", "a", "referral", "are", "not", "considered", "by", "this", "method", "...
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L3046-L3062
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
PaymentStatus.getReferringTransactionAttempt
public function getReferringTransactionAttempt($refTransactionId, $transactionOperation) { $attempts = $this->getReferringTransactionAttempts($refTransactionId, $transactionOperation); if (is_array($attempts) && count($attempts) > 0) { return $attempts[0]; } return null; }
php
public function getReferringTransactionAttempt($refTransactionId, $transactionOperation) { $attempts = $this->getReferringTransactionAttempts($refTransactionId, $transactionOperation); if (is_array($attempts) && count($attempts) > 0) { return $attempts[0]; } return null; }
[ "public", "function", "getReferringTransactionAttempt", "(", "$", "refTransactionId", ",", "$", "transactionOperation", ")", "{", "$", "attempts", "=", "$", "this", "->", "getReferringTransactionAttempts", "(", "$", "refTransactionId", ",", "$", "transactionOperation", ...
Get the transaction attempt referring to the provided transactionId with the given operation. In case several transactions are found will return the older one. Used for example to retrieve the collection for a submission. @param refTransactionId The transaction identifier of the referral (initial) transaction @param transactionOperation The operation of the transaction to retrieve (collection, refund...) @return TransactionAttempt The TransactionAttempt found or null if not found
[ "Get", "the", "transaction", "attempt", "referring", "to", "the", "provided", "transactionId", "with", "the", "given", "operation", ".", "In", "case", "several", "transactions", "are", "found", "will", "return", "the", "older", "one", ".", "Used", "for", "exam...
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L3079-L3087
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
PaymentStatus.getReferringTransactionAttempts
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, function ($t1, $t2) { $date1 = $t1->getDate(); $date2 = $t2->getDate(); if ($date1 === null && $date2 !== null) { return -1; } if ($date1 !== null && $date2 === null) { return 1; } return ($date1 === $date2 ? 0 : ($date1 < $date2 ? -1 : 1)); }); } } return $attempts; }
php
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, function ($t1, $t2) { $date1 = $t1->getDate(); $date2 = $t2->getDate(); if ($date1 === null && $date2 !== null) { return -1; } if ($date1 !== null && $date2 === null) { return 1; } return ($date1 === $date2 ? 0 : ($date1 < $date2 ? -1 : 1)); }); } } return $attempts; }
[ "public", "function", "getReferringTransactionAttempts", "(", "$", "refTransactionId", ",", "$", "transactionOperation", "=", "null", ")", "{", "$", "attempts", "=", "array", "(", ")", ";", "if", "(", "$", "refTransactionId", "!==", "null", "&&", "isset", "(",...
Get the transaction attempts referring to the provided transactionId with the given operation. @param refTransactionId The transaction identifier of the referral (initial) transaction @param transactionOperation The operation of the transactions to retrieve (collection, refund...). If null, all operations are returned. @return array TransactionAttempt A list with the transactions found (sorted by date, older first) or an empty list if not found
[ "Get", "the", "transaction", "attempts", "referring", "to", "the", "provided", "transactionId", "with", "the", "given", "operation", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L3104-L3135
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayCurrencyHelper.getISO4217CurrencyFromCode
public static function getISO4217CurrencyFromCode($code) { foreach (Connect2PayCurrencyHelper::$currencies as $currency => $data) { if ($data["code"] == $code) { return $currency; } } return null; }
php
public static function getISO4217CurrencyFromCode($code) { foreach (Connect2PayCurrencyHelper::$currencies as $currency => $data) { if ($data["code"] == $code) { return $currency; } } return null; }
[ "public", "static", "function", "getISO4217CurrencyFromCode", "(", "$", "code", ")", "{", "foreach", "(", "Connect2PayCurrencyHelper", "::", "$", "currencies", "as", "$", "currency", "=>", "$", "data", ")", "{", "if", "(", "$", "data", "[", "\"code\"", "]", ...
Get a currency alphabetic code according to its numeric code in ISO4217 @param string $code The numeric code to look for @return string The alphabetic code (like EUR or USD) or null if not found.
[ "Get", "a", "currency", "alphabetic", "code", "according", "to", "its", "numeric", "code", "in", "ISO4217" ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5029-L5037
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayCurrencyHelper.getISO4217CurrencyCode
public static function getISO4217CurrencyCode($currency) { return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["code"] : null; }
php
public static function getISO4217CurrencyCode($currency) { return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["code"] : null; }
[ "public", "static", "function", "getISO4217CurrencyCode", "(", "$", "currency", ")", "{", "return", "(", "array_key_exists", "(", "$", "currency", ",", "Connect2PayCurrencyHelper", "::", "$", "currencies", ")", ")", "?", "Connect2PayCurrencyHelper", "::", "$", "cu...
Return the ISO4217 currency code. @param string $currency The currency to look for @return string The ISO4217 code or null if not found
[ "Return", "the", "ISO4217", "currency", "code", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5046-L5048
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayCurrencyHelper.getCurrencySymbol
public static function getCurrencySymbol($currency) { return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["symbol"] : null; }
php
public static function getCurrencySymbol($currency) { return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["symbol"] : null; }
[ "public", "static", "function", "getCurrencySymbol", "(", "$", "currency", ")", "{", "return", "(", "array_key_exists", "(", "$", "currency", ",", "Connect2PayCurrencyHelper", "::", "$", "currencies", ")", ")", "?", "Connect2PayCurrencyHelper", "::", "$", "currenc...
Return the currency symbol. @param string $currency The currency to look for @return string The currency symbol or null if not found
[ "Return", "the", "currency", "symbol", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5057-L5059
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayCurrencyHelper.getCurrencyName
public static function getCurrencyName($currency) { return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["currency"] : null; }
php
public static function getCurrencyName($currency) { return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["currency"] : null; }
[ "public", "static", "function", "getCurrencyName", "(", "$", "currency", ")", "{", "return", "(", "array_key_exists", "(", "$", "currency", ",", "Connect2PayCurrencyHelper", "::", "$", "currencies", ")", ")", "?", "Connect2PayCurrencyHelper", "::", "$", "currencie...
Return the currency name. @param string $currency The currency to look for @return string The currency name or null if not found
[ "Return", "the", "currency", "name", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5068-L5070
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayCurrencyHelper.getRate
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); } } $json = trim(curl_exec($curl)); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($httpCode == 200) { // Parse the CSV, we should only have a number, check this $obj = json_decode($json, true); if (is_array($obj) && array_key_exists("rates", $obj) && array_key_exists($to, $obj['rates']) && preg_match('/^[0-9.]+$/', $obj['rates'][$to])) { return $obj['rates'][$to]; } } return null; }
php
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); } } $json = trim(curl_exec($curl)); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($httpCode == 200) { // Parse the CSV, we should only have a number, check this $obj = json_decode($json, true); if (is_array($obj) && array_key_exists("rates", $obj) && array_key_exists($to, $obj['rates']) && preg_match('/^[0-9.]+$/', $obj['rates'][$to])) { return $obj['rates'][$to]; } } return null; }
[ "public", "static", "function", "getRate", "(", "$", "from", ",", "$", "to", ")", "{", "// Check if currencies exists", "if", "(", "!", "Connect2PayCurrencyHelper", "::", "currencyIsAvailable", "(", "$", "from", ")", "||", "!", "Connect2PayCurrencyHelper", "::", ...
Get a currency conversion rate from Yahoo webservice. @param string $from The source currency @param string $to The destination currency
[ "Get", "a", "currency", "conversion", "rate", "from", "Yahoo", "webservice", "." ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5080-L5119
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
Connect2PayCurrencyHelper.convert
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 // else round the result to 2 digits only return ($cent) ? round($convert, 0) : round($convert, 2); } return null; }
php
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 // else round the result to 2 digits only return ($cent) ? round($convert, 0) : round($convert, 2); } return null; }
[ "public", "static", "function", "convert", "(", "$", "amount", ",", "$", "from", ",", "$", "to", ",", "$", "cent", "=", "true", ")", "{", "// Get the conversion rate", "$", "rate", "=", "Connect2PayCurrencyHelper", "::", "getRate", "(", "$", "from", ",", ...
Convert an amount from one currency to another @param int $amount The amount to convert @param string $from The source currency @param string $to The destination currency @param boolean $cent Specifies if the amount is in cent (default true) @return integer The converted amount or null in case of error
[ "Convert", "an", "amount", "from", "one", "currency", "to", "another" ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5134-L5147
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
C2PValidate.isPaymentMethod
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 || (string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_WECHAT || (string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_LINE || (string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_ALIPAY); }
php
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 || (string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_WECHAT || (string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_LINE || (string) $paymentMethod == Connect2PayClient::PAYMENT_METHOD_ALIPAY); }
[ "static", "public", "function", "isPaymentMethod", "(", "$", "paymentMethod", ")", "{", "return", "(", "(", "string", ")", "$", "paymentMethod", "==", "Connect2PayClient", "::", "PAYMENT_METHOD_CREDITCARD", "||", "(", "string", ")", "$", "paymentMethod", "==", "...
Payment Mean validity @param string $paymentMethod Payment Mean to validate @return boolean Validity is ok or not
[ "Payment", "Mean", "validity" ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5419-L5427
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
C2PValidate.isPaymentNetwork
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) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_POLI || (string) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_DRAGONPAY || (string) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_TRUSTLY); }
php
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) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_POLI || (string) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_DRAGONPAY || (string) $paymentNetwork == Connect2PayClient::PAYMENT_NETWORK_TRUSTLY); }
[ "static", "public", "function", "isPaymentNetwork", "(", "$", "paymentNetwork", ")", "{", "return", "(", "(", "string", ")", "$", "paymentNetwork", "==", "Connect2PayClient", "::", "PAYMENT_NETWORK_SOFORT", "||", "(", "string", ")", "$", "paymentNetwork", "==", ...
Payment network validity @param string $paymentNetwork Payment Network to validate @return boolean Validity is ok or not
[ "Payment", "network", "validity" ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5436-L5445
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
C2PValidate.isPaymentMode
static public function isPaymentMode($paymentMode) { return ((string) $paymentMode == Connect2PayClient::PAYMENT_MODE_SINGLE || (string) $paymentMode == Connect2PayClient::PAYMENT_MODE_ONSHIPPING || (string) $paymentMode == Connect2PayClient::PAYMENT_MODE_RECURRENT || (string) $paymentMode == Connect2PayClient::PAYMENT_MODE_INSTALMENTS); }
php
static public function isPaymentMode($paymentMode) { return ((string) $paymentMode == Connect2PayClient::PAYMENT_MODE_SINGLE || (string) $paymentMode == Connect2PayClient::PAYMENT_MODE_ONSHIPPING || (string) $paymentMode == Connect2PayClient::PAYMENT_MODE_RECURRENT || (string) $paymentMode == Connect2PayClient::PAYMENT_MODE_INSTALMENTS); }
[ "static", "public", "function", "isPaymentMode", "(", "$", "paymentMode", ")", "{", "return", "(", "(", "string", ")", "$", "paymentMode", "==", "Connect2PayClient", "::", "PAYMENT_MODE_SINGLE", "||", "(", "string", ")", "$", "paymentMode", "==", "Connect2PayCli...
Payment Type validity @param string $paymentMode Payment Mode to validate @return boolean Validity is ok or not
[ "Payment", "Type", "validity" ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5466-L5471
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
C2PValidate.isSubscriptionType
static public function isSubscriptionType($subscriptionType) { return ((string) $subscriptionType == Connect2PayClient::SUBSCRIPTION_TYPE_NORMAL || (string) $subscriptionType == Connect2PayClient::SUBSCRIPTION_TYPE_INFINITE || (string) $subscriptionType == Connect2PayClient::SUBSCRIPTION_TYPE_ONETIME || (string) $subscriptionType == Connect2PayClient::SUBSCRIPTION_TYPE_LIFETIME); }
php
static public function isSubscriptionType($subscriptionType) { return ((string) $subscriptionType == Connect2PayClient::SUBSCRIPTION_TYPE_NORMAL || (string) $subscriptionType == Connect2PayClient::SUBSCRIPTION_TYPE_INFINITE || (string) $subscriptionType == Connect2PayClient::SUBSCRIPTION_TYPE_ONETIME || (string) $subscriptionType == Connect2PayClient::SUBSCRIPTION_TYPE_LIFETIME); }
[ "static", "public", "function", "isSubscriptionType", "(", "$", "subscriptionType", ")", "{", "return", "(", "(", "string", ")", "$", "subscriptionType", "==", "Connect2PayClient", "::", "SUBSCRIPTION_TYPE_NORMAL", "||", "(", "string", ")", "$", "subscriptionType", ...
Subscription Type validity @param string $subscriptionType Subscription Type to validate @return boolean Validity is ok or not
[ "Subscription", "Type", "validity" ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5480-L5485
train
PayXpert/connect2pay-php-client
src/Connect2PayClient.php
C2PValidate.strlen
public static function strlen($str) { if (is_array($str)) return false; if (function_exists('mb_strlen')) return mb_strlen($str, 'UTF-8'); return strlen($str); }
php
public static function strlen($str) { if (is_array($str)) return false; if (function_exists('mb_strlen')) return mb_strlen($str, 'UTF-8'); return strlen($str); }
[ "public", "static", "function", "strlen", "(", "$", "str", ")", "{", "if", "(", "is_array", "(", "$", "str", ")", ")", "return", "false", ";", "if", "(", "function_exists", "(", "'mb_strlen'", ")", ")", "return", "mb_strlen", "(", "$", "str", ",", "'...
strlen overloaded function @param string $str @return int size of the string
[ "strlen", "overloaded", "function" ]
9efd7b2d8aa255db298edf42195dd4876cc83262
https://github.com/PayXpert/connect2pay-php-client/blob/9efd7b2d8aa255db298edf42195dd4876cc83262/src/Connect2PayClient.php#L5503-L5511
train
KodiCMS/module-loader
src/ModulesInstaller.php
ModulesInstaller.migrateModule
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. $ran = $this->migrator->getRepository()->getRan(); $migrations = array_diff($files, $ran); $this->migrator->requireFiles($path, $migrations); foreach ($migrations as $migration) { $this->migrations[] = $migration; } return $this; }
php
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. $ran = $this->migrator->getRepository()->getRan(); $migrations = array_diff($files, $ran); $this->migrator->requireFiles($path, $migrations); foreach ($migrations as $migration) { $this->migrations[] = $migration; } return $this; }
[ "public", "function", "migrateModule", "(", "ModuleContainerInterface", "$", "module", ")", "{", "$", "path", "=", "$", "module", "->", "getPath", "(", "[", "'database'", ",", "'migrations'", "]", ")", ";", "$", "files", "=", "$", "this", "->", "migrator",...
Run migrations on a single module. @param ModuleContainerInterface $module @return $this
[ "Run", "migrations", "on", "a", "single", "module", "." ]
733775698a1c350ea7f05e08c6fc5665bd26b6b5
https://github.com/KodiCMS/module-loader/blob/733775698a1c350ea7f05e08c6fc5665bd26b6b5/src/ModulesInstaller.php#L81-L99
train
KodiCMS/module-loader
src/ModulesInstaller.php
ModulesInstaller.addModuleToReset
public function addModuleToReset(ModuleContainerInterface $module) { $path = $module->getPath(['database', 'migrations']); $this->migrator->requireFiles($path, $this->migrator->getMigrationFiles($path)); return $this; }
php
public function addModuleToReset(ModuleContainerInterface $module) { $path = $module->getPath(['database', 'migrations']); $this->migrator->requireFiles($path, $this->migrator->getMigrationFiles($path)); return $this; }
[ "public", "function", "addModuleToReset", "(", "ModuleContainerInterface", "$", "module", ")", "{", "$", "path", "=", "$", "module", "->", "getPath", "(", "[", "'database'", ",", "'migrations'", "]", ")", ";", "$", "this", "->", "migrator", "->", "requireFil...
Reset migrations on a single module. @param ModuleContainerInterface $module @return $this
[ "Reset", "migrations", "on", "a", "single", "module", "." ]
733775698a1c350ea7f05e08c6fc5665bd26b6b5
https://github.com/KodiCMS/module-loader/blob/733775698a1c350ea7f05e08c6fc5665bd26b6b5/src/ModulesInstaller.php#L122-L128
train
KodiCMS/module-loader
src/ModulesInstaller.php
ModulesInstaller.seedModule
public function seedModule(ModuleContainerInterface $module, array $data = []) { $className = $module->getNamespace().'\\database\\seeds\\DatabaseSeeder'; if (!class_exists($className)) { return false; } $seeder = app($className, $data); $seeder->run(); $this->output(sprintf('<info>Seeded %s</info> ', $module)); return $this; }
php
public function seedModule(ModuleContainerInterface $module, array $data = []) { $className = $module->getNamespace().'\\database\\seeds\\DatabaseSeeder'; if (!class_exists($className)) { return false; } $seeder = app($className, $data); $seeder->run(); $this->output(sprintf('<info>Seeded %s</info> ', $module)); return $this; }
[ "public", "function", "seedModule", "(", "ModuleContainerInterface", "$", "module", ",", "array", "$", "data", "=", "[", "]", ")", "{", "$", "className", "=", "$", "module", "->", "getNamespace", "(", ")", ".", "'\\\\database\\\\seeds\\\\DatabaseSeeder'", ";", ...
Run seeds on a module. @param ModuleContainerInterface $module @param array $data @return $this
[ "Run", "seeds", "on", "a", "module", "." ]
733775698a1c350ea7f05e08c6fc5665bd26b6b5
https://github.com/KodiCMS/module-loader/blob/733775698a1c350ea7f05e08c6fc5665bd26b6b5/src/ModulesInstaller.php#L172-L186
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.removeAllProperties
public function removeAllProperties() { //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/documentProperties'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'DELETE'); $json = json_decode($responseStream); if (is_object($json)) { if ($json->Code == 200) return true; else return false; } return true; }
php
public function removeAllProperties() { //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/documentProperties'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'DELETE'); $json = json_decode($responseStream); if (is_object($json)) { if ($json->Code == 200) return true; else return false; } return true; }
[ "public", "function", "removeAllProperties", "(", ")", "{", "//build URI to merge Docs", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/cells/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/documentProperties'", ";", "//sign URI",...
Remove All Document's properties. @return boolean @throws Exception
[ "Remove", "All", "Document", "s", "properties", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L106-L122
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.createWorkbookFromTemplate
public function createWorkbookFromTemplate($templateFileName) { if ($templateFileName == '') throw new Exception('Template file not specified'); //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '?templatefile=' . $templateFileName; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'PUT'); $json = json_decode($responseStream); return $json; }
php
public function createWorkbookFromTemplate($templateFileName) { if ($templateFileName == '') throw new Exception('Template file not specified'); //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '?templatefile=' . $templateFileName; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'PUT'); $json = json_decode($responseStream); return $json; }
[ "public", "function", "createWorkbookFromTemplate", "(", "$", "templateFileName", ")", "{", "if", "(", "$", "templateFileName", "==", "''", ")", "throw", "new", "Exception", "(", "'Template file not specified'", ")", ";", "//build URI to merge Docs", "$", "strURI", ...
Create Empty Workbook. @param string $templateFileName Name of the template file. @return null @throws Exception
[ "Create", "Empty", "Workbook", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L175-L188
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.getWorksheetsCount
public function getWorksheetsCount() { //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Worksheets->WorksheetList); }
php
public function getWorksheetsCount() { //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return count($json->Worksheets->WorksheetList); }
[ "public", "function", "getWorksheetsCount", "(", ")", "{", "//build URI to merge Docs", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/cells/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/worksheets'", ";", "//sign URI", "$", ...
Get Worksheets Count in Workbook. @return integer @throws Exception
[ "Get", "Worksheets", "Count", "in", "Workbook", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L245-L255
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.getNamesCount
public function getNamesCount() { //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/names'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Names->Count; }
php
public function getNamesCount() { //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/names'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->Names->Count; }
[ "public", "function", "getNamesCount", "(", ")", "{", "//build URI to merge Docs", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/cells/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/names'", ";", "//sign URI", "$", "signedUR...
Get Names Count in Workbook. @return integer @throws Exception
[ "Get", "Names", "Count", "in", "Workbook", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L263-L273
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.getDefaultStyle
public function getDefaultStyle() { //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/defaultStyle'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', ''); $json = json_decode($responseStream); return $json->Style; }
php
public function getDefaultStyle() { //build URI to merge Docs $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/defaultStyle'; //sign URI $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', ''); $json = json_decode($responseStream); return $json->Style; }
[ "public", "function", "getDefaultStyle", "(", ")", "{", "//build URI to merge Docs", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/cells/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/defaultStyle'", ";", "//sign URI", "$", ...
Get Default Style. @return object @throws Exception
[ "Get", "Default", "Style", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L281-L291
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.encryptWorkbook
public function encryptWorkbook($encryptionType = 'XOR', $password = '', $keyLength = '') { //Build JSON to post $fieldsArray['EncriptionType'] = $encryptionType; $fieldsArray['KeyLength'] = $keyLength; $fieldsArray['Password'] = $password; $json = json_encode($fieldsArray); $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/encryption'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'POST', 'json', $json); $json_response = json_decode($responseStream); if ($json_response->Code == 200) return true; else return false; }
php
public function encryptWorkbook($encryptionType = 'XOR', $password = '', $keyLength = '') { //Build JSON to post $fieldsArray['EncriptionType'] = $encryptionType; $fieldsArray['KeyLength'] = $keyLength; $fieldsArray['Password'] = $password; $json = json_encode($fieldsArray); $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/encryption'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'POST', 'json', $json); $json_response = json_decode($responseStream); if ($json_response->Code == 200) return true; else return false; }
[ "public", "function", "encryptWorkbook", "(", "$", "encryptionType", "=", "'XOR'", ",", "$", "password", "=", "''", ",", "$", "keyLength", "=", "''", ")", "{", "//Build JSON to post", "$", "fieldsArray", "[", "'EncriptionType'", "]", "=", "$", "encryptionType"...
Encrypt workbook. @param string $encryptionType Type of the encryption. @param string $password Document encryption password. @param integer $keyLength The key length. This parameter is only for Excel97~2003 format @return boolean @throws Exception
[ "Encrypt", "workbook", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L303-L319
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.addWorksheet
public function addWorksheet($worksheetName) { $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $worksheetName; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'PUT', '', ''); $json_response = json_decode($responseStream); if ($json_response->Code == 201) return true; else return false; }
php
public function addWorksheet($worksheetName) { $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $worksheetName; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'PUT', '', ''); $json_response = json_decode($responseStream); if ($json_response->Code == 201) return true; else return false; }
[ "public", "function", "addWorksheet", "(", "$", "worksheetName", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/cells/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/worksheets/'", ".", "$", "worksheetName", ";", ...
Add worksheet. @param string $worksheetName Name of the sheet. @return boolean @throws Exception
[ "Add", "worksheet", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L451-L462
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.mergeWorkbook
public function mergeWorkbook($mergeFileName) { $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/merge?mergeWith=' . $mergeFileName; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'POST', '', ''); $json_response = json_decode($responseStream); if ($json_response->Code == 200) return true; else return false; }
php
public function mergeWorkbook($mergeFileName) { $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/merge?mergeWith=' . $mergeFileName; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'POST', '', ''); $json_response = json_decode($responseStream); if ($json_response->Code == 200) return true; else return false; }
[ "public", "function", "mergeWorkbook", "(", "$", "mergeFileName", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/cells/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/merge?mergeWith='", ".", "$", "mergeFileName", ...
Merge workbook. @param string $mergeFileName Name of merge file. @return boolean @throws Exception
[ "Merge", "workbook", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L493-L504
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.autofitRows
public function autofitRows($saveFormat = "") { $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '?isAutoFit=true'; if ($saveFormat != '') $strURI .= '&format=' . $saveFormat; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { if ($saveFormat == '') { $strURI = Product::$baseProductUri . '/storage/file/' . $this->getFileName(); $signedURI = Utils::Sign($strURI); $responseStream = Utils::processCommand($signedURI, "GET", "", ""); $outputPath = AsposeApp::$outPutLocation . $this->getFileName(); Utils::saveFile($responseStream, $outputFile); } else { $outputPath = AsposeApp::$outPutLocation . Utils::getFileName($this->getFileName()) . '.' . $saveFormat; Utils::saveFile($responseStream, $outputPath); } return $outputPath; } else { return $v_output; } }
php
public function autofitRows($saveFormat = "") { $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '?isAutoFit=true'; if ($saveFormat != '') $strURI .= '&format=' . $saveFormat; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { if ($saveFormat == '') { $strURI = Product::$baseProductUri . '/storage/file/' . $this->getFileName(); $signedURI = Utils::Sign($strURI); $responseStream = Utils::processCommand($signedURI, "GET", "", ""); $outputPath = AsposeApp::$outPutLocation . $this->getFileName(); Utils::saveFile($responseStream, $outputFile); } else { $outputPath = AsposeApp::$outPutLocation . Utils::getFileName($this->getFileName()) . '.' . $saveFormat; Utils::saveFile($responseStream, $outputPath); } return $outputPath; } else { return $v_output; } }
[ "public", "function", "autofitRows", "(", "$", "saveFormat", "=", "\"\"", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/cells/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'?isAutoFit=true'", ";", "if", "(", "...
Auto Fit Rows in Excel Workbooks @param string $saveFormat Format for the output file. @return string Returns file path.
[ "Auto", "Fit", "Rows", "in", "Excel", "Workbooks" ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L513-L541
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Cells/Workbook.php
Workbook.saveAs
public function saveAs($strXML, $outputFile) { if ($strXML == '') throw new Exception('XML Data not specified'); if ($outputFile == '') throw new Exception('Output Filename along extension not specified'); $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/saveAs?newfilename=' . $outputFile; $signedURI = Utils::Sign($strURI); $responseStream = Utils::processCommand($signedURI, "POST", "XML", $strXML); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { $strURI = Product::$baseProductUri . '/storage/file/' . $outputFile; $signedURI = Utils::Sign($strURI); $responseStream = Utils::processCommand($signedURI, "GET", "", ""); $outputPath = AsposeApp::$outPutLocation . $outputFile; Utils::saveFile($responseStream, $outputPath); return $outputPath; } else { return $v_output; } }
php
public function saveAs($strXML, $outputFile) { if ($strXML == '') throw new Exception('XML Data not specified'); if ($outputFile == '') throw new Exception('Output Filename along extension not specified'); $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/saveAs?newfilename=' . $outputFile; $signedURI = Utils::Sign($strURI); $responseStream = Utils::processCommand($signedURI, "POST", "XML", $strXML); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { $strURI = Product::$baseProductUri . '/storage/file/' . $outputFile; $signedURI = Utils::Sign($strURI); $responseStream = Utils::processCommand($signedURI, "GET", "", ""); $outputPath = AsposeApp::$outPutLocation . $outputFile; Utils::saveFile($responseStream, $outputPath); return $outputPath; } else { return $v_output; } }
[ "public", "function", "saveAs", "(", "$", "strXML", ",", "$", "outputFile", ")", "{", "if", "(", "$", "strXML", "==", "''", ")", "throw", "new", "Exception", "(", "'XML Data not specified'", ")", ";", "if", "(", "$", "outputFile", "==", "''", ")", "thr...
Convert Excel Workbook with Additional Settings @param xml $strXML Data in XML format. @param string $outputFile The name of output file. @return string Returns the file path. @throws Exception
[ "Convert", "Excel", "Workbook", "with", "Additional", "Settings" ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Cells/Workbook.php#L552-L578
train
wikimedia/utfnormal
src/Utils.php
Utils.codepointToUtf8
public static function codepointToUtf8( $codepoint ) { if ( $codepoint < 0x80 ) { return chr( $codepoint ); } if ( $codepoint < 0x800 ) { return chr( $codepoint >> 6 & 0x3f | 0xc0 ) . chr( $codepoint & 0x3f | 0x80 ); } if ( $codepoint < 0x10000 ) { return chr( $codepoint >> 12 & 0x0f | 0xe0 ) . chr( $codepoint >> 6 & 0x3f | 0x80 ) . chr( $codepoint & 0x3f | 0x80 ); } if ( $codepoint < 0x110000 ) { return chr( $codepoint >> 18 & 0x07 | 0xf0 ) . chr( $codepoint >> 12 & 0x3f | 0x80 ) . chr( $codepoint >> 6 & 0x3f | 0x80 ) . chr( $codepoint & 0x3f | 0x80 ); } throw new InvalidArgumentException( "Asked for code outside of range ($codepoint)" ); }
php
public static function codepointToUtf8( $codepoint ) { if ( $codepoint < 0x80 ) { return chr( $codepoint ); } if ( $codepoint < 0x800 ) { return chr( $codepoint >> 6 & 0x3f | 0xc0 ) . chr( $codepoint & 0x3f | 0x80 ); } if ( $codepoint < 0x10000 ) { return chr( $codepoint >> 12 & 0x0f | 0xe0 ) . chr( $codepoint >> 6 & 0x3f | 0x80 ) . chr( $codepoint & 0x3f | 0x80 ); } if ( $codepoint < 0x110000 ) { return chr( $codepoint >> 18 & 0x07 | 0xf0 ) . chr( $codepoint >> 12 & 0x3f | 0x80 ) . chr( $codepoint >> 6 & 0x3f | 0x80 ) . chr( $codepoint & 0x3f | 0x80 ); } throw new InvalidArgumentException( "Asked for code outside of range ($codepoint)" ); }
[ "public", "static", "function", "codepointToUtf8", "(", "$", "codepoint", ")", "{", "if", "(", "$", "codepoint", "<", "0x80", ")", "{", "return", "chr", "(", "$", "codepoint", ")", ";", "}", "if", "(", "$", "codepoint", "<", "0x800", ")", "{", "retur...
Return UTF-8 sequence for a given Unicode code point. @param int $codepoint @return string @throws InvalidArgumentException if fed out of range data.
[ "Return", "UTF", "-", "8", "sequence", "for", "a", "given", "Unicode", "code", "point", "." ]
8dc487748268bc374f7d134478b53baf6252553f
https://github.com/wikimedia/utfnormal/blob/8dc487748268bc374f7d134478b53baf6252553f/src/Utils.php#L40-L64
train
wikimedia/utfnormal
src/Utils.php
Utils.hexSequenceToUtf8
public static function hexSequenceToUtf8( $sequence ) { $utf = ''; foreach ( explode( ' ', $sequence ) as $hex ) { $n = hexdec( $hex ); $utf .= self::codepointToUtf8( $n ); } return $utf; }
php
public static function hexSequenceToUtf8( $sequence ) { $utf = ''; foreach ( explode( ' ', $sequence ) as $hex ) { $n = hexdec( $hex ); $utf .= self::codepointToUtf8( $n ); } return $utf; }
[ "public", "static", "function", "hexSequenceToUtf8", "(", "$", "sequence", ")", "{", "$", "utf", "=", "''", ";", "foreach", "(", "explode", "(", "' '", ",", "$", "sequence", ")", "as", "$", "hex", ")", "{", "$", "n", "=", "hexdec", "(", "$", "hex",...
Take a series of space-separated hexadecimal numbers representing Unicode code points and return a UTF-8 string composed of those characters. Used by UTF-8 data generation and testing routines. @param string $sequence @return string @throws InvalidArgumentException if fed out of range data. @private Used in tests and data table generation
[ "Take", "a", "series", "of", "space", "-", "separated", "hexadecimal", "numbers", "representing", "Unicode", "code", "points", "and", "return", "a", "UTF", "-", "8", "string", "composed", "of", "those", "characters", ".", "Used", "by", "UTF", "-", "8", "da...
8dc487748268bc374f7d134478b53baf6252553f
https://github.com/wikimedia/utfnormal/blob/8dc487748268bc374f7d134478b53baf6252553f/src/Utils.php#L76-L84
train
wikimedia/utfnormal
src/Utils.php
Utils.utf8ToHexSequence
private static function utf8ToHexSequence( $str ) { $buf = ''; foreach ( preg_split( '//u', $str, -1, PREG_SPLIT_NO_EMPTY ) as $cp ) { $buf .= sprintf( '%04x ', self::utf8ToCodepoint( $cp ) ); } return rtrim( $buf ); }
php
private static function utf8ToHexSequence( $str ) { $buf = ''; foreach ( preg_split( '//u', $str, -1, PREG_SPLIT_NO_EMPTY ) as $cp ) { $buf .= sprintf( '%04x ', self::utf8ToCodepoint( $cp ) ); } return rtrim( $buf ); }
[ "private", "static", "function", "utf8ToHexSequence", "(", "$", "str", ")", "{", "$", "buf", "=", "''", ";", "foreach", "(", "preg_split", "(", "'//u'", ",", "$", "str", ",", "-", "1", ",", "PREG_SPLIT_NO_EMPTY", ")", "as", "$", "cp", ")", "{", "$", ...
Take a UTF-8 string and return a space-separated series of hex numbers representing Unicode code points. For debugging. @param string $str UTF-8 string. @return string @private
[ "Take", "a", "UTF", "-", "8", "string", "and", "return", "a", "space", "-", "separated", "series", "of", "hex", "numbers", "representing", "Unicode", "code", "points", ".", "For", "debugging", "." ]
8dc487748268bc374f7d134478b53baf6252553f
https://github.com/wikimedia/utfnormal/blob/8dc487748268bc374f7d134478b53baf6252553f/src/Utils.php#L94-L101
train
wikimedia/utfnormal
src/Utils.php
Utils.utf8ToCodepoint
public static function utf8ToCodepoint( $char ) { # Find the length $z = ord( $char[0] ); if ( $z & 0x80 ) { $length = 0; while ( $z & 0x80 ) { $length++; $z <<= 1; } } else { $length = 1; } if ( $length != strlen( $char ) ) { return false; } if ( $length == 1 ) { return ord( $char ); } # Mask off the length-determining bits and shift back to the original location $z &= 0xff; $z >>= $length; # Add in the free bits from subsequent bytes for ( $i = 1; $i < $length; $i++ ) { $z <<= 6; $z |= ord( $char[$i] ) & 0x3f; } return $z; }
php
public static function utf8ToCodepoint( $char ) { # Find the length $z = ord( $char[0] ); if ( $z & 0x80 ) { $length = 0; while ( $z & 0x80 ) { $length++; $z <<= 1; } } else { $length = 1; } if ( $length != strlen( $char ) ) { return false; } if ( $length == 1 ) { return ord( $char ); } # Mask off the length-determining bits and shift back to the original location $z &= 0xff; $z >>= $length; # Add in the free bits from subsequent bytes for ( $i = 1; $i < $length; $i++ ) { $z <<= 6; $z |= ord( $char[$i] ) & 0x3f; } return $z; }
[ "public", "static", "function", "utf8ToCodepoint", "(", "$", "char", ")", "{", "# Find the length", "$", "z", "=", "ord", "(", "$", "char", "[", "0", "]", ")", ";", "if", "(", "$", "z", "&", "0x80", ")", "{", "$", "length", "=", "0", ";", "while"...
Determine the Unicode codepoint of a single-character UTF-8 sequence. Does not check for invalid input data. @param string $char @return int
[ "Determine", "the", "Unicode", "codepoint", "of", "a", "single", "-", "character", "UTF", "-", "8", "sequence", ".", "Does", "not", "check", "for", "invalid", "input", "data", "." ]
8dc487748268bc374f7d134478b53baf6252553f
https://github.com/wikimedia/utfnormal/blob/8dc487748268bc374f7d134478b53baf6252553f/src/Utils.php#L110-L142
train
RxPHP/RxHttp
src/HttpObservable.php
HttpObservable.setContentLength
private function setContentLength() { if (!is_string($this->body)) { return; } $headers = array_map('strtolower', array_keys($this->headers)); if (!in_array('content-length', $headers, true)) { $this->headers['Content-Length'] = strlen($this->body); } }
php
private function setContentLength() { if (!is_string($this->body)) { return; } $headers = array_map('strtolower', array_keys($this->headers)); if (!in_array('content-length', $headers, true)) { $this->headers['Content-Length'] = strlen($this->body); } }
[ "private", "function", "setContentLength", "(", ")", "{", "if", "(", "!", "is_string", "(", "$", "this", "->", "body", ")", ")", "{", "return", ";", "}", "$", "headers", "=", "array_map", "(", "'strtolower'", ",", "array_keys", "(", "$", "this", "->", ...
Adds if needed a `Content-Length` header field to the request.
[ "Adds", "if", "needed", "a", "Content", "-", "Length", "header", "field", "to", "the", "request", "." ]
2ac4dd8e6cde58efb3f9987b53acbb4536edb3f6
https://github.com/RxPHP/RxHttp/blob/2ac4dd8e6cde58efb3f9987b53acbb4536edb3f6/src/HttpObservable.php#L134-L145
train
Speelpenning-nl/laravel-products
src/AttributeValue.php
AttributeValue.instantiate
public static function instantiate(AttributeContract $attribute, $value) { if (! $attribute->supportsValues()) { throw new AttributeMustSupportValues(); } return new static([ 'attribute_id' => $attribute->id, 'value' => $value, ]); }
php
public static function instantiate(AttributeContract $attribute, $value) { if (! $attribute->supportsValues()) { throw new AttributeMustSupportValues(); } return new static([ 'attribute_id' => $attribute->id, 'value' => $value, ]); }
[ "public", "static", "function", "instantiate", "(", "AttributeContract", "$", "attribute", ",", "$", "value", ")", "{", "if", "(", "!", "$", "attribute", "->", "supportsValues", "(", ")", ")", "{", "throw", "new", "AttributeMustSupportValues", "(", ")", ";",...
Instantiates a new attribute value. @param AttributeContract $attribute @param string $value @return AttributeValueContract
[ "Instantiates", "a", "new", "attribute", "value", "." ]
41522ebbdd41108c1d4532bb42be602cc0c530c4
https://github.com/Speelpenning-nl/laravel-products/blob/41522ebbdd41108c1d4532bb42be602cc0c530c4/src/AttributeValue.php#L23-L33
train
Speelpenning-nl/laravel-products
src/Product.php
Product.instantiate
public static function instantiate(ProductNumberContract $productNumber, ProductTypeContract $productType, $description) { return new static([ 'product_number' => $productNumber, 'product_type_id' => $productType->id, 'description' => $description, ]); }
php
public static function instantiate(ProductNumberContract $productNumber, ProductTypeContract $productType, $description) { return new static([ 'product_number' => $productNumber, 'product_type_id' => $productType->id, 'description' => $description, ]); }
[ "public", "static", "function", "instantiate", "(", "ProductNumberContract", "$", "productNumber", ",", "ProductTypeContract", "$", "productType", ",", "$", "description", ")", "{", "return", "new", "static", "(", "[", "'product_number'", "=>", "$", "productNumber",...
Instantiate a new product. @param ProductNumberContract $productNumber @param ProductTypeContract $productType @param string $description @return ProductContract
[ "Instantiate", "a", "new", "product", "." ]
41522ebbdd41108c1d4532bb42be602cc0c530c4
https://github.com/Speelpenning-nl/laravel-products/blob/41522ebbdd41108c1d4532bb42be602cc0c530c4/src/Product.php#L27-L34
train
gofmanaa/yii2-crontask
console/CronController.php
CronController.actionStart
public function actionStart($taskCommand = null ) { /** * @var $cron Crontab */ $cron = $this->module->get($this->module->nameComponent); $cron->eraseJobs(); $common_params = $this->module->params; if(!empty($this->module->tasks)) { if($taskCommand && isset($this->module->tasks[$taskCommand])){ $task = $this->module->tasks[$taskCommand]; $params = ArrayHelper::merge( ArrayHelper::getValue($task, 'params',[]), $common_params ); $cron->addApplicationJob($this->module->phpPath.' '.$this->getYiiPath(), $task['command'], $params, ArrayHelper::getValue($task, 'min'), ArrayHelper::getValue($task, 'hour'), ArrayHelper::getValue($task, 'day'), ArrayHelper::getValue($task, 'month'), ArrayHelper::getValue($task, 'dayofweek'), $this->module->cronGroup //mast be unique for any app on server ); } else { foreach ($this->module->tasks as $commandName => $task) { $params = ArrayHelper::merge( ArrayHelper::getValue($task, 'params',[]), $common_params ); $cron->addApplicationJob($this->module->phpPath.' '.$this->getYiiPath(), $task['command'], $params, ArrayHelper::getValue($task, 'min'), ArrayHelper::getValue($task, 'hour'), ArrayHelper::getValue($task, 'day'), ArrayHelper::getValue($task, 'month'), ArrayHelper::getValue($task, 'dayofweek'), $this->module->cronGroup //mast be unique for any app on server ); } } $cron->saveCronFile(); // save to my_crontab cronfile $cron->saveToCrontab(); // adds all my_crontab jobs to system (replacing previous my_crontab jobs) echo $this->ansiFormat('Cron Tasks started.' . PHP_EOL, Console::FG_GREEN); } else { echo $this->ansiFormat('Cron do not have Tasks.' . PHP_EOL, Console::FG_GREEN); } }
php
public function actionStart($taskCommand = null ) { /** * @var $cron Crontab */ $cron = $this->module->get($this->module->nameComponent); $cron->eraseJobs(); $common_params = $this->module->params; if(!empty($this->module->tasks)) { if($taskCommand && isset($this->module->tasks[$taskCommand])){ $task = $this->module->tasks[$taskCommand]; $params = ArrayHelper::merge( ArrayHelper::getValue($task, 'params',[]), $common_params ); $cron->addApplicationJob($this->module->phpPath.' '.$this->getYiiPath(), $task['command'], $params, ArrayHelper::getValue($task, 'min'), ArrayHelper::getValue($task, 'hour'), ArrayHelper::getValue($task, 'day'), ArrayHelper::getValue($task, 'month'), ArrayHelper::getValue($task, 'dayofweek'), $this->module->cronGroup //mast be unique for any app on server ); } else { foreach ($this->module->tasks as $commandName => $task) { $params = ArrayHelper::merge( ArrayHelper::getValue($task, 'params',[]), $common_params ); $cron->addApplicationJob($this->module->phpPath.' '.$this->getYiiPath(), $task['command'], $params, ArrayHelper::getValue($task, 'min'), ArrayHelper::getValue($task, 'hour'), ArrayHelper::getValue($task, 'day'), ArrayHelper::getValue($task, 'month'), ArrayHelper::getValue($task, 'dayofweek'), $this->module->cronGroup //mast be unique for any app on server ); } } $cron->saveCronFile(); // save to my_crontab cronfile $cron->saveToCrontab(); // adds all my_crontab jobs to system (replacing previous my_crontab jobs) echo $this->ansiFormat('Cron Tasks started.' . PHP_EOL, Console::FG_GREEN); } else { echo $this->ansiFormat('Cron do not have Tasks.' . PHP_EOL, Console::FG_GREEN); } }
[ "public", "function", "actionStart", "(", "$", "taskCommand", "=", "null", ")", "{", "/**\n * @var $cron Crontab\n */", "$", "cron", "=", "$", "this", "->", "module", "->", "get", "(", "$", "this", "->", "module", "->", "nameComponent", ")", ";...
Start cron tasks @param string $taskCommand @throws \yii\base\InvalidConfigException
[ "Start", "cron", "tasks" ]
23dcfd9e0be64217b84767d97e6ca8db4a4a30d3
https://github.com/gofmanaa/yii2-crontask/blob/23dcfd9e0be64217b84767d97e6ca8db4a4a30d3/console/CronController.php#L50-L98
train
gofmanaa/yii2-crontask
console/CronController.php
CronController.actionLs
public function actionLs($params = false){ /** * @var $cron Crontab */ if(false == $params) { $cron = $this->module->get($this->module->nameComponent); $jobs = $cron->getJobs(); foreach ($jobs as $index=>$job) { /** * @var $job Cronjob */ if($job->getGroup() == $this->module->cronGroup) echo '['.$index.'] '. $this->ansiFormat($job->getJobCommand(), Console::FG_CYAN); } } elseif($params == 'a' || $params == 'al') { echo shell_exec('crontab -l') . PHP_EOL; } }
php
public function actionLs($params = false){ /** * @var $cron Crontab */ if(false == $params) { $cron = $this->module->get($this->module->nameComponent); $jobs = $cron->getJobs(); foreach ($jobs as $index=>$job) { /** * @var $job Cronjob */ if($job->getGroup() == $this->module->cronGroup) echo '['.$index.'] '. $this->ansiFormat($job->getJobCommand(), Console::FG_CYAN); } } elseif($params == 'a' || $params == 'al') { echo shell_exec('crontab -l') . PHP_EOL; } }
[ "public", "function", "actionLs", "(", "$", "params", "=", "false", ")", "{", "/**\n * @var $cron Crontab\n */", "if", "(", "false", "==", "$", "params", ")", "{", "$", "cron", "=", "$", "this", "->", "module", "->", "get", "(", "$", "this"...
List Application Cron Jobs; a|al All jobs @param string $params @throws \yii\base\InvalidConfigException
[ "List", "Application", "Cron", "Jobs", ";", "a|al", "All", "jobs" ]
23dcfd9e0be64217b84767d97e6ca8db4a4a30d3
https://github.com/gofmanaa/yii2-crontask/blob/23dcfd9e0be64217b84767d97e6ca8db4a4a30d3/console/CronController.php#L152-L173
train
Vovan-VE/parser
src/actions/ActionsMadeMap.php
ActionsMadeMap.runActionHandler
protected function runActionHandler($action, TreeNodeInterface $node) { if ($node instanceof Token) { try { return $action($node->getContent()); } catch (AbortParsingException $e) { if (null === $e->getOffset()) { throw new AbortParsingException($e->getMessage(), $node->getOffset(), $e); } throw $e; } catch (AbortNodeException $e) { throw new AbortParsingException($e->getMessage(), $node->getOffset(), $e); } catch (\Throwable $e) { throw new \RuntimeException("Action failure in `{$this::buildActionName($node)}`", 0, $e); } } $args = []; foreach ($node->getChildren() as $child) { $args[] = $child->made(); } try { $result = $action(...$args); } catch (AbortNodeException $e) { throw new AbortParsingException( $e->getMessage(), $node->getChild($e->getNodeIndex() - 1)->getOffset(), $e ); } catch (AbortParsingException $e) { if (null === $e->getOffset()) { throw new AbortParsingException($e->getMessage(), $node->getOffset(), $e); } throw $e; } catch (\Throwable $e) { throw new \RuntimeException("Action failure in `{$this::buildActionName($node)}`", 0, $e); } if ($this->prune) { $node->prune(); } return $result; }
php
protected function runActionHandler($action, TreeNodeInterface $node) { if ($node instanceof Token) { try { return $action($node->getContent()); } catch (AbortParsingException $e) { if (null === $e->getOffset()) { throw new AbortParsingException($e->getMessage(), $node->getOffset(), $e); } throw $e; } catch (AbortNodeException $e) { throw new AbortParsingException($e->getMessage(), $node->getOffset(), $e); } catch (\Throwable $e) { throw new \RuntimeException("Action failure in `{$this::buildActionName($node)}`", 0, $e); } } $args = []; foreach ($node->getChildren() as $child) { $args[] = $child->made(); } try { $result = $action(...$args); } catch (AbortNodeException $e) { throw new AbortParsingException( $e->getMessage(), $node->getChild($e->getNodeIndex() - 1)->getOffset(), $e ); } catch (AbortParsingException $e) { if (null === $e->getOffset()) { throw new AbortParsingException($e->getMessage(), $node->getOffset(), $e); } throw $e; } catch (\Throwable $e) { throw new \RuntimeException("Action failure in `{$this::buildActionName($node)}`", 0, $e); } if ($this->prune) { $node->prune(); } return $result; }
[ "protected", "function", "runActionHandler", "(", "$", "action", ",", "TreeNodeInterface", "$", "node", ")", "{", "if", "(", "$", "node", "instanceof", "Token", ")", "{", "try", "{", "return", "$", "action", "(", "$", "node", "->", "getContent", "(", ")"...
Run action handler and return its result @param callable $action Action callback from the map @param TreeNodeInterface $node Subject node @return mixed Result of the action call @since 1.5.0 @throws AbortParsingException
[ "Run", "action", "handler", "and", "return", "its", "result" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/actions/ActionsMadeMap.php#L61-L105
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/OCR/Extractor.php
Extractor.extractTextFromLocalFile
public function extractTextFromLocalFile($localFile, $language, $useDefaultDictionaries) { $strURI = Product::$baseProductUri . '/ocr/recognize?language=' . $language . '&useDefaultDictionaries='; $strURI .= ($useDefaultDictionaries) ? 'true' : 'false'; $signedURI = Utils::sign($strURI); $stream = file_get_contents($localFile); $responseStream = Utils::processCommand($signedURI, 'POST', 'json', $stream); $json = json_decode($responseStream); return $json; }
php
public function extractTextFromLocalFile($localFile, $language, $useDefaultDictionaries) { $strURI = Product::$baseProductUri . '/ocr/recognize?language=' . $language . '&useDefaultDictionaries='; $strURI .= ($useDefaultDictionaries) ? 'true' : 'false'; $signedURI = Utils::sign($strURI); $stream = file_get_contents($localFile); $responseStream = Utils::processCommand($signedURI, 'POST', 'json', $stream); $json = json_decode($responseStream); return $json; }
[ "public", "function", "extractTextFromLocalFile", "(", "$", "localFile", ",", "$", "language", ",", "$", "useDefaultDictionaries", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/ocr/recognize?language='", ".", "$", "language", ".", ...
Extract OCR or HOCR Text from Images without using Storage. @param string $localFile Filename of image. @param string $language Language of document to recogniize. @param string $useDefaultDictionaries Allows to correct text after recognition using default dictionaries. @return object
[ "Extract", "OCR", "or", "HOCR", "Text", "from", "Images", "without", "using", "Storage", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/OCR/Extractor.php#L122-L131
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/OCR/Extractor.php
Extractor.extractTextFromUrl
public function extractTextFromUrl($url, $language, $useDefaultDictionaries) { $strURI = Product::$baseProductUri . '/ocr/recognize?url=' . $url . '&language=' . $language . '&useDefaultDictionaries=' . $useDefaultDictionaries; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI); $json = json_decode($responseStream); return $json; }
php
public function extractTextFromUrl($url, $language, $useDefaultDictionaries) { $strURI = Product::$baseProductUri . '/ocr/recognize?url=' . $url . '&language=' . $language . '&useDefaultDictionaries=' . $useDefaultDictionaries; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI); $json = json_decode($responseStream); return $json; }
[ "public", "function", "extractTextFromUrl", "(", "$", "url", ",", "$", "language", ",", "$", "useDefaultDictionaries", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/ocr/recognize?url='", ".", "$", "url", ".", "'&language='", "."...
Extract OCR or HOCR Text from image url. @param string $url URL of the image. @param string $language Language of document to recogniize. @param string $useDefaultDictionaries Allows to correct text after recognition using default dictionaries. @return object
[ "Extract", "OCR", "or", "HOCR", "Text", "from", "image", "url", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/OCR/Extractor.php#L143-L150
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.parse
public function parse(string $input) { $pos = 0; while (null !== ($match = $this->parseOne($input, $pos))) { $pos = $match->nextOffset; yield $match->token; } }
php
public function parse(string $input) { $pos = 0; while (null !== ($match = $this->parseOne($input, $pos))) { $pos = $match->nextOffset; yield $match->token; } }
[ "public", "function", "parse", "(", "string", "$", "input", ")", "{", "$", "pos", "=", "0", ";", "while", "(", "null", "!==", "(", "$", "match", "=", "$", "this", "->", "parseOne", "(", "$", "input", ",", "$", "pos", ")", ")", ")", "{", "$", ...
Parse input text into Tokens Lexer will be compiled if didn't yet. Note: Parsing in this way will be context independent. To utilize context dependent parsing use `parseOne()` in you own loop. @param string $input Input text to parse @return \Generator|Token[] Returns generator of `Token`s. Generator has no its own return value. @throws UnknownCharacterException Nothing matched in a current position
[ "Parse", "input", "text", "into", "Tokens" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L223-L230
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.parseOne
public function parseOne(string $input, int $pos, array $preferredTokens = []): ?Match { $length = strlen($input); if ($pos >= $length) { return null; } $this->compile(); $whitespace_length = $this->getWhitespaceLength($input, $pos); if ($whitespace_length) { $pos += $whitespace_length; if ($pos >= $length) { return null; } } $match = $this->match($input, $pos, $preferredTokens); if (!$match) { $near = substr($input, $pos, self::DUMP_NEAR_LENGTH); if ("" === $near || false === $near) { $near = '<EOF>'; } else { $near = '"' . $near . '"'; } throw new UnknownCharacterException( "Cannot parse none of expected tokens near $near", $pos ); } return $match; }
php
public function parseOne(string $input, int $pos, array $preferredTokens = []): ?Match { $length = strlen($input); if ($pos >= $length) { return null; } $this->compile(); $whitespace_length = $this->getWhitespaceLength($input, $pos); if ($whitespace_length) { $pos += $whitespace_length; if ($pos >= $length) { return null; } } $match = $this->match($input, $pos, $preferredTokens); if (!$match) { $near = substr($input, $pos, self::DUMP_NEAR_LENGTH); if ("" === $near || false === $near) { $near = '<EOF>'; } else { $near = '"' . $near . '"'; } throw new UnknownCharacterException( "Cannot parse none of expected tokens near $near", $pos ); } return $match; }
[ "public", "function", "parseOne", "(", "string", "$", "input", ",", "int", "$", "pos", ",", "array", "$", "preferredTokens", "=", "[", "]", ")", ":", "?", "Match", "{", "$", "length", "=", "strlen", "(", "$", "input", ")", ";", "if", "(", "$", "p...
Parse one next token from input at the given offset @param string $input Input text to parse @param int $pos Offset to parse at @param string[] $preferredTokens Preferred tokens types to match first @return Match|null Returns match on success match. Returns `null` on EOF. @throws UnknownCharacterException
[ "Parse", "one", "next", "token", "from", "input", "at", "the", "given", "offset" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L240-L272
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.checkOverlappingNames
private function checkOverlappingNames(array $maps): void { $index = 0; foreach ($maps as $type => $map) { $rest_maps = array_slice($maps, $index + 1, null, true); foreach ($rest_maps as $type2 => $map2) { $same = array_intersect_key($map, $map2); if ($same) { throw new \InvalidArgumentException( "Duplicating $type tokens and $type2 tokens: " . join(', ', array_keys($same)) ); } } ++$index; } }
php
private function checkOverlappingNames(array $maps): void { $index = 0; foreach ($maps as $type => $map) { $rest_maps = array_slice($maps, $index + 1, null, true); foreach ($rest_maps as $type2 => $map2) { $same = array_intersect_key($map, $map2); if ($same) { throw new \InvalidArgumentException( "Duplicating $type tokens and $type2 tokens: " . join(', ', array_keys($same)) ); } } ++$index; } }
[ "private", "function", "checkOverlappingNames", "(", "array", "$", "maps", ")", ":", "void", "{", "$", "index", "=", "0", ";", "foreach", "(", "$", "maps", "as", "$", "type", "=>", "$", "map", ")", "{", "$", "rest_maps", "=", "array_slice", "(", "$",...
Check defined tokens for duplicating names Each token's name must be used only once. Inline tokens must not overlap with names of named tokens. @param array $maps Map on different tokens' maps. Key is token type for error message. Value is tokens map of the type in form `[name => mixed, ...]`. Inline tokens use its strings as name. @throws \InvalidArgumentException Some overlapping names
[ "Check", "defined", "tokens", "for", "duplicating", "names" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L284-L299
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.buildFixedAndInlines
private function buildFixedAndInlines(array $fixedMap, array $inlines): array { $overlapped = array_intersect($fixedMap, $inlines); if ($overlapped) { throw new \InvalidArgumentException( "Duplicating fixed tokens and inline tokens strings: " . join(', ', array_map('json_encode', $overlapped)) ); } // $fixedMap all keys are valid names, so + with integer keys will not loss anything $all = $fixedMap + array_values($inlines); // sort in reverse order to let more long items match first // so /'$$' | '$'/ will find ['$$', '$'] in '$$$' and not ['$', '$', '$'] arsort($all, SORT_STRING); $re_map = []; $alias_name = 'a'; foreach ($all as $name => $text) { // inline? if (is_int($name)) { $name = '_' . $alias_name; // string increment $alias_name++; $this->aliased[$name] = $text; $this->aliasOf[$text] = $name; } $re_map[$name] = $this->textToRegExp($text); } return $re_map; }
php
private function buildFixedAndInlines(array $fixedMap, array $inlines): array { $overlapped = array_intersect($fixedMap, $inlines); if ($overlapped) { throw new \InvalidArgumentException( "Duplicating fixed tokens and inline tokens strings: " . join(', ', array_map('json_encode', $overlapped)) ); } // $fixedMap all keys are valid names, so + with integer keys will not loss anything $all = $fixedMap + array_values($inlines); // sort in reverse order to let more long items match first // so /'$$' | '$'/ will find ['$$', '$'] in '$$$' and not ['$', '$', '$'] arsort($all, SORT_STRING); $re_map = []; $alias_name = 'a'; foreach ($all as $name => $text) { // inline? if (is_int($name)) { $name = '_' . $alias_name; // string increment $alias_name++; $this->aliased[$name] = $text; $this->aliasOf[$text] = $name; } $re_map[$name] = $this->textToRegExp($text); } return $re_map; }
[ "private", "function", "buildFixedAndInlines", "(", "array", "$", "fixedMap", ",", "array", "$", "inlines", ")", ":", "array", "{", "$", "overlapped", "=", "array_intersect", "(", "$", "fixedMap", ",", "$", "inlines", ")", ";", "if", "(", "$", "overlapped"...
Build inline tokens into regexp map **Note** about side effect of changing properties in addition to returned map. Inline tokens all are aliased with generated names. Returned regexps map has that generated named in keys. Aliases map is stored in `$aliased` property. As of all inline tokens are hidden, `$hiddens` map will be updated too with generated names. @param string[] $fixedMap Fixed tokens map @param string[] $inlines List of inline token texts. @return string[] Returns regexps map with generated names in keys. Also properties `$aliased` and `$hiddens` will be updated.
[ "Build", "inline", "tokens", "into", "regexp", "map" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L314-L348
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.buildMap
private function buildMap(array $map, string $join): string { $alt = []; foreach ($map as $type => $re) { $alt[] = "(?<$type>$re)"; } if (false !== $join) { $alt = join($join, $alt); } return $alt; }
php
private function buildMap(array $map, string $join): string { $alt = []; foreach ($map as $type => $re) { $alt[] = "(?<$type>$re)"; } if (false !== $join) { $alt = join($join, $alt); } return $alt; }
[ "private", "function", "buildMap", "(", "array", "$", "map", ",", "string", "$", "join", ")", ":", "string", "{", "$", "alt", "=", "[", "]", ";", "foreach", "(", "$", "map", "as", "$", "type", "=>", "$", "re", ")", "{", "$", "alt", "[", "]", ...
Build regexp map into one regexp part or list of ready parts Input map is key=>value paired array. Key which is name will become name for named regexp group, and value will becove its body. So `'int' => '\\d+'` will become `(?<int>\\d+)`. The result is one regexp part of built subparts joined with delimiter. Joining can be bypassed with `$join = false` argument. @param string[] $map Input map of regexps. @param string $join Join with delimiter. @return string Returns joined regexp part
[ "Build", "regexp", "map", "into", "one", "regexp", "part", "or", "list", "of", "ready", "parts" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L362-L372
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.match
private function match(string $input, int $pos, array $preferredTokens): ?Match { $current_regexp = $this->getRegexpForTokens($preferredTokens); if (false === preg_match($current_regexp, $input, $match, 0, $pos)) { $error_code = preg_last_error(); throw new \RuntimeException( "PCRE error #" . $error_code . " for token at input pos $pos; REGEXP = $current_regexp", $error_code ); } if (!$match) { return null; } $full_match = $match[0]; if ('' === $full_match) { throw new DevException( 'Tokens should not match empty string' . '; context: `' . substr($input, $pos, 10) . '`' . '; expected: ' . json_encode($preferredTokens) . "; REGEXP: $current_regexp" ); } // remove null, empty "" values and integer keys but [0] foreach ($match as $key => $value) { if ( null === $value || '' === $value || (0 !== $key && is_int($key)) ) { unset($match[$key]); } } $named = $match; unset($named[0]); if (1 !== count($named)) { throw new InternalException('Match with multiple named group'); } $content = reset($named); $type = key($named); $is_inline = false; if (isset($this->aliased[$type])) { $type = $this->aliased[$type]; $is_inline = true; } $token = new Token($type, $content, $match, $pos, $is_inline); $result = new Match(); $result->token = $token; $result->nextOffset = $pos + strlen($full_match); return $result; }
php
private function match(string $input, int $pos, array $preferredTokens): ?Match { $current_regexp = $this->getRegexpForTokens($preferredTokens); if (false === preg_match($current_regexp, $input, $match, 0, $pos)) { $error_code = preg_last_error(); throw new \RuntimeException( "PCRE error #" . $error_code . " for token at input pos $pos; REGEXP = $current_regexp", $error_code ); } if (!$match) { return null; } $full_match = $match[0]; if ('' === $full_match) { throw new DevException( 'Tokens should not match empty string' . '; context: `' . substr($input, $pos, 10) . '`' . '; expected: ' . json_encode($preferredTokens) . "; REGEXP: $current_regexp" ); } // remove null, empty "" values and integer keys but [0] foreach ($match as $key => $value) { if ( null === $value || '' === $value || (0 !== $key && is_int($key)) ) { unset($match[$key]); } } $named = $match; unset($named[0]); if (1 !== count($named)) { throw new InternalException('Match with multiple named group'); } $content = reset($named); $type = key($named); $is_inline = false; if (isset($this->aliased[$type])) { $type = $this->aliased[$type]; $is_inline = true; } $token = new Token($type, $content, $match, $pos, $is_inline); $result = new Match(); $result->token = $token; $result->nextOffset = $pos + strlen($full_match); return $result; }
[ "private", "function", "match", "(", "string", "$", "input", ",", "int", "$", "pos", ",", "array", "$", "preferredTokens", ")", ":", "?", "Match", "{", "$", "current_regexp", "=", "$", "this", "->", "getRegexpForTokens", "(", "$", "preferredTokens", ")", ...
Search a match in input text at a position Search is performed by `parse()` after `compile()` call. Match is searched exactly in the given position by `\G`. @param string $input Input text to search where @param int $pos Position inthe text to match where @param string[] $preferredTokens Preferred tokens types to match first @return Match|null Match object on success match. `null` if no match found. @throws \RuntimeException Error from PCRE @throws DevException Error by end developer in lexer configuration @throws InternalException Error in the package
[ "Search", "a", "match", "in", "input", "text", "at", "a", "position" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L387-L445
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.getWhitespaceLength
private function getWhitespaceLength(string $input, int $pos): int { if ($this->regexpWhitespace) { if ( false === preg_match( $this->regexpWhitespace, $input, $match, 0, $pos ) ) { $error_code = preg_last_error(); throw new \RuntimeException( "PCRE error #$error_code for whitespace at input pos $pos" . '; REGEXP = ' . $this->regexpWhitespace, $error_code ); } if ($match) { return strlen($match[0]); } } return 0; }
php
private function getWhitespaceLength(string $input, int $pos): int { if ($this->regexpWhitespace) { if ( false === preg_match( $this->regexpWhitespace, $input, $match, 0, $pos ) ) { $error_code = preg_last_error(); throw new \RuntimeException( "PCRE error #$error_code for whitespace at input pos $pos" . '; REGEXP = ' . $this->regexpWhitespace, $error_code ); } if ($match) { return strlen($match[0]); } } return 0; }
[ "private", "function", "getWhitespaceLength", "(", "string", "$", "input", ",", "int", "$", "pos", ")", ":", "int", "{", "if", "(", "$", "this", "->", "regexpWhitespace", ")", "{", "if", "(", "false", "===", "preg_match", "(", "$", "this", "->", "regex...
Search a presens of whitespaces in input text in a position Search is performed by `parse()` after `compile()` call. Match is searched exactly in the given position by `\G`. @param string $input Input text to search where @param int $pos Position inthe text to match where @return int Returns matched length of whitespaces. Returns 0 if no whitespaces found in the position.
[ "Search", "a", "presens", "of", "whitespaces", "in", "input", "text", "in", "a", "position" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L457-L483
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.checkMapNames
private function checkMapNames(array $map): void { $names = array_keys($map); $bad_names = preg_grep(self::RE_NAME, $names, PREG_GREP_INVERT); if ($bad_names) { throw new \InvalidArgumentException( 'Bad names: ' . join(', ', $bad_names) ); } }
php
private function checkMapNames(array $map): void { $names = array_keys($map); $bad_names = preg_grep(self::RE_NAME, $names, PREG_GREP_INVERT); if ($bad_names) { throw new \InvalidArgumentException( 'Bad names: ' . join(', ', $bad_names) ); } }
[ "private", "function", "checkMapNames", "(", "array", "$", "map", ")", ":", "void", "{", "$", "names", "=", "array_keys", "(", "$", "map", ")", ";", "$", "bad_names", "=", "preg_grep", "(", "self", "::", "RE_NAME", ",", "$", "names", ",", "PREG_GREP_IN...
Check names in regexps map for validity @param array $map Map of regexp parts to check
[ "Check", "names", "in", "regexps", "map", "for", "validity" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L542-L551
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.validateRegExp
private static function validateRegExp(string $regExp, string $displayName): void { /** @uses convertErrorToException() */ set_error_handler([__CLASS__, 'convertErrorToException'], E_WARNING); try { if (false === preg_match($regExp, null)) { throw new \InvalidArgumentException( "PCRE error in $displayName RegExp: $regExp", preg_last_error() ); } } catch (\ErrorException $e) { throw new \InvalidArgumentException( "PCRE error in $displayName RegExp: " . $e->getMessage() . "; RegExp: $regExp", preg_last_error(), $e ); } finally { restore_error_handler(); } }
php
private static function validateRegExp(string $regExp, string $displayName): void { /** @uses convertErrorToException() */ set_error_handler([__CLASS__, 'convertErrorToException'], E_WARNING); try { if (false === preg_match($regExp, null)) { throw new \InvalidArgumentException( "PCRE error in $displayName RegExp: $regExp", preg_last_error() ); } } catch (\ErrorException $e) { throw new \InvalidArgumentException( "PCRE error in $displayName RegExp: " . $e->getMessage() . "; RegExp: $regExp", preg_last_error(), $e ); } finally { restore_error_handler(); } }
[ "private", "static", "function", "validateRegExp", "(", "string", "$", "regExp", ",", "string", "$", "displayName", ")", ":", "void", "{", "/** @uses convertErrorToException() */", "set_error_handler", "(", "[", "__CLASS__", ",", "'convertErrorToException'", "]", ",",...
Validate given RegExp @param string $regExp RegExp to validate @param string $displayName Display name for error message @throws \InvalidArgumentException
[ "Validate", "given", "RegExp" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L559-L579
train
Vovan-VE/parser
src/lexer/BaseLexer.php
BaseLexer.textToRegExp
protected function textToRegExp(string $text): string { // preg_quote() is useless with /x modifier: https://3v4l.org/brdeT if (false === strpos($this->modifiers, 'x') || !preg_match('~[\\s/#]|\\\\E~', $text)) { return preg_quote($text, '/'); } // foo\Efoo --> \Qfoo\E\\\QEfoo\E // ---^==== --- ^^ ==== // // foo/foo --> \Qfoo\E\/\Qfoo\E // ---^=== --- ^^ === return '\\Q' . strtr($text, ['\\E' => '\\E\\\\\\QE', '/' => '\\E\\/\\Q']) . '\\E'; }
php
protected function textToRegExp(string $text): string { // preg_quote() is useless with /x modifier: https://3v4l.org/brdeT if (false === strpos($this->modifiers, 'x') || !preg_match('~[\\s/#]|\\\\E~', $text)) { return preg_quote($text, '/'); } // foo\Efoo --> \Qfoo\E\\\QEfoo\E // ---^==== --- ^^ ==== // // foo/foo --> \Qfoo\E\/\Qfoo\E // ---^=== --- ^^ === return '\\Q' . strtr($text, ['\\E' => '\\E\\\\\\QE', '/' => '\\E\\/\\Q']) . '\\E'; }
[ "protected", "function", "textToRegExp", "(", "string", "$", "text", ")", ":", "string", "{", "// preg_quote() is useless with /x modifier: https://3v4l.org/brdeT", "if", "(", "false", "===", "strpos", "(", "$", "this", "->", "modifiers", ",", "'x'", ")", "||", "!...
Escape plain text to be a RegExp matching the text Native `preg_quote()` does not care about possible `/x` modifier and does not take modifiers with delimiter. So, with `/x` modifier we use `\Q...\E` instead if `$text` contains some `/x`-mode meta characters: `#` or spaces. @param string $text Plain text @return string RegExp matching the text @see https://3v4l.org/brdeT Comparison between `preg_quote()` and `\Q...\E` when `/x` modifier is used @see https://3v4l.org/tnnap This function test
[ "Escape", "plain", "text", "to", "be", "a", "RegExp", "matching", "the", "text" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/lexer/BaseLexer.php#L605-L619
train
Vovan-VE/parser
src/common/Symbol.php
Symbol.compare
public static function compare(Symbol $a, Symbol $b): int { return ($a->isTerminal - $b->isTerminal) ?: strcmp($a->name, $b->name); }
php
public static function compare(Symbol $a, Symbol $b): int { return ($a->isTerminal - $b->isTerminal) ?: strcmp($a->name, $b->name); }
[ "public", "static", "function", "compare", "(", "Symbol", "$", "a", ",", "Symbol", "$", "b", ")", ":", "int", "{", "return", "(", "$", "a", "->", "isTerminal", "-", "$", "b", "->", "isTerminal", ")", "?", ":", "strcmp", "(", "$", "a", "->", "name...
Compares two symbols Two symbols are equal when its `$name` and `$isTerminal` are the same. Note: Value of `$isHidden` is not used for comparison. @param Symbol $a @param Symbol $b @return int Returns 0 when both symbols are equal.
[ "Compares", "two", "symbols" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/common/Symbol.php#L29-L33
train
Vovan-VE/parser
src/common/Symbol.php
Symbol.compareList
public static function compareList(array $a, array $b): int { foreach ($a as $i => $symbol) { // $b finished, but $a not yet if (!isset($b[$i])) { // $a > $b return 1; } // $a[$i] <=> $b[$i] $result = static::compare($symbol, $b[$i]); if ($result) { //# $a[$i] <> $b[$i] return $result; } } // $b starts with $a // if $b longer then $a if (count($b) > count($a)) { // $a < $b return -1; } // $a == $b return 0; }
php
public static function compareList(array $a, array $b): int { foreach ($a as $i => $symbol) { // $b finished, but $a not yet if (!isset($b[$i])) { // $a > $b return 1; } // $a[$i] <=> $b[$i] $result = static::compare($symbol, $b[$i]); if ($result) { //# $a[$i] <> $b[$i] return $result; } } // $b starts with $a // if $b longer then $a if (count($b) > count($a)) { // $a < $b return -1; } // $a == $b return 0; }
[ "public", "static", "function", "compareList", "(", "array", "$", "a", ",", "array", "$", "b", ")", ":", "int", "{", "foreach", "(", "$", "a", "as", "$", "i", "=>", "$", "symbol", ")", "{", "// $b finished, but $a not yet", "if", "(", "!", "isset", "...
Compare two lists of symbols Lists are equal when both contains equal symbols in the same order. @param Symbol[] $a @param Symbol[] $b @return int Returns 0 then lists are equals
[ "Compare", "two", "lists", "of", "symbols" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/common/Symbol.php#L43-L66
train
Vovan-VE/parser
src/common/Symbol.php
Symbol.dumpName
public static function dumpName(string $name): string { if (self::isLikeName($name)) { return $name; } return self::dumpInline($name); }
php
public static function dumpName(string $name): string { if (self::isLikeName($name)) { return $name; } return self::dumpInline($name); }
[ "public", "static", "function", "dumpName", "(", "string", "$", "name", ")", ":", "string", "{", "if", "(", "self", "::", "isLikeName", "(", "$", "name", ")", ")", "{", "return", "$", "name", ";", "}", "return", "self", "::", "dumpInline", "(", "$", ...
Dump symbol name for debug purpose @param string $name @return string @since 1.5.0
[ "Dump", "symbol", "name", "for", "debug", "purpose" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/common/Symbol.php#L146-L152
train
Vovan-VE/parser
src/common/Symbol.php
Symbol.dumpType
public static function dumpType(string $type): string { if (self::isLikeName($type)) { return "<$type>"; } return self::dumpInline($type); }
php
public static function dumpType(string $type): string { if (self::isLikeName($type)) { return "<$type>"; } return self::dumpInline($type); }
[ "public", "static", "function", "dumpType", "(", "string", "$", "type", ")", ":", "string", "{", "if", "(", "self", "::", "isLikeName", "(", "$", "type", ")", ")", "{", "return", "\"<$type>\"", ";", "}", "return", "self", "::", "dumpInline", "(", "$", ...
Dump symbol type for debug purpose @param string $type @return string @since 1.5.0
[ "Dump", "symbol", "type", "for", "debug", "purpose" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/common/Symbol.php#L160-L166
train
Vovan-VE/parser
src/common/Symbol.php
Symbol.dumpInline
public static function dumpInline(string $inline): string { if (false === strpos($inline, '"')) { return '"' . $inline . '"'; } if (false === strpos($inline, "'")) { return "'$inline'"; } return "<$inline>"; }
php
public static function dumpInline(string $inline): string { if (false === strpos($inline, '"')) { return '"' . $inline . '"'; } if (false === strpos($inline, "'")) { return "'$inline'"; } return "<$inline>"; }
[ "public", "static", "function", "dumpInline", "(", "string", "$", "inline", ")", ":", "string", "{", "if", "(", "false", "===", "strpos", "(", "$", "inline", ",", "'\"'", ")", ")", "{", "return", "'\"'", ".", "$", "inline", ".", "'\"'", ";", "}", "...
Dump inline symbol for debug purpose @param string $inline @return string @since 1.5.0
[ "Dump", "inline", "symbol", "for", "debug", "purpose" ]
2aaf29054129bb70167c0cc278a401ef933e87ce
https://github.com/Vovan-VE/parser/blob/2aaf29054129bb70167c0cc278a401ef933e87ce/src/common/Symbol.php#L174-L183
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Words/Extractor.php
Extractor.getText
public function getText() { $strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/textItems'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->TextItems->List; }
php
public function getText() { $strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/textItems'; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); return $json->TextItems->List; }
[ "public", "function", "getText", "(", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/words/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/textItems'", ";", "$", "signedURI", "=", "Utils", "::", "sign", "(", ...
Gets Text items list from document. @return array @throws Exception
[ "Gets", "Text", "items", "list", "from", "document", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Words/Extractor.php#L28-L41
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Words/Extractor.php
Extractor.getDrawingObject
public function getDrawingObject($objectURI, $outputPath) { if ($outputPath == '') throw new Exception('Output path not specified'); if ($objectURI == '') throw new Exception('Object URI not specified'); $url_arr = explode('/', $objectURI); $objectIndex = end($url_arr); $strURI = $objectURI; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); if ($json->Code == 200) { if ($json->DrawingObject->ImageDataLink != '') { $strURI = $strURI . '/imageData'; $outputPath = $outputPath . '\\DrawingObject_' . $objectIndex . '.jpeg'; } else if ($json->DrawingObject->OleDataLink != '') { $strURI = $strURI . '/oleData'; $outputPath = $outputPath . '\\DrawingObject_' . $objectIndex . '.xlsx'; } else { $strURI = $strURI . '?format=jpeg'; $outputPath = $outputPath . '\\DrawingObject_' . $objectIndex . '.jpeg'; } $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { Utils::saveFile($responseStream, $outputPath); return $outputPath; } else return $v_output; } else { return false; } }
php
public function getDrawingObject($objectURI, $outputPath) { if ($outputPath == '') throw new Exception('Output path not specified'); if ($objectURI == '') throw new Exception('Object URI not specified'); $url_arr = explode('/', $objectURI); $objectIndex = end($url_arr); $strURI = $objectURI; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($responseStream); if ($json->Code == 200) { if ($json->DrawingObject->ImageDataLink != '') { $strURI = $strURI . '/imageData'; $outputPath = $outputPath . '\\DrawingObject_' . $objectIndex . '.jpeg'; } else if ($json->DrawingObject->OleDataLink != '') { $strURI = $strURI . '/oleData'; $outputPath = $outputPath . '\\DrawingObject_' . $objectIndex . '.xlsx'; } else { $strURI = $strURI . '?format=jpeg'; $outputPath = $outputPath . '\\DrawingObject_' . $objectIndex . '.jpeg'; } $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output === '') { Utils::saveFile($responseStream, $outputPath); return $outputPath; } else return $v_output; } else { return false; } }
[ "public", "function", "getDrawingObject", "(", "$", "objectURI", ",", "$", "outputPath", ")", "{", "if", "(", "$", "outputPath", "==", "''", ")", "throw", "new", "Exception", "(", "'Output path not specified'", ")", ";", "if", "(", "$", "objectURI", "==", ...
Get the drawing object from document. @param string $objectURI The URI of object. @param string $outputPath The output directory path. @return string|boolean @throws Exception
[ "Get", "the", "drawing", "object", "from", "document", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Words/Extractor.php#L194-L241
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Words/Extractor.php
Extractor.getProtection
public function getProtection() { $strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/protection'; $signedURI = Utils::sign($strURI); $response = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($response); if ($json->Code == 200) return $json->ProtectionData->ProtectionType; else return false; }
php
public function getProtection() { $strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/protection'; $signedURI = Utils::sign($strURI); $response = Utils::processCommand($signedURI, 'GET', '', ''); $json = json_decode($response); if ($json->Code == 200) return $json->ProtectionData->ProtectionType; else return false; }
[ "public", "function", "getProtection", "(", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/words/'", ".", "$", "this", "->", "getFileName", "(", ")", ".", "'/protection'", ";", "$", "signedURI", "=", "Utils", "::", "sign", ...
Get the Current Protection of the Word @return string|boolean
[ "Get", "the", "Current", "Protection", "of", "the", "Word" ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Words/Extractor.php#L248-L262
train
amphp/sql-common
src/StatementPool.php
StatementPool.push
protected function push(Statement $statement) { $maxConnections = $this->pool->getConnectionLimit(); if ($this->statements->count() > ($maxConnections / 10)) { return; } if ($maxConnections === $this->pool->getConnectionCount() && $this->pool->getIdleConnectionCount() === 0) { return; } $this->statements->push($statement); }
php
protected function push(Statement $statement) { $maxConnections = $this->pool->getConnectionLimit(); if ($this->statements->count() > ($maxConnections / 10)) { return; } if ($maxConnections === $this->pool->getConnectionCount() && $this->pool->getIdleConnectionCount() === 0) { return; } $this->statements->push($statement); }
[ "protected", "function", "push", "(", "Statement", "$", "statement", ")", "{", "$", "maxConnections", "=", "$", "this", "->", "pool", "->", "getConnectionLimit", "(", ")", ";", "if", "(", "$", "this", "->", "statements", "->", "count", "(", ")", ">", "...
Only retains statements if less than 10% of the pool is consumed by this statement and the pool has available connections. @param Statement $statement
[ "Only", "retains", "statements", "if", "less", "than", "10%", "of", "the", "pool", "is", "consumed", "by", "this", "statement", "and", "the", "pool", "has", "available", "connections", "." ]
861d71d01a9863459b0651bb77d8f212d81dd594
https://github.com/amphp/sql-common/blob/861d71d01a9863459b0651bb77d8f212d81dd594/src/StatementPool.php#L129-L142
train
amphp/sql-common
src/StatementPool.php
StatementPool.pop
protected function pop(): \Generator { while (!$this->statements->isEmpty()) { $statement = $this->statements->shift(); \assert($statement instanceof Statement); if ($statement->isAlive()) { return $statement; } } $statement = yield ($this->prepare)($this->sql); \assert($statement instanceof Statement); return $statement; }
php
protected function pop(): \Generator { while (!$this->statements->isEmpty()) { $statement = $this->statements->shift(); \assert($statement instanceof Statement); if ($statement->isAlive()) { return $statement; } } $statement = yield ($this->prepare)($this->sql); \assert($statement instanceof Statement); return $statement; }
[ "protected", "function", "pop", "(", ")", ":", "\\", "Generator", "{", "while", "(", "!", "$", "this", "->", "statements", "->", "isEmpty", "(", ")", ")", "{", "$", "statement", "=", "$", "this", "->", "statements", "->", "shift", "(", ")", ";", "\...
Coroutine returning a Statement object from the pool or creating a new Statement. @return \Generator
[ "Coroutine", "returning", "a", "Statement", "object", "from", "the", "pool", "or", "creating", "a", "new", "Statement", "." ]
861d71d01a9863459b0651bb77d8f212d81dd594
https://github.com/amphp/sql-common/blob/861d71d01a9863459b0651bb77d8f212d81dd594/src/StatementPool.php#L149-L163
train
asposeforcloud/Aspose_Cloud_SDK_For_PHP
src/Aspose/Cloud/Slides/Converter.php
Converter.convertToImagebySize
public function convertToImagebySize($slideNumber, $imageFormat, $width, $height) { $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '?format=' . $imageFormat . '&width=' . $width . '&height=' . $height; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output == '') { $outputPath = AsposeApp::$outPutLocation . 'output.' . $imageFormat; Utils::saveFile($responseStream, $outputPath); return $outputPath; } else { return $v_output; } }
php
public function convertToImagebySize($slideNumber, $imageFormat, $width, $height) { $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '?format=' . $imageFormat . '&width=' . $width . '&height=' . $height; $signedURI = Utils::sign($strURI); $responseStream = Utils::processCommand($signedURI, 'GET', '', ''); $v_output = Utils::validateOutput($responseStream); if ($v_output == '') { $outputPath = AsposeApp::$outPutLocation . 'output.' . $imageFormat; Utils::saveFile($responseStream, $outputPath); return $outputPath; } else { return $v_output; } }
[ "public", "function", "convertToImagebySize", "(", "$", "slideNumber", ",", "$", "imageFormat", ",", "$", "width", ",", "$", "height", ")", "{", "$", "strURI", "=", "Product", "::", "$", "baseProductUri", ".", "'/slides/'", ".", "$", "this", "->", "getFile...
Convert a particular slide into various formats with specified width and height. @param integer $slideNumber The slide number. @param string $imageFormat The image format. @param integer $width The width of image. @param integer $height The height of image. @return string Returns the file path. @throws Exception
[ "Convert", "a", "particular", "slide", "into", "various", "formats", "with", "specified", "width", "and", "height", "." ]
4950f2f2d24c9a101bf8e0a552d3801c251adac0
https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_PHP/blob/4950f2f2d24c9a101bf8e0a552d3801c251adac0/src/Aspose/Cloud/Slides/Converter.php#L65-L82
train