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
czim/laravel-cms-core
src/Core/BootChecker.php
BootChecker.shouldCmsRegister
public function shouldCmsRegister() { if (null !== $this->shouldRegister) { // @codeCoverageIgnoreStart return $this->shouldRegister; // @codeCoverageIgnoreEnd } if ( ! $this->isCmsEnabled()) { $this->shouldRegister = false; return false; } if ($this->isConsole()) { $this->shouldRegister = $this->isCmsEnabledArtisanCommand(); return $this->shouldRegister; } if ($this->isCmsBeingUnitTested()) { $this->shouldRegister = true; return true; } $this->shouldRegister = $this->isCmsWebRequest() || $this->isCmsApiRequest(); return $this->shouldRegister; }
php
public function shouldCmsRegister() { if (null !== $this->shouldRegister) { // @codeCoverageIgnoreStart return $this->shouldRegister; // @codeCoverageIgnoreEnd } if ( ! $this->isCmsEnabled()) { $this->shouldRegister = false; return false; } if ($this->isConsole()) { $this->shouldRegister = $this->isCmsEnabledArtisanCommand(); return $this->shouldRegister; } if ($this->isCmsBeingUnitTested()) { $this->shouldRegister = true; return true; } $this->shouldRegister = $this->isCmsWebRequest() || $this->isCmsApiRequest(); return $this->shouldRegister; }
[ "public", "function", "shouldCmsRegister", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "shouldRegister", ")", "{", "// @codeCoverageIgnoreStart", "return", "$", "this", "->", "shouldRegister", ";", "// @codeCoverageIgnoreEnd", "}", "if", "(", "!"...
Returns whether the CMS should perform any service providing. @return bool
[ "Returns", "whether", "the", "CMS", "should", "perform", "any", "service", "providing", "." ]
55a800c73e92390b4ef8268633ac96cd888e23b3
https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BootChecker.php#L41-L66
train
czim/laravel-cms-core
src/Core/BootChecker.php
BootChecker.isCmsApiRequest
public function isCmsApiRequest() { if (app()->runningInConsole() || ! $this->isCmsApiEnabled()) { return false; } return $this->requestRouteMatchesPrefix($this->getCmsApiRoutePrefix()); }
php
public function isCmsApiRequest() { if (app()->runningInConsole() || ! $this->isCmsApiEnabled()) { return false; } return $this->requestRouteMatchesPrefix($this->getCmsApiRoutePrefix()); }
[ "public", "function", "isCmsApiRequest", "(", ")", "{", "if", "(", "app", "(", ")", "->", "runningInConsole", "(", ")", "||", "!", "$", "this", "->", "isCmsApiEnabled", "(", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "re...
Returns whether performing a request to the CMS API, based on its routing. @return bool
[ "Returns", "whether", "performing", "a", "request", "to", "the", "CMS", "API", "based", "on", "its", "routing", "." ]
55a800c73e92390b4ef8268633ac96cd888e23b3
https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BootChecker.php#L199-L206
train
czim/laravel-cms-core
src/Core/BootChecker.php
BootChecker.requestRouteMatchesPrefix
protected function requestRouteMatchesPrefix($prefix) { $prefixSegments = $this->splitPrefixSegments($prefix); $request = request(); foreach ($prefixSegments as $index => $segment) { if (strtolower($request->segment($index + 1)) !== $segment) { return false; } } return true; }
php
protected function requestRouteMatchesPrefix($prefix) { $prefixSegments = $this->splitPrefixSegments($prefix); $request = request(); foreach ($prefixSegments as $index => $segment) { if (strtolower($request->segment($index + 1)) !== $segment) { return false; } } return true; }
[ "protected", "function", "requestRouteMatchesPrefix", "(", "$", "prefix", ")", "{", "$", "prefixSegments", "=", "$", "this", "->", "splitPrefixSegments", "(", "$", "prefix", ")", ";", "$", "request", "=", "request", "(", ")", ";", "foreach", "(", "$", "pre...
Returns whether a given route prefix matches the current request. @param string $prefix @return bool
[ "Returns", "whether", "a", "given", "route", "prefix", "matches", "the", "current", "request", "." ]
55a800c73e92390b4ef8268633ac96cd888e23b3
https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BootChecker.php#L214-L226
train
czim/laravel-cms-core
src/Core/BootChecker.php
BootChecker.isCmsEnabledArtisanCommand
protected function isCmsEnabledArtisanCommand() { if (null !== $this->registeredConsoleCommand) { // @codeCoverageIgnoreStart return $this->registeredConsoleCommand; // @codeCoverageIgnoreEnd } if ( ! $this->isConsole()) { $this->registeredConsoleCommand = false; return false; } $command = $this->getArtisanBaseCommand(); // If no command is given, the CMS will be loaded, to make // sure that its commands will appear in the Artisan list. if (empty($command)) { $this->registeredConsoleCommand = true; return true; } $patterns = $this->getCmsEnabledArtisanPatterns(); foreach ($patterns as $pattern) { if ($command === $pattern || Str::is($pattern, $command)) { $this->registeredConsoleCommand = true; return true; } } $this->registeredConsoleCommand = false; return false; }
php
protected function isCmsEnabledArtisanCommand() { if (null !== $this->registeredConsoleCommand) { // @codeCoverageIgnoreStart return $this->registeredConsoleCommand; // @codeCoverageIgnoreEnd } if ( ! $this->isConsole()) { $this->registeredConsoleCommand = false; return false; } $command = $this->getArtisanBaseCommand(); // If no command is given, the CMS will be loaded, to make // sure that its commands will appear in the Artisan list. if (empty($command)) { $this->registeredConsoleCommand = true; return true; } $patterns = $this->getCmsEnabledArtisanPatterns(); foreach ($patterns as $pattern) { if ($command === $pattern || Str::is($pattern, $command)) { $this->registeredConsoleCommand = true; return true; } } $this->registeredConsoleCommand = false; return false; }
[ "protected", "function", "isCmsEnabledArtisanCommand", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "registeredConsoleCommand", ")", "{", "// @codeCoverageIgnoreStart", "return", "$", "this", "->", "registeredConsoleCommand", ";", "// @codeCoverageIgnoreE...
Returns whether running an Artisan command that requires full CMS registration. @return bool
[ "Returns", "whether", "running", "an", "Artisan", "command", "that", "requires", "full", "CMS", "registration", "." ]
55a800c73e92390b4ef8268633ac96cd888e23b3
https://github.com/czim/laravel-cms-core/blob/55a800c73e92390b4ef8268633ac96cd888e23b3/src/Core/BootChecker.php#L248-L281
train
widoz/twig-wordpress
src/Factory.php
Factory.create
public function create(): \Twig\Environment { $twig = new \Twig\Environment($this->loader, $this->options); $modules = (new Provider($twig))->modules(); foreach ($modules as $module) { if (!$module instanceof Module\Injectable) { continue; } // Add the module into Twig. $module->injectInto($twig); } return $twig; }
php
public function create(): \Twig\Environment { $twig = new \Twig\Environment($this->loader, $this->options); $modules = (new Provider($twig))->modules(); foreach ($modules as $module) { if (!$module instanceof Module\Injectable) { continue; } // Add the module into Twig. $module->injectInto($twig); } return $twig; }
[ "public", "function", "create", "(", ")", ":", "\\", "Twig", "\\", "Environment", "{", "$", "twig", "=", "new", "\\", "Twig", "\\", "Environment", "(", "$", "this", "->", "loader", ",", "$", "this", "->", "options", ")", ";", "$", "modules", "=", "...
Create Instance of Twig Environment @since 1.0.0 @return \Twig\Environment The new instance of the environment
[ "Create", "Instance", "of", "Twig", "Environment" ]
c9c01400f7b4c5e0f1a3d3754444d8f739655c8a
https://github.com/widoz/twig-wordpress/blob/c9c01400f7b4c5e0f1a3d3754444d8f739655c8a/src/Factory.php#L65-L80
train
Jyxon/GDPR-Cookie-Compliance
src/Cookie/Manager.php
Manager.setCookie
public function setCookie( string $scope, string $name, string $value = "", int $expire = 0, string $path = "", string $domain = "", bool $secure = false, bool $httponly = false ): bool { if ($this->canSet($scope)) { return setcookie($name, $value, $expire, $path, $domain, $secure, $httponly); } if (isset($_COOKIE[$name])) { return setcookie($name, "", time() - 360, $path, $domain, $secure, $httponly); } return false; }
php
public function setCookie( string $scope, string $name, string $value = "", int $expire = 0, string $path = "", string $domain = "", bool $secure = false, bool $httponly = false ): bool { if ($this->canSet($scope)) { return setcookie($name, $value, $expire, $path, $domain, $secure, $httponly); } if (isset($_COOKIE[$name])) { return setcookie($name, "", time() - 360, $path, $domain, $secure, $httponly); } return false; }
[ "public", "function", "setCookie", "(", "string", "$", "scope", ",", "string", "$", "name", ",", "string", "$", "value", "=", "\"\"", ",", "int", "$", "expire", "=", "0", ",", "string", "$", "path", "=", "\"\"", ",", "string", "$", "domain", "=", "...
Send a cookie if there is consent. Also deletes cookies for which is no longer consent. @param string $scope @param string $name @param string $value @param integer $expire @param string $path @param string $domain @param boolean $secure @param boolean $httponly @return bool @SuppressWarnings(PHPMD.Superglobals) @SuppressWarnings(PHPMD.BooleanArgumentFlag)
[ "Send", "a", "cookie", "if", "there", "is", "consent", ".", "Also", "deletes", "cookies", "for", "which", "is", "no", "longer", "consent", "." ]
f71191ae3cf7fb06ada8946fc890bcbce874499c
https://github.com/Jyxon/GDPR-Cookie-Compliance/blob/f71191ae3cf7fb06ada8946fc890bcbce874499c/src/Cookie/Manager.php#L58-L77
train
Jyxon/GDPR-Cookie-Compliance
src/Cookie/Manager.php
Manager.getCookie
public function getCookie( string $scope, string $name, string $path = "", string $domain = "", bool $secure = false, bool $httponly = false ) { if (isset($_COOKIE[$name])) { if ($this->canSet($scope)) { return $_COOKIE[$name]; } setcookie($name, "", time() - 360, $path, $domain, $secure, $httponly); } return null; }
php
public function getCookie( string $scope, string $name, string $path = "", string $domain = "", bool $secure = false, bool $httponly = false ) { if (isset($_COOKIE[$name])) { if ($this->canSet($scope)) { return $_COOKIE[$name]; } setcookie($name, "", time() - 360, $path, $domain, $secure, $httponly); } return null; }
[ "public", "function", "getCookie", "(", "string", "$", "scope", ",", "string", "$", "name", ",", "string", "$", "path", "=", "\"\"", ",", "string", "$", "domain", "=", "\"\"", ",", "bool", "$", "secure", "=", "false", ",", "bool", "$", "httponly", "=...
Fetch a cookie if there is consent. Also deletes cookies for which is no longer consent. @param string $scope @param string $name @param string $path @param string $domain @param boolean $secure @param boolean $httponly @return mixed @SuppressWarnings(PHPMD.Superglobals) @SuppressWarnings(PHPMD.BooleanArgumentFlag)
[ "Fetch", "a", "cookie", "if", "there", "is", "consent", ".", "Also", "deletes", "cookies", "for", "which", "is", "no", "longer", "consent", "." ]
f71191ae3cf7fb06ada8946fc890bcbce874499c
https://github.com/Jyxon/GDPR-Cookie-Compliance/blob/f71191ae3cf7fb06ada8946fc890bcbce874499c/src/Cookie/Manager.php#L94-L111
train
tasmanianfox/MpdfPortBundle
Service/MpdfService.php
MpdfService.getMpdf
public function getMpdf($constructorArgs = array()) { $allConstructorArgs = $constructorArgs; if($this->getAddDefaultConstructorArgs()) { $allConstructorArgs = array(array_merge(array('utf-8', 'A4'), $allConstructorArgs)); } $reflection = new \ReflectionClass('Mpdf\Mpdf'); $mpdf = $reflection->newInstanceArgs($allConstructorArgs); return $mpdf; }
php
public function getMpdf($constructorArgs = array()) { $allConstructorArgs = $constructorArgs; if($this->getAddDefaultConstructorArgs()) { $allConstructorArgs = array(array_merge(array('utf-8', 'A4'), $allConstructorArgs)); } $reflection = new \ReflectionClass('Mpdf\Mpdf'); $mpdf = $reflection->newInstanceArgs($allConstructorArgs); return $mpdf; }
[ "public", "function", "getMpdf", "(", "$", "constructorArgs", "=", "array", "(", ")", ")", "{", "$", "allConstructorArgs", "=", "$", "constructorArgs", ";", "if", "(", "$", "this", "->", "getAddDefaultConstructorArgs", "(", ")", ")", "{", "$", "allConstructo...
Get an instance of mPDF class @param array $constructorArgs arguments for mPDF constror @return \mPDF
[ "Get", "an", "instance", "of", "mPDF", "class" ]
5c12c67f90273fd3cff0a83576cc3cb3edfb85a5
https://github.com/tasmanianfox/MpdfPortBundle/blob/5c12c67f90273fd3cff0a83576cc3cb3edfb85a5/Service/MpdfService.php#L16-L27
train
tasmanianfox/MpdfPortBundle
Service/MpdfService.php
MpdfService.generatePdfResponse
public function generatePdfResponse($html, array $argOptions = array()) { $response = new Response(); $response->headers->set('Content-Type', 'application/pdf'); $content = $this->generatePdf($html, $argOptions); $response->setContent($content); return $response; }
php
public function generatePdfResponse($html, array $argOptions = array()) { $response = new Response(); $response->headers->set('Content-Type', 'application/pdf'); $content = $this->generatePdf($html, $argOptions); $response->setContent($content); return $response; }
[ "public", "function", "generatePdfResponse", "(", "$", "html", ",", "array", "$", "argOptions", "=", "array", "(", ")", ")", "{", "$", "response", "=", "new", "Response", "(", ")", ";", "$", "response", "->", "headers", "->", "set", "(", "'Content-Type'"...
Generates an instance of Response class with PDF document @param string $html @param array $argOptions
[ "Generates", "an", "instance", "of", "Response", "class", "with", "PDF", "document" ]
5c12c67f90273fd3cff0a83576cc3cb3edfb85a5
https://github.com/tasmanianfox/MpdfPortBundle/blob/5c12c67f90273fd3cff0a83576cc3cb3edfb85a5/Service/MpdfService.php#L77-L86
train
captioning/captioning
src/Captioning/File.php
File.addCue
public function addCue($_mixed, $_start = null, $_stop = null) { $fileFormat = self::getFormat($this); // if $_mixed is a Cue if (is_object($_mixed) && class_exists(get_class($_mixed)) && class_exists(__NAMESPACE__.'\Cue') && is_subclass_of($_mixed, __NAMESPACE__.'\Cue')) { $cueFormat = Cue::getFormat($_mixed); if ($cueFormat !== $fileFormat) { throw new \Exception("Can't add a $cueFormat cue in a $fileFormat file."); } $_mixed->setLineEnding($this->lineEnding); $this->cues[] = $_mixed; } else { $cueClass = self::getExpectedCueClass($this); $cue = new $cueClass($_start, $_stop, $_mixed); $cue->setLineEnding($this->lineEnding); $this->cues[] = $cue; } return $this; }
php
public function addCue($_mixed, $_start = null, $_stop = null) { $fileFormat = self::getFormat($this); // if $_mixed is a Cue if (is_object($_mixed) && class_exists(get_class($_mixed)) && class_exists(__NAMESPACE__.'\Cue') && is_subclass_of($_mixed, __NAMESPACE__.'\Cue')) { $cueFormat = Cue::getFormat($_mixed); if ($cueFormat !== $fileFormat) { throw new \Exception("Can't add a $cueFormat cue in a $fileFormat file."); } $_mixed->setLineEnding($this->lineEnding); $this->cues[] = $_mixed; } else { $cueClass = self::getExpectedCueClass($this); $cue = new $cueClass($_start, $_stop, $_mixed); $cue->setLineEnding($this->lineEnding); $this->cues[] = $cue; } return $this; }
[ "public", "function", "addCue", "(", "$", "_mixed", ",", "$", "_start", "=", "null", ",", "$", "_stop", "=", "null", ")", "{", "$", "fileFormat", "=", "self", "::", "getFormat", "(", "$", "this", ")", ";", "// if $_mixed is a Cue", "if", "(", "is_objec...
Add a cue @param mixed $_mixed An cue instance or a string representing the text @param string $_start A timecode @param string $_stop A timecode @throws \Exception @return File
[ "Add", "a", "cue" ]
d830685b5a942b944d06d97a86eddc8de032e2c1
https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L322-L342
train
captioning/captioning
src/Captioning/File.php
File.removeCue
public function removeCue($_index) { if (isset($this->cues[$_index])) { unset($this->cues[$_index]); } return $this; }
php
public function removeCue($_index) { if (isset($this->cues[$_index])) { unset($this->cues[$_index]); } return $this; }
[ "public", "function", "removeCue", "(", "$", "_index", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "cues", "[", "$", "_index", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "cues", "[", "$", "_index", "]", ")", ";", "}", "retur...
Removes a cue @param int $_index @return File
[ "Removes", "a", "cue" ]
d830685b5a942b944d06d97a86eddc8de032e2c1
https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L350-L357
train
captioning/captioning
src/Captioning/File.php
File.changeFPS
public function changeFPS($_old_fps, $_new_fps) { $cuesCount = $this->getCuesCount(); for ($i = 0; $i < $cuesCount; $i++) { $cue = $this->getCue($i); $old_start = $cue->getStart(); $old_stop = $cue->getStop(); $new_start = $old_start * ($_new_fps / $_old_fps); $new_stop = $old_stop * ($_new_fps / $_old_fps); $cue->setStart($new_start); $cue->setStop($new_stop); } return $this; }
php
public function changeFPS($_old_fps, $_new_fps) { $cuesCount = $this->getCuesCount(); for ($i = 0; $i < $cuesCount; $i++) { $cue = $this->getCue($i); $old_start = $cue->getStart(); $old_stop = $cue->getStop(); $new_start = $old_start * ($_new_fps / $_old_fps); $new_stop = $old_stop * ($_new_fps / $_old_fps); $cue->setStart($new_start); $cue->setStop($new_stop); } return $this; }
[ "public", "function", "changeFPS", "(", "$", "_old_fps", ",", "$", "_new_fps", ")", "{", "$", "cuesCount", "=", "$", "this", "->", "getCuesCount", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "cuesCount", ";", "$", "i",...
Converts timecodes based on the specified FPS ratio @param float $_old_fps @param float $_new_fps @return File
[ "Converts", "timecodes", "based", "on", "the", "specified", "FPS", "ratio" ]
d830685b5a942b944d06d97a86eddc8de032e2c1
https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L393-L410
train
captioning/captioning
src/Captioning/File.php
File.shift
public function shift($_time, $_startIndex = null, $_endIndex = null) { if (!is_int($_time)) { return false; } if ($_time == 0) { return true; } if (null === $_startIndex) { $_startIndex = 0; } if (null === $_endIndex) { $_endIndex = $this->getCuesCount() - 1; } $startCue = $this->getCue($_startIndex); $endCue = $this->getCue($_endIndex); //check subtitles do exist if (!$startCue || !$endCue) { return false; } for ($i = $_startIndex; $i <= $_endIndex; $i++) { $cue = $this->getCue($i); $cue->shift($_time); } return true; }
php
public function shift($_time, $_startIndex = null, $_endIndex = null) { if (!is_int($_time)) { return false; } if ($_time == 0) { return true; } if (null === $_startIndex) { $_startIndex = 0; } if (null === $_endIndex) { $_endIndex = $this->getCuesCount() - 1; } $startCue = $this->getCue($_startIndex); $endCue = $this->getCue($_endIndex); //check subtitles do exist if (!$startCue || !$endCue) { return false; } for ($i = $_startIndex; $i <= $_endIndex; $i++) { $cue = $this->getCue($i); $cue->shift($_time); } return true; }
[ "public", "function", "shift", "(", "$", "_time", ",", "$", "_startIndex", "=", "null", ",", "$", "_endIndex", "=", "null", ")", "{", "if", "(", "!", "is_int", "(", "$", "_time", ")", ")", "{", "return", "false", ";", "}", "if", "(", "$", "_time"...
Shifts a range of subtitles a specified amount of time. @param int $_time The time to use (ms), which can be positive or negative. @param int $_startIndex The subtitle index the range begins with. @param int $_endIndex The subtitle index the range ends with.
[ "Shifts", "a", "range", "of", "subtitles", "a", "specified", "amount", "of", "time", "." ]
d830685b5a942b944d06d97a86eddc8de032e2c1
https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L436-L466
train
captioning/captioning
src/Captioning/File.php
File.sync
public function sync($_startIndex, $_startTime, $_endIndex, $_endTime, $_syncLast = true) { //set first and last subtitles index if (!$_startIndex) { $_startIndex = 0; } if (!$_endIndex) { $_endIndex = $this->getCuesCount() - 1; } if (!$_syncLast) { $_endIndex--; } //check subtitles do exist $startSubtitle = $this->getCue($_startIndex); $endSubtitle = $this->getCue($_endIndex); if (!$startSubtitle || !$endSubtitle || ($_startTime >= $_endTime)) { return false; } $shift = $_startTime - $startSubtitle->getStartMS(); $factor = ($_endTime - $_startTime) / ($endSubtitle->getStartMS() - $startSubtitle->getStartMS()); /* Shift subtitles to the start point */ if ($shift) { $this->shift($shift, $_startIndex, $_endIndex); } /* Sync timings with proportion */ for ($index = $_startIndex; $index <= $_endIndex; $index++) { $cue = $this->getCue($index); $cue->scale($_startTime, $factor); } return true; }
php
public function sync($_startIndex, $_startTime, $_endIndex, $_endTime, $_syncLast = true) { //set first and last subtitles index if (!$_startIndex) { $_startIndex = 0; } if (!$_endIndex) { $_endIndex = $this->getCuesCount() - 1; } if (!$_syncLast) { $_endIndex--; } //check subtitles do exist $startSubtitle = $this->getCue($_startIndex); $endSubtitle = $this->getCue($_endIndex); if (!$startSubtitle || !$endSubtitle || ($_startTime >= $_endTime)) { return false; } $shift = $_startTime - $startSubtitle->getStartMS(); $factor = ($_endTime - $_startTime) / ($endSubtitle->getStartMS() - $startSubtitle->getStartMS()); /* Shift subtitles to the start point */ if ($shift) { $this->shift($shift, $_startIndex, $_endIndex); } /* Sync timings with proportion */ for ($index = $_startIndex; $index <= $_endIndex; $index++) { $cue = $this->getCue($index); $cue->scale($_startTime, $factor); } return true; }
[ "public", "function", "sync", "(", "$", "_startIndex", ",", "$", "_startTime", ",", "$", "_endIndex", ",", "$", "_endTime", ",", "$", "_syncLast", "=", "true", ")", "{", "//set first and last subtitles index", "if", "(", "!", "$", "_startIndex", ")", "{", ...
Auto syncs a range of subtitles given their first and last correct times. The subtitles are first shifted to the first subtitle's correct time, and then proportionally adjusted using the last subtitle's correct time. Based on gnome-subtitles (https://git.gnome.org/browse/gnome-subtitles/) @param int $_startIndex The subtitle index to start the adjustment with. @param int $_startTime The correct start time for the first subtitle. @param int $_endIndex The subtitle index to end the adjustment with. @param int $_endTime The correct start time for the last subtitle. @param bool $_syncLast Whether to sync the last subtitle. @return bool Whether the subtitles could be adjusted
[ "Auto", "syncs", "a", "range", "of", "subtitles", "given", "their", "first", "and", "last", "correct", "times", ".", "The", "subtitles", "are", "first", "shifted", "to", "the", "first", "subtitle", "s", "correct", "time", "and", "then", "proportionally", "ad...
d830685b5a942b944d06d97a86eddc8de032e2c1
https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L482-L517
train
captioning/captioning
src/Captioning/File.php
File.getStats
public function getStats() { $this->stats = array( 'tooSlow' => 0, 'slowAcceptable' => 0, 'aBitSlow' => 0, 'goodSlow' => 0, 'perfect' => 0, 'goodFast' => 0, 'aBitFast' => 0, 'fastAcceptable' => 0, 'tooFast' => 0 ); $cuesCount = $this->getCuesCount(); for ($i = 0; $i < $cuesCount; $i++) { $rs = $this->getCue($i)->getReadingSpeed(); if ($rs < 5) { $this->stats['tooSlow']++; } elseif ($rs < 10) { $this->stats['slowAcceptable']++; } elseif ($rs < 13) { $this->stats['aBitSlow']++; } elseif ($rs < 15) { $this->stats['goodSlow']++; } elseif ($rs < 23) { $this->stats['perfect']++; } elseif ($rs < 27) { $this->stats['goodFast']++; } elseif ($rs < 31) { $this->stats['aBitFast']++; } elseif ($rs < 35) { $this->stats['fastAcceptable']++; } else { $this->stats['tooFast']++; } } return $this->stats; }
php
public function getStats() { $this->stats = array( 'tooSlow' => 0, 'slowAcceptable' => 0, 'aBitSlow' => 0, 'goodSlow' => 0, 'perfect' => 0, 'goodFast' => 0, 'aBitFast' => 0, 'fastAcceptable' => 0, 'tooFast' => 0 ); $cuesCount = $this->getCuesCount(); for ($i = 0; $i < $cuesCount; $i++) { $rs = $this->getCue($i)->getReadingSpeed(); if ($rs < 5) { $this->stats['tooSlow']++; } elseif ($rs < 10) { $this->stats['slowAcceptable']++; } elseif ($rs < 13) { $this->stats['aBitSlow']++; } elseif ($rs < 15) { $this->stats['goodSlow']++; } elseif ($rs < 23) { $this->stats['perfect']++; } elseif ($rs < 27) { $this->stats['goodFast']++; } elseif ($rs < 31) { $this->stats['aBitFast']++; } elseif ($rs < 35) { $this->stats['fastAcceptable']++; } else { $this->stats['tooFast']++; } } return $this->stats; }
[ "public", "function", "getStats", "(", ")", "{", "$", "this", "->", "stats", "=", "array", "(", "'tooSlow'", "=>", "0", ",", "'slowAcceptable'", "=>", "0", ",", "'aBitSlow'", "=>", "0", ",", "'goodSlow'", "=>", "0", ",", "'perfect'", "=>", "0", ",", ...
Computes reading speed statistics
[ "Computes", "reading", "speed", "statistics" ]
d830685b5a942b944d06d97a86eddc8de032e2c1
https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L567-L607
train
captioning/captioning
src/Captioning/File.php
File.encode
protected function encode() { if ($this->useIconv) { $this->fileContent = iconv($this->encoding, 'UTF-8', $this->fileContent); } else { $this->fileContent = mb_convert_encoding($this->fileContent, 'UTF-8', $this->encoding); } }
php
protected function encode() { if ($this->useIconv) { $this->fileContent = iconv($this->encoding, 'UTF-8', $this->fileContent); } else { $this->fileContent = mb_convert_encoding($this->fileContent, 'UTF-8', $this->encoding); } }
[ "protected", "function", "encode", "(", ")", "{", "if", "(", "$", "this", "->", "useIconv", ")", "{", "$", "this", "->", "fileContent", "=", "iconv", "(", "$", "this", "->", "encoding", ",", "'UTF-8'", ",", "$", "this", "->", "fileContent", ")", ";",...
Encode file content
[ "Encode", "file", "content" ]
d830685b5a942b944d06d97a86eddc8de032e2c1
https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/File.php#L661-L668
train
captioning/captioning
src/Captioning/Format/SubripCue.php
SubripCue.getStrippedText
public function getStrippedText($_stripBasic = false, $_replacements = array()) { $text = $this->text; if ($_stripBasic) { $text = strip_tags($text); } $patterns = "/{[^}]+}/"; $repl = ""; $text = preg_replace($patterns, $repl, $text); if (count($_replacements) > 0) { $text = str_replace(array_keys($_replacements), array_values($_replacements), $text); $text = iconv('UTF-8', 'UTF-8//IGNORE', $text); } return $text; }
php
public function getStrippedText($_stripBasic = false, $_replacements = array()) { $text = $this->text; if ($_stripBasic) { $text = strip_tags($text); } $patterns = "/{[^}]+}/"; $repl = ""; $text = preg_replace($patterns, $repl, $text); if (count($_replacements) > 0) { $text = str_replace(array_keys($_replacements), array_values($_replacements), $text); $text = iconv('UTF-8', 'UTF-8//IGNORE', $text); } return $text; }
[ "public", "function", "getStrippedText", "(", "$", "_stripBasic", "=", "false", ",", "$", "_replacements", "=", "array", "(", ")", ")", "{", "$", "text", "=", "$", "this", "->", "text", ";", "if", "(", "$", "_stripBasic", ")", "{", "$", "text", "=", ...
Return the text without Advanced SSA tags @param boolean $_stripBasic If true, <i>, <b> and <u> tags will be stripped @param array $_replacements @return string
[ "Return", "the", "text", "without", "Advanced", "SSA", "tags" ]
d830685b5a942b944d06d97a86eddc8de032e2c1
https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/Format/SubripCue.php#L46-L64
train
captioning/captioning
src/Captioning/Format/SubripFile.php
SubripFile.cleanUpTimecode
private function cleanUpTimecode($timecode) { strpos($timecode, ',') ?: $timecode .= ',000'; $patternNoLeadingZeroes = '/(?:(?<=\:)|^)\d(?=(:|,))/'; return preg_replace_callback($patternNoLeadingZeroes, function($matches) { return sprintf('%02d', $matches[0]); }, $timecode); }
php
private function cleanUpTimecode($timecode) { strpos($timecode, ',') ?: $timecode .= ',000'; $patternNoLeadingZeroes = '/(?:(?<=\:)|^)\d(?=(:|,))/'; return preg_replace_callback($patternNoLeadingZeroes, function($matches) { return sprintf('%02d', $matches[0]); }, $timecode); }
[ "private", "function", "cleanUpTimecode", "(", "$", "timecode", ")", "{", "strpos", "(", "$", "timecode", ",", "','", ")", "?", ":", "$", "timecode", ".=", "',000'", ";", "$", "patternNoLeadingZeroes", "=", "'/(?:(?<=\\:)|^)\\d(?=(:|,))/'", ";", "return", "pre...
Add milliseconds and leading zeroes if they are missing @param $timecode @return mixed
[ "Add", "milliseconds", "and", "leading", "zeroes", "if", "they", "are", "missing" ]
d830685b5a942b944d06d97a86eddc8de032e2c1
https://github.com/captioning/captioning/blob/d830685b5a942b944d06d97a86eddc8de032e2c1/src/Captioning/Format/SubripFile.php#L254-L264
train
Torann/remote-model
src/Torann/RemoteModel/Model.php
Model.getEndpoint
public function getEndpoint() { if (is_null($this->endpoint)) { $this->endpoint = str_replace('\\', '', snake_case(str_plural(class_basename($this)))); } return $this->endpoint; }
php
public function getEndpoint() { if (is_null($this->endpoint)) { $this->endpoint = str_replace('\\', '', snake_case(str_plural(class_basename($this)))); } return $this->endpoint; }
[ "public", "function", "getEndpoint", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "endpoint", ")", ")", "{", "$", "this", "->", "endpoint", "=", "str_replace", "(", "'\\\\'", ",", "''", ",", "snake_case", "(", "str_plural", "(", "class_...
Get API endpoint. @return string
[ "Get", "API", "endpoint", "." ]
ac855fee4b4460297f0a5bbf86895c837188f8d3
https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L312-L319
train
Torann/remote-model
src/Torann/RemoteModel/Model.php
Model.paginateHydrate
public function paginateHydrate($result, $modelClass = null) { // Get values $pagination = array_get($result, 'pagination', []); $items = array_get($result, 'items', []); $page = LengthAwarePaginator::resolveCurrentPage(); // Set pagination $perPage = array_get($pagination, 'perPage', array_get($pagination, 'per_page', 15)); $total = array_get($pagination, 'total', null); // Set options $options = is_array($result) ? array_except($result, [ 'pagination', 'items', 'next', 'per_page', 'last' ]) : []; return new LengthAwarePaginator($this->hydrate($items, $modelClass), $total, $perPage, $page, array_merge($options, [ 'path' => LengthAwarePaginator::resolveCurrentPath() ])); }
php
public function paginateHydrate($result, $modelClass = null) { // Get values $pagination = array_get($result, 'pagination', []); $items = array_get($result, 'items', []); $page = LengthAwarePaginator::resolveCurrentPage(); // Set pagination $perPage = array_get($pagination, 'perPage', array_get($pagination, 'per_page', 15)); $total = array_get($pagination, 'total', null); // Set options $options = is_array($result) ? array_except($result, [ 'pagination', 'items', 'next', 'per_page', 'last' ]) : []; return new LengthAwarePaginator($this->hydrate($items, $modelClass), $total, $perPage, $page, array_merge($options, [ 'path' => LengthAwarePaginator::resolveCurrentPath() ])); }
[ "public", "function", "paginateHydrate", "(", "$", "result", ",", "$", "modelClass", "=", "null", ")", "{", "// Get values", "$", "pagination", "=", "array_get", "(", "$", "result", ",", "'pagination'", ",", "[", "]", ")", ";", "$", "items", "=", "array_...
Paginate items. @param array $result @param string $modelClass @return \Illuminate\Pagination\LengthAwarePaginator
[ "Paginate", "items", "." ]
ac855fee4b4460297f0a5bbf86895c837188f8d3
https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L425-L449
train
Torann/remote-model
src/Torann/RemoteModel/Model.php
Model.all
public static function all(array $params = []) { // Remove empty params $params = array_filter($params); $instance = new static([], static::getParentID()); // Make request $result = $instance->makeRequest($instance->getEndpoint(), 'all', [$params]); // Hydrate object $result = $instance->paginateHydrate($result); // Append search params $result->appends($params); return $result; }
php
public static function all(array $params = []) { // Remove empty params $params = array_filter($params); $instance = new static([], static::getParentID()); // Make request $result = $instance->makeRequest($instance->getEndpoint(), 'all', [$params]); // Hydrate object $result = $instance->paginateHydrate($result); // Append search params $result->appends($params); return $result; }
[ "public", "static", "function", "all", "(", "array", "$", "params", "=", "[", "]", ")", "{", "// Remove empty params", "$", "params", "=", "array_filter", "(", "$", "params", ")", ";", "$", "instance", "=", "new", "static", "(", "[", "]", ",", "static"...
Make an all paginated request. @param array $params @return \Illuminate\Pagination\LengthAwarePaginator
[ "Make", "an", "all", "paginated", "request", "." ]
ac855fee4b4460297f0a5bbf86895c837188f8d3
https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L486-L503
train
Torann/remote-model
src/Torann/RemoteModel/Model.php
Model.findOrFail
public static function findOrFail($id, array $params = []) { $instance = new static([], static::getParentID()); // Make request if (!is_null($result = $instance->request($instance->getEndpoint(), 'find', [$id, $params]))) { return $result; } // Not found throw new NotFoundException; }
php
public static function findOrFail($id, array $params = []) { $instance = new static([], static::getParentID()); // Make request if (!is_null($result = $instance->request($instance->getEndpoint(), 'find', [$id, $params]))) { return $result; } // Not found throw new NotFoundException; }
[ "public", "static", "function", "findOrFail", "(", "$", "id", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "instance", "=", "new", "static", "(", "[", "]", ",", "static", "::", "getParentID", "(", ")", ")", ";", "// Make request", "if",...
Find a model by its primary key or throw an exception @param string $id @param array $params @return mixed|static @throws \Torann\RemoteModel\NotFoundException
[ "Find", "a", "model", "by", "its", "primary", "key", "or", "throw", "an", "exception" ]
ac855fee4b4460297f0a5bbf86895c837188f8d3
https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L542-L553
train
Torann/remote-model
src/Torann/RemoteModel/Model.php
Model.performCreate
protected function performCreate(array $options = []) { if ($this->fireModelEvent('creating') === false) { return false; } $params = $this->setKeysForSave(); $results = $this->makeRequest($this->getEndpoint(), 'create', [$params]); // Creation failed if (is_array($results) === false) { return false; } // Fresh start $this->attributes = []; // Update model with new data $this->fill($results); // We will go ahead and set the exists property to true, so that it is set when // the created event is fired, just in case the developer tries to update it // during the event. This will allow them to do so and run an update here. $this->exists = true; $this->fireModelEvent('created', false); return true; }
php
protected function performCreate(array $options = []) { if ($this->fireModelEvent('creating') === false) { return false; } $params = $this->setKeysForSave(); $results = $this->makeRequest($this->getEndpoint(), 'create', [$params]); // Creation failed if (is_array($results) === false) { return false; } // Fresh start $this->attributes = []; // Update model with new data $this->fill($results); // We will go ahead and set the exists property to true, so that it is set when // the created event is fired, just in case the developer tries to update it // during the event. This will allow them to do so and run an update here. $this->exists = true; $this->fireModelEvent('created', false); return true; }
[ "protected", "function", "performCreate", "(", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "fireModelEvent", "(", "'creating'", ")", "===", "false", ")", "{", "return", "false", ";", "}", "$", "params", "=", "$", "...
Perform a model create operation. @param array $options @return bool
[ "Perform", "a", "model", "create", "operation", "." ]
ac855fee4b4460297f0a5bbf86895c837188f8d3
https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L802-L831
train
Torann/remote-model
src/Torann/RemoteModel/Model.php
Model.setKeysForSave
protected function setKeysForSave() { // Convert objects to array $params = array_map(function($value) { if (is_object($value) && !($value instanceof UploadedFile) && is_callable([$value, 'toApi'])) { return $value->toApi(); } return $value; }, $this->toApi()); // Remove dynamic params return array_except($params, array_merge([static::CREATED_AT, static::UPDATED_AT], [ 'id', 'pagination', ])); }
php
protected function setKeysForSave() { // Convert objects to array $params = array_map(function($value) { if (is_object($value) && !($value instanceof UploadedFile) && is_callable([$value, 'toApi'])) { return $value->toApi(); } return $value; }, $this->toApi()); // Remove dynamic params return array_except($params, array_merge([static::CREATED_AT, static::UPDATED_AT], [ 'id', 'pagination', ])); }
[ "protected", "function", "setKeysForSave", "(", ")", "{", "// Convert objects to array", "$", "params", "=", "array_map", "(", "function", "(", "$", "value", ")", "{", "if", "(", "is_object", "(", "$", "value", ")", "&&", "!", "(", "$", "value", "instanceo...
Set the keys for a save update request. @return array
[ "Set", "the", "keys", "for", "a", "save", "update", "request", "." ]
ac855fee4b4460297f0a5bbf86895c837188f8d3
https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L857-L875
train
Torann/remote-model
src/Torann/RemoteModel/Model.php
Model.request
protected function request($endpoint = null, $method, $params) { $results = $this->makeRequest($endpoint, $method, $params); return $results ? $this->newInstance($results, true) : null; }
php
protected function request($endpoint = null, $method, $params) { $results = $this->makeRequest($endpoint, $method, $params); return $results ? $this->newInstance($results, true) : null; }
[ "protected", "function", "request", "(", "$", "endpoint", "=", "null", ",", "$", "method", ",", "$", "params", ")", "{", "$", "results", "=", "$", "this", "->", "makeRequest", "(", "$", "endpoint", ",", "$", "method", ",", "$", "params", ")", ";", ...
Request through the API client. @return mixed
[ "Request", "through", "the", "API", "client", "." ]
ac855fee4b4460297f0a5bbf86895c837188f8d3
https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L1783-L1788
train
Torann/remote-model
src/Torann/RemoteModel/Model.php
Model.makeRequest
protected function makeRequest($endpoint = null, $method, $params) { $endpoint = $endpoint ?: $this->getEndpoint(); // Prepend relationship, if one exists. if (static::getParentID()) { $params = array_merge([ static::getParentID() ], $params); } $results = call_user_func_array([static::$client->$endpoint(), $method], $params); // Set errors from server...if any $this->messageBag = static::$client->errors(); return $results; }
php
protected function makeRequest($endpoint = null, $method, $params) { $endpoint = $endpoint ?: $this->getEndpoint(); // Prepend relationship, if one exists. if (static::getParentID()) { $params = array_merge([ static::getParentID() ], $params); } $results = call_user_func_array([static::$client->$endpoint(), $method], $params); // Set errors from server...if any $this->messageBag = static::$client->errors(); return $results; }
[ "protected", "function", "makeRequest", "(", "$", "endpoint", "=", "null", ",", "$", "method", ",", "$", "params", ")", "{", "$", "endpoint", "=", "$", "endpoint", "?", ":", "$", "this", "->", "getEndpoint", "(", ")", ";", "// Prepend relationship, if one ...
Make request through the API client. @return mixed
[ "Make", "request", "through", "the", "API", "client", "." ]
ac855fee4b4460297f0a5bbf86895c837188f8d3
https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L1795-L1812
train
Torann/remote-model
src/Torann/RemoteModel/Model.php
Model.registerModelEvent
protected static function registerModelEvent($event, $callback, $priority = 0) { $name = get_called_class(); app('events')->listen("eloquent.{$event}: {$name}", $callback, $priority); }
php
protected static function registerModelEvent($event, $callback, $priority = 0) { $name = get_called_class(); app('events')->listen("eloquent.{$event}: {$name}", $callback, $priority); }
[ "protected", "static", "function", "registerModelEvent", "(", "$", "event", ",", "$", "callback", ",", "$", "priority", "=", "0", ")", "{", "$", "name", "=", "get_called_class", "(", ")", ";", "app", "(", "'events'", ")", "->", "listen", "(", "\"eloquent...
Register a model event with the dispatcher. @param string $event @param \Closure|string $callback @param int $priority @return void
[ "Register", "a", "model", "event", "with", "the", "dispatcher", "." ]
ac855fee4b4460297f0a5bbf86895c837188f8d3
https://github.com/Torann/remote-model/blob/ac855fee4b4460297f0a5bbf86895c837188f8d3/src/Torann/RemoteModel/Model.php#L1822-L1827
train
tyua07/laravel-upload
src/Cos/cos-php-sdk-v4/qcloudcos/auth.php
Auth.createSignature
private static function createSignature( $appId, $secretId, $secretKey, $expiration, $bucket, $fileId) { if (empty($secretId) || empty($secretKey)) { return self::AUTH_SECRET_ID_KEY_ERROR; } $now = time(); $random = rand(); $plainText = "a=$appId&k=$secretId&e=$expiration&t=$now&r=$random&f=$fileId&b=$bucket"; $bin = hash_hmac('SHA1', $plainText, $secretKey, true); $bin = $bin.$plainText; $signature = base64_encode($bin); return $signature; }
php
private static function createSignature( $appId, $secretId, $secretKey, $expiration, $bucket, $fileId) { if (empty($secretId) || empty($secretKey)) { return self::AUTH_SECRET_ID_KEY_ERROR; } $now = time(); $random = rand(); $plainText = "a=$appId&k=$secretId&e=$expiration&t=$now&r=$random&f=$fileId&b=$bucket"; $bin = hash_hmac('SHA1', $plainText, $secretKey, true); $bin = $bin.$plainText; $signature = base64_encode($bin); return $signature; }
[ "private", "static", "function", "createSignature", "(", "$", "appId", ",", "$", "secretId", ",", "$", "secretKey", ",", "$", "expiration", ",", "$", "bucket", ",", "$", "fileId", ")", "{", "if", "(", "empty", "(", "$", "secretId", ")", "||", "empty", ...
A helper function for creating signature. Return the signature on success. Return error code if parameter is not valid.
[ "A", "helper", "function", "for", "creating", "signature", ".", "Return", "the", "signature", "on", "success", ".", "Return", "error", "code", "if", "parameter", "is", "not", "valid", "." ]
d54bad8987c09cc8106e3959c38c1ef975e39013
https://github.com/tyua07/laravel-upload/blob/d54bad8987c09cc8106e3959c38c1ef975e39013/src/Cos/cos-php-sdk-v4/qcloudcos/auth.php#L70-L85
train
awps/font-awesome-php
src/AbstractFontAwesome.php
AbstractFontAwesome.getUnicodeKeys
public function getUnicodeKeys() { $the_array = $this->icons_array; if ( is_array( $the_array ) ) { $temp = array(); foreach ( $the_array as $class => $unicode ) { $temp[ $class ] = $unicode; } $the_array = $temp; } return $the_array; }
php
public function getUnicodeKeys() { $the_array = $this->icons_array; if ( is_array( $the_array ) ) { $temp = array(); foreach ( $the_array as $class => $unicode ) { $temp[ $class ] = $unicode; } $the_array = $temp; } return $the_array; }
[ "public", "function", "getUnicodeKeys", "(", ")", "{", "$", "the_array", "=", "$", "this", "->", "icons_array", ";", "if", "(", "is_array", "(", "$", "the_array", ")", ")", "{", "$", "temp", "=", "array", "(", ")", ";", "foreach", "(", "$", "the_arra...
Get only the unicode keys @return array|bool
[ "Get", "only", "the", "unicode", "keys" ]
61cfa3f9715b62193d55fc4f4792d213787b9769
https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L83-L97
train
awps/font-awesome-php
src/AbstractFontAwesome.php
AbstractFontAwesome.normalizeIconClass
protected function normalizeIconClass( $icon_class ) { $icon_class = trim( $icon_class ); if ( stripos( $icon_class, 'fa-' ) === false ) { $icon_class = 'fa-' . $icon_class; } return $icon_class; }
php
protected function normalizeIconClass( $icon_class ) { $icon_class = trim( $icon_class ); if ( stripos( $icon_class, 'fa-' ) === false ) { $icon_class = 'fa-' . $icon_class; } return $icon_class; }
[ "protected", "function", "normalizeIconClass", "(", "$", "icon_class", ")", "{", "$", "icon_class", "=", "trim", "(", "$", "icon_class", ")", ";", "if", "(", "stripos", "(", "$", "icon_class", ",", "'fa-'", ")", "===", "false", ")", "{", "$", "icon_class...
Make sure to have a class that starts with `fa-`. @param string $icon_class @return string
[ "Make", "sure", "to", "have", "a", "class", "that", "starts", "with", "fa", "-", "." ]
61cfa3f9715b62193d55fc4f4792d213787b9769
https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L147-L155
train
awps/font-awesome-php
src/AbstractFontAwesome.php
AbstractFontAwesome.getIconUnicode
public function getIconUnicode( $icon_class ) { $icon_class = $this->normalizeIconClass( $icon_class ); $result = false; if ( ! empty( $this->icons_array ) && array_key_exists( $icon_class, $this->icons_array ) ) { $result = $this->icons_array[ $icon_class ]; } return $result; }
php
public function getIconUnicode( $icon_class ) { $icon_class = $this->normalizeIconClass( $icon_class ); $result = false; if ( ! empty( $this->icons_array ) && array_key_exists( $icon_class, $this->icons_array ) ) { $result = $this->icons_array[ $icon_class ]; } return $result; }
[ "public", "function", "getIconUnicode", "(", "$", "icon_class", ")", "{", "$", "icon_class", "=", "$", "this", "->", "normalizeIconClass", "(", "$", "icon_class", ")", ";", "$", "result", "=", "false", ";", "if", "(", "!", "empty", "(", "$", "this", "-...
Get the unicode by icon class. @param string|bool $icon_class @return bool|string
[ "Get", "the", "unicode", "by", "icon", "class", "." ]
61cfa3f9715b62193d55fc4f4792d213787b9769
https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L200-L209
train
awps/font-awesome-php
src/AbstractFontAwesome.php
AbstractFontAwesome.getIconName
public function getIconName( $icon_class ) { $icon_class = $this->normalizeIconClass( $icon_class ); $result = false; if ( ! empty( $this->icons_array ) && array_key_exists( $icon_class, $this->icons_array ) ) { $result = $this->generateName( $icon_class ); } return $result; }
php
public function getIconName( $icon_class ) { $icon_class = $this->normalizeIconClass( $icon_class ); $result = false; if ( ! empty( $this->icons_array ) && array_key_exists( $icon_class, $this->icons_array ) ) { $result = $this->generateName( $icon_class ); } return $result; }
[ "public", "function", "getIconName", "(", "$", "icon_class", ")", "{", "$", "icon_class", "=", "$", "this", "->", "normalizeIconClass", "(", "$", "icon_class", ")", ";", "$", "result", "=", "false", ";", "if", "(", "!", "empty", "(", "$", "this", "->",...
Get the readable name by icon class. @param string|bool $icon_class @return bool|string
[ "Get", "the", "readable", "name", "by", "icon", "class", "." ]
61cfa3f9715b62193d55fc4f4792d213787b9769
https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L218-L227
train
awps/font-awesome-php
src/AbstractFontAwesome.php
AbstractFontAwesome.getIcon
public function getIcon( $icon_class ) { $icon_class = $this->normalizeIconClass( $icon_class ); $result = false; $icons = $this->getAllData(); if ( ! empty( $icons ) && array_key_exists( $icon_class, $icons ) ) { $result = $icons[ $icon_class ]; } return $result; }
php
public function getIcon( $icon_class ) { $icon_class = $this->normalizeIconClass( $icon_class ); $result = false; $icons = $this->getAllData(); if ( ! empty( $icons ) && array_key_exists( $icon_class, $icons ) ) { $result = $icons[ $icon_class ]; } return $result; }
[ "public", "function", "getIcon", "(", "$", "icon_class", ")", "{", "$", "icon_class", "=", "$", "this", "->", "normalizeIconClass", "(", "$", "icon_class", ")", ";", "$", "result", "=", "false", ";", "$", "icons", "=", "$", "this", "->", "getAllData", ...
Get icon data by icon class. @param string|bool $icon_class @return bool|string
[ "Get", "icon", "data", "by", "icon", "class", "." ]
61cfa3f9715b62193d55fc4f4792d213787b9769
https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L236-L247
train
awps/font-awesome-php
src/AbstractFontAwesome.php
AbstractFontAwesome.getIconByUnicode
public function getIconByUnicode( $unicode ) { $unicode = $this->normalizeUnicode( $unicode ); $result = false; $the_key = array_search( $unicode, $this->icons_array ); if ( ! empty( $the_key ) ) { $result = $this->getIcon( $the_key ); } return $result; }
php
public function getIconByUnicode( $unicode ) { $unicode = $this->normalizeUnicode( $unicode ); $result = false; $the_key = array_search( $unicode, $this->icons_array ); if ( ! empty( $the_key ) ) { $result = $this->getIcon( $the_key ); } return $result; }
[ "public", "function", "getIconByUnicode", "(", "$", "unicode", ")", "{", "$", "unicode", "=", "$", "this", "->", "normalizeUnicode", "(", "$", "unicode", ")", ";", "$", "result", "=", "false", ";", "$", "the_key", "=", "array_search", "(", "$", "unicode"...
Get icon data by unicode. @param string|bool $unicode @return bool|string
[ "Get", "icon", "data", "by", "unicode", "." ]
61cfa3f9715b62193d55fc4f4792d213787b9769
https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/AbstractFontAwesome.php#L256-L267
train
awps/font-awesome-php
src/FontAwesomeReader.php
FontAwesomeReader.readCss
protected static function readCss( $path, $class_prefix = 'fa-' ) { //if path is incorrect or file does not exist, stop. if ( ! file_exists( $path ) ) { throw new \Exception( 'Can\'t read the CSS. File does not exists.' ); } $css = file_get_contents( $path ); $pattern = '/\.(' . $class_prefix . '(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/'; preg_match_all( $pattern, $css, $matches, PREG_SET_ORDER ); $icons = array(); foreach ( $matches as $match ) { $icons[ $match[1] ] = $match[2]; } return $icons; }
php
protected static function readCss( $path, $class_prefix = 'fa-' ) { //if path is incorrect or file does not exist, stop. if ( ! file_exists( $path ) ) { throw new \Exception( 'Can\'t read the CSS. File does not exists.' ); } $css = file_get_contents( $path ); $pattern = '/\.(' . $class_prefix . '(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/'; preg_match_all( $pattern, $css, $matches, PREG_SET_ORDER ); $icons = array(); foreach ( $matches as $match ) { $icons[ $match[1] ] = $match[2]; } return $icons; }
[ "protected", "static", "function", "readCss", "(", "$", "path", ",", "$", "class_prefix", "=", "'fa-'", ")", "{", "//if path is incorrect or file does not exist, stop.", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "throw", "new", "\\", "Exc...
Read the CSS file and return the array @param string $path font awesome css file path @param string $class_prefix change this if the class names does not start with `fa-` @return array|bool @throws \Exception
[ "Read", "the", "CSS", "file", "and", "return", "the", "array" ]
61cfa3f9715b62193d55fc4f4792d213787b9769
https://github.com/awps/font-awesome-php/blob/61cfa3f9715b62193d55fc4f4792d213787b9769/src/FontAwesomeReader.php#L40-L57
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.hideChars
protected function hideChars($inString, $n1, $n2) { $inStringLength = strlen($inString); if ($inStringLength < ($n1 + $n2)) { return $inString; } $outString = substr($inString, 0, $n1); $outString .= substr("********************", 0, $inStringLength - ($n1 + $n2)); $outString .= substr($inString, - ($n2)); return $outString; }
php
protected function hideChars($inString, $n1, $n2) { $inStringLength = strlen($inString); if ($inStringLength < ($n1 + $n2)) { return $inString; } $outString = substr($inString, 0, $n1); $outString .= substr("********************", 0, $inStringLength - ($n1 + $n2)); $outString .= substr($inString, - ($n2)); return $outString; }
[ "protected", "function", "hideChars", "(", "$", "inString", ",", "$", "n1", ",", "$", "n2", ")", "{", "$", "inStringLength", "=", "strlen", "(", "$", "inString", ")", ";", "if", "(", "$", "inStringLength", "<", "(", "$", "n1", "+", "$", "n2", ")", ...
Hide characters in a string @param String $inString the string to hide @param int $n1 number of characters shown at the begining of the string @param int $n2 number of characters shown at end begining of the string
[ "Hide", "characters", "in", "a", "string" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L818-L828
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.responseToArray
protected function responseToArray($node, $parent = null) { $array = array(); foreach ($node as $k => $v) { if ($this->isChildFromList($k, $parent)) { // current value is a list if ($v instanceof \Countable && count($v) == 1 && $k != '0') { // a list with 1 element. It's returned with a 0-index $array[$k][0] = PaylineSDK::responseToArray($v, $k); } elseif (is_object($v) || is_array($v)) { // a list with more than 1 element $array[$k] = PaylineSDK::responseToArray($v, $k); } else { $array[$k] = $v; } } else { if (is_object($v) || is_array($v)) { $array[$k] = PaylineSDK::responseToArray($v, $k); } else { $array[$k] = $v; } } } return $array; }
php
protected function responseToArray($node, $parent = null) { $array = array(); foreach ($node as $k => $v) { if ($this->isChildFromList($k, $parent)) { // current value is a list if ($v instanceof \Countable && count($v) == 1 && $k != '0') { // a list with 1 element. It's returned with a 0-index $array[$k][0] = PaylineSDK::responseToArray($v, $k); } elseif (is_object($v) || is_array($v)) { // a list with more than 1 element $array[$k] = PaylineSDK::responseToArray($v, $k); } else { $array[$k] = $v; } } else { if (is_object($v) || is_array($v)) { $array[$k] = PaylineSDK::responseToArray($v, $k); } else { $array[$k] = $v; } } } return $array; }
[ "protected", "function", "responseToArray", "(", "$", "node", ",", "$", "parent", "=", "null", ")", "{", "$", "array", "=", "array", "(", ")", ";", "foreach", "(", "$", "node", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "$", "this", "...
make an array from a payline server response object. @param object $node response node from payline web service @param string $parent name of the node's parent @return array representation of the object
[ "make", "an", "array", "from", "a", "payline", "server", "response", "object", "." ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L854-L875
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.addOrderDetail
public function addOrderDetail(array $newOrderDetail) { $orderDetail = new OrderDetail(); if ($newOrderDetail) { foreach ($newOrderDetail as $k => $v) { if (array_key_exists($k, $orderDetail) && (strlen($v))) { $orderDetail->$k = $v; } } } $this->orderDetails[] = new \SoapVar($orderDetail, SOAP_ENC_OBJECT, self::SOAP_ORDERDETAIL, self::PAYLINE_NAMESPACE); }
php
public function addOrderDetail(array $newOrderDetail) { $orderDetail = new OrderDetail(); if ($newOrderDetail) { foreach ($newOrderDetail as $k => $v) { if (array_key_exists($k, $orderDetail) && (strlen($v))) { $orderDetail->$k = $v; } } } $this->orderDetails[] = new \SoapVar($orderDetail, SOAP_ENC_OBJECT, self::SOAP_ORDERDETAIL, self::PAYLINE_NAMESPACE); }
[ "public", "function", "addOrderDetail", "(", "array", "$", "newOrderDetail", ")", "{", "$", "orderDetail", "=", "new", "OrderDetail", "(", ")", ";", "if", "(", "$", "newOrderDetail", ")", "{", "foreach", "(", "$", "newOrderDetail", "as", "$", "k", "=>", ...
Adds details about an order item @param array $newOrderDetail associative array containing details about an order item
[ "Adds", "details", "about", "an", "order", "item" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1353-L1364
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.addPrivateData
public function addPrivateData(array $array) { $private = new PrivateData(); if ($array) { foreach ($array as $k => $v) { if (array_key_exists($k, $private) && (strlen($v))) { $private->$k = $v; } } } $this->privateData[] = new \SoapVar($private, SOAP_ENC_OBJECT, self::SOAP_PRIVATE_DATA, self::PAYLINE_NAMESPACE); }
php
public function addPrivateData(array $array) { $private = new PrivateData(); if ($array) { foreach ($array as $k => $v) { if (array_key_exists($k, $private) && (strlen($v))) { $private->$k = $v; } } } $this->privateData[] = new \SoapVar($private, SOAP_ENC_OBJECT, self::SOAP_PRIVATE_DATA, self::PAYLINE_NAMESPACE); }
[ "public", "function", "addPrivateData", "(", "array", "$", "array", ")", "{", "$", "private", "=", "new", "PrivateData", "(", ")", ";", "if", "(", "$", "array", ")", "{", "foreach", "(", "$", "array", "as", "$", "k", "=>", "$", "v", ")", "{", "if...
Adds a privateData element @param array $array an array containing two indexes : key and value
[ "Adds", "a", "privateData", "element" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1373-L1384
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doAuthorization
public function doAuthorization(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'card' => $this->card($array['card']), 'order' => $this->order($array['order']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'privateDataList' => $this->privateData, 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'bankAccountData' => $this->bankAccountData($array['bankAccountData']), 'subMerchant' => $this->subMerchant($array['subMerchant']), 'asynchronousRetryTimeout' => $array['asynchronousRetryTimeout'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doAuthorization'); }
php
public function doAuthorization(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'card' => $this->card($array['card']), 'order' => $this->order($array['order']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'privateDataList' => $this->privateData, 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'bankAccountData' => $this->bankAccountData($array['bankAccountData']), 'subMerchant' => $this->subMerchant($array['subMerchant']), 'asynchronousRetryTimeout' => $array['asynchronousRetryTimeout'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doAuthorization'); }
[ "public", "function", "doAuthorization", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "["...
calls doAuthorization web service @param array $array associative array containing doAuthorization parameters
[ "calls", "doAuthorization", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1400-L1416
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doCapture
public function doCapture(array $array) { $WSRequest = array( 'transactionID' => $array['transactionID'], 'payment' => $this->payment($array['payment']), 'privateDataList' => $this->privateData, 'sequenceNumber' => $array['sequenceNumber'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doCapture'); }
php
public function doCapture(array $array) { $WSRequest = array( 'transactionID' => $array['transactionID'], 'payment' => $this->payment($array['payment']), 'privateDataList' => $this->privateData, 'sequenceNumber' => $array['sequenceNumber'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doCapture'); }
[ "public", "function", "doCapture", "(", "array", "$", "array", ")", "{", "$", "WSRequest", "=", "array", "(", "'transactionID'", "=>", "$", "array", "[", "'transactionID'", "]", ",", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "["...
calls doCapture web service @param array $array associative array containing doCapture parameters
[ "calls", "doCapture", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1424-L1433
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doReAuthorization
public function doReAuthorization(array $array) { $WSRequest = array( 'transactionID' => $array['transactionID'], 'payment' => $this->payment($array['payment']), 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doReAuthorization'); }
php
public function doReAuthorization(array $array) { $WSRequest = array( 'transactionID' => $array['transactionID'], 'payment' => $this->payment($array['payment']), 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doReAuthorization'); }
[ "public", "function", "doReAuthorization", "(", "array", "$", "array", ")", "{", "$", "WSRequest", "=", "array", "(", "'transactionID'", "=>", "$", "array", "[", "'transactionID'", "]", ",", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array...
calls doReAuthorization web service @param array $array associative array containing doReAuthorization parameters
[ "calls", "doReAuthorization", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1441-L1450
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doDebit
public function doDebit(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'card' => $this->card($array['card']), 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData, 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'authorization' => $this->authorization($array['authorization']), 'subMerchant' => $this->subMerchant($array['subMerchant']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doDebit'); }
php
public function doDebit(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'card' => $this->card($array['card']), 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData, 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'authorization' => $this->authorization($array['authorization']), 'subMerchant' => $this->subMerchant($array['subMerchant']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doDebit'); }
[ "public", "function", "doDebit", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "[", "'pa...
calls doDebit web service @param array $array associative array containing doDebit parameters
[ "calls", "doDebit", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1458-L1472
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doRefund
public function doRefund($array) { $WSRequest = array( 'transactionID' => $array['transactionID'], 'payment' => $this->payment($array['payment']), 'comment' => $array['comment'], 'privateDataList' => $this->privateData, 'details' => $this->orderDetails, 'sequenceNumber' => $array['sequenceNumber'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doRefund'); }
php
public function doRefund($array) { $WSRequest = array( 'transactionID' => $array['transactionID'], 'payment' => $this->payment($array['payment']), 'comment' => $array['comment'], 'privateDataList' => $this->privateData, 'details' => $this->orderDetails, 'sequenceNumber' => $array['sequenceNumber'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doRefund'); }
[ "public", "function", "doRefund", "(", "$", "array", ")", "{", "$", "WSRequest", "=", "array", "(", "'transactionID'", "=>", "$", "array", "[", "'transactionID'", "]", ",", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "[", "'paymen...
calls doRefund web service @param array $array associative array containing doRefund parameters
[ "calls", "doRefund", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1480-L1491
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doCredit
public function doCredit(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'card' => $this->card($array['card']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'privateDataList' => $this->privateData, 'order' => $this->order($array['order']), 'comment' => $array['comment'], 'subMerchant' => $this->subMerchant($array['subMerchant']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doCredit'); }
php
public function doCredit(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'card' => $this->card($array['card']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'privateDataList' => $this->privateData, 'order' => $this->order($array['order']), 'comment' => $array['comment'], 'subMerchant' => $this->subMerchant($array['subMerchant']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doCredit'); }
[ "public", "function", "doCredit", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "[", "'p...
calls doCredit web service @param array $array associative array containing doCredit parameters
[ "calls", "doCredit", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1514-L1527
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.createWallet
public function createWallet(array $array) { $this->formatRequest($array); $WSRequest = array( 'contractNumber' => $array['contractNumber'], 'wallet' => $this->wallet($array['wallet'], $array['address'], $array['card']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'privateDataList' => $this->privateData, 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'contractNumberWalletList' => $array['walletContracts'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'createWallet'); }
php
public function createWallet(array $array) { $this->formatRequest($array); $WSRequest = array( 'contractNumber' => $array['contractNumber'], 'wallet' => $this->wallet($array['wallet'], $array['address'], $array['card']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'privateDataList' => $this->privateData, 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'contractNumberWalletList' => $array['walletContracts'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'createWallet'); }
[ "public", "function", "createWallet", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'contractNumber'", "=>", "$", "array", "[", "'contractNumber'", "]", ",", "...
calls createWallet web service @param array $array associative array containing createWallet parameters
[ "calls", "createWallet", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1535-L1548
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.updateWallet
public function updateWallet(array $array) { $WSRequest = array( 'contractNumber' => $array['contractNumber'], 'cardInd' => $array['cardInd'], 'wallet' => $this->wallet($array['wallet'], $array['address'], $array['card']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'privateDataList' => $this->privateData, 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'contractNumberWalletList' => $array['walletContracts'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'updateWallet'); }
php
public function updateWallet(array $array) { $WSRequest = array( 'contractNumber' => $array['contractNumber'], 'cardInd' => $array['cardInd'], 'wallet' => $this->wallet($array['wallet'], $array['address'], $array['card']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'privateDataList' => $this->privateData, 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'contractNumberWalletList' => $array['walletContracts'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'updateWallet'); }
[ "public", "function", "updateWallet", "(", "array", "$", "array", ")", "{", "$", "WSRequest", "=", "array", "(", "'contractNumber'", "=>", "$", "array", "[", "'contractNumber'", "]", ",", "'cardInd'", "=>", "$", "array", "[", "'cardInd'", "]", ",", "'walle...
calls updateWallet web service @param array $array associative array containing updateWallet parameters
[ "calls", "updateWallet", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1556-L1569
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doImmediateWalletPayment
public function doImmediateWalletPayment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'order' => $this->order($array['order']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'walletId' => $array['walletId'], 'cardInd' => $array['cardInd'], 'cvx' => $array['walletCvx'], 'privateDataList' => $this->privateData, 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'subMerchant' => $this->subMerchant($array['subMerchant']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doImmediateWalletPayment'); }
php
public function doImmediateWalletPayment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'order' => $this->order($array['order']), 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'walletId' => $array['walletId'], 'cardInd' => $array['cardInd'], 'cvx' => $array['walletCvx'], 'privateDataList' => $this->privateData, 'authentication3DSecure' => $this->authentication3DSecure($array['3DSecure']), 'subMerchant' => $this->subMerchant($array['subMerchant']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doImmediateWalletPayment'); }
[ "public", "function", "doImmediateWalletPayment", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "arra...
calls doImmediateWalletPayment web service @param array $array associative array containing doImmediateWalletPayment parameters
[ "calls", "doImmediateWalletPayment", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1641-L1656
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doScheduledWalletPayment
public function doScheduledWalletPayment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'orderRef' => $array['orderRef'], 'orderDate' => $array['orderDate'], 'scheduledDate' => $array['scheduledDate'], 'walletId' => $array['walletId'], 'cardInd' => $array['cardInd'], 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData, 'subMerchant' => $this->subMerchant($array['subMerchant']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doScheduledWalletPayment'); }
php
public function doScheduledWalletPayment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'orderRef' => $array['orderRef'], 'orderDate' => $array['orderDate'], 'scheduledDate' => $array['scheduledDate'], 'walletId' => $array['walletId'], 'cardInd' => $array['cardInd'], 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData, 'subMerchant' => $this->subMerchant($array['subMerchant']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doScheduledWalletPayment'); }
[ "public", "function", "doScheduledWalletPayment", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "arra...
calls doScheduledWalletPayment web service @param array $array associative array containing doScheduledWalletPayment parameters
[ "calls", "doScheduledWalletPayment", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1664-L1679
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doRecurrentWalletPayment
public function doRecurrentWalletPayment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'orderRef' => $array['orderRef'], 'orderDate' => $array['orderDate'], 'scheduledDate' => $array['scheduledDate'], 'walletId' => $array['walletId'], 'cardInd' => $array['cardInd'], 'recurring' => $this->recurring($array['recurring']), 'privateDataList' => $this->privateData, 'order' => $this->order($array['order']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doRecurrentWalletPayment'); }
php
public function doRecurrentWalletPayment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'orderRef' => $array['orderRef'], 'orderDate' => $array['orderDate'], 'scheduledDate' => $array['scheduledDate'], 'walletId' => $array['walletId'], 'cardInd' => $array['cardInd'], 'recurring' => $this->recurring($array['recurring']), 'privateDataList' => $this->privateData, 'order' => $this->order($array['order']) ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doRecurrentWalletPayment'); }
[ "public", "function", "doRecurrentWalletPayment", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "arra...
calls doRecurrentWalletPayment web service @param array $array associative array containing doRecurrentWalletPayment parameters
[ "calls", "doRecurrentWalletPayment", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1687-L1702
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.verifyEnrollment
public function verifyEnrollment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'card' => $this->card($array['card']), 'orderRef' => $array['orderRef'], 'userAgent' => $array['userAgent'], 'mdFieldValue' => $array['mdFieldValue'], 'walletId' => $array['walletId'], 'walletCardInd' => $array['walletCardInd'], 'merchantName' => $array['merchantName'], 'returnURL' => $array['returnURL'] ); if (isset($array['generateVirtualCvx'])) { $WSRequest['generateVirtualCvx'] = $array['generateVirtualCvx']; } return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'verifyEnrollment'); }
php
public function verifyEnrollment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'card' => $this->card($array['card']), 'orderRef' => $array['orderRef'], 'userAgent' => $array['userAgent'], 'mdFieldValue' => $array['mdFieldValue'], 'walletId' => $array['walletId'], 'walletCardInd' => $array['walletCardInd'], 'merchantName' => $array['merchantName'], 'returnURL' => $array['returnURL'] ); if (isset($array['generateVirtualCvx'])) { $WSRequest['generateVirtualCvx'] = $array['generateVirtualCvx']; } return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'verifyEnrollment'); }
[ "public", "function", "verifyEnrollment", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "[...
calls verifyEnrollment web service @param array $array associative array containing verifyEnrollment parameters
[ "calls", "verifyEnrollment", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1740-L1758
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doScoringCheque
public function doScoringCheque(array $array) { $WSRequest = array( 'payment' => $this->payment($array['payment']), 'cheque' => $this->cheque($array['cheque']), 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doScoringCheque'); }
php
public function doScoringCheque(array $array) { $WSRequest = array( 'payment' => $this->payment($array['payment']), 'cheque' => $this->cheque($array['cheque']), 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doScoringCheque'); }
[ "public", "function", "doScoringCheque", "(", "array", "$", "array", ")", "{", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "[", "'payment'", "]", ")", ",", "'cheque'", "=>", "$", "this", "->"...
calls doScoringCheque web service @param array $array associative array containing doScoringCheque parameters
[ "calls", "doScoringCheque", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1783-L1792
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doBankTransfer
public function doBankTransfer(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'creditor' => $this->creditor($array['creditor']), 'comment' => $array['comment'], 'transactionID' => $array['transactionID'], 'orderID' => $array['orderID'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doBankTransfer'); }
php
public function doBankTransfer(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'creditor' => $this->creditor($array['creditor']), 'comment' => $array['comment'], 'transactionID' => $array['transactionID'], 'orderID' => $array['orderID'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doBankTransfer'); }
[ "public", "function", "doBankTransfer", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "[",...
calls doBankTransfer web service @param array $array associative array containing doBankTransfer parameters
[ "calls", "doBankTransfer", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1919-L1930
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.isRegistered
public function isRegistered(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData, 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'miscData' => $array['miscData'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'isRegistered'); }
php
public function isRegistered(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'order' => $this->order($array['order']), 'privateDataList' => $this->privateData, 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'miscData' => $array['miscData'] ); return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'isRegistered'); }
[ "public", "function", "isRegistered", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "[", ...
calls isRegistered web service @param array $array associative array containing isRegistered parameters
[ "calls", "isRegistered", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1938-L1949
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.doWebPayment
public function doWebPayment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'returnURL' => $array['returnURL'], 'cancelURL' => $array['cancelURL'], 'order' => $this->order($array['order']), 'notificationURL' => $array['notificationURL'], 'customPaymentTemplateURL' => $array['customPaymentTemplateURL'], 'selectedContractList' => $array['contracts'], 'secondSelectedContractList' => $array['secondContracts'], 'privateDataList' => $this->privateData, 'languageCode' => $array['languageCode'], 'customPaymentPageCode' => $array['customPaymentPageCode'], 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'securityMode' => $array['securityMode'], 'contractNumberWalletList' => $array['walletContracts'], 'merchantName' => $array['merchantName'], 'subMerchant' => $this->subMerchant($array['subMerchant']), 'miscData' => $array['miscData'], 'asynchronousRetryTimeout' => $array['asynchronousRetryTimeout'] ); if (isset($array['payment']['mode'])) { if (($array['payment']['mode'] == "REC") || ($array['payment']['mode'] == "NX")) { $WSRequest['recurring'] = $this->recurring($array['recurring']); } } return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'doWebPayment'); }
php
public function doWebPayment(array $array) { $this->formatRequest($array); $WSRequest = array( 'payment' => $this->payment($array['payment']), 'returnURL' => $array['returnURL'], 'cancelURL' => $array['cancelURL'], 'order' => $this->order($array['order']), 'notificationURL' => $array['notificationURL'], 'customPaymentTemplateURL' => $array['customPaymentTemplateURL'], 'selectedContractList' => $array['contracts'], 'secondSelectedContractList' => $array['secondContracts'], 'privateDataList' => $this->privateData, 'languageCode' => $array['languageCode'], 'customPaymentPageCode' => $array['customPaymentPageCode'], 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'securityMode' => $array['securityMode'], 'contractNumberWalletList' => $array['walletContracts'], 'merchantName' => $array['merchantName'], 'subMerchant' => $this->subMerchant($array['subMerchant']), 'miscData' => $array['miscData'], 'asynchronousRetryTimeout' => $array['asynchronousRetryTimeout'] ); if (isset($array['payment']['mode'])) { if (($array['payment']['mode'] == "REC") || ($array['payment']['mode'] == "NX")) { $WSRequest['recurring'] = $this->recurring($array['recurring']); } } return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'doWebPayment'); }
[ "public", "function", "doWebPayment", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'payment'", "=>", "$", "this", "->", "payment", "(", "$", "array", "[", ...
calls doWebPayment web service @param array $array associative array containing doWebPayment parameters
[ "calls", "doWebPayment", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L1965-L1996
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.manageWebWallet
public function manageWebWallet(array $array) { $this->formatRequest($array); $WSRequest = array( 'contractNumber' => $array['contractNumber'], 'selectedContractList' => $array['contracts'], 'updatePersonalDetails' => $array['updatePersonalDetails'], 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'languageCode' => $array['languageCode'], 'customPaymentPageCode' => $array['customPaymentPageCode'], 'securityMode' => $array['securityMode'], 'returnURL' => $array['returnURL'], 'cancelURL' => $array['cancelURL'], 'notificationURL' => $array['notificationURL'], 'privateDataList' => $this->privateData, 'customPaymentTemplateURL' => $array['customPaymentTemplateURL'], 'contractNumberWalletList' => $array['walletContracts'], 'merchantName' => $array['merchantName'] ); return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'manageWebWallet'); }
php
public function manageWebWallet(array $array) { $this->formatRequest($array); $WSRequest = array( 'contractNumber' => $array['contractNumber'], 'selectedContractList' => $array['contracts'], 'updatePersonalDetails' => $array['updatePersonalDetails'], 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'owner' => $this->owner($array['owner'], $array['ownerAddress']), 'languageCode' => $array['languageCode'], 'customPaymentPageCode' => $array['customPaymentPageCode'], 'securityMode' => $array['securityMode'], 'returnURL' => $array['returnURL'], 'cancelURL' => $array['cancelURL'], 'notificationURL' => $array['notificationURL'], 'privateDataList' => $this->privateData, 'customPaymentTemplateURL' => $array['customPaymentTemplateURL'], 'contractNumberWalletList' => $array['walletContracts'], 'merchantName' => $array['merchantName'] ); return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'manageWebWallet'); }
[ "public", "function", "manageWebWallet", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'contractNumber'", "=>", "$", "array", "[", "'contractNumber'", "]", ",", ...
calls manageWebWallet web service @param array $array associative array containing manageWebWallet parameters
[ "calls", "manageWebWallet", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L2015-L2036
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.createWebWallet
public function createWebWallet(array $array) { $this->formatRequest($array); $WSRequest = array( 'contractNumber' => $array['contractNumber'], 'selectedContractList' => $array['contracts'], 'updatePersonalDetails' => $array['updatePersonalDetails'], 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'languageCode' => $array['languageCode'], 'customPaymentPageCode' => $array['customPaymentPageCode'], 'securityMode' => $array['securityMode'], 'returnURL' => $array['returnURL'], 'cancelURL' => $array['cancelURL'], 'notificationURL' => $array['notificationURL'], 'privateDataList' => $this->privateData, 'customPaymentTemplateURL' => $array['customPaymentTemplateURL'], 'contractNumberWalletList' => $array['walletContracts'] ); return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'createWebWallet'); }
php
public function createWebWallet(array $array) { $this->formatRequest($array); $WSRequest = array( 'contractNumber' => $array['contractNumber'], 'selectedContractList' => $array['contracts'], 'updatePersonalDetails' => $array['updatePersonalDetails'], 'buyer' => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']), 'languageCode' => $array['languageCode'], 'customPaymentPageCode' => $array['customPaymentPageCode'], 'securityMode' => $array['securityMode'], 'returnURL' => $array['returnURL'], 'cancelURL' => $array['cancelURL'], 'notificationURL' => $array['notificationURL'], 'privateDataList' => $this->privateData, 'customPaymentTemplateURL' => $array['customPaymentTemplateURL'], 'contractNumberWalletList' => $array['walletContracts'] ); return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'createWebWallet'); }
[ "public", "function", "createWebWallet", "(", "array", "$", "array", ")", "{", "$", "this", "->", "formatRequest", "(", "$", "array", ")", ";", "$", "WSRequest", "=", "array", "(", "'contractNumber'", "=>", "$", "array", "[", "'contractNumber'", "]", ",", ...
calls createWebWallet web service @param array $array associative array containing createWebWallet parameters
[ "calls", "createWebWallet", "web", "service" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L2044-L2063
train
PaylineByMonext/payline-php-sdk
src/Payline/PaylineSDK.php
PaylineSDK.getDecrypt
public function getDecrypt($message, $accessKey) { $cipher = "AES-256-ECB"; $opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING; $message = $this->base64_url_decode($message); $decrypted = openssl_decrypt($message, $cipher, $accessKey, $opts); $len = strlen($decrypted); $pad = ord($decrypted[$len - 1]); return substr($decrypted, 0, strlen($decrypted) - $pad); }
php
public function getDecrypt($message, $accessKey) { $cipher = "AES-256-ECB"; $opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING; $message = $this->base64_url_decode($message); $decrypted = openssl_decrypt($message, $cipher, $accessKey, $opts); $len = strlen($decrypted); $pad = ord($decrypted[$len - 1]); return substr($decrypted, 0, strlen($decrypted) - $pad); }
[ "public", "function", "getDecrypt", "(", "$", "message", ",", "$", "accessKey", ")", "{", "$", "cipher", "=", "\"AES-256-ECB\"", ";", "$", "opts", "=", "OPENSSL_RAW_DATA", "|", "OPENSSL_ZERO_PADDING", ";", "$", "message", "=", "$", "this", "->", "base64_url_...
Decrypts message sent by getToken servlet @param string $message message to decrypt @param string $accessKey merchant access key (SHA256 encrypted)
[ "Decrypts", "message", "sent", "by", "getToken", "servlet" ]
19bd51153add5d785c8dabfbf2d44f53cd7f75d8
https://github.com/PaylineByMonext/payline-php-sdk/blob/19bd51153add5d785c8dabfbf2d44f53cd7f75d8/src/Payline/PaylineSDK.php#L2246-L2257
train
kevinkhill/php-duration
src/Duration.php
Duration.toSeconds
public function toSeconds($duration = null, $precision = false) { if (null !== $duration) { $this->parse($duration); } $this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds; return $precision !== false ? round($this->output, $precision) : $this->output; }
php
public function toSeconds($duration = null, $precision = false) { if (null !== $duration) { $this->parse($duration); } $this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds; return $precision !== false ? round($this->output, $precision) : $this->output; }
[ "public", "function", "toSeconds", "(", "$", "duration", "=", "null", ",", "$", "precision", "=", "false", ")", "{", "if", "(", "null", "!==", "$", "duration", ")", "{", "$", "this", "->", "parse", "(", "$", "duration", ")", ";", "}", "$", "this", ...
Returns the duration as an amount of seconds. For example, one hour and 42 minutes would be "6120" @param int|float|string $duration A string or number, representing a duration @param int|bool $precision Number of decimal digits to round to. If set to false, the number is not rounded. @return int|float
[ "Returns", "the", "duration", "as", "an", "amount", "of", "seconds", "." ]
2118a067359ffc96784b02fcd26f312e2bd886db
https://github.com/kevinkhill/php-duration/blob/2118a067359ffc96784b02fcd26f312e2bd886db/src/Duration.php#L139-L147
train
kevinkhill/php-duration
src/Duration.php
Duration.toMinutes
public function toMinutes($duration = null, $precision = false) { if (null !== $duration) { $this->parse($duration); } // backward compatibility, true = round to integer if ($precision === true) { $precision = 0; } $this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds; $result = intval($this->output()) / 60; return $precision !== false ? round($result, $precision) : $result; }
php
public function toMinutes($duration = null, $precision = false) { if (null !== $duration) { $this->parse($duration); } // backward compatibility, true = round to integer if ($precision === true) { $precision = 0; } $this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds; $result = intval($this->output()) / 60; return $precision !== false ? round($result, $precision) : $result; }
[ "public", "function", "toMinutes", "(", "$", "duration", "=", "null", ",", "$", "precision", "=", "false", ")", "{", "if", "(", "null", "!==", "$", "duration", ")", "{", "$", "this", "->", "parse", "(", "$", "duration", ")", ";", "}", "// backward co...
Returns the duration as an amount of minutes. For example, one hour and 42 minutes would be "102" minutes @param int|float|string $duration A string or number, representing a duration @param int|bool $precision Number of decimal digits to round to. If set to false, the number is not rounded. @return int|float
[ "Returns", "the", "duration", "as", "an", "amount", "of", "minutes", "." ]
2118a067359ffc96784b02fcd26f312e2bd886db
https://github.com/kevinkhill/php-duration/blob/2118a067359ffc96784b02fcd26f312e2bd886db/src/Duration.php#L158-L173
train
kevinkhill/php-duration
src/Duration.php
Duration.formatted
public function formatted($duration = null, $zeroFill = false) { if (null !== $duration) { $this->parse($duration); } $hours = $this->hours + ($this->days * $this->hoursPerDay); if ($this->seconds > 0) { if ($this->seconds < 10 && ($this->minutes > 0 || $hours > 0 || $zeroFill)) { $this->output .= '0' . $this->seconds; } else { $this->output .= $this->seconds; } } else { if ($this->minutes > 0 || $hours > 0 || $zeroFill) { $this->output = '00'; } else { $this->output = '0'; } } if ($this->minutes > 0) { if ($this->minutes <= 9 && ($hours > 0 || $zeroFill)) { $this->output = '0' . $this->minutes . ':' . $this->output; } else { $this->output = $this->minutes . ':' . $this->output; } } else { if ($hours > 0 || $zeroFill) { $this->output = '00' . ':' . $this->output; } } if ($hours > 0) { $this->output = $hours . ':' . $this->output; } else { if ($zeroFill) { $this->output = '0' . ':' . $this->output; } } return $this->output(); }
php
public function formatted($duration = null, $zeroFill = false) { if (null !== $duration) { $this->parse($duration); } $hours = $this->hours + ($this->days * $this->hoursPerDay); if ($this->seconds > 0) { if ($this->seconds < 10 && ($this->minutes > 0 || $hours > 0 || $zeroFill)) { $this->output .= '0' . $this->seconds; } else { $this->output .= $this->seconds; } } else { if ($this->minutes > 0 || $hours > 0 || $zeroFill) { $this->output = '00'; } else { $this->output = '0'; } } if ($this->minutes > 0) { if ($this->minutes <= 9 && ($hours > 0 || $zeroFill)) { $this->output = '0' . $this->minutes . ':' . $this->output; } else { $this->output = $this->minutes . ':' . $this->output; } } else { if ($hours > 0 || $zeroFill) { $this->output = '00' . ':' . $this->output; } } if ($hours > 0) { $this->output = $hours . ':' . $this->output; } else { if ($zeroFill) { $this->output = '0' . ':' . $this->output; } } return $this->output(); }
[ "public", "function", "formatted", "(", "$", "duration", "=", "null", ",", "$", "zeroFill", "=", "false", ")", "{", "if", "(", "null", "!==", "$", "duration", ")", "{", "$", "this", "->", "parse", "(", "$", "duration", ")", ";", "}", "$", "hours", ...
Returns the duration as a colon formatted string For example, one hour and 42 minutes would be "1:43" With $zeroFill to true : - 42 minutes would be "0:42:00" - 28 seconds would be "0:00:28" @param int|float|string|null $duration A string or number, representing a duration @param bool $zeroFill A boolean, to force zero-fill result or not (see example) @return string
[ "Returns", "the", "duration", "as", "a", "colon", "formatted", "string" ]
2118a067359ffc96784b02fcd26f312e2bd886db
https://github.com/kevinkhill/php-duration/blob/2118a067359ffc96784b02fcd26f312e2bd886db/src/Duration.php#L187-L230
train
kevinkhill/php-duration
src/Duration.php
Duration.humanize
public function humanize($duration = null) { if (null !== $duration) { $this->parse($duration); } if ($this->seconds > 0 || ($this->seconds === 0.0 && $this->minutes === 0 && $this->hours === 0 && $this->days === 0)) { $this->output .= $this->seconds . 's'; } if ($this->minutes > 0) { $this->output = $this->minutes . 'm ' . $this->output; } if ($this->hours > 0) { $this->output = $this->hours . 'h ' . $this->output; } if ($this->days > 0) { $this->output = $this->days . 'd ' . $this->output; } return trim($this->output()); }
php
public function humanize($duration = null) { if (null !== $duration) { $this->parse($duration); } if ($this->seconds > 0 || ($this->seconds === 0.0 && $this->minutes === 0 && $this->hours === 0 && $this->days === 0)) { $this->output .= $this->seconds . 's'; } if ($this->minutes > 0) { $this->output = $this->minutes . 'm ' . $this->output; } if ($this->hours > 0) { $this->output = $this->hours . 'h ' . $this->output; } if ($this->days > 0) { $this->output = $this->days . 'd ' . $this->output; } return trim($this->output()); }
[ "public", "function", "humanize", "(", "$", "duration", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "duration", ")", "{", "$", "this", "->", "parse", "(", "$", "duration", ")", ";", "}", "if", "(", "$", "this", "->", "seconds", ">", "0"...
Returns the duration as a human-readable string. For example, one hour and 42 minutes would be "1h 42m" @param int|float|string $duration A string or number, representing a duration @return string
[ "Returns", "the", "duration", "as", "a", "human", "-", "readable", "string", "." ]
2118a067359ffc96784b02fcd26f312e2bd886db
https://github.com/kevinkhill/php-duration/blob/2118a067359ffc96784b02fcd26f312e2bd886db/src/Duration.php#L240-L263
train
kevinkhill/php-duration
src/Duration.php
Duration.reset
private function reset() { $this->output = ''; $this->seconds = 0.0; $this->minutes = 0; $this->hours = 0; $this->days = 0; }
php
private function reset() { $this->output = ''; $this->seconds = 0.0; $this->minutes = 0; $this->hours = 0; $this->days = 0; }
[ "private", "function", "reset", "(", ")", "{", "$", "this", "->", "output", "=", "''", ";", "$", "this", "->", "seconds", "=", "0.0", ";", "$", "this", "->", "minutes", "=", "0", ";", "$", "this", "->", "hours", "=", "0", ";", "$", "this", "->"...
Resets the Duration object by clearing the output and values. @access private @return void
[ "Resets", "the", "Duration", "object", "by", "clearing", "the", "output", "and", "values", "." ]
2118a067359ffc96784b02fcd26f312e2bd886db
https://github.com/kevinkhill/php-duration/blob/2118a067359ffc96784b02fcd26f312e2bd886db/src/Duration.php#L295-L302
train
j0k3r/php-imgur-api-client
lib/Imgur/HttpClient/HttpClient.php
HttpClient.addAuthMiddleware
public function addAuthMiddleware($token, $clientId) { $this->stack->push(Middleware::mapRequest(function (RequestInterface $request) use ($token, $clientId) { return (new AuthMiddleware($token, $clientId))->addAuthHeader($request); })); }
php
public function addAuthMiddleware($token, $clientId) { $this->stack->push(Middleware::mapRequest(function (RequestInterface $request) use ($token, $clientId) { return (new AuthMiddleware($token, $clientId))->addAuthHeader($request); })); }
[ "public", "function", "addAuthMiddleware", "(", "$", "token", ",", "$", "clientId", ")", "{", "$", "this", "->", "stack", "->", "push", "(", "Middleware", "::", "mapRequest", "(", "function", "(", "RequestInterface", "$", "request", ")", "use", "(", "$", ...
Push authorization middleware. @param array $token @param string $clientId
[ "Push", "authorization", "middleware", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/HttpClient/HttpClient.php#L138-L143
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/AlbumOrImage.php
AlbumOrImage.find
public function find($imageIdOrAlbumId) { try { return $this->get('image/' . $imageIdOrAlbumId); } catch (ExceptionInterface $e) { if (404 !== $e->getCode()) { throw $e; } } try { return $this->get('album/' . $imageIdOrAlbumId); } catch (ExceptionInterface $e) { if (404 !== $e->getCode()) { throw $e; } } throw new ErrorException('Unable to find an album OR an image with the id, ' . $imageIdOrAlbumId); }
php
public function find($imageIdOrAlbumId) { try { return $this->get('image/' . $imageIdOrAlbumId); } catch (ExceptionInterface $e) { if (404 !== $e->getCode()) { throw $e; } } try { return $this->get('album/' . $imageIdOrAlbumId); } catch (ExceptionInterface $e) { if (404 !== $e->getCode()) { throw $e; } } throw new ErrorException('Unable to find an album OR an image with the id, ' . $imageIdOrAlbumId); }
[ "public", "function", "find", "(", "$", "imageIdOrAlbumId", ")", "{", "try", "{", "return", "$", "this", "->", "get", "(", "'image/'", ".", "$", "imageIdOrAlbumId", ")", ";", "}", "catch", "(", "ExceptionInterface", "$", "e", ")", "{", "if", "(", "404"...
Try to find an image or an album using the given parameter. @param string $imageIdOrAlbumId @return array Album (@see https://api.imgur.com/models/album) OR Image (@see https://api.imgur.com/models/image)
[ "Try", "to", "find", "an", "image", "or", "an", "album", "using", "the", "given", "parameter", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/AlbumOrImage.php#L22-L41
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Comment.php
Comment.createReply
public function createReply($commentId, $data) { if (!isset($data['image_id'], $data['comment'])) { throw new MissingArgumentException(['image_id', 'comment']); } return $this->post('comment/' . $commentId, $data); }
php
public function createReply($commentId, $data) { if (!isset($data['image_id'], $data['comment'])) { throw new MissingArgumentException(['image_id', 'comment']); } return $this->post('comment/' . $commentId, $data); }
[ "public", "function", "createReply", "(", "$", "commentId", ",", "$", "data", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "'image_id'", "]", ",", "$", "data", "[", "'comment'", "]", ")", ")", "{", "throw", "new", "MissingArgumentException...
Create a reply for the given comment. @param string $commentId @param array $data @see https://api.imgur.com/endpoints/comment#comment-reply-create @return bool
[ "Create", "a", "reply", "for", "the", "given", "comment", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Comment.php#L86-L93
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Topic.php
Topic.galleryTopic
public function galleryTopic($topicId, $sort = 'viral', $page = 0, $window = 'week') { $this->validateSortArgument($sort, ['viral', 'top', 'time', 'rising']); $this->validateWindowArgument($window, ['day', 'week', 'month', 'year', 'all']); return $this->get('topics/' . $topicId . '/' . $sort . '/' . $window . '/' . $page); }
php
public function galleryTopic($topicId, $sort = 'viral', $page = 0, $window = 'week') { $this->validateSortArgument($sort, ['viral', 'top', 'time', 'rising']); $this->validateWindowArgument($window, ['day', 'week', 'month', 'year', 'all']); return $this->get('topics/' . $topicId . '/' . $sort . '/' . $window . '/' . $page); }
[ "public", "function", "galleryTopic", "(", "$", "topicId", ",", "$", "sort", "=", "'viral'", ",", "$", "page", "=", "0", ",", "$", "window", "=", "'week'", ")", "{", "$", "this", "->", "validateSortArgument", "(", "$", "sort", ",", "[", "'viral'", ",...
View gallery items for a topic. @param string $topicId The ID or URL-formatted name of the topic. If using a topic's name, replace its spaces with underscores (Mother's_Day) @param string $sort (viral | top | time) @param int $page @param string $window (day | week | month | year | all) @see https://api.imgur.com/endpoints/topic#gallery-topic @return array Gallery Image (@see https://api.imgur.com/models/gallery_image) OR Gallery Album (@see https://api.imgur.com/models/gallery_album)
[ "View", "gallery", "items", "for", "a", "topic", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Topic.php#L36-L42
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/CustomGallery.php
CustomGallery.filtered
public function filtered($sort = 'viral', $page = 0, $window = 'week') { $this->validateSortArgument($sort, ['viral', 'top', 'time']); $this->validateWindowArgument($window, ['day', 'week', 'month', 'year', 'all']); return $this->get('g/filtered/' . $sort . '/' . $window . '/' . (int) $page); }
php
public function filtered($sort = 'viral', $page = 0, $window = 'week') { $this->validateSortArgument($sort, ['viral', 'top', 'time']); $this->validateWindowArgument($window, ['day', 'week', 'month', 'year', 'all']); return $this->get('g/filtered/' . $sort . '/' . $window . '/' . (int) $page); }
[ "public", "function", "filtered", "(", "$", "sort", "=", "'viral'", ",", "$", "page", "=", "0", ",", "$", "window", "=", "'week'", ")", "{", "$", "this", "->", "validateSortArgument", "(", "$", "sort", ",", "[", "'viral'", ",", "'top'", ",", "'time'"...
Retrieve user's filtered out gallery. @param string $sort (viral | top | time) @param int $page @param string $window (day | week | month | year | all) @see https://api.imgur.com/endpoints/custom_gallery#filtered-out-gallery @return array Custom Gallery (@see https://api.imgur.com/models/custom_gallery)
[ "Retrieve", "user", "s", "filtered", "out", "gallery", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/CustomGallery.php#L42-L48
train
j0k3r/php-imgur-api-client
lib/Imgur/Middleware/ErrorMiddleware.php
ErrorMiddleware.checkUserRateLimit
private function checkUserRateLimit(ResponseInterface $response) { $userRemaining = $response->getHeaderLine('X-RateLimit-UserRemaining'); $userLimit = $response->getHeaderLine('X-RateLimit-UserLimit'); if ('' !== $userRemaining && $userRemaining < 1) { throw new RateLimitException('No user credits available. The limit is ' . $userLimit); } }
php
private function checkUserRateLimit(ResponseInterface $response) { $userRemaining = $response->getHeaderLine('X-RateLimit-UserRemaining'); $userLimit = $response->getHeaderLine('X-RateLimit-UserLimit'); if ('' !== $userRemaining && $userRemaining < 1) { throw new RateLimitException('No user credits available. The limit is ' . $userLimit); } }
[ "private", "function", "checkUserRateLimit", "(", "ResponseInterface", "$", "response", ")", "{", "$", "userRemaining", "=", "$", "response", "->", "getHeaderLine", "(", "'X-RateLimit-UserRemaining'", ")", ";", "$", "userLimit", "=", "$", "response", "->", "getHea...
Check if user hit limit. @param ResponseInterface $response
[ "Check", "if", "user", "hit", "limit", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Middleware/ErrorMiddleware.php#L102-L110
train
j0k3r/php-imgur-api-client
lib/Imgur/Middleware/ErrorMiddleware.php
ErrorMiddleware.checkClientRateLimit
private function checkClientRateLimit(ResponseInterface $response) { $clientRemaining = $response->getHeaderLine('X-RateLimit-ClientRemaining'); $clientLimit = $response->getHeaderLine('X-RateLimit-ClientLimit'); if ('' !== $clientRemaining && $clientRemaining < 1) { // X-RateLimit-UserReset: Timestamp (unix epoch) for when the credits will be reset. $resetTime = date('Y-m-d H:i:s', $response->getHeaderLine('X-RateLimit-UserReset')); throw new RateLimitException('No application credits available. The limit is ' . $clientLimit . ' and will be reset at ' . $resetTime); } }
php
private function checkClientRateLimit(ResponseInterface $response) { $clientRemaining = $response->getHeaderLine('X-RateLimit-ClientRemaining'); $clientLimit = $response->getHeaderLine('X-RateLimit-ClientLimit'); if ('' !== $clientRemaining && $clientRemaining < 1) { // X-RateLimit-UserReset: Timestamp (unix epoch) for when the credits will be reset. $resetTime = date('Y-m-d H:i:s', $response->getHeaderLine('X-RateLimit-UserReset')); throw new RateLimitException('No application credits available. The limit is ' . $clientLimit . ' and will be reset at ' . $resetTime); } }
[ "private", "function", "checkClientRateLimit", "(", "ResponseInterface", "$", "response", ")", "{", "$", "clientRemaining", "=", "$", "response", "->", "getHeaderLine", "(", "'X-RateLimit-ClientRemaining'", ")", ";", "$", "clientLimit", "=", "$", "response", "->", ...
Check if client hit limit. @param ResponseInterface $response
[ "Check", "if", "client", "hit", "limit", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Middleware/ErrorMiddleware.php#L117-L128
train
j0k3r/php-imgur-api-client
lib/Imgur/Middleware/ErrorMiddleware.php
ErrorMiddleware.checkPostRateLimit
private function checkPostRateLimit(ResponseInterface $response) { $postRemaining = $response->getHeaderLine('X-Post-Rate-Limit-Remaining'); $postLimit = $response->getHeaderLine('X-Post-Rate-Limit-Limit'); if ('' !== $postRemaining && $postRemaining < 1) { // X-Post-Rate-Limit-Reset: Time in seconds until your POST ratelimit is reset $resetTime = date('Y-m-d H:i:s', $response->getHeaderLine('X-Post-Rate-Limit-Reset')); throw new RateLimitException('No post credits available. The limit is ' . $postLimit . ' and will be reset at ' . $resetTime); } }
php
private function checkPostRateLimit(ResponseInterface $response) { $postRemaining = $response->getHeaderLine('X-Post-Rate-Limit-Remaining'); $postLimit = $response->getHeaderLine('X-Post-Rate-Limit-Limit'); if ('' !== $postRemaining && $postRemaining < 1) { // X-Post-Rate-Limit-Reset: Time in seconds until your POST ratelimit is reset $resetTime = date('Y-m-d H:i:s', $response->getHeaderLine('X-Post-Rate-Limit-Reset')); throw new RateLimitException('No post credits available. The limit is ' . $postLimit . ' and will be reset at ' . $resetTime); } }
[ "private", "function", "checkPostRateLimit", "(", "ResponseInterface", "$", "response", ")", "{", "$", "postRemaining", "=", "$", "response", "->", "getHeaderLine", "(", "'X-Post-Rate-Limit-Remaining'", ")", ";", "$", "postLimit", "=", "$", "response", "->", "getH...
Check if client hit post limit. @param ResponseInterface $response
[ "Check", "if", "client", "hit", "post", "limit", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Middleware/ErrorMiddleware.php#L135-L146
train
j0k3r/php-imgur-api-client
lib/Imgur/Client.php
Client.getAuthenticationClient
public function getAuthenticationClient() { if (null === $this->authenticationClient) { $this->authenticationClient = new Auth\OAuth2( $this->getHttpClient(), $this->getOption('client_id'), $this->getOption('client_secret') ); } return $this->authenticationClient; }
php
public function getAuthenticationClient() { if (null === $this->authenticationClient) { $this->authenticationClient = new Auth\OAuth2( $this->getHttpClient(), $this->getOption('client_id'), $this->getOption('client_secret') ); } return $this->authenticationClient; }
[ "public", "function", "getAuthenticationClient", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "authenticationClient", ")", "{", "$", "this", "->", "authenticationClient", "=", "new", "Auth", "\\", "OAuth2", "(", "$", "this", "->", "getHttpClie...
Retrieves the Auth object and also instantiates it if not already present. @return Auth\AuthInterface
[ "Retrieves", "the", "Auth", "object", "and", "also", "instantiates", "it", "if", "not", "already", "present", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Client.php#L128-L139
train
j0k3r/php-imgur-api-client
lib/Imgur/Auth/OAuth2.php
OAuth2.getAuthenticationURL
public function getAuthenticationURL($responseType = 'code', $state = null) { $httpQueryParameters = [ 'client_id' => $this->clientId, 'response_type' => $responseType, 'state' => $state, ]; $httpQueryParameters = http_build_query($httpQueryParameters); return self::AUTHORIZATION_ENDPOINT . '?' . $httpQueryParameters; }
php
public function getAuthenticationURL($responseType = 'code', $state = null) { $httpQueryParameters = [ 'client_id' => $this->clientId, 'response_type' => $responseType, 'state' => $state, ]; $httpQueryParameters = http_build_query($httpQueryParameters); return self::AUTHORIZATION_ENDPOINT . '?' . $httpQueryParameters; }
[ "public", "function", "getAuthenticationURL", "(", "$", "responseType", "=", "'code'", ",", "$", "state", "=", "null", ")", "{", "$", "httpQueryParameters", "=", "[", "'client_id'", "=>", "$", "this", "->", "clientId", ",", "'response_type'", "=>", "$", "res...
Generates the authentication URL to which a user should be pointed at in order to start the OAuth2 process. @param string $responseType @param string|null $state @return string
[ "Generates", "the", "authentication", "URL", "to", "which", "a", "user", "should", "be", "pointed", "at", "in", "order", "to", "start", "the", "OAuth2", "process", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Auth/OAuth2.php#L84-L95
train
j0k3r/php-imgur-api-client
lib/Imgur/Auth/OAuth2.php
OAuth2.refreshToken
public function refreshToken() { $token = $this->getAccessToken(); try { $response = $this->httpClient->post( self::ACCESS_TOKEN_ENDPOINT, [ 'refresh_token' => $token['refresh_token'], 'client_id' => $this->clientId, 'client_secret' => $this->clientSecret, 'grant_type' => 'refresh_token', ] ); $responseBody = json_decode($response->getBody(), true); } catch (\Exception $e) { throw new AuthException('Request for refresh access token failed: ' . $e->getMessage(), $e->getCode()); } $this->setAccessToken($responseBody); $this->sign(); return $responseBody; }
php
public function refreshToken() { $token = $this->getAccessToken(); try { $response = $this->httpClient->post( self::ACCESS_TOKEN_ENDPOINT, [ 'refresh_token' => $token['refresh_token'], 'client_id' => $this->clientId, 'client_secret' => $this->clientSecret, 'grant_type' => 'refresh_token', ] ); $responseBody = json_decode($response->getBody(), true); } catch (\Exception $e) { throw new AuthException('Request for refresh access token failed: ' . $e->getMessage(), $e->getCode()); } $this->setAccessToken($responseBody); $this->sign(); return $responseBody; }
[ "public", "function", "refreshToken", "(", ")", "{", "$", "token", "=", "$", "this", "->", "getAccessToken", "(", ")", ";", "try", "{", "$", "response", "=", "$", "this", "->", "httpClient", "->", "post", "(", "self", "::", "ACCESS_TOKEN_ENDPOINT", ",", ...
If a user has authorized their account but you no longer have a valid access_token for them, then a new one can be generated by using the refresh_token. When your application receives a refresh token, it is important to store that refresh token for future use. If your application loses the refresh token, you will have to prompt the user for their login information again. @throws AuthException @return array
[ "If", "a", "user", "has", "authorized", "their", "account", "but", "you", "no", "longer", "have", "a", "valid", "access_token", "for", "them", "then", "a", "new", "one", "can", "be", "generated", "by", "using", "the", "refresh_token", ".", "When", "your", ...
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Auth/OAuth2.php#L153-L178
train
j0k3r/php-imgur-api-client
lib/Imgur/Auth/OAuth2.php
OAuth2.setAccessToken
public function setAccessToken($token) { if (!\is_array($token)) { throw new AuthException('Token is not a valid json string.'); } if (isset($token['data']['access_token'])) { $token = $token['data']; } if (!isset($token['access_token'])) { throw new AuthException('Access token could not be retrieved from the decoded json response.'); } $this->token = $token; $this->sign(); }
php
public function setAccessToken($token) { if (!\is_array($token)) { throw new AuthException('Token is not a valid json string.'); } if (isset($token['data']['access_token'])) { $token = $token['data']; } if (!isset($token['access_token'])) { throw new AuthException('Access token could not be retrieved from the decoded json response.'); } $this->token = $token; $this->sign(); }
[ "public", "function", "setAccessToken", "(", "$", "token", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "token", ")", ")", "{", "throw", "new", "AuthException", "(", "'Token is not a valid json string.'", ")", ";", "}", "if", "(", "isset", "(", ...
Stores the access token, refresh token and expiration date. @param array $token @throws AuthException @return array
[ "Stores", "the", "access", "token", "refresh", "token", "and", "expiration", "date", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Auth/OAuth2.php#L189-L206
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Account.php
Account.galleryFavorites
public function galleryFavorites($username = 'me', $page = 0, $sort = 'newest') { $this->validateSortArgument($sort, ['oldest', 'newest']); return $this->get('account/' . $username . '/gallery_favorites/' . (int) $page . '/' . $sort); }
php
public function galleryFavorites($username = 'me', $page = 0, $sort = 'newest') { $this->validateSortArgument($sort, ['oldest', 'newest']); return $this->get('account/' . $username . '/gallery_favorites/' . (int) $page . '/' . $sort); }
[ "public", "function", "galleryFavorites", "(", "$", "username", "=", "'me'", ",", "$", "page", "=", "0", ",", "$", "sort", "=", "'newest'", ")", "{", "$", "this", "->", "validateSortArgument", "(", "$", "sort", ",", "[", "'oldest'", ",", "'newest'", "]...
Return the images the user has favorited in the gallery. @param string $username @param int $page @param string $sort 'oldest', or 'newest'. Defaults to 'newest' @see https://api.imgur.com/endpoints/account#account-gallery-favorites @return array Gallery Image (@see https://api.imgur.com/models/gallery_image) OR Gallery Album (@see https://api.imgur.com/models/gallery_album)
[ "Return", "the", "images", "the", "user", "has", "favorited", "in", "the", "gallery", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Account.php#L52-L57
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Account.php
Account.comments
public function comments($username = 'me', $page = 0, $sort = 'newest') { $this->validateSortArgument($sort, ['best', 'worst', 'oldest', 'newest']); return $this->get('account/' . $username . '/comments/' . $sort . '/' . (int) $page); }
php
public function comments($username = 'me', $page = 0, $sort = 'newest') { $this->validateSortArgument($sort, ['best', 'worst', 'oldest', 'newest']); return $this->get('account/' . $username . '/comments/' . $sort . '/' . (int) $page); }
[ "public", "function", "comments", "(", "$", "username", "=", "'me'", ",", "$", "page", "=", "0", ",", "$", "sort", "=", "'newest'", ")", "{", "$", "this", "->", "validateSortArgument", "(", "$", "sort", ",", "[", "'best'", ",", "'worst'", ",", "'olde...
Return the comments the user has created. @param string $username @param int $page @param string $sort 'best', 'worst', 'oldest', or 'newest'. Defaults to 'newest' @see https://api.imgur.com/endpoints/account#comments @return array Array of Comment (@see https://api.imgur.com/models/comment)
[ "Return", "the", "comments", "the", "user", "has", "created", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Account.php#L257-L262
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Account.php
Account.commentIds
public function commentIds($username = 'me', $page = 0, $sort = 'newest') { $this->validateSortArgument($sort, ['best', 'worst', 'oldest', 'newest']); return $this->get('account/' . $username . '/comments/ids/' . $sort . '/' . (int) $page); }
php
public function commentIds($username = 'me', $page = 0, $sort = 'newest') { $this->validateSortArgument($sort, ['best', 'worst', 'oldest', 'newest']); return $this->get('account/' . $username . '/comments/ids/' . $sort . '/' . (int) $page); }
[ "public", "function", "commentIds", "(", "$", "username", "=", "'me'", ",", "$", "page", "=", "0", ",", "$", "sort", "=", "'newest'", ")", "{", "$", "this", "->", "validateSortArgument", "(", "$", "sort", ",", "[", "'best'", ",", "'worst'", ",", "'ol...
Return an array of all of the comment IDs. @param string $username @param int $page @param string $sort 'best', 'worst', 'oldest', or 'newest'. Defaults to 'newest' @see https://api.imgur.com/endpoints/account#comment-ids @return array<int>
[ "Return", "an", "array", "of", "all", "of", "the", "comment", "IDs", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Account.php#L291-L296
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Account.php
Account.replies
public function replies($username = 'me', $onlyNew = false) { $onlyNew = $onlyNew ? 'true' : 'false'; return $this->get('account/' . $username . '/notifications/replies', ['new' => $onlyNew]); }
php
public function replies($username = 'me', $onlyNew = false) { $onlyNew = $onlyNew ? 'true' : 'false'; return $this->get('account/' . $username . '/notifications/replies', ['new' => $onlyNew]); }
[ "public", "function", "replies", "(", "$", "username", "=", "'me'", ",", "$", "onlyNew", "=", "false", ")", "{", "$", "onlyNew", "=", "$", "onlyNew", "?", "'true'", ":", "'false'", ";", "return", "$", "this", "->", "get", "(", "'account/'", ".", "$",...
Returns all of the reply notifications for the user. Required to be logged in as that user. @param string $username @param bool $onlyNew @see https://api.imgur.com/endpoints/account#replies @return array Array of Notification (@see https://api.imgur.com/models/notification)
[ "Returns", "all", "of", "the", "reply", "notifications", "for", "the", "user", ".", "Required", "to", "be", "logged", "in", "as", "that", "user", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Account.php#L413-L418
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Gallery.php
Gallery.subredditGalleries
public function subredditGalleries($subreddit, $sort = 'time', $page = 0, $window = 'day') { $this->validateSortArgument($sort, ['top', 'time']); $this->validateWindowArgument($window, ['day', 'week', 'month', 'year', 'all']); return $this->get('gallery/r/' . $subreddit . '/' . $sort . '/' . $window . '/' . (int) $page); }
php
public function subredditGalleries($subreddit, $sort = 'time', $page = 0, $window = 'day') { $this->validateSortArgument($sort, ['top', 'time']); $this->validateWindowArgument($window, ['day', 'week', 'month', 'year', 'all']); return $this->get('gallery/r/' . $subreddit . '/' . $sort . '/' . $window . '/' . (int) $page); }
[ "public", "function", "subredditGalleries", "(", "$", "subreddit", ",", "$", "sort", "=", "'time'", ",", "$", "page", "=", "0", ",", "$", "window", "=", "'day'", ")", "{", "$", "this", "->", "validateSortArgument", "(", "$", "sort", ",", "[", "'top'", ...
View gallery images for a sub-reddit. @param string $subreddit (e.g pics - A valid sub-reddit name) @param string $sort (top | time) @param int $page @param string $window (day | week | month | year | all) @see https://api.imgur.com/endpoints/gallery#subreddit @return array Gallery Image (@see https://api.imgur.com/models/gallery_image)
[ "View", "gallery", "images", "for", "a", "sub", "-", "reddit", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Gallery.php#L91-L97
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Gallery.php
Gallery.galleryTag
public function galleryTag($name, $sort = 'viral', $page = 0, $window = 'week') { $this->validateSortArgument($sort, ['top', 'time', 'viral']); $this->validateWindowArgument($window, ['day', 'week', 'month', 'year', 'all']); return $this->get('gallery/t/' . $name . '/' . $sort . '/' . $window . '/' . (int) $page); }
php
public function galleryTag($name, $sort = 'viral', $page = 0, $window = 'week') { $this->validateSortArgument($sort, ['top', 'time', 'viral']); $this->validateWindowArgument($window, ['day', 'week', 'month', 'year', 'all']); return $this->get('gallery/t/' . $name . '/' . $sort . '/' . $window . '/' . (int) $page); }
[ "public", "function", "galleryTag", "(", "$", "name", ",", "$", "sort", "=", "'viral'", ",", "$", "page", "=", "0", ",", "$", "window", "=", "'week'", ")", "{", "$", "this", "->", "validateSortArgument", "(", "$", "sort", ",", "[", "'top'", ",", "'...
View images for a gallery tag. @param string $name The name of the tag @param string $sort (top | time | viral) @param int $page @param string $window (day | week | month | year | all) @see https://api.imgur.com/endpoints/gallery#gallery-tag @return array Tag (@see https://api.imgur.com/models/tag)
[ "View", "images", "for", "a", "gallery", "tag", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Gallery.php#L126-L132
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Gallery.php
Gallery.galleryVoteTag
public function galleryVoteTag($id, $name, $vote) { $this->validateVoteArgument($vote, ['up', 'down']); return $this->post('gallery/' . $id . '/vote/tag/' . $name . '/' . $vote); }
php
public function galleryVoteTag($id, $name, $vote) { $this->validateVoteArgument($vote, ['up', 'down']); return $this->post('gallery/' . $id . '/vote/tag/' . $name . '/' . $vote); }
[ "public", "function", "galleryVoteTag", "(", "$", "id", ",", "$", "name", ",", "$", "vote", ")", "{", "$", "this", "->", "validateVoteArgument", "(", "$", "vote", ",", "[", "'up'", ",", "'down'", "]", ")", ";", "return", "$", "this", "->", "post", ...
Vote for a tag, 'up' or 'down' vote. Send the same value again to undo a vote. @param string $id ID of the gallery item @param string $name Name of the tag (implicitly created, if doesn't exist) @param string $vote 'up' or 'down' @see https://api.imgur.com/endpoints/gallery#gallery-tag-vote @return bool
[ "Vote", "for", "a", "tag", "up", "or", "down", "vote", ".", "Send", "the", "same", "value", "again", "to", "undo", "a", "vote", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Gallery.php#L174-L179
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Gallery.php
Gallery.search
public function search($query, $sort = 'time', $page = 0) { $this->validateSortArgument($sort, ['viral', 'top', 'time']); return $this->get('gallery/search/' . $sort . '/' . (int) $page, ['q' => $query]); }
php
public function search($query, $sort = 'time', $page = 0) { $this->validateSortArgument($sort, ['viral', 'top', 'time']); return $this->get('gallery/search/' . $sort . '/' . (int) $page, ['q' => $query]); }
[ "public", "function", "search", "(", "$", "query", ",", "$", "sort", "=", "'time'", ",", "$", "page", "=", "0", ")", "{", "$", "this", "->", "validateSortArgument", "(", "$", "sort", ",", "[", "'viral'", ",", "'top'", ",", "'time'", "]", ")", ";", ...
Search the gallery with a given query string. @param string $query Query string (note: if advanced search parameters are set, this query string is ignored). This parameter also supports boolean operators (AND, OR, NOT) and indices (tag: user: title: ext: subreddit: album: meme:). An example compound query would be 'title: cats AND dogs ext: gif' @param string $sort (time | viral | top) @param int $page @see https://api.imgur.com/endpoints/gallery#gallery-search @return array Gallery Image (@see https://api.imgur.com/models/gallery_image) OR Gallery Album (@see https://api.imgur.com/models/gallery_album)
[ "Search", "the", "gallery", "with", "a", "given", "query", "string", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Gallery.php#L194-L199
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Gallery.php
Gallery.submitToGallery
public function submitToGallery($imageOrAlbumId, $data) { if (!isset($data['title'])) { throw new MissingArgumentException('title'); } return $this->post('gallery/' . $imageOrAlbumId, $data); }
php
public function submitToGallery($imageOrAlbumId, $data) { if (!isset($data['title'])) { throw new MissingArgumentException('title'); } return $this->post('gallery/' . $imageOrAlbumId, $data); }
[ "public", "function", "submitToGallery", "(", "$", "imageOrAlbumId", ",", "$", "data", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "'title'", "]", ")", ")", "{", "throw", "new", "MissingArgumentException", "(", "'title'", ")", ";", "}", "...
Share an Album or Image to the Gallery. @param string $imageOrAlbumId @param array $data @see https://api.imgur.com/endpoints/gallery#to-gallery @return bool
[ "Share", "an", "Album", "or", "Image", "to", "the", "Gallery", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Gallery.php#L225-L232
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Gallery.php
Gallery.vote
public function vote($imageOrAlbumId, $vote) { $this->validateVoteArgument($vote, ['up', 'down', 'veto']); return $this->post('gallery/' . $imageOrAlbumId . '/vote/' . $vote); }
php
public function vote($imageOrAlbumId, $vote) { $this->validateVoteArgument($vote, ['up', 'down', 'veto']); return $this->post('gallery/' . $imageOrAlbumId . '/vote/' . $vote); }
[ "public", "function", "vote", "(", "$", "imageOrAlbumId", ",", "$", "vote", ")", "{", "$", "this", "->", "validateVoteArgument", "(", "$", "vote", ",", "[", "'up'", ",", "'down'", ",", "'veto'", "]", ")", ";", "return", "$", "this", "->", "post", "("...
Vote for an image, 'up' or 'down' vote. Send 'veto' to undo a vote. @param string $imageOrAlbumId @param string $vote (up | down | veto) @see https://api.imgur.com/endpoints/gallery#gallery-voting @return bool
[ "Vote", "for", "an", "image", "up", "or", "down", "vote", ".", "Send", "veto", "to", "undo", "a", "vote", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Gallery.php#L314-L319
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/Gallery.php
Gallery.comments
public function comments($imageOrAlbumId, $sort = 'best') { $this->validateSortArgument($sort, ['best', 'top', 'new']); return $this->get('gallery/' . $imageOrAlbumId . '/comments/' . $sort); }
php
public function comments($imageOrAlbumId, $sort = 'best') { $this->validateSortArgument($sort, ['best', 'top', 'new']); return $this->get('gallery/' . $imageOrAlbumId . '/comments/' . $sort); }
[ "public", "function", "comments", "(", "$", "imageOrAlbumId", ",", "$", "sort", "=", "'best'", ")", "{", "$", "this", "->", "validateSortArgument", "(", "$", "sort", ",", "[", "'best'", ",", "'top'", ",", "'new'", "]", ")", ";", "return", "$", "this", ...
Retrieve comments on an image or album in the gallery. @param string $imageOrAlbumId @param string $sort (best | top | new) @see https://api.imgur.com/endpoints/gallery#gallery-comments @return array Array of Comment (@see https://api.imgur.com/endpoints/gallery#gallery-comments)
[ "Retrieve", "comments", "on", "an", "image", "or", "album", "in", "the", "gallery", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/Gallery.php#L331-L336
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/AbstractApi.php
AbstractApi.get
public function get($url, $parameters = []) { $httpClient = $this->client->getHttpClient(); if (!empty($this->pager)) { $parameters['page'] = $this->pager->getPage(); $parameters['perPage'] = $this->pager->getResultsPerPage(); } $response = $httpClient->get($url, ['query' => $parameters]); return $httpClient->parseResponse($response); }
php
public function get($url, $parameters = []) { $httpClient = $this->client->getHttpClient(); if (!empty($this->pager)) { $parameters['page'] = $this->pager->getPage(); $parameters['perPage'] = $this->pager->getResultsPerPage(); } $response = $httpClient->get($url, ['query' => $parameters]); return $httpClient->parseResponse($response); }
[ "public", "function", "get", "(", "$", "url", ",", "$", "parameters", "=", "[", "]", ")", "{", "$", "httpClient", "=", "$", "this", "->", "client", "->", "getHttpClient", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "pager", ")...
Perform a GET request and return the parsed response. @param string $url @return array
[ "Perform", "a", "GET", "request", "and", "return", "the", "parsed", "response", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/AbstractApi.php#L39-L51
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/AbstractApi.php
AbstractApi.put
public function put($url, $parameters = []) { $httpClient = $this->client->getHttpClient(); $response = $httpClient->put($url, $parameters); return $httpClient->parseResponse($response); }
php
public function put($url, $parameters = []) { $httpClient = $this->client->getHttpClient(); $response = $httpClient->put($url, $parameters); return $httpClient->parseResponse($response); }
[ "public", "function", "put", "(", "$", "url", ",", "$", "parameters", "=", "[", "]", ")", "{", "$", "httpClient", "=", "$", "this", "->", "client", "->", "getHttpClient", "(", ")", ";", "$", "response", "=", "$", "httpClient", "->", "put", "(", "$"...
Perform a PUT request and return the parsed response. @param string $url @return array
[ "Perform", "a", "PUT", "request", "and", "return", "the", "parsed", "response", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/AbstractApi.php#L76-L83
train
j0k3r/php-imgur-api-client
lib/Imgur/Api/AbstractApi.php
AbstractApi.validateArgument
private function validateArgument($type, $input, $possibleValues) { if (!\in_array($input, $possibleValues, true)) { throw new InvalidArgumentException($type . ' parameter "' . $input . '" is wrong. Possible values are: ' . implode(', ', $possibleValues)); } }
php
private function validateArgument($type, $input, $possibleValues) { if (!\in_array($input, $possibleValues, true)) { throw new InvalidArgumentException($type . ' parameter "' . $input . '" is wrong. Possible values are: ' . implode(', ', $possibleValues)); } }
[ "private", "function", "validateArgument", "(", "$", "type", ",", "$", "input", ",", "$", "possibleValues", ")", "{", "if", "(", "!", "\\", "in_array", "(", "$", "input", ",", "$", "possibleValues", ",", "true", ")", ")", "{", "throw", "new", "InvalidA...
Global method to validate an argument. @param string $type The required parameter (used for the error message) @param string $input Input value @param array $possibleValues Possible values for this argument
[ "Global", "method", "to", "validate", "an", "argument", "." ]
30455a44248b6933fc33f3a01022cf2869c3557b
https://github.com/j0k3r/php-imgur-api-client/blob/30455a44248b6933fc33f3a01022cf2869c3557b/lib/Imgur/Api/AbstractApi.php#L141-L146
train
maxhelias/php-nominatim
src/Reverse.php
Reverse.latlon
public function latlon(float $lat, float $lon): self { $this->query['lat'] = $lat; $this->query['lon'] = $lon; return $this; }
php
public function latlon(float $lat, float $lon): self { $this->query['lat'] = $lat; $this->query['lon'] = $lon; return $this; }
[ "public", "function", "latlon", "(", "float", "$", "lat", ",", "float", "$", "lon", ")", ":", "self", "{", "$", "this", "->", "query", "[", "'lat'", "]", "=", "$", "lat", ";", "$", "this", "->", "query", "[", "'lon'", "]", "=", "$", "lon", ";",...
The location to generate an address for. @param float $lat The latitude @param float $lon The longitude @return \maxh\Nominatim\Reverse
[ "The", "location", "to", "generate", "an", "address", "for", "." ]
7bd5fd76fb87625dd52bb459cb89df2b06937dd7
https://github.com/maxhelias/php-nominatim/blob/7bd5fd76fb87625dd52bb459cb89df2b06937dd7/src/Reverse.php#L86-L93
train
maxhelias/php-nominatim
src/Nominatim.php
Nominatim.decodeResponse
private function decodeResponse(string $format, Request $request, ResponseInterface $response) { if ('json' === $format || 'jsonv2' === $format || 'geojson' === $format || 'geocodejson' === $format) { return \json_decode($response->getBody()->getContents(), true); } if ('xml' === $format) { return new \SimpleXMLElement($response->getBody()->getContents()); } throw new NominatimException('Format is undefined or not supported for decode response', $request, $response); }
php
private function decodeResponse(string $format, Request $request, ResponseInterface $response) { if ('json' === $format || 'jsonv2' === $format || 'geojson' === $format || 'geocodejson' === $format) { return \json_decode($response->getBody()->getContents(), true); } if ('xml' === $format) { return new \SimpleXMLElement($response->getBody()->getContents()); } throw new NominatimException('Format is undefined or not supported for decode response', $request, $response); }
[ "private", "function", "decodeResponse", "(", "string", "$", "format", ",", "Request", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "if", "(", "'json'", "===", "$", "format", "||", "'jsonv2'", "===", "$", "format", "||", "'geojson'", ...
Decode the data returned from the request. @param string $format json or xml @param Request $request Request object from Guzzle @param ResponseInterface $response Interface response object from Guzzle @throws \RuntimeException @throws \maxh\Nominatim\Exceptions\NominatimException if no format for decode @return array|\SimpleXMLElement
[ "Decode", "the", "data", "returned", "from", "the", "request", "." ]
7bd5fd76fb87625dd52bb459cb89df2b06937dd7
https://github.com/maxhelias/php-nominatim/blob/7bd5fd76fb87625dd52bb459cb89df2b06937dd7/src/Nominatim.php#L159-L170
train
maxhelias/php-nominatim
src/Nominatim.php
Nominatim.find
public function find(QueryInterface $nRequest, array $headers = []) { $url = $this->application_url . '/' . $nRequest->getPath() . '?'; $request = new Request('GET', $url, \array_merge($this->defaultHeaders, $headers)); //Convert the query array to string with space replace to + $query = \GuzzleHttp\Psr7\build_query($nRequest->getQuery(), PHP_QUERY_RFC1738); $url = $request->getUri()->withQuery($query); $request = $request->withUri($url); return $this->decodeResponse( $nRequest->getFormat(), $request, $this->http_client->send($request) ); }
php
public function find(QueryInterface $nRequest, array $headers = []) { $url = $this->application_url . '/' . $nRequest->getPath() . '?'; $request = new Request('GET', $url, \array_merge($this->defaultHeaders, $headers)); //Convert the query array to string with space replace to + $query = \GuzzleHttp\Psr7\build_query($nRequest->getQuery(), PHP_QUERY_RFC1738); $url = $request->getUri()->withQuery($query); $request = $request->withUri($url); return $this->decodeResponse( $nRequest->getFormat(), $request, $this->http_client->send($request) ); }
[ "public", "function", "find", "(", "QueryInterface", "$", "nRequest", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "url", "=", "$", "this", "->", "application_url", ".", "'/'", ".", "$", "nRequest", "->", "getPath", "(", ")", ".", "'?'...
Runs the query and returns the result set from Nominatim. @param QueryInterface $nRequest The object request to send @param array $headers Override the request header @throws NominatimException if no format for decode @throws \GuzzleHttp\Exception\GuzzleException @return array|\SimpleXMLElement The decoded data returned from Nominatim
[ "Runs", "the", "query", "and", "returns", "the", "result", "set", "from", "Nominatim", "." ]
7bd5fd76fb87625dd52bb459cb89df2b06937dd7
https://github.com/maxhelias/php-nominatim/blob/7bd5fd76fb87625dd52bb459cb89df2b06937dd7/src/Nominatim.php#L183-L199
train
maxhelias/php-nominatim
src/Query.php
Query.format
public function format(string $format): self { $format = \mb_strtolower($format); if (\in_array($format, $this->acceptedFormat, true)) { $this->setFormat($format); return $this; } throw new InvalidParameterException('Format is not supported'); }
php
public function format(string $format): self { $format = \mb_strtolower($format); if (\in_array($format, $this->acceptedFormat, true)) { $this->setFormat($format); return $this; } throw new InvalidParameterException('Format is not supported'); }
[ "public", "function", "format", "(", "string", "$", "format", ")", ":", "self", "{", "$", "format", "=", "\\", "mb_strtolower", "(", "$", "format", ")", ";", "if", "(", "\\", "in_array", "(", "$", "format", ",", "$", "this", "->", "acceptedFormat", "...
Format returning by the request. @param string $format The output format for the request @throws \maxh\Nominatim\Exceptions\InvalidParameterException if format is not supported @return \maxh\Nominatim\Search|\maxh\Nominatim\Reverse|\maxh\Nominatim\Lookup
[ "Format", "returning", "by", "the", "request", "." ]
7bd5fd76fb87625dd52bb459cb89df2b06937dd7
https://github.com/maxhelias/php-nominatim/blob/7bd5fd76fb87625dd52bb459cb89df2b06937dd7/src/Query.php#L83-L94
train
maxhelias/php-nominatim
src/Query.php
Query.polygon
public function polygon(string $polygon) { if (\in_array($polygon, $this->polygon, true)) { $this->query['polygon_' . $polygon] = '1'; return $this; } throw new InvalidParameterException('This polygon format is not supported'); }
php
public function polygon(string $polygon) { if (\in_array($polygon, $this->polygon, true)) { $this->query['polygon_' . $polygon] = '1'; return $this; } throw new InvalidParameterException('This polygon format is not supported'); }
[ "public", "function", "polygon", "(", "string", "$", "polygon", ")", "{", "if", "(", "\\", "in_array", "(", "$", "polygon", ",", "$", "this", "->", "polygon", ",", "true", ")", ")", "{", "$", "this", "->", "query", "[", "'polygon_'", ".", "$", "pol...
Output format for the geometry of results. @param string $polygon @throws \maxh\Nominatim\Exceptions\InvalidParameterException if polygon format is not supported @return \maxh\Nominatim\Search|\maxh\Nominatim\Reverse|\maxh\Nominatim\Query
[ "Output", "format", "for", "the", "geometry", "of", "results", "." ]
7bd5fd76fb87625dd52bb459cb89df2b06937dd7
https://github.com/maxhelias/php-nominatim/blob/7bd5fd76fb87625dd52bb459cb89df2b06937dd7/src/Query.php#L154-L163
train
maxhelias/php-nominatim
src/Search.php
Search.viewBox
public function viewBox(string $left, string $top, string $right, string $bottom): self { $this->query['viewbox'] = $left . ',' . $top . ',' . $right . ',' . $bottom; return $this; }
php
public function viewBox(string $left, string $top, string $right, string $bottom): self { $this->query['viewbox'] = $left . ',' . $top . ',' . $right . ',' . $bottom; return $this; }
[ "public", "function", "viewBox", "(", "string", "$", "left", ",", "string", "$", "top", ",", "string", "$", "right", ",", "string", "$", "bottom", ")", ":", "self", "{", "$", "this", "->", "query", "[", "'viewbox'", "]", "=", "$", "left", ".", "','...
The preferred area to find search results. @param string $left Left of the area @param string $top Top of the area @param string $right Right of the area @param string $bottom Bottom of the area @return \maxh\Nominatim\Search
[ "The", "preferred", "area", "to", "find", "search", "results", "." ]
7bd5fd76fb87625dd52bb459cb89df2b06937dd7
https://github.com/maxhelias/php-nominatim/blob/7bd5fd76fb87625dd52bb459cb89df2b06937dd7/src/Search.php#L187-L192
train
maxhelias/php-nominatim
src/Search.php
Search.exludePlaceIds
public function exludePlaceIds(): self { $args = \func_get_args(); if (\count($args) > 0) { $this->query['exclude_place_ids'] = \implode(', ', $args); return $this; } throw new InvalidParameterException('No place id in parameter'); }
php
public function exludePlaceIds(): self { $args = \func_get_args(); if (\count($args) > 0) { $this->query['exclude_place_ids'] = \implode(', ', $args); return $this; } throw new InvalidParameterException('No place id in parameter'); }
[ "public", "function", "exludePlaceIds", "(", ")", ":", "self", "{", "$", "args", "=", "\\", "func_get_args", "(", ")", ";", "if", "(", "\\", "count", "(", "$", "args", ")", ">", "0", ")", "{", "$", "this", "->", "query", "[", "'exclude_place_ids'", ...
If you do not want certain OpenStreetMap objects to appear in the search results. @throws \maxh\Nominatim\Exceptions\InvalidParameterException if no place id @return \maxh\Nominatim\Search
[ "If", "you", "do", "not", "want", "certain", "OpenStreetMap", "objects", "to", "appear", "in", "the", "search", "results", "." ]
7bd5fd76fb87625dd52bb459cb89df2b06937dd7
https://github.com/maxhelias/php-nominatim/blob/7bd5fd76fb87625dd52bb459cb89df2b06937dd7/src/Search.php#L201-L212
train
lndj/Lcrawl
src/Traits/BuildRequest.php
BuildRequest.buildGetRequest
public function buildGetRequest($uri, $param = [], $headers = [], $isAsync = false) { $query_param = array_merge(['xh' => $this->stu_id], $param); $query = [ 'query' => $query_param, 'headers' => $headers, ]; if ($this->cacheCookie) { $query['cookies'] = $this->getCookie(); } //If use getAll(), use the Async request. return $isAsync ? $this->client->getAsync($uri, $query) : $this->client->get($uri, $query); }
php
public function buildGetRequest($uri, $param = [], $headers = [], $isAsync = false) { $query_param = array_merge(['xh' => $this->stu_id], $param); $query = [ 'query' => $query_param, 'headers' => $headers, ]; if ($this->cacheCookie) { $query['cookies'] = $this->getCookie(); } //If use getAll(), use the Async request. return $isAsync ? $this->client->getAsync($uri, $query) : $this->client->get($uri, $query); }
[ "public", "function", "buildGetRequest", "(", "$", "uri", ",", "$", "param", "=", "[", "]", ",", "$", "headers", "=", "[", "]", ",", "$", "isAsync", "=", "false", ")", "{", "$", "query_param", "=", "array_merge", "(", "[", "'xh'", "=>", "$", "this"...
Build the get request. @param type|string $uri @param type|array $param @param type|array $headers @param type|bool $isAsync @return type
[ "Build", "the", "get", "request", "." ]
61adc5d99355155099743b288ea3be52efebb852
https://github.com/lndj/Lcrawl/blob/61adc5d99355155099743b288ea3be52efebb852/src/Traits/BuildRequest.php#L29-L43
train
lndj/Lcrawl
src/Traits/BuildRequest.php
BuildRequest.buildPostRequest
public function buildPostRequest($uri, $query, $param, $headers = [], $isAsync = false) { $query_param = array_merge(['xh' => $this->stu_id], $query); $post = [ 'query' => $query_param, 'headers' => $headers, 'form_params' => $param, ]; //If opened cookie cache if ($this->cacheCookie) { $post['cookies'] = $this->getCookie(); } //If use getAll(), use the Async request. return $isAsync ? $this->client->postAsync($uri, $post) : $this->client->post($uri, $post); }
php
public function buildPostRequest($uri, $query, $param, $headers = [], $isAsync = false) { $query_param = array_merge(['xh' => $this->stu_id], $query); $post = [ 'query' => $query_param, 'headers' => $headers, 'form_params' => $param, ]; //If opened cookie cache if ($this->cacheCookie) { $post['cookies'] = $this->getCookie(); } //If use getAll(), use the Async request. return $isAsync ? $this->client->postAsync($uri, $post) : $this->client->post($uri, $post); }
[ "public", "function", "buildPostRequest", "(", "$", "uri", ",", "$", "query", ",", "$", "param", ",", "$", "headers", "=", "[", "]", ",", "$", "isAsync", "=", "false", ")", "{", "$", "query_param", "=", "array_merge", "(", "[", "'xh'", "=>", "$", "...
Build the POST request. @param $uri @param $query @param $param @param array $headers A array of headers. @param bool $isAsync If use getAll(), by Async request. @return mixed
[ "Build", "the", "POST", "request", "." ]
61adc5d99355155099743b288ea3be52efebb852
https://github.com/lndj/Lcrawl/blob/61adc5d99355155099743b288ea3be52efebb852/src/Traits/BuildRequest.php#L55-L73
train
letsdrink/ouzo
src/Ouzo/Core/Model.php
Model.inspect
public function inspect() { return get_called_class() . Objects::toString(Arrays::filter($this->attributes, Functions::notNull())); }
php
public function inspect() { return get_called_class() . Objects::toString(Arrays::filter($this->attributes, Functions::notNull())); }
[ "public", "function", "inspect", "(", ")", "{", "return", "get_called_class", "(", ")", ".", "Objects", "::", "toString", "(", "Arrays", "::", "filter", "(", "$", "this", "->", "attributes", ",", "Functions", "::", "notNull", "(", ")", ")", ")", ";", "...
Returns model object as a nicely formatted string. @return string
[ "Returns", "model", "object", "as", "a", "nicely", "formatted", "string", "." ]
4ab809ce8152dc7ef02c67bd6d42924d5d73631e
https://github.com/letsdrink/ouzo/blob/4ab809ce8152dc7ef02c67bd6d42924d5d73631e/src/Ouzo/Core/Model.php#L374-L377
train
letsdrink/ouzo
src/Ouzo/Core/Model.php
Model.findBySql
public static function findBySql($nativeSql, $params = []) { $meta = static::metaInstance(); $results = $meta->modelDefinition->db->query($nativeSql, Arrays::toArray($params))->fetchAll(); return Arrays::map($results, function ($row) use ($meta) { return $meta->newInstance($row); }); }
php
public static function findBySql($nativeSql, $params = []) { $meta = static::metaInstance(); $results = $meta->modelDefinition->db->query($nativeSql, Arrays::toArray($params))->fetchAll(); return Arrays::map($results, function ($row) use ($meta) { return $meta->newInstance($row); }); }
[ "public", "static", "function", "findBySql", "(", "$", "nativeSql", ",", "$", "params", "=", "[", "]", ")", "{", "$", "meta", "=", "static", "::", "metaInstance", "(", ")", ";", "$", "results", "=", "$", "meta", "->", "modelDefinition", "->", "db", "...
Executes a native sql and returns an array of model objects created by passing every result row to the model constructor. @param string $nativeSql - database specific sql @param array $params - bind parameters @return Model[]
[ "Executes", "a", "native", "sql", "and", "returns", "an", "array", "of", "model", "objects", "created", "by", "passing", "every", "result", "row", "to", "the", "model", "constructor", "." ]
4ab809ce8152dc7ef02c67bd6d42924d5d73631e
https://github.com/letsdrink/ouzo/blob/4ab809ce8152dc7ef02c67bd6d42924d5d73631e/src/Ouzo/Core/Model.php#L582-L590
train