id
int32
0
241k
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
45,000
OXID-eSales/testing_library
library/Bootstrap/BootstrapBase.php
BootstrapBase.init
public function init() { $testConfig = $this->getTestConfig(); $this->cleanUpExceptionLogFile(); $this->prepareShop(); $this->setGlobalConstants(); if ($testConfig->shouldRestoreShopAfterTestsSuite()) { $this->registerResetDbAfterSuite(); } if ($testConfig->shouldInstallShop()) { $this->installShop(); } /** @var \OxidEsales\Eshop\Core\Config $config */ $config = oxNew(\OxidEsales\Eshop\Core\Config::class); \OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Config::class, $config); $config->init(); }
php
public function init() { $testConfig = $this->getTestConfig(); $this->cleanUpExceptionLogFile(); $this->prepareShop(); $this->setGlobalConstants(); if ($testConfig->shouldRestoreShopAfterTestsSuite()) { $this->registerResetDbAfterSuite(); } if ($testConfig->shouldInstallShop()) { $this->installShop(); } /** @var \OxidEsales\Eshop\Core\Config $config */ $config = oxNew(\OxidEsales\Eshop\Core\Config::class); \OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Config::class, $config); $config->init(); }
[ "public", "function", "init", "(", ")", "{", "$", "testConfig", "=", "$", "this", "->", "getTestConfig", "(", ")", ";", "$", "this", "->", "cleanUpExceptionLogFile", "(", ")", ";", "$", "this", "->", "prepareShop", "(", ")", ";", "$", "this", "->", "...
Prepares tests environment.
[ "Prepares", "tests", "environment", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Bootstrap/BootstrapBase.php#L33-L54
45,001
OXID-eSales/testing_library
library/Bootstrap/BootstrapBase.php
BootstrapBase.prepareShop
protected function prepareShop() { $testConfig = $this->getTestConfig(); $shopPath = $testConfig->getShopPath(); require_once $shopPath .'bootstrap.php'; $tempDirectory = $testConfig->getTempDirectory(); if ($tempDirectory && $tempDirectory != '/') { $fileCopier = new FileCopier(); $fileCopier->createEmptyDirectory($tempDirectory); } }
php
protected function prepareShop() { $testConfig = $this->getTestConfig(); $shopPath = $testConfig->getShopPath(); require_once $shopPath .'bootstrap.php'; $tempDirectory = $testConfig->getTempDirectory(); if ($tempDirectory && $tempDirectory != '/') { $fileCopier = new FileCopier(); $fileCopier->createEmptyDirectory($tempDirectory); } }
[ "protected", "function", "prepareShop", "(", ")", "{", "$", "testConfig", "=", "$", "this", "->", "getTestConfig", "(", ")", ";", "$", "shopPath", "=", "$", "testConfig", "->", "getShopPath", "(", ")", ";", "require_once", "$", "shopPath", ".", "'bootstrap...
Prepares shop config object.
[ "Prepares", "shop", "config", "object", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Bootstrap/BootstrapBase.php#L69-L81
45,002
OXID-eSales/testing_library
library/Bootstrap/BootstrapBase.php
BootstrapBase.installShop
protected function installShop() { $config = $this->getTestConfig(); $serviceCaller = new ServiceCaller($this->getTestConfig()); $serviceCaller->setParameter('serial', $config->getShopSerial()); $serviceCaller->setParameter('addDemoData', $this->addDemoData); $serviceCaller->setParameter('turnOnVarnish', $config->shouldEnableVarnish()); if ($setupPath = $config->getShopSetupPath()) { $fileCopier = new FileCopier(); $remoteDirectory = $config->getRemoteDirectory(); $shopDirectory = $remoteDirectory ? $remoteDirectory : $config->getShopPath(); $fileCopier->copyFiles($setupPath, $shopDirectory.'/Setup/'); } try { $serviceCaller->callService('ShopInstaller'); } catch (\Exception $e) { exit("Failed to install shop with message: " . $e->getMessage() . PHP_EOL . $e->getTraceAsString()); } }
php
protected function installShop() { $config = $this->getTestConfig(); $serviceCaller = new ServiceCaller($this->getTestConfig()); $serviceCaller->setParameter('serial', $config->getShopSerial()); $serviceCaller->setParameter('addDemoData', $this->addDemoData); $serviceCaller->setParameter('turnOnVarnish', $config->shouldEnableVarnish()); if ($setupPath = $config->getShopSetupPath()) { $fileCopier = new FileCopier(); $remoteDirectory = $config->getRemoteDirectory(); $shopDirectory = $remoteDirectory ? $remoteDirectory : $config->getShopPath(); $fileCopier->copyFiles($setupPath, $shopDirectory.'/Setup/'); } try { $serviceCaller->callService('ShopInstaller'); } catch (\Exception $e) { exit("Failed to install shop with message: " . $e->getMessage() . PHP_EOL . $e->getTraceAsString()); } }
[ "protected", "function", "installShop", "(", ")", "{", "$", "config", "=", "$", "this", "->", "getTestConfig", "(", ")", ";", "$", "serviceCaller", "=", "new", "ServiceCaller", "(", "$", "this", "->", "getTestConfig", "(", ")", ")", ";", "$", "serviceCal...
Installs the shop. @throws \Exception
[ "Installs", "the", "shop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Bootstrap/BootstrapBase.php#L107-L128
45,003
OXID-eSales/testing_library
library/Bootstrap/BootstrapBase.php
BootstrapBase.registerResetDbAfterSuite
protected function registerResetDbAfterSuite() { $serviceCaller = new ServiceCaller($this->getTestConfig()); $serviceCaller->setParameter('dumpDB', true); $serviceCaller->setParameter('dump-prefix', 'orig_db_dump'); try { $serviceCaller->callService('ShopPreparation', 1); } catch (\Exception $e) { define('RESTORE_SHOP_AFTER_TEST_SUITE_ERROR', true); } register_shutdown_function(function () { if (!defined('RESTORE_SHOP_AFTER_TEST_SUITE_ERROR')) { $serviceCaller = new ServiceCaller(); $serviceCaller->setParameter('restoreDB', true); $serviceCaller->setParameter('dump-prefix', 'orig_db_dump'); $serviceCaller->callService('ShopPreparation', 1); } }); }
php
protected function registerResetDbAfterSuite() { $serviceCaller = new ServiceCaller($this->getTestConfig()); $serviceCaller->setParameter('dumpDB', true); $serviceCaller->setParameter('dump-prefix', 'orig_db_dump'); try { $serviceCaller->callService('ShopPreparation', 1); } catch (\Exception $e) { define('RESTORE_SHOP_AFTER_TEST_SUITE_ERROR', true); } register_shutdown_function(function () { if (!defined('RESTORE_SHOP_AFTER_TEST_SUITE_ERROR')) { $serviceCaller = new ServiceCaller(); $serviceCaller->setParameter('restoreDB', true); $serviceCaller->setParameter('dump-prefix', 'orig_db_dump'); $serviceCaller->callService('ShopPreparation', 1); } }); }
[ "protected", "function", "registerResetDbAfterSuite", "(", ")", "{", "$", "serviceCaller", "=", "new", "ServiceCaller", "(", "$", "this", "->", "getTestConfig", "(", ")", ")", ";", "$", "serviceCaller", "->", "setParameter", "(", "'dumpDB'", ",", "true", ")", ...
Creates original database dump and registers database restoration after the tests suite.
[ "Creates", "original", "database", "dump", "and", "registers", "database", "restoration", "after", "the", "tests", "suite", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Bootstrap/BootstrapBase.php#L134-L153
45,004
OXID-eSales/testing_library
library/Curl.php
Curl.setQuery
public function setQuery($sQuery = null) { if (is_null($sQuery)) { $sQuery = ""; if ($aParams = $this->getParameters()) { $aParams = $this->_prepareQueryParameters($aParams); $sQuery = http_build_query($aParams, "", "&"); } } $this->_sQuery = $sQuery; }
php
public function setQuery($sQuery = null) { if (is_null($sQuery)) { $sQuery = ""; if ($aParams = $this->getParameters()) { $aParams = $this->_prepareQueryParameters($aParams); $sQuery = http_build_query($aParams, "", "&"); } } $this->_sQuery = $sQuery; }
[ "public", "function", "setQuery", "(", "$", "sQuery", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "sQuery", ")", ")", "{", "$", "sQuery", "=", "\"\"", ";", "if", "(", "$", "aParams", "=", "$", "this", "->", "getParameters", "(", ")", "...
Set query like "param1=value1&param2=values2.." @param null $sQuery
[ "Set", "query", "like", "param1", "=", "value1&param2", "=", "values2", ".." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Curl.php#L116-L127
45,005
biblys/isbn
src/Biblys/Isbn/Isbn.php
Isbn.format
public function format($format = 'EAN') { if (!$this->isValid()) { throw new \Exception('Cannot format invalid ISBN: '.$this->getErrors()); } $this->calculateChecksum($format); $A = $this->getProduct(); $B = $this->getCountry(); $C = $this->getPublisher(); $D = $this->getPublication(); $E = $this->getChecksum(); if ($format == 'ISBN-10') { return $B.'-'.$C.'-'.$D.'-'.$E; } elseif ($format == 'ISBN-13' || $format == 'ISBN') { return $A.'-'.$B.'-'.$C.'-'.$D.'-'.$E; } else { return $A.$B.$C.$D.$E; } }
php
public function format($format = 'EAN') { if (!$this->isValid()) { throw new \Exception('Cannot format invalid ISBN: '.$this->getErrors()); } $this->calculateChecksum($format); $A = $this->getProduct(); $B = $this->getCountry(); $C = $this->getPublisher(); $D = $this->getPublication(); $E = $this->getChecksum(); if ($format == 'ISBN-10') { return $B.'-'.$C.'-'.$D.'-'.$E; } elseif ($format == 'ISBN-13' || $format == 'ISBN') { return $A.'-'.$B.'-'.$C.'-'.$D.'-'.$E; } else { return $A.$B.$C.$D.$E; } }
[ "public", "function", "format", "(", "$", "format", "=", "'EAN'", ")", "{", "if", "(", "!", "$", "this", "->", "isValid", "(", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Cannot format invalid ISBN: '", ".", "$", "this", "->", "getErrors", ...
Format an ISBN according to specified format @param string $format (ISBN-10, ISBN-13, EAN)
[ "Format", "an", "ISBN", "according", "to", "specified", "format" ]
c9ce51f2c563bb7de4000652a00e0c8f7750cc0c
https://github.com/biblys/isbn/blob/c9ce51f2c563bb7de4000652a00e0c8f7750cc0c/src/Biblys/Isbn/Isbn.php#L109-L130
45,006
biblys/isbn
src/Biblys/Isbn/Isbn.php
Isbn.removeHyphens
private function removeHyphens($code) { // Remove Hyphens and others characters $replacements = array('-','_',' '); $code = str_replace($replacements, '', $code); // Check for unwanted characters if (!is_numeric($code) && !(is_numeric(substr($code, 0, -1)) && strtoupper(substr($code, -1)) == 'X')) { $this->setValid(false); $this->addError(self::ERROR_INVALID_CHARACTERS); } return $code; }
php
private function removeHyphens($code) { // Remove Hyphens and others characters $replacements = array('-','_',' '); $code = str_replace($replacements, '', $code); // Check for unwanted characters if (!is_numeric($code) && !(is_numeric(substr($code, 0, -1)) && strtoupper(substr($code, -1)) == 'X')) { $this->setValid(false); $this->addError(self::ERROR_INVALID_CHARACTERS); } return $code; }
[ "private", "function", "removeHyphens", "(", "$", "code", ")", "{", "// Remove Hyphens and others characters", "$", "replacements", "=", "array", "(", "'-'", ",", "'_'", ",", "' '", ")", ";", "$", "code", "=", "str_replace", "(", "$", "replacements", ",", "'...
Delete '-', '_' and ' '
[ "Delete", "-", "_", "and" ]
c9ce51f2c563bb7de4000652a00e0c8f7750cc0c
https://github.com/biblys/isbn/blob/c9ce51f2c563bb7de4000652a00e0c8f7750cc0c/src/Biblys/Isbn/Isbn.php#L153-L168
45,007
biblys/isbn
src/Biblys/Isbn/Isbn.php
Isbn.removeChecksum
private function removeChecksum($code) { $length = strlen($code); if ($length == 13 || $length == 10) { $code = substr_replace($code, "", -1); return $code; } elseif ($length == 12 || $length == 9) { return $code; } else { $this->setValid(false); $this->addError(self::ERROR_INVALID_LENGTH); return $code; } }
php
private function removeChecksum($code) { $length = strlen($code); if ($length == 13 || $length == 10) { $code = substr_replace($code, "", -1); return $code; } elseif ($length == 12 || $length == 9) { return $code; } else { $this->setValid(false); $this->addError(self::ERROR_INVALID_LENGTH); return $code; } }
[ "private", "function", "removeChecksum", "(", "$", "code", ")", "{", "$", "length", "=", "strlen", "(", "$", "code", ")", ";", "if", "(", "$", "length", "==", "13", "||", "$", "length", "==", "10", ")", "{", "$", "code", "=", "substr_replace", "(",...
Remove checksum character if present
[ "Remove", "checksum", "character", "if", "present" ]
c9ce51f2c563bb7de4000652a00e0c8f7750cc0c
https://github.com/biblys/isbn/blob/c9ce51f2c563bb7de4000652a00e0c8f7750cc0c/src/Biblys/Isbn/Isbn.php#L173-L186
45,008
biblys/isbn
src/Biblys/Isbn/Isbn.php
Isbn.removeProductCode
private function removeProductCode($code) { $first3 = substr($code, 0, 3); // For ISBN-10, product code is always 978 if (strlen($code) == 9) { $this->setProduct(978); } // ISBN-13: check that product code is 978 or 979 elseif ($first3 == 978 || $first3 == 979) { $this->setProduct($first3); $code = substr($code, 3); } // Product code is Invalid else { $this->setValid(false); $this->addError(self::ERROR_INVALID_PRODUCT_CODE); } return $code; }
php
private function removeProductCode($code) { $first3 = substr($code, 0, 3); // For ISBN-10, product code is always 978 if (strlen($code) == 9) { $this->setProduct(978); } // ISBN-13: check that product code is 978 or 979 elseif ($first3 == 978 || $first3 == 979) { $this->setProduct($first3); $code = substr($code, 3); } // Product code is Invalid else { $this->setValid(false); $this->addError(self::ERROR_INVALID_PRODUCT_CODE); } return $code; }
[ "private", "function", "removeProductCode", "(", "$", "code", ")", "{", "$", "first3", "=", "substr", "(", "$", "code", ",", "0", ",", "3", ")", ";", "// For ISBN-10, product code is always 978", "if", "(", "strlen", "(", "$", "code", ")", "==", "9", ")"...
Remove first three characters if 978 or 979 and save Product Code
[ "Remove", "first", "three", "characters", "if", "978", "or", "979", "and", "save", "Product", "Code" ]
c9ce51f2c563bb7de4000652a00e0c8f7750cc0c
https://github.com/biblys/isbn/blob/c9ce51f2c563bb7de4000652a00e0c8f7750cc0c/src/Biblys/Isbn/Isbn.php#L191-L213
45,009
biblys/isbn
src/Biblys/Isbn/Isbn.php
Isbn.removeCountryCode
private function removeCountryCode($code) { // Get the seven first digits $first7 = substr($code, 0, 7); // Select the right set of rules according to the product code foreach ($this->getRanges()->getPrefixes() as $p) { if ($p['Prefix'] == $this->getProduct()) { $rules = $p['Rules']['Rule']; break; } } // If product code was not found, cannot proceed if (empty($rules)) { return null; } // Select the right rule foreach ($rules as $r) { $ra = explode('-', $r['Range']); if ($first7 >= $ra[0] && $first7 <= $ra[1]) { $length = $r['Length']; break; } } // Country code is invalid if ($length === "0") { $this->setValid(false); $this->addError(self::ERROR_INVALID_COUNTRY_CODE); return $code; } $this->setCountry(substr($code, 0, $length)); $code = substr($code, $length); return $code; }
php
private function removeCountryCode($code) { // Get the seven first digits $first7 = substr($code, 0, 7); // Select the right set of rules according to the product code foreach ($this->getRanges()->getPrefixes() as $p) { if ($p['Prefix'] == $this->getProduct()) { $rules = $p['Rules']['Rule']; break; } } // If product code was not found, cannot proceed if (empty($rules)) { return null; } // Select the right rule foreach ($rules as $r) { $ra = explode('-', $r['Range']); if ($first7 >= $ra[0] && $first7 <= $ra[1]) { $length = $r['Length']; break; } } // Country code is invalid if ($length === "0") { $this->setValid(false); $this->addError(self::ERROR_INVALID_COUNTRY_CODE); return $code; } $this->setCountry(substr($code, 0, $length)); $code = substr($code, $length); return $code; }
[ "private", "function", "removeCountryCode", "(", "$", "code", ")", "{", "// Get the seven first digits", "$", "first7", "=", "substr", "(", "$", "code", ",", "0", ",", "7", ")", ";", "// Select the right set of rules according to the product code", "foreach", "(", "...
Remove and save Country Code
[ "Remove", "and", "save", "Country", "Code" ]
c9ce51f2c563bb7de4000652a00e0c8f7750cc0c
https://github.com/biblys/isbn/blob/c9ce51f2c563bb7de4000652a00e0c8f7750cc0c/src/Biblys/Isbn/Isbn.php#L218-L257
45,010
biblys/isbn
src/Biblys/Isbn/Isbn.php
Isbn.removePublisherCode
private function removePublisherCode($code) { // Get the seven first digits $first7 = substr($code, 0, 7); // Select the right set of rules according to the agency (product + country code) foreach ($this->getRanges()->getGroups() as $g) { if ($g['Prefix'] <> $this->getProduct().'-'.$this->getCountry()) { continue; } $rules = $g['Rules']['Rule']; $this->setAgency($g['Agency']); // Select the right rule foreach ($rules as $r) { $ra = explode('-', $r['Range']); if ($first7 < $ra[0] || $first7 > $ra[1]) { continue; } $length = $r['Length']; $this->setPublisher(substr($code, 0, $length)); $this->setPublication(substr($code, $length)); break; } break; } }
php
private function removePublisherCode($code) { // Get the seven first digits $first7 = substr($code, 0, 7); // Select the right set of rules according to the agency (product + country code) foreach ($this->getRanges()->getGroups() as $g) { if ($g['Prefix'] <> $this->getProduct().'-'.$this->getCountry()) { continue; } $rules = $g['Rules']['Rule']; $this->setAgency($g['Agency']); // Select the right rule foreach ($rules as $r) { $ra = explode('-', $r['Range']); if ($first7 < $ra[0] || $first7 > $ra[1]) { continue; } $length = $r['Length']; $this->setPublisher(substr($code, 0, $length)); $this->setPublication(substr($code, $length)); break; } break; } }
[ "private", "function", "removePublisherCode", "(", "$", "code", ")", "{", "// Get the seven first digits", "$", "first7", "=", "substr", "(", "$", "code", ",", "0", ",", "7", ")", ";", "// Select the right set of rules according to the agency (product + country code)", ...
Remove and save Publisher Code and Publication Code
[ "Remove", "and", "save", "Publisher", "Code", "and", "Publication", "Code" ]
c9ce51f2c563bb7de4000652a00e0c8f7750cc0c
https://github.com/biblys/isbn/blob/c9ce51f2c563bb7de4000652a00e0c8f7750cc0c/src/Biblys/Isbn/Isbn.php#L262-L291
45,011
biblys/isbn
src/Biblys/Isbn/Isbn.php
Isbn.calculateChecksum
private function calculateChecksum($format = 'EAN') { $sum = null; if ($format == 'ISBN-10') { $code = $this->getCountry().$this->getPublisher().$this->getPublication(); $c = str_split($code); $sum = (11 - (($c[0] * 10) + ($c[1] * 9) + ($c[2] * 8) + ($c[3] * 7) + ($c[4] * 6) + ($c[5] * 5) + ($c[6] * 4) + ($c[7] * 3) + ($c[8] * 2)) % 11) % 11; if ($sum == 10) { $sum = 'X'; } } else { $code = $this->getProduct().$this->getCountry().$this->getPublisher().$this->getPublication(); $c = str_split($code); $sum = (($c[1] + $c[3] + $c[5] + $c[7] + $c[9] + $c[11]) * 3) + ($c[0] + $c[2] + $c[4] + $c[6] + $c[8] + $c[10]); $sum = (10 - ($sum % 10)) % 10; } $this->setChecksum($sum); }
php
private function calculateChecksum($format = 'EAN') { $sum = null; if ($format == 'ISBN-10') { $code = $this->getCountry().$this->getPublisher().$this->getPublication(); $c = str_split($code); $sum = (11 - (($c[0] * 10) + ($c[1] * 9) + ($c[2] * 8) + ($c[3] * 7) + ($c[4] * 6) + ($c[5] * 5) + ($c[6] * 4) + ($c[7] * 3) + ($c[8] * 2)) % 11) % 11; if ($sum == 10) { $sum = 'X'; } } else { $code = $this->getProduct().$this->getCountry().$this->getPublisher().$this->getPublication(); $c = str_split($code); $sum = (($c[1] + $c[3] + $c[5] + $c[7] + $c[9] + $c[11]) * 3) + ($c[0] + $c[2] + $c[4] + $c[6] + $c[8] + $c[10]); $sum = (10 - ($sum % 10)) % 10; } $this->setChecksum($sum); }
[ "private", "function", "calculateChecksum", "(", "$", "format", "=", "'EAN'", ")", "{", "$", "sum", "=", "null", ";", "if", "(", "$", "format", "==", "'ISBN-10'", ")", "{", "$", "code", "=", "$", "this", "->", "getCountry", "(", ")", ".", "$", "thi...
Calculate checksum character
[ "Calculate", "checksum", "character" ]
c9ce51f2c563bb7de4000652a00e0c8f7750cc0c
https://github.com/biblys/isbn/blob/c9ce51f2c563bb7de4000652a00e0c8f7750cc0c/src/Biblys/Isbn/Isbn.php#L296-L315
45,012
OXID-eSales/testing_library
library/Services/ModuleInstaller/ModuleInstaller.php
ModuleInstaller.switchToShop
public function switchToShop($shopId) { $_POST['shp'] = $shopId; $_POST['actshop'] = $shopId; $keepThese = [\OxidEsales\Eshop\Core\ConfigFile::class]; $registryKeys = Registry::getKeys(); foreach ($registryKeys as $key) { if (in_array($key, $keepThese)) { continue; } Registry::set($key, null); } $utilsObject = new \OxidEsales\Eshop\Core\UtilsObject; $utilsObject->resetInstanceCache(); Registry::set(\OxidEsales\Eshop\Core\UtilsObject::class, $utilsObject); \OxidEsales\Eshop\Core\Module\ModuleVariablesLocator::resetModuleVariables(); Registry::getSession()->setVariable('shp', $shopId); Registry::set(\OxidEsales\Eshop\Core\Config::class, null); Registry::getConfig()->setConfig(null); Registry::set(\OxidEsales\Eshop\Core\Config::class, null); $moduleVariablesCache = new \OxidEsales\Eshop\Core\FileCache(); $shopIdCalculator = new \OxidEsales\Eshop\Core\ShopIdCalculator($moduleVariablesCache); return $shopIdCalculator->getShopId(); }
php
public function switchToShop($shopId) { $_POST['shp'] = $shopId; $_POST['actshop'] = $shopId; $keepThese = [\OxidEsales\Eshop\Core\ConfigFile::class]; $registryKeys = Registry::getKeys(); foreach ($registryKeys as $key) { if (in_array($key, $keepThese)) { continue; } Registry::set($key, null); } $utilsObject = new \OxidEsales\Eshop\Core\UtilsObject; $utilsObject->resetInstanceCache(); Registry::set(\OxidEsales\Eshop\Core\UtilsObject::class, $utilsObject); \OxidEsales\Eshop\Core\Module\ModuleVariablesLocator::resetModuleVariables(); Registry::getSession()->setVariable('shp', $shopId); Registry::set(\OxidEsales\Eshop\Core\Config::class, null); Registry::getConfig()->setConfig(null); Registry::set(\OxidEsales\Eshop\Core\Config::class, null); $moduleVariablesCache = new \OxidEsales\Eshop\Core\FileCache(); $shopIdCalculator = new \OxidEsales\Eshop\Core\ShopIdCalculator($moduleVariablesCache); return $shopIdCalculator->getShopId(); }
[ "public", "function", "switchToShop", "(", "$", "shopId", ")", "{", "$", "_POST", "[", "'shp'", "]", "=", "$", "shopId", ";", "$", "_POST", "[", "'actshop'", "]", "=", "$", "shopId", ";", "$", "keepThese", "=", "[", "\\", "OxidEsales", "\\", "Eshop",...
Switch to subshop. @param integer $shopId @return integer
[ "Switch", "to", "subshop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ModuleInstaller/ModuleInstaller.php#L53-L76
45,013
OXID-eSales/testing_library
library/Services/ModuleInstaller/ModuleInstaller.php
ModuleInstaller.loadModule
private function loadModule($modulePath) { $module = oxNew(\OxidEsales\Eshop\Core\Module\Module::class); if (!$module->loadByDir($modulePath)) { throw new Exception("Module not found"); } return $module; }
php
private function loadModule($modulePath) { $module = oxNew(\OxidEsales\Eshop\Core\Module\Module::class); if (!$module->loadByDir($modulePath)) { throw new Exception("Module not found"); } return $module; }
[ "private", "function", "loadModule", "(", "$", "modulePath", ")", "{", "$", "module", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Module", "\\", "Module", "::", "class", ")", ";", "if", "(", "!", "$", "module", "->", "l...
Loads module object from given directory. @param string $modulePath The path to the module. @return \OxidEsales\Eshop\Core\Module\Module @throws Exception
[ "Loads", "module", "object", "from", "given", "directory", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ModuleInstaller/ModuleInstaller.php#L115-L122
45,014
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorerToFile.php
DatabaseRestorerToFile.getDumpChecksum
private function getDumpChecksum() { $dumpName = $this->getDumpName(); $checksum = $this->getChecksum(); return array_key_exists($dumpName, $checksum)? $checksum[$dumpName] : array(); }
php
private function getDumpChecksum() { $dumpName = $this->getDumpName(); $checksum = $this->getChecksum(); return array_key_exists($dumpName, $checksum)? $checksum[$dumpName] : array(); }
[ "private", "function", "getDumpChecksum", "(", ")", "{", "$", "dumpName", "=", "$", "this", "->", "getDumpName", "(", ")", ";", "$", "checksum", "=", "$", "this", "->", "getChecksum", "(", ")", ";", "return", "array_key_exists", "(", "$", "dumpName", ","...
Returns database dump data @return array
[ "Returns", "database", "dump", "data" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorerToFile.php#L144-L150
45,015
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorerToFile.php
DatabaseRestorerToFile.saveChecksum
protected function saveChecksum($dumpChecksum) { $dumpName = $this->getDumpName(); $dumpDirectory = $this->getDumpDirectory(); $allChecksum = $this->getChecksum(); $allChecksum[$dumpName] = $dumpChecksum; $this->checksum = $allChecksum; file_put_contents($dumpDirectory.'/checksums.txt', serialize($allChecksum)); }
php
protected function saveChecksum($dumpChecksum) { $dumpName = $this->getDumpName(); $dumpDirectory = $this->getDumpDirectory(); $allChecksum = $this->getChecksum(); $allChecksum[$dumpName] = $dumpChecksum; $this->checksum = $allChecksum; file_put_contents($dumpDirectory.'/checksums.txt', serialize($allChecksum)); }
[ "protected", "function", "saveChecksum", "(", "$", "dumpChecksum", ")", "{", "$", "dumpName", "=", "$", "this", "->", "getDumpName", "(", ")", ";", "$", "dumpDirectory", "=", "$", "this", "->", "getDumpDirectory", "(", ")", ";", "$", "allChecksum", "=", ...
Saves tables checksum. @param array $dumpChecksum
[ "Saves", "tables", "checksum", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorerToFile.php#L173-L182
45,016
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorerToFile.php
DatabaseRestorerToFile.getDumpDirectory
protected function getDumpDirectory() { $dumpName = $this->getDumpName(); $databaseHandler = $this->getDatabaseHandler(); $directory = $this->getBaseDumpDirectory() . '/' . $databaseHandler->getDbName() . '/' . $dumpName . '/'; if (!file_exists($directory)) { mkdir($directory, 0777, true); } return $directory; }
php
protected function getDumpDirectory() { $dumpName = $this->getDumpName(); $databaseHandler = $this->getDatabaseHandler(); $directory = $this->getBaseDumpDirectory() . '/' . $databaseHandler->getDbName() . '/' . $dumpName . '/'; if (!file_exists($directory)) { mkdir($directory, 0777, true); } return $directory; }
[ "protected", "function", "getDumpDirectory", "(", ")", "{", "$", "dumpName", "=", "$", "this", "->", "getDumpName", "(", ")", ";", "$", "databaseHandler", "=", "$", "this", "->", "getDatabaseHandler", "(", ")", ";", "$", "directory", "=", "$", "this", "-...
Create dump file name @return string
[ "Create", "dump", "file", "name" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorerToFile.php#L231-L241
45,017
OXID-eSales/testing_library
library/Services/Library/FileHandler.php
FileHandler.createDirectory
public function createDirectory($directoryPath, $permissions = 0777) { $current = ''; $parts = array_filter(explode('/', $directoryPath)); foreach ($parts as $part) { $current = "$current/$part"; if (!empty($part) && !file_exists($current)) { mkdir($current, $permissions); chmod($current, $permissions); } } }
php
public function createDirectory($directoryPath, $permissions = 0777) { $current = ''; $parts = array_filter(explode('/', $directoryPath)); foreach ($parts as $part) { $current = "$current/$part"; if (!empty($part) && !file_exists($current)) { mkdir($current, $permissions); chmod($current, $permissions); } } }
[ "public", "function", "createDirectory", "(", "$", "directoryPath", ",", "$", "permissions", "=", "0777", ")", "{", "$", "current", "=", "''", ";", "$", "parts", "=", "array_filter", "(", "explode", "(", "'/'", ",", "$", "directoryPath", ")", ")", ";", ...
Creates directory with write permissions @param string $directoryPath @param int $permissions
[ "Creates", "directory", "with", "write", "permissions" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/FileHandler.php#L19-L30
45,018
OXID-eSales/testing_library
library/Services/Library/ServiceConfig.php
ServiceConfig.getShopEdition
public function getShopEdition() { if (is_null($this->shopEdition)) { $config = new \OxidEsales\Eshop\Core\Config(); $shopEdition = $config->getEdition(); $this->shopEdition = strtoupper($shopEdition); } return $this->shopEdition; }
php
public function getShopEdition() { if (is_null($this->shopEdition)) { $config = new \OxidEsales\Eshop\Core\Config(); $shopEdition = $config->getEdition(); $this->shopEdition = strtoupper($shopEdition); } return $this->shopEdition; }
[ "public", "function", "getShopEdition", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "shopEdition", ")", ")", "{", "$", "config", "=", "new", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Config", "(", ")", ";", "$", "shopEd...
Returns shop edition @return array|null|string
[ "Returns", "shop", "edition" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/ServiceConfig.php#L72-L81
45,019
OXID-eSales/testing_library
library/Services/Library/ServiceConfig.php
ServiceConfig.getTempDirectory
public function getTempDirectory() { if (!file_exists($this->tempDirectory)) { mkdir($this->tempDirectory, 0777); chmod($this->tempDirectory, 0777); } return $this->tempDirectory; }
php
public function getTempDirectory() { if (!file_exists($this->tempDirectory)) { mkdir($this->tempDirectory, 0777); chmod($this->tempDirectory, 0777); } return $this->tempDirectory; }
[ "public", "function", "getTempDirectory", "(", ")", "{", "if", "(", "!", "file_exists", "(", "$", "this", "->", "tempDirectory", ")", ")", "{", "mkdir", "(", "$", "this", "->", "tempDirectory", ",", "0777", ")", ";", "chmod", "(", "$", "this", "->", ...
Returns temp path. @return string
[ "Returns", "temp", "path", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/ServiceConfig.php#L98-L106
45,020
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.open
public function open($sUrl) { try { $this->getMinkSession()->visit($sUrl); } catch (\Selenium\Exception $exception) { sleep(1); $this->getMinkSession()->visit($sUrl); } }
php
public function open($sUrl) { try { $this->getMinkSession()->visit($sUrl); } catch (\Selenium\Exception $exception) { sleep(1); $this->getMinkSession()->visit($sUrl); } }
[ "public", "function", "open", "(", "$", "sUrl", ")", "{", "try", "{", "$", "this", "->", "getMinkSession", "(", ")", "->", "visit", "(", "$", "sUrl", ")", ";", "}", "catch", "(", "\\", "Selenium", "\\", "Exception", "$", "exception", ")", "{", "sle...
Opens url in browser @param $sUrl
[ "Opens", "url", "in", "browser" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L123-L131
45,021
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.selectFrame
public function selectFrame($sFrame) { $this->getMinkSession()->getDriver()->switchToIFrame($sFrame); $this->selectedFrame = $sFrame; }
php
public function selectFrame($sFrame) { $this->getMinkSession()->getDriver()->switchToIFrame($sFrame); $this->selectedFrame = $sFrame; }
[ "public", "function", "selectFrame", "(", "$", "sFrame", ")", "{", "$", "this", "->", "getMinkSession", "(", ")", "->", "getDriver", "(", ")", "->", "switchToIFrame", "(", "$", "sFrame", ")", ";", "$", "this", "->", "selectedFrame", "=", "$", "sFrame", ...
Selects frame by name @param string $sFrame
[ "Selects", "frame", "by", "name" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L164-L168
45,022
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.click
public function click($sSelector) { try { $this->getElementLazy($sSelector)->click(); } catch (ElementException $e) { sleep(1); $this->getElementLazy($sSelector)->click(); } }
php
public function click($sSelector) { try { $this->getElementLazy($sSelector)->click(); } catch (ElementException $e) { sleep(1); $this->getElementLazy($sSelector)->click(); } }
[ "public", "function", "click", "(", "$", "sSelector", ")", "{", "try", "{", "$", "this", "->", "getElementLazy", "(", "$", "sSelector", ")", "->", "click", "(", ")", ";", "}", "catch", "(", "ElementException", "$", "e", ")", "{", "sleep", "(", "1", ...
Clicks on element @param $sSelector
[ "Clicks", "on", "element" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L228-L236
45,023
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.type
public function type($sSelector, $sText) { try { $this->getElementLazy($sSelector)->setValue($sText); } catch (ElementException $e) { sleep(1); $this->getElementLazy($sSelector)->setValue($sText); } }
php
public function type($sSelector, $sText) { try { $this->getElementLazy($sSelector)->setValue($sText); } catch (ElementException $e) { sleep(1); $this->getElementLazy($sSelector)->setValue($sText); } }
[ "public", "function", "type", "(", "$", "sSelector", ",", "$", "sText", ")", "{", "try", "{", "$", "this", "->", "getElementLazy", "(", "$", "sSelector", ")", "->", "setValue", "(", "$", "sText", ")", ";", "}", "catch", "(", "ElementException", "$", ...
Types text to given element @param $sSelector @param $sText
[ "Types", "text", "to", "given", "element" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L244-L252
45,024
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.select
public function select($sSelector, $sOptionSelector) { $oSelectorsHandler = $this->getMinkSession()->getSelectorsHandler(); $oSelect = null; if (strpos($sSelector, '/') === false) { $page = $this->getMinkSession()->getPage(); $sParsedSelector = $oSelectorsHandler->xpathLiteral($sSelector); $oSelect = $page->find('named', array('select', $sParsedSelector)); } if (is_null($oSelect)) { $oSelect = $this->getElementLazy($sSelector); } if (strpos($sOptionSelector, 'index=') === 0) { $iIndex = str_replace('index=', '', $sOptionSelector); $sOptionSelector = $this->_getSelectOptionByIndex($oSelect, $iIndex); } else { $sOptionSelector = str_replace(array('label=', 'value='), '', $sOptionSelector); } if (is_null($oSelect)) { $this->fail("Select '$sSelector' was not found!"); } $oOptions = $oSelect->findAll('named', array('option', $oSelectorsHandler->xpathLiteral($sOptionSelector))); $oOption = $this->_getExactMatch($oOptions, $sOptionSelector); if (is_null($oOption)) { $this->fail("Option '$sOptionSelector' was not found in '$sSelector' select "); } $this->getMinkSession()->getDriver()->selectOption( $oSelect->getXpath(), $oOption->getValue(), false ); $this->fireEvent($sSelector, 'change'); }
php
public function select($sSelector, $sOptionSelector) { $oSelectorsHandler = $this->getMinkSession()->getSelectorsHandler(); $oSelect = null; if (strpos($sSelector, '/') === false) { $page = $this->getMinkSession()->getPage(); $sParsedSelector = $oSelectorsHandler->xpathLiteral($sSelector); $oSelect = $page->find('named', array('select', $sParsedSelector)); } if (is_null($oSelect)) { $oSelect = $this->getElementLazy($sSelector); } if (strpos($sOptionSelector, 'index=') === 0) { $iIndex = str_replace('index=', '', $sOptionSelector); $sOptionSelector = $this->_getSelectOptionByIndex($oSelect, $iIndex); } else { $sOptionSelector = str_replace(array('label=', 'value='), '', $sOptionSelector); } if (is_null($oSelect)) { $this->fail("Select '$sSelector' was not found!"); } $oOptions = $oSelect->findAll('named', array('option', $oSelectorsHandler->xpathLiteral($sOptionSelector))); $oOption = $this->_getExactMatch($oOptions, $sOptionSelector); if (is_null($oOption)) { $this->fail("Option '$sOptionSelector' was not found in '$sSelector' select "); } $this->getMinkSession()->getDriver()->selectOption( $oSelect->getXpath(), $oOption->getValue(), false ); $this->fireEvent($sSelector, 'change'); }
[ "public", "function", "select", "(", "$", "sSelector", ",", "$", "sOptionSelector", ")", "{", "$", "oSelectorsHandler", "=", "$", "this", "->", "getMinkSession", "(", ")", "->", "getSelectorsHandler", "(", ")", ";", "$", "oSelect", "=", "null", ";", "if", ...
Selects select element option @param $sSelector @param $sOptionSelector
[ "Selects", "select", "element", "option" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L260-L299
45,025
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.dragAndDropToObject
public function dragAndDropToObject($sSelector, $sContainer) { $oElement = $this->getElementLazy($sSelector); $oContainer = $this->getElementLazy($sContainer); $oElement->dragTo($oContainer); }
php
public function dragAndDropToObject($sSelector, $sContainer) { $oElement = $this->getElementLazy($sSelector); $oContainer = $this->getElementLazy($sContainer); $oElement->dragTo($oContainer); }
[ "public", "function", "dragAndDropToObject", "(", "$", "sSelector", ",", "$", "sContainer", ")", "{", "$", "oElement", "=", "$", "this", "->", "getElementLazy", "(", "$", "sSelector", ")", ";", "$", "oContainer", "=", "$", "this", "->", "getElementLazy", "...
Drags element to container @param string $sSelector @param string $sContainer
[ "Drags", "element", "to", "container" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L397-L403
45,026
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.isTextPresent
public function isTextPresent($sText) { $sHTML = $this->getMinkSession()->getPage()->getText(); return (stripos($sHTML, $sText) !== false); }
php
public function isTextPresent($sText) { $sHTML = $this->getMinkSession()->getPage()->getText(); return (stripos($sHTML, $sText) !== false); }
[ "public", "function", "isTextPresent", "(", "$", "sText", ")", "{", "$", "sHTML", "=", "$", "this", "->", "getMinkSession", "(", ")", "->", "getPage", "(", ")", "->", "getText", "(", ")", ";", "return", "(", "stripos", "(", "$", "sHTML", ",", "$", ...
Checks if given text is present on page @param string $sText text to be searched @return bool
[ "Checks", "if", "given", "text", "is", "present", "on", "page" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L411-L415
45,027
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.isVisible
public function isVisible($sSelector) { $element = $this->getElement($sSelector, false); return $element && $element->isVisible(); }
php
public function isVisible($sSelector) { $element = $this->getElement($sSelector, false); return $element && $element->isVisible(); }
[ "public", "function", "isVisible", "(", "$", "sSelector", ")", "{", "$", "element", "=", "$", "this", "->", "getElement", "(", "$", "sSelector", ",", "false", ")", ";", "return", "$", "element", "&&", "$", "element", "->", "isVisible", "(", ")", ";", ...
Checks if element is visible. If element is not found, waits for it to appear and checks again. @param string $sSelector @return bool
[ "Checks", "if", "element", "is", "visible", ".", "If", "element", "is", "not", "found", "waits", "for", "it", "to", "appear", "and", "checks", "again", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L434-L438
45,028
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.getText
public function getText($sSelector) { $oElement = $this->getElementLazy($sSelector); try { $sText = $oElement->getText(); } catch (Exception $e) { sleep(1); $sText = $oElement->getText(); } return $sText; }
php
public function getText($sSelector) { $oElement = $this->getElementLazy($sSelector); try { $sText = $oElement->getText(); } catch (Exception $e) { sleep(1); $sText = $oElement->getText(); } return $sText; }
[ "public", "function", "getText", "(", "$", "sSelector", ")", "{", "$", "oElement", "=", "$", "this", "->", "getElementLazy", "(", "$", "sSelector", ")", ";", "try", "{", "$", "sText", "=", "$", "oElement", "->", "getText", "(", ")", ";", "}", "catch"...
Overrides original method - waits for element before checking for text @param string $sSelector text to be searched @return string
[ "Overrides", "original", "method", "-", "waits", "for", "element", "before", "checking", "for", "text" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L458-L468
45,029
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.getValue
public function getValue($sSelector) { $element = $this->getElementLazy($sSelector); $mValue = $this->_getValue($element->getXpath()); try { $sType = $element->getAttribute('type'); } catch (InvalidArgumentException $e) { sleep(1); $sType = $element->getAttribute('type'); } if ($sType == 'checkbox') { $mValue = $mValue ? 'on' : 'off'; } return trim($mValue); }
php
public function getValue($sSelector) { $element = $this->getElementLazy($sSelector); $mValue = $this->_getValue($element->getXpath()); try { $sType = $element->getAttribute('type'); } catch (InvalidArgumentException $e) { sleep(1); $sType = $element->getAttribute('type'); } if ($sType == 'checkbox') { $mValue = $mValue ? 'on' : 'off'; } return trim($mValue); }
[ "public", "function", "getValue", "(", "$", "sSelector", ")", "{", "$", "element", "=", "$", "this", "->", "getElementLazy", "(", "$", "sSelector", ")", ";", "$", "mValue", "=", "$", "this", "->", "_getValue", "(", "$", "element", "->", "getXpath", "("...
Returns element's value @param string $sSelector @return mixed|string
[ "Returns", "element", "s", "value" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L477-L493
45,030
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.close
public function close() { $this->getMinkSession()->getDriver()->getBrowser()->close(); $this->getMinkSession()->getDriver()->switchToWindow(null); }
php
public function close() { $this->getMinkSession()->getDriver()->getBrowser()->close(); $this->getMinkSession()->getDriver()->switchToWindow(null); }
[ "public", "function", "close", "(", ")", "{", "$", "this", "->", "getMinkSession", "(", ")", "->", "getDriver", "(", ")", "->", "getBrowser", "(", ")", "->", "close", "(", ")", ";", "$", "this", "->", "getMinkSession", "(", ")", "->", "getDriver", "(...
Closes browser window, mainly used for closing popups
[ "Closes", "browser", "window", "mainly", "used", "for", "closing", "popups" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L562-L566
45,031
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.getHtmlSource
public function getHtmlSource() { try { $sSource = $this->getMinkSession()->getPage()->getContent(); } catch (Exception $e) { sleep(1); $sSource = $this->getMinkSession()->getPage()->getContent(); } return $sSource; }
php
public function getHtmlSource() { try { $sSource = $this->getMinkSession()->getPage()->getContent(); } catch (Exception $e) { sleep(1); $sSource = $this->getMinkSession()->getPage()->getContent(); } return $sSource; }
[ "public", "function", "getHtmlSource", "(", ")", "{", "try", "{", "$", "sSource", "=", "$", "this", "->", "getMinkSession", "(", ")", "->", "getPage", "(", ")", "->", "getContent", "(", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", ...
Returns page html source @return null|string
[ "Returns", "page", "html", "source" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L573-L582
45,032
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.getXpathCount
public function getXpathCount($sSelector) { $page = $this->getMinkSession()->getPage(); return count($page->findAll('xpath', $sSelector)); }
php
public function getXpathCount($sSelector) { $page = $this->getMinkSession()->getPage(); return count($page->findAll('xpath', $sSelector)); }
[ "public", "function", "getXpathCount", "(", "$", "sSelector", ")", "{", "$", "page", "=", "$", "this", "->", "getMinkSession", "(", ")", "->", "getPage", "(", ")", ";", "return", "count", "(", "$", "page", "->", "findAll", "(", "'xpath'", ",", "$", "...
Returns count of all elements which can be found by xPath. @param string $sSelector @return int
[ "Returns", "count", "of", "all", "elements", "which", "can", "be", "found", "by", "xPath", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L598-L603
45,033
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.getElementLazy
public function getElementLazy($selector, $failOnError = true, $waitTime = 10) { $element = $this->getElement($selector, false); while (!$element && $waitTime > 0) { $element = $this->getElement($selector, false); $waitTime -= 0.5; usleep(500000); } return $element ?: $this->getElement($selector, $failOnError); }
php
public function getElementLazy($selector, $failOnError = true, $waitTime = 10) { $element = $this->getElement($selector, false); while (!$element && $waitTime > 0) { $element = $this->getElement($selector, false); $waitTime -= 0.5; usleep(500000); } return $element ?: $this->getElement($selector, $failOnError); }
[ "public", "function", "getElementLazy", "(", "$", "selector", ",", "$", "failOnError", "=", "true", ",", "$", "waitTime", "=", "10", ")", "{", "$", "element", "=", "$", "this", "->", "getElement", "(", "$", "selector", ",", "false", ")", ";", "while", ...
Returns element. If element is not found, tries to wait for it. @param $selector @param bool|true $failOnError @param int $waitTime @return NodeElement|null
[ "Returns", "element", ".", "If", "element", "is", "not", "found", "tries", "to", "wait", "for", "it", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L639-L649
45,034
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.getAttribute
public function getAttribute($sSelectorWithAttribute) { $mAttribute = null; $sSelectorAttributeSeparator = '@'; $iSeparatorPosition = strrpos($sSelectorWithAttribute, $sSelectorAttributeSeparator); if ($iSeparatorPosition !== false) { $sSelector = $this->_getSelectorWithoutAttribute($sSelectorWithAttribute, $iSeparatorPosition); $sAttributeName = $this->_getAttributeWithoutSelector($sSelectorWithAttribute, $iSeparatorPosition); $oElement = $this->getElementLazy($sSelector); $mAttribute = $oElement->getAttribute($sAttributeName); } return $mAttribute; }
php
public function getAttribute($sSelectorWithAttribute) { $mAttribute = null; $sSelectorAttributeSeparator = '@'; $iSeparatorPosition = strrpos($sSelectorWithAttribute, $sSelectorAttributeSeparator); if ($iSeparatorPosition !== false) { $sSelector = $this->_getSelectorWithoutAttribute($sSelectorWithAttribute, $iSeparatorPosition); $sAttributeName = $this->_getAttributeWithoutSelector($sSelectorWithAttribute, $iSeparatorPosition); $oElement = $this->getElementLazy($sSelector); $mAttribute = $oElement->getAttribute($sAttributeName); } return $mAttribute; }
[ "public", "function", "getAttribute", "(", "$", "sSelectorWithAttribute", ")", "{", "$", "mAttribute", "=", "null", ";", "$", "sSelectorAttributeSeparator", "=", "'@'", ";", "$", "iSeparatorPosition", "=", "strrpos", "(", "$", "sSelectorWithAttribute", ",", "$", ...
Get attribute from selector with attribute @param string $sSelectorWithAttribute @return mixed|null
[ "Get", "attribute", "from", "selector", "with", "attribute" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L658-L673
45,035
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.fireEvent
public function fireEvent($sSelector, $sEvent) { $this->getMinkSession()->getDriver()->getBrowser()->fireEvent($sSelector, $sEvent); }
php
public function fireEvent($sSelector, $sEvent) { $this->getMinkSession()->getDriver()->getBrowser()->fireEvent($sSelector, $sEvent); }
[ "public", "function", "fireEvent", "(", "$", "sSelector", ",", "$", "sEvent", ")", "{", "$", "this", "->", "getMinkSession", "(", ")", "->", "getDriver", "(", ")", "->", "getBrowser", "(", ")", "->", "fireEvent", "(", "$", "sSelector", ",", "$", "sEven...
Call event on element. @param string $sSelector @param string $sEvent
[ "Call", "event", "on", "element", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L681-L684
45,036
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.waitForFrameToLoad
public function waitForFrameToLoad($sFrame, $iTimeout = 10000, $blIgnoreResult = true) { try { $this->getMinkSession()->getDriver()->getBrowser()->waitForFrameToLoad($sFrame, $iTimeout * $this->_iWaitTimeMultiplier); } catch (Exception $e) { if (!$blIgnoreResult) { throw $e; } } }
php
public function waitForFrameToLoad($sFrame, $iTimeout = 10000, $blIgnoreResult = true) { try { $this->getMinkSession()->getDriver()->getBrowser()->waitForFrameToLoad($sFrame, $iTimeout * $this->_iWaitTimeMultiplier); } catch (Exception $e) { if (!$blIgnoreResult) { throw $e; } } }
[ "public", "function", "waitForFrameToLoad", "(", "$", "sFrame", ",", "$", "iTimeout", "=", "10000", ",", "$", "blIgnoreResult", "=", "true", ")", "{", "try", "{", "$", "this", "->", "getMinkSession", "(", ")", "->", "getDriver", "(", ")", "->", "getBrows...
Waits for frame to load by frame name @param string $sFrame frame name @param int $iTimeout time to wait for frame @param bool $blIgnoreResult Ignores if frame does not load @throws Exception
[ "Waits", "for", "frame", "to", "load", "by", "frame", "name" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L735-L745
45,037
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.typeKeys
public function typeKeys($locator, $value) { try { return $this->getMinkSession()->getDriver()->getBrowser()->typeKeys($locator, $value); } catch (\Selenium\Exception $e) { sleep(1); return $this->getMinkSession()->getDriver()->getBrowser()->typeKeys($locator, $value); } }
php
public function typeKeys($locator, $value) { try { return $this->getMinkSession()->getDriver()->getBrowser()->typeKeys($locator, $value); } catch (\Selenium\Exception $e) { sleep(1); return $this->getMinkSession()->getDriver()->getBrowser()->typeKeys($locator, $value); } }
[ "public", "function", "typeKeys", "(", "$", "locator", ",", "$", "value", ")", "{", "try", "{", "return", "$", "this", "->", "getMinkSession", "(", ")", "->", "getDriver", "(", ")", "->", "getBrowser", "(", ")", "->", "typeKeys", "(", "$", "locator", ...
Types value to locator element. @param string $locator @param string $value @return mixed
[ "Types", "value", "to", "locator", "element", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L766-L774
45,038
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper.getScreenShot
public function getScreenShot($sFileName) { $oDriver = $this->getMinkSession()->getDriver(); if ($oDriver instanceof \Behat\Mink\Driver\SeleniumDriver) { return $this->getMinkSession()->getDriver()->getBrowser()->captureEntirePageScreenshot($sFileName, ""); } return ''; }
php
public function getScreenShot($sFileName) { $oDriver = $this->getMinkSession()->getDriver(); if ($oDriver instanceof \Behat\Mink\Driver\SeleniumDriver) { return $this->getMinkSession()->getDriver()->getBrowser()->captureEntirePageScreenshot($sFileName, ""); } return ''; }
[ "public", "function", "getScreenShot", "(", "$", "sFileName", ")", "{", "$", "oDriver", "=", "$", "this", "->", "getMinkSession", "(", ")", "->", "getDriver", "(", ")", ";", "if", "(", "$", "oDriver", "instanceof", "\\", "Behat", "\\", "Mink", "\\", "D...
Captures screen shot to given file. @param string $sFileName @return string
[ "Captures", "screen", "shot", "to", "given", "file", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L783-L791
45,039
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper._getElementByIdOrName
protected function _getElementByIdOrName($sSelector) { $sSelector = str_replace(array('name=', 'id='), array('', ''), $sSelector); if (strpos($sSelector, '.') || strpos($sSelector, '[')) { $oElement = $this->_getElementByIdOrNameXpath($sSelector); } else { $oElement = $this->_getElementByIdOrNameCSS($sSelector); } return $oElement; }
php
protected function _getElementByIdOrName($sSelector) { $sSelector = str_replace(array('name=', 'id='), array('', ''), $sSelector); if (strpos($sSelector, '.') || strpos($sSelector, '[')) { $oElement = $this->_getElementByIdOrNameXpath($sSelector); } else { $oElement = $this->_getElementByIdOrNameCSS($sSelector); } return $oElement; }
[ "protected", "function", "_getElementByIdOrName", "(", "$", "sSelector", ")", "{", "$", "sSelector", "=", "str_replace", "(", "array", "(", "'name='", ",", "'id='", ")", ",", "array", "(", "''", ",", "''", ")", ",", "$", "sSelector", ")", ";", "if", "(...
Returns element by given id or name @param string $sSelector @return NodeElement|null
[ "Returns", "element", "by", "given", "id", "or", "name" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L830-L841
45,040
OXID-eSales/testing_library
library/MinkWrapper.php
MinkWrapper._getElementByLink
protected function _getElementByLink($sSelector) { $sSelector = str_replace('link=', '', $sSelector); $sParsedSelector = $this->getMinkSession()->getSelectorsHandler()->xpathLiteral($sSelector); $oElements = $this->getMinkSession()->getPage()->findAll('named', array('link', $sParsedSelector)); if (empty($oElements)) { $aSelectorParts = explode(' ', $sSelector); $aSelectorParts = array_map(array($this->getMinkSession()->getSelectorsHandler(), 'xpathLiteral'), $aSelectorParts); $sFormedSelector = "//a[contains(.," . implode(") and contains(.,", $aSelectorParts) . ")]"; $oElements = $this->getMinkSession()->getPage()->findAll('xpath', $sFormedSelector); } return $this->_getExactMatch($oElements, $sSelector); }
php
protected function _getElementByLink($sSelector) { $sSelector = str_replace('link=', '', $sSelector); $sParsedSelector = $this->getMinkSession()->getSelectorsHandler()->xpathLiteral($sSelector); $oElements = $this->getMinkSession()->getPage()->findAll('named', array('link', $sParsedSelector)); if (empty($oElements)) { $aSelectorParts = explode(' ', $sSelector); $aSelectorParts = array_map(array($this->getMinkSession()->getSelectorsHandler(), 'xpathLiteral'), $aSelectorParts); $sFormedSelector = "//a[contains(.," . implode(") and contains(.,", $aSelectorParts) . ")]"; $oElements = $this->getMinkSession()->getPage()->findAll('xpath', $sFormedSelector); } return $this->_getExactMatch($oElements, $sSelector); }
[ "protected", "function", "_getElementByLink", "(", "$", "sSelector", ")", "{", "$", "sSelector", "=", "str_replace", "(", "'link='", ",", "''", ",", "$", "sSelector", ")", ";", "$", "sParsedSelector", "=", "$", "this", "->", "getMinkSession", "(", ")", "->...
Returns element by given link @param string $sSelector @return mixed
[ "Returns", "element", "by", "given", "link" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MinkWrapper.php#L850-L866
45,041
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/oxListConstructor.php
oxListConstructor.callFunction
public function callFunction($functionName, $parameters) { if ($functionName == 'getList') { $oObject = $this->getObject(); $mResponse = $this->_formArrayFromList($oObject->getList()); } else { $mResponse = parent::callFunction($functionName, $parameters); } return $mResponse; }
php
public function callFunction($functionName, $parameters) { if ($functionName == 'getList') { $oObject = $this->getObject(); $mResponse = $this->_formArrayFromList($oObject->getList()); } else { $mResponse = parent::callFunction($functionName, $parameters); } return $mResponse; }
[ "public", "function", "callFunction", "(", "$", "functionName", ",", "$", "parameters", ")", "{", "if", "(", "$", "functionName", "==", "'getList'", ")", "{", "$", "oObject", "=", "$", "this", "->", "getObject", "(", ")", ";", "$", "mResponse", "=", "$...
Calls object function with given parameters @param string $functionName @param array $parameters @return mixed
[ "Calls", "object", "function", "with", "given", "parameters" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/oxListConstructor.php#L32-L42
45,042
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/oxListConstructor.php
oxListConstructor._formArrayFromList
protected function _formArrayFromList($oList) { $aData = array(); foreach ($oList as $sKey => $object) { $aData[$sKey] = $this->_getObjectFieldValues($object); } return $aData; }
php
protected function _formArrayFromList($oList) { $aData = array(); foreach ($oList as $sKey => $object) { $aData[$sKey] = $this->_getObjectFieldValues($object); } return $aData; }
[ "protected", "function", "_formArrayFromList", "(", "$", "oList", ")", "{", "$", "aData", "=", "array", "(", ")", ";", "foreach", "(", "$", "oList", "as", "$", "sKey", "=>", "$", "object", ")", "{", "$", "aData", "[", "$", "sKey", "]", "=", "$", ...
Returns formed array with data from given list @param \OxidEsales\Eshop\Core\Model\ListModel|Iterator $oList @return array
[ "Returns", "formed", "array", "with", "data", "from", "given", "list" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/oxListConstructor.php#L50-L58
45,043
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/oxListConstructor.php
oxListConstructor._getObjectFieldValues
protected function _getObjectFieldValues($object) { $result = array(); $fields = $object->getFieldNames(); $tableName = $object->getCoreTableName(); foreach ($fields as $field) { $fieldName = $tableName.'__'.$field; $result[$field] = $object->$fieldName->value; } return $result; }
php
protected function _getObjectFieldValues($object) { $result = array(); $fields = $object->getFieldNames(); $tableName = $object->getCoreTableName(); foreach ($fields as $field) { $fieldName = $tableName.'__'.$field; $result[$field] = $object->$fieldName->value; } return $result; }
[ "protected", "function", "_getObjectFieldValues", "(", "$", "object", ")", "{", "$", "result", "=", "array", "(", ")", ";", "$", "fields", "=", "$", "object", "->", "getFieldNames", "(", ")", ";", "$", "tableName", "=", "$", "object", "->", "getCoreTable...
Returns object field values @param \OxidEsales\Eshop\Core\Model\BaseModel|object $object @return array
[ "Returns", "object", "field", "values" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/oxListConstructor.php#L67-L78
45,044
OXID-eSales/testing_library
library/Services/ThemeSwitcher/ThemeSwitcher.php
ThemeSwitcher.init
public function init($request) { $themeName = $request->getParameter('themeName'); $shopId = $request->getParameter('shp'); $currentShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId(); \OxidEsales\Eshop\Core\Registry::getConfig()->setShopId($shopId); $theme = oxNew( \OxidEsales\Eshop\Core\Theme::class); $theme->load($themeName); $theme->activate(); \OxidEsales\Eshop\Core\Registry::getConfig()->setShopId($currentShopId); }
php
public function init($request) { $themeName = $request->getParameter('themeName'); $shopId = $request->getParameter('shp'); $currentShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId(); \OxidEsales\Eshop\Core\Registry::getConfig()->setShopId($shopId); $theme = oxNew( \OxidEsales\Eshop\Core\Theme::class); $theme->load($themeName); $theme->activate(); \OxidEsales\Eshop\Core\Registry::getConfig()->setShopId($currentShopId); }
[ "public", "function", "init", "(", "$", "request", ")", "{", "$", "themeName", "=", "$", "request", "->", "getParameter", "(", "'themeName'", ")", ";", "$", "shopId", "=", "$", "request", "->", "getParameter", "(", "'shp'", ")", ";", "$", "currentShopId"...
Initiates service. @param \OxidEsales\TestingLibrary\Services\Library\Request $request
[ "Initiates", "service", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ThemeSwitcher/ThemeSwitcher.php#L28-L41
45,045
OXID-eSales/testing_library
library/ModuleLoader.php
ModuleLoader.activateModules
public function activateModules($modulesToActivate) { $this->clearModuleChain(); // First load all needed config options before the module will be installed. $this->prepareModulesForActivation(); foreach ($modulesToActivate as $modulePath) { $this->installModule($modulePath); } // Reset reverse proxy backend as module activation sets it to flush mode. \OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Cache\ReverseProxy\ReverseProxyBackend::class, null); }
php
public function activateModules($modulesToActivate) { $this->clearModuleChain(); // First load all needed config options before the module will be installed. $this->prepareModulesForActivation(); foreach ($modulesToActivate as $modulePath) { $this->installModule($modulePath); } // Reset reverse proxy backend as module activation sets it to flush mode. \OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Cache\ReverseProxy\ReverseProxyBackend::class, null); }
[ "public", "function", "activateModules", "(", "$", "modulesToActivate", ")", "{", "$", "this", "->", "clearModuleChain", "(", ")", ";", "// First load all needed config options before the module will be installed.", "$", "this", "->", "prepareModulesForActivation", "(", ")"...
Loads modules and activates them. @param array $modulesToActivate Array of modules to load.
[ "Loads", "modules", "and", "activates", "them", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ModuleLoader.php#L42-L54
45,046
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorer.php
DatabaseRestorer.restoreTable
public function restoreTable($table, $restoreColumns = false) { $dumpChecksum = $this->getDumpChecksum(); $currentChecksum = $this->getTableChecksum($table); if ($currentChecksum[$table] === $dumpChecksum[$table]) { return false; } if ($restoreColumns) { $this->restoreColumns($table); } $this->resetTable($table); return true; }
php
public function restoreTable($table, $restoreColumns = false) { $dumpChecksum = $this->getDumpChecksum(); $currentChecksum = $this->getTableChecksum($table); if ($currentChecksum[$table] === $dumpChecksum[$table]) { return false; } if ($restoreColumns) { $this->restoreColumns($table); } $this->resetTable($table); return true; }
[ "public", "function", "restoreTable", "(", "$", "table", ",", "$", "restoreColumns", "=", "false", ")", "{", "$", "dumpChecksum", "=", "$", "this", "->", "getDumpChecksum", "(", ")", ";", "$", "currentChecksum", "=", "$", "this", "->", "getTableChecksum", ...
Restores table records @param string $table Table to restore @param bool $restoreColumns whether to check and restore table columns @return bool whether table had changes
[ "Restores", "table", "records" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorer.php#L96-L111
45,047
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorer.php
DatabaseRestorer.resetTable
public function resetTable($table) { $data = $this->getDumpData(); $this->executeQuery("TRUNCATE TABLE `$table`"); if (isset($data[$table]["_sql_"])) { $this->executeQuery($data[$table]["_sql_"]); } }
php
public function resetTable($table) { $data = $this->getDumpData(); $this->executeQuery("TRUNCATE TABLE `$table`"); if (isset($data[$table]["_sql_"])) { $this->executeQuery($data[$table]["_sql_"]); } }
[ "public", "function", "resetTable", "(", "$", "table", ")", "{", "$", "data", "=", "$", "this", "->", "getDumpData", "(", ")", ";", "$", "this", "->", "executeQuery", "(", "\"TRUNCATE TABLE `$table`\"", ")", ";", "if", "(", "isset", "(", "$", "data", "...
Drops all table records and adds them back from dump @param string $table
[ "Drops", "all", "table", "records", "and", "adds", "them", "back", "from", "dump" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorer.php#L119-L127
45,048
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorer.php
DatabaseRestorer.getTableColumns
private function getTableColumns($tables) { $database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $columns = array(); foreach ($tables as $table) { $tmp = $database->getAll("SHOW COLUMNS FROM `$table`"); foreach ($tmp as $sub) { $key = $sub['Field']; unset($sub['Field']); $columns[$table][$key] = $sub; } } return $columns; }
php
private function getTableColumns($tables) { $database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $columns = array(); foreach ($tables as $table) { $tmp = $database->getAll("SHOW COLUMNS FROM `$table`"); foreach ($tmp as $sub) { $key = $sub['Field']; unset($sub['Field']); $columns[$table][$key] = $sub; } } return $columns; }
[ "private", "function", "getTableColumns", "(", "$", "tables", ")", "{", "$", "database", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getMaster", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseP...
Returns columns array for given tables. @param array $tables @return array
[ "Returns", "columns", "array", "for", "given", "tables", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorer.php#L135-L150
45,049
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorer.php
DatabaseRestorer.getTableData
private function getTableData($tables) { $db = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $data = array(); foreach ($tables as $table) { $data[$table] = array(); $result = $db->select("SELECT * FROM `${table}`"); if ($result && $result->count() > 0) { $rows = array(); while (!$result->EOF) { $rows[] = $result->fields; $result->fetchRow(); } $data[$table]["_sql_"] = $this->getInsertString($rows, $table); } } return $data; }
php
private function getTableData($tables) { $db = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $data = array(); foreach ($tables as $table) { $data[$table] = array(); $result = $db->select("SELECT * FROM `${table}`"); if ($result && $result->count() > 0) { $rows = array(); while (!$result->EOF) { $rows[] = $result->fields; $result->fetchRow(); } $data[$table]["_sql_"] = $this->getInsertString($rows, $table); } } return $data; }
[ "private", "function", "getTableData", "(", "$", "tables", ")", "{", "$", "db", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getMaster", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider",...
Returns data for given tables. @param array $tables @return array
[ "Returns", "data", "for", "given", "tables", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorer.php#L158-L180
45,050
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorer.php
DatabaseRestorer.executeQuery
private function executeQuery($sQuery) { $oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(); $oDB->execute($sQuery); }
php
private function executeQuery($sQuery) { $oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(); $oDB->execute($sQuery); }
[ "private", "function", "executeQuery", "(", "$", "sQuery", ")", "{", "$", "oDB", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getMaster", "(", ")", ";", "$", "oDB", "->", "execute", "(", "$", "sQuery", ")", ";"...
executes given query. @param string $sQuery
[ "executes", "given", "query", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorer.php#L218-L222
45,051
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorer.php
DatabaseRestorer.getInsertString
private function getInsertString($rows, $table) { $columns = array(); $values = array(); foreach ($rows as $row) { if (empty($columns)) { $columns = array_keys($row); } $rowValues = array(); foreach ($row as $entry) { $entry = is_null($entry) ? "NULL" : \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->quote($entry); $rowValues[] = $entry; } $values[] = "(". implode(", ", $rowValues).")"; } $query = "INSERT INTO $table "; $query .= "(`".implode("`, `", $columns)."`) VALUES ".implode(", ", $values); return $query; }
php
private function getInsertString($rows, $table) { $columns = array(); $values = array(); foreach ($rows as $row) { if (empty($columns)) { $columns = array_keys($row); } $rowValues = array(); foreach ($row as $entry) { $entry = is_null($entry) ? "NULL" : \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->quote($entry); $rowValues[] = $entry; } $values[] = "(". implode(", ", $rowValues).")"; } $query = "INSERT INTO $table "; $query .= "(`".implode("`, `", $columns)."`) VALUES ".implode(", ", $values); return $query; }
[ "private", "function", "getInsertString", "(", "$", "rows", ",", "$", "table", ")", "{", "$", "columns", "=", "array", "(", ")", ";", "$", "values", "=", "array", "(", ")", ";", "foreach", "(", "$", "rows", "as", "$", "row", ")", "{", "if", "(", ...
Creates a insert string to insert the given row into to given table @param array $rows a array of the current row in the db @param string $table the name of the current table @return string a sql insert string for the given row
[ "Creates", "a", "insert", "string", "to", "insert", "the", "given", "row", "into", "to", "given", "table" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorer.php#L265-L285
45,052
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorer.php
DatabaseRestorer.getTableChecksum
private function getTableChecksum($aTables) { $aTables = is_array($aTables) ? $aTables : array($aTables); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $sSelect = 'CHECKSUM TABLE `' . implode("`, `", $aTables) . '`'; $aResults = $oDb->getAll($sSelect); $sDbName = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('dbName'); $aChecksum = array(); foreach ($aResults as $aResult) { $sTable = str_replace($sDbName . '.', '', $aResult['Table']); $aChecksum[$sTable] = $aResult['Checksum']; } return $aChecksum; }
php
private function getTableChecksum($aTables) { $aTables = is_array($aTables) ? $aTables : array($aTables); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $sSelect = 'CHECKSUM TABLE `' . implode("`, `", $aTables) . '`'; $aResults = $oDb->getAll($sSelect); $sDbName = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('dbName'); $aChecksum = array(); foreach ($aResults as $aResult) { $sTable = str_replace($sDbName . '.', '', $aResult['Table']); $aChecksum[$sTable] = $aResult['Checksum']; } return $aChecksum; }
[ "private", "function", "getTableChecksum", "(", "$", "aTables", ")", "{", "$", "aTables", "=", "is_array", "(", "$", "aTables", ")", "?", "$", "aTables", ":", "array", "(", "$", "aTables", ")", ";", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", ...
Converts a string to UTF format. @param array|string $aTables @return array
[ "Converts", "a", "string", "to", "UTF", "format", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorer.php#L294-L309
45,053
OXID-eSales/testing_library
library/Services/Library/FileUploader.php
FileUploader.uploadFile
public function uploadFile($sFileIndex, $sLocation, $blOverwrite = true) { $aFileInfo = $this->_getFileInfo($sFileIndex); if (!$this->_checkFile($aFileInfo)) { throw new Exception("File with index '$sFileIndex' does not exist or error occurred while downloading it"); } return $this->_moveUploadedFile($aFileInfo, $sLocation, $blOverwrite); }
php
public function uploadFile($sFileIndex, $sLocation, $blOverwrite = true) { $aFileInfo = $this->_getFileInfo($sFileIndex); if (!$this->_checkFile($aFileInfo)) { throw new Exception("File with index '$sFileIndex' does not exist or error occurred while downloading it"); } return $this->_moveUploadedFile($aFileInfo, $sLocation, $blOverwrite); }
[ "public", "function", "uploadFile", "(", "$", "sFileIndex", ",", "$", "sLocation", ",", "$", "blOverwrite", "=", "true", ")", "{", "$", "aFileInfo", "=", "$", "this", "->", "_getFileInfo", "(", "$", "sFileIndex", ")", ";", "if", "(", "!", "$", "this", ...
Uploads file to given location. @param string $sFileIndex File index @param string $sLocation Location where to put uploaded file @param bool $blOverwrite Whether to overwrite existing file @throws Exception Throws exception if file with given index does not exist. @return bool Whether upload succeeded
[ "Uploads", "file", "to", "given", "location", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/FileUploader.php#L26-L35
45,054
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorerLocal.php
DatabaseRestorerLocal.getDumpFolderPath
private function getDumpFolderPath() { if (is_null($this->tmpFilePath)) { $dumpName = $this->getDumpName(); $databaseName = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('dbName'); $this->tmpFilePath = $this->tempDirectory . '/' . $databaseName . '_dbdump/'. $dumpName .'/'; $this->getFileHandler()->createDirectory($this->tmpFilePath); } return $this->tmpFilePath; }
php
private function getDumpFolderPath() { if (is_null($this->tmpFilePath)) { $dumpName = $this->getDumpName(); $databaseName = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('dbName'); $this->tmpFilePath = $this->tempDirectory . '/' . $databaseName . '_dbdump/'. $dumpName .'/'; $this->getFileHandler()->createDirectory($this->tmpFilePath); } return $this->tmpFilePath; }
[ "private", "function", "getDumpFolderPath", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "tmpFilePath", ")", ")", "{", "$", "dumpName", "=", "$", "this", "->", "getDumpName", "(", ")", ";", "$", "databaseName", "=", "\\", "OxidEsales", ...
Returns dump file path @return string
[ "Returns", "dump", "file", "path" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorerLocal.php#L154-L164
45,055
OXID-eSales/testing_library
library/helpers/ExceptionLogFileHelper.php
ExceptionLogFileHelper.getExceptionLogFileContent
public function getExceptionLogFileContent() { $fileCreated = false; /** Suppress the warning, which is emitted, if the file does not exist */ if ($fileDoesNotExist = !@file_exists($this->exceptionLogFile)) { $fileCreated = touch($this->exceptionLogFile); } if ($fileDoesNotExist && !$fileCreated) { throw new \OxidEsales\Eshop\Core\Exception\StandardException('Empty file ' . $this->exceptionLogFile . ' could not have been be created'); } $logFileContent = file_get_contents($this->exceptionLogFile); if (false === $logFileContent) { throw new \OxidEsales\Eshop\Core\Exception\StandardException('File ' . $this->exceptionLogFile . ' could not be read'); } return $logFileContent; }
php
public function getExceptionLogFileContent() { $fileCreated = false; /** Suppress the warning, which is emitted, if the file does not exist */ if ($fileDoesNotExist = !@file_exists($this->exceptionLogFile)) { $fileCreated = touch($this->exceptionLogFile); } if ($fileDoesNotExist && !$fileCreated) { throw new \OxidEsales\Eshop\Core\Exception\StandardException('Empty file ' . $this->exceptionLogFile . ' could not have been be created'); } $logFileContent = file_get_contents($this->exceptionLogFile); if (false === $logFileContent) { throw new \OxidEsales\Eshop\Core\Exception\StandardException('File ' . $this->exceptionLogFile . ' could not be read'); } return $logFileContent; }
[ "public", "function", "getExceptionLogFileContent", "(", ")", "{", "$", "fileCreated", "=", "false", ";", "/** Suppress the warning, which is emitted, if the file does not exist */", "if", "(", "$", "fileDoesNotExist", "=", "!", "@", "file_exists", "(", "$", "this", "->...
Return the complete content of the exception log file as a string. @return string Content of the exception log file @throws \OxidEsales\Eshop\Core\Exception\StandardException if log file contend could not be read
[ "Return", "the", "complete", "content", "of", "the", "exception", "log", "file", "as", "a", "string", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/helpers/ExceptionLogFileHelper.php#L45-L63
45,056
OXID-eSales/testing_library
library/helpers/ExceptionLogFileHelper.php
ExceptionLogFileHelper.getParsedExceptions
public function getParsedExceptions() { $parsedExceptions = []; $exceptions = $this->getExceptionLinesFromLogFile(); foreach ($exceptions as $exception) { $parsedExceptions[] = str_replace('\\\\', '\\', $exception); } return $parsedExceptions; }
php
public function getParsedExceptions() { $parsedExceptions = []; $exceptions = $this->getExceptionLinesFromLogFile(); foreach ($exceptions as $exception) { $parsedExceptions[] = str_replace('\\\\', '\\', $exception); } return $parsedExceptions; }
[ "public", "function", "getParsedExceptions", "(", ")", "{", "$", "parsedExceptions", "=", "[", "]", ";", "$", "exceptions", "=", "$", "this", "->", "getExceptionLinesFromLogFile", "(", ")", ";", "foreach", "(", "$", "exceptions", "as", "$", "exception", ")",...
Return an array of arrays with parsed exception lines @return array
[ "Return", "an", "array", "of", "arrays", "with", "parsed", "exception", "lines" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/helpers/ExceptionLogFileHelper.php#L87-L97
45,057
OXID-eSales/testing_library
library/helpers/ExceptionLogFileHelper.php
ExceptionLogFileHelper.getExceptionLinesFromLogFile
protected function getExceptionLinesFromLogFile() { $exceptionLogLines = file($this->exceptionLogFile, FILE_IGNORE_NEW_LINES); if (false === $exceptionLogLines) { throw new \OxidEsales\Eshop\Core\Exception\StandardException('File ' . $this->exceptionLogFile . ' could not be read'); } $exceptionEntries = array_filter( $exceptionLogLines, function ($entry) { return false !== strpos($entry, '.ERROR') && false !== strpos($entry, 'Exception'); } ); return $exceptionEntries; }
php
protected function getExceptionLinesFromLogFile() { $exceptionLogLines = file($this->exceptionLogFile, FILE_IGNORE_NEW_LINES); if (false === $exceptionLogLines) { throw new \OxidEsales\Eshop\Core\Exception\StandardException('File ' . $this->exceptionLogFile . ' could not be read'); } $exceptionEntries = array_filter( $exceptionLogLines, function ($entry) { return false !== strpos($entry, '.ERROR') && false !== strpos($entry, 'Exception'); } ); return $exceptionEntries; }
[ "protected", "function", "getExceptionLinesFromLogFile", "(", ")", "{", "$", "exceptionLogLines", "=", "file", "(", "$", "this", "->", "exceptionLogFile", ",", "FILE_IGNORE_NEW_LINES", ")", ";", "if", "(", "false", "===", "$", "exceptionLogLines", ")", "{", "thr...
Return an array, which only contains the lines with information about the exception, not the whole stacktrace @return array @throws \OxidEsales\Eshop\Core\Exception\StandardException
[ "Return", "an", "array", "which", "only", "contains", "the", "lines", "with", "information", "about", "the", "exception", "not", "the", "whole", "stacktrace" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/helpers/ExceptionLogFileHelper.php#L106-L121
45,058
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/ShopObjectConstructor.php
ShopObjectConstructor.setActiveShop
protected function setActiveShop($shopId) { if ($shopId && $this->getServiceConfig()->getShopEdition() == 'EE') { \OxidEsales\Eshop\Core\Registry::getConfig()->setShopId($shopId); } }
php
protected function setActiveShop($shopId) { if ($shopId && $this->getServiceConfig()->getShopEdition() == 'EE') { \OxidEsales\Eshop\Core\Registry::getConfig()->setShopId($shopId); } }
[ "protected", "function", "setActiveShop", "(", "$", "shopId", ")", "{", "if", "(", "$", "shopId", "&&", "$", "this", "->", "getServiceConfig", "(", ")", "->", "getShopEdition", "(", ")", "==", "'EE'", ")", "{", "\\", "OxidEsales", "\\", "Eshop", "\\", ...
Switches active shop @param string $shopId
[ "Switches", "active", "shop" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/ShopObjectConstructor.php#L81-L86
45,059
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/ShopObjectConstructor.php
ShopObjectConstructor.setActiveLanguage
protected function setActiveLanguage($language) { $languages = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageIds(); $languageId = array_search($language, $languages); if ($languageId === false) { throw new Exception("Language $language was not found or is not active in shop"); } \OxidEsales\Eshop\Core\Registry::getLang()->setBaseLanguage($languageId); }
php
protected function setActiveLanguage($language) { $languages = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageIds(); $languageId = array_search($language, $languages); if ($languageId === false) { throw new Exception("Language $language was not found or is not active in shop"); } \OxidEsales\Eshop\Core\Registry::getLang()->setBaseLanguage($languageId); }
[ "protected", "function", "setActiveLanguage", "(", "$", "language", ")", "{", "$", "languages", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getLang", "(", ")", "->", "getLanguageIds", "(", ")", ";", "$", "languageId", "="...
Switches active language @param string $language @throws Exception
[ "Switches", "active", "language" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/ShopObjectConstructor.php#L95-L103
45,060
OXID-eSales/testing_library
library/FileCopier.php
FileCopier.copyFiles
public function copyFiles($source, $target, $setPermissions = false) { if (strpos($target, ':') !== false && strpos($target, '@') !== false) { if (is_dir($source)) { $source .= "/."; } $command = "scp -rp " . escapeshellarg($source) . " " . escapeshellarg($target); if ($setPermissions) { $command = "rsync -rp --perms --chmod=u+rwx,g+rwx,o+rwx " . escapeshellarg($source) . " " . escapeshellarg($target); } } else { $command = "cp -frT " . escapeshellarg($source) . " " . escapeshellarg($target); if ($setPermissions) { $command .= " && chmod 777 " . escapeshellarg($target); } } $this->executeCommand($command); }
php
public function copyFiles($source, $target, $setPermissions = false) { if (strpos($target, ':') !== false && strpos($target, '@') !== false) { if (is_dir($source)) { $source .= "/."; } $command = "scp -rp " . escapeshellarg($source) . " " . escapeshellarg($target); if ($setPermissions) { $command = "rsync -rp --perms --chmod=u+rwx,g+rwx,o+rwx " . escapeshellarg($source) . " " . escapeshellarg($target); } } else { $command = "cp -frT " . escapeshellarg($source) . " " . escapeshellarg($target); if ($setPermissions) { $command .= " && chmod 777 " . escapeshellarg($target); } } $this->executeCommand($command); }
[ "public", "function", "copyFiles", "(", "$", "source", ",", "$", "target", ",", "$", "setPermissions", "=", "false", ")", "{", "if", "(", "strpos", "(", "$", "target", ",", "':'", ")", "!==", "false", "&&", "strpos", "(", "$", "target", ",", "'@'", ...
Copy files to shop @param string $source File or directory to copy. @param string $target Path where to copy. @param bool $setPermissions Whether to set given Target permissions to 777.
[ "Copy", "files", "to", "shop" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/FileCopier.php#L24-L41
45,061
OXID-eSales/testing_library
library/FileCopier.php
FileCopier.createEmptyDirectory
public function createEmptyDirectory($directory) { if (!is_dir($directory)) { mkdir($directory, 0777, true); } else { $this->deleteTree($directory, false); } }
php
public function createEmptyDirectory($directory) { if (!is_dir($directory)) { mkdir($directory, 0777, true); } else { $this->deleteTree($directory, false); } }
[ "public", "function", "createEmptyDirectory", "(", "$", "directory", ")", "{", "if", "(", "!", "is_dir", "(", "$", "directory", ")", ")", "{", "mkdir", "(", "$", "directory", ",", "0777", ",", "true", ")", ";", "}", "else", "{", "$", "this", "->", ...
Creates new directory if it does not exists, if exists - clears its content. @param string $directory
[ "Creates", "new", "directory", "if", "it", "does", "not", "exists", "if", "exists", "-", "clears", "its", "content", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/FileCopier.php#L48-L55
45,062
OXID-eSales/testing_library
library/FileCopier.php
FileCopier.deleteTree
protected function deleteTree($directory, $removeBaseDir = false) { $files = array_diff(scandir($directory), array('.', '..')); foreach ($files as $file) { (is_dir("$directory/$file")) ? $this->deleteTree("$directory/$file", true) : @unlink("$directory/$file"); } if ($removeBaseDir) { @rmdir($directory); } }
php
protected function deleteTree($directory, $removeBaseDir = false) { $files = array_diff(scandir($directory), array('.', '..')); foreach ($files as $file) { (is_dir("$directory/$file")) ? $this->deleteTree("$directory/$file", true) : @unlink("$directory/$file"); } if ($removeBaseDir) { @rmdir($directory); } }
[ "protected", "function", "deleteTree", "(", "$", "directory", ",", "$", "removeBaseDir", "=", "false", ")", "{", "$", "files", "=", "array_diff", "(", "scandir", "(", "$", "directory", ")", ",", "array", "(", "'.'", ",", "'..'", ")", ")", ";", "foreach...
Deletes given directory content @param string $directory Path to directory. @param bool $removeBaseDir Whether to delete base directory.
[ "Deletes", "given", "directory", "content" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/FileCopier.php#L63-L73
45,063
OXID-eSales/testing_library
library/Services/ClearCache/ClearCache.php
ClearCache.init
public function init($request) { $cache = new Cache(); if ($this->getServiceConfig()->getShopEdition() === ServiceConfig::EDITION_ENTERPRISE) { $cache->clearCacheBackend(); if ($request->getParameter('clearVarnish')) { $cache->clearReverseProxyCache(); } } $cache->clearTemporaryDirectory(); }
php
public function init($request) { $cache = new Cache(); if ($this->getServiceConfig()->getShopEdition() === ServiceConfig::EDITION_ENTERPRISE) { $cache->clearCacheBackend(); if ($request->getParameter('clearVarnish')) { $cache->clearReverseProxyCache(); } } $cache->clearTemporaryDirectory(); }
[ "public", "function", "init", "(", "$", "request", ")", "{", "$", "cache", "=", "new", "Cache", "(", ")", ";", "if", "(", "$", "this", "->", "getServiceConfig", "(", ")", "->", "getShopEdition", "(", ")", "===", "ServiceConfig", "::", "EDITION_ENTERPRISE...
Clears shop cache. @param Request $request
[ "Clears", "shop", "cache", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ClearCache/ClearCache.php#L34-L44
45,064
OXID-eSales/testing_library
library/Services/ShopPreparation/ShopPreparation.php
ShopPreparation.init
public function init($request) { if ($file = $request->getUploadedFile('importSql')) { $databaseHandler = $this->getDatabaseHandler(); $databaseHandler->import($file); } if ($request->getParameter('dumpDB')) { $databaseRestorer = $this->getDatabaseRestorer(); $databaseRestorer->dumpDB($request->getParameter('dump-prefix')); } if ($request->getParameter('restoreDB')) { $databaseRestorer = $this->getDatabaseRestorer(); $databaseRestorer->restoreDB($request->getParameter('dump-prefix')); } }
php
public function init($request) { if ($file = $request->getUploadedFile('importSql')) { $databaseHandler = $this->getDatabaseHandler(); $databaseHandler->import($file); } if ($request->getParameter('dumpDB')) { $databaseRestorer = $this->getDatabaseRestorer(); $databaseRestorer->dumpDB($request->getParameter('dump-prefix')); } if ($request->getParameter('restoreDB')) { $databaseRestorer = $this->getDatabaseRestorer(); $databaseRestorer->restoreDB($request->getParameter('dump-prefix')); } }
[ "public", "function", "init", "(", "$", "request", ")", "{", "if", "(", "$", "file", "=", "$", "request", "->", "getUploadedFile", "(", "'importSql'", ")", ")", "{", "$", "databaseHandler", "=", "$", "this", "->", "getDatabaseHandler", "(", ")", ";", "...
Handles request parameters. @param Request $request
[ "Handles", "request", "parameters", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopPreparation/ShopPreparation.php#L47-L63
45,065
OXID-eSales/testing_library
library/Bootstrap/SeleniumBootstrap.php
SeleniumBootstrap.init
public function init() { parent::init(); define("SHOP_EDITION", ($this->getTestConfig()->getShopEdition() == 'EE') ? 'EE' : 'PE_CE'); $this->prepareScreenShots(); $this->copyTestFilesToShop(); /** @var \OxidEsales\Eshop\Core\Config $config */ $config = oxNew(\OxidEsales\Eshop\Core\Config::class); \OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Config::class, $config); register_shutdown_function(function () { AcceptanceTestCase::stopMinkSession(); }); }
php
public function init() { parent::init(); define("SHOP_EDITION", ($this->getTestConfig()->getShopEdition() == 'EE') ? 'EE' : 'PE_CE'); $this->prepareScreenShots(); $this->copyTestFilesToShop(); /** @var \OxidEsales\Eshop\Core\Config $config */ $config = oxNew(\OxidEsales\Eshop\Core\Config::class); \OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Config::class, $config); register_shutdown_function(function () { AcceptanceTestCase::stopMinkSession(); }); }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "define", "(", "\"SHOP_EDITION\"", ",", "(", "$", "this", "->", "getTestConfig", "(", ")", "->", "getShopEdition", "(", ")", "==", "'EE'", ")", "?", "'EE'", ":", "'PE...
Initiates shop before testing.
[ "Initiates", "shop", "before", "testing", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Bootstrap/SeleniumBootstrap.php#L20-L36
45,066
OXID-eSales/testing_library
library/Bootstrap/SeleniumBootstrap.php
SeleniumBootstrap.prepareScreenShots
public function prepareScreenShots() { $screenShotsPath = $this->getTestConfig()->getScreenShotsPath(); if ($screenShotsPath && !is_dir($screenShotsPath)) { mkdir($screenShotsPath, 0777, true); } }
php
public function prepareScreenShots() { $screenShotsPath = $this->getTestConfig()->getScreenShotsPath(); if ($screenShotsPath && !is_dir($screenShotsPath)) { mkdir($screenShotsPath, 0777, true); } }
[ "public", "function", "prepareScreenShots", "(", ")", "{", "$", "screenShotsPath", "=", "$", "this", "->", "getTestConfig", "(", ")", "->", "getScreenShotsPath", "(", ")", ";", "if", "(", "$", "screenShotsPath", "&&", "!", "is_dir", "(", "$", "screenShotsPat...
Creates screenshots directory if it does not exists.
[ "Creates", "screenshots", "directory", "if", "it", "does", "not", "exists", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Bootstrap/SeleniumBootstrap.php#L41-L47
45,067
amphp/websocket-server
src/Websocket.php
Websocket.multicast
final public function multicast(string $data, array $clientIds): Promise { return $this->multicastData($data, false, $clientIds); }
php
final public function multicast(string $data, array $clientIds): Promise { return $this->multicastData($data, false, $clientIds); }
[ "final", "public", "function", "multicast", "(", "string", "$", "data", ",", "array", "$", "clientIds", ")", ":", "Promise", "{", "return", "$", "this", "->", "multicastData", "(", "$", "data", ",", "false", ",", "$", "clientIds", ")", ";", "}" ]
Send a UTF-8 text message to a set of clients. @param string $data Data to send. @param string[] $clientIds Array of client IDs. @return \Amp\Promise<int>
[ "Send", "a", "UTF", "-", "8", "text", "message", "to", "a", "set", "of", "clients", "." ]
eb666a3546ab90588064a65fd07656bb7b8f662d
https://github.com/amphp/websocket-server/blob/eb666a3546ab90588064a65fd07656bb7b8f662d/src/Websocket.php#L344-L347
45,068
amphp/websocket-server
src/Websocket.php
Websocket.multicastBinary
final public function multicastBinary(string $data, array $clientIds): Promise { return $this->multicastData($data, true, $clientIds); }
php
final public function multicastBinary(string $data, array $clientIds): Promise { return $this->multicastData($data, true, $clientIds); }
[ "final", "public", "function", "multicastBinary", "(", "string", "$", "data", ",", "array", "$", "clientIds", ")", ":", "Promise", "{", "return", "$", "this", "->", "multicastData", "(", "$", "data", ",", "true", ",", "$", "clientIds", ")", ";", "}" ]
Send a binary message to a set of clients. @param string $data Data to send. @param string[] $clientIds Array of client IDs. @return \Amp\Promise<int>
[ "Send", "a", "binary", "message", "to", "a", "set", "of", "clients", "." ]
eb666a3546ab90588064a65fd07656bb7b8f662d
https://github.com/amphp/websocket-server/blob/eb666a3546ab90588064a65fd07656bb7b8f662d/src/Websocket.php#L370-L373
45,069
Learnosity/learnosity-sdk-php
src/LearnositySdk/Utils/Json.php
Json.encode
public static function encode($array, $options = null) { $result = false; $highPrecisionFloatMap = static::getHighPrecisionFloatMap($array); if (version_compare(PHP_VERSION, '5.4', '>=')) { $jsonOptions = JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES; if (!empty($options)) { foreach ($options as $o) { $jsonOptions += $o; } } $result = json_encode($array, (int)$jsonOptions); } else { $result = json_encode($array); // Unicode fix: http://stackoverflow.com/a/2934602 $result = preg_replace_callback( '/\\\\u([0-9a-f]{4})/i', function ($match) { return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); }, $result ); // Escaped slashes fix $result = str_replace('\/', '/', $result); } foreach($highPrecisionFloatMap as $scientificValueString => $floatValueString) { // Replace all scientific values by equivalent floatValues $result = str_ireplace($scientificValueString, $floatValueString, $result); } return $result; }
php
public static function encode($array, $options = null) { $result = false; $highPrecisionFloatMap = static::getHighPrecisionFloatMap($array); if (version_compare(PHP_VERSION, '5.4', '>=')) { $jsonOptions = JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES; if (!empty($options)) { foreach ($options as $o) { $jsonOptions += $o; } } $result = json_encode($array, (int)$jsonOptions); } else { $result = json_encode($array); // Unicode fix: http://stackoverflow.com/a/2934602 $result = preg_replace_callback( '/\\\\u([0-9a-f]{4})/i', function ($match) { return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); }, $result ); // Escaped slashes fix $result = str_replace('\/', '/', $result); } foreach($highPrecisionFloatMap as $scientificValueString => $floatValueString) { // Replace all scientific values by equivalent floatValues $result = str_ireplace($scientificValueString, $floatValueString, $result); } return $result; }
[ "public", "static", "function", "encode", "(", "$", "array", ",", "$", "options", "=", "null", ")", "{", "$", "result", "=", "false", ";", "$", "highPrecisionFloatMap", "=", "static", "::", "getHighPrecisionFloatMap", "(", "$", "array", ")", ";", "if", "...
Encodes a PHP array into a JSON string. Has settings to unescape both slashes and unicode characters. @param array $array Value to convert to JSON @return string JSON encoded string
[ "Encodes", "a", "PHP", "array", "into", "a", "JSON", "string", ".", "Has", "settings", "to", "unescape", "both", "slashes", "and", "unicode", "characters", "." ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Utils/Json.php#L48-L81
45,070
Learnosity/learnosity-sdk-php
src/LearnositySdk/Utils/Json.php
Json.getFromFile
public static function getFromFile($path, $decode = false, $assoc = true) { if (is_readable($path)) { $json = utf8_encode(file_get_contents($path)); if ($decode) { $json = json_decode($json, $assoc); } return $json; } return false; }
php
public static function getFromFile($path, $decode = false, $assoc = true) { if (is_readable($path)) { $json = utf8_encode(file_get_contents($path)); if ($decode) { $json = json_decode($json, $assoc); } return $json; } return false; }
[ "public", "static", "function", "getFromFile", "(", "$", "path", ",", "$", "decode", "=", "false", ",", "$", "assoc", "=", "true", ")", "{", "if", "(", "is_readable", "(", "$", "path", ")", ")", "{", "$", "json", "=", "utf8_encode", "(", "file_get_co...
Trying to open a file and read json from there @param string $path path to the resource @param boolean $decode whether to decode @param boolean $assoc whether to decode to associative array @return mixed json string, json object, json array or false on failure
[ "Trying", "to", "open", "a", "file", "and", "read", "json", "from", "there" ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Utils/Json.php#L90-L100
45,071
Learnosity/learnosity-sdk-php
src/LearnositySdk/Utils/Json.php
Json.getHighPrecisionFloatMap
private static function getHighPrecisionFloatMap($value) { if (!is_array($value)) { return static::getFloatMap($value); } $floatMap = []; foreach ($value as $entry) { $floatMap = array_merge(static::getHighPrecisionFloatMap($entry), $floatMap); } return $floatMap; }
php
private static function getHighPrecisionFloatMap($value) { if (!is_array($value)) { return static::getFloatMap($value); } $floatMap = []; foreach ($value as $entry) { $floatMap = array_merge(static::getHighPrecisionFloatMap($entry), $floatMap); } return $floatMap; }
[ "private", "static", "function", "getHighPrecisionFloatMap", "(", "$", "value", ")", "{", "if", "(", "!", "is_array", "(", "$", "value", ")", ")", "{", "return", "static", "::", "getFloatMap", "(", "$", "value", ")", ";", "}", "$", "floatMap", "=", "["...
This function builds up a map of float values in scientific notation and the equivalent float notations. json_encode encodes float values in scientific notation, but we want to make sure they are in float notation @param $value the $json to be encoded @return array mapping scientific values to float values
[ "This", "function", "builds", "up", "a", "map", "of", "float", "values", "in", "scientific", "notation", "and", "the", "equivalent", "float", "notations", ".", "json_encode", "encodes", "float", "values", "in", "scientific", "notation", "but", "we", "want", "t...
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Utils/Json.php#L122-L133
45,072
Learnosity/learnosity-sdk-php
src/LearnositySdk/Utils/Json.php
Json.getFloatMap
private static function getFloatMap($value) { if (!is_float($value)) { return []; } $stringValue = json_encode($value); // If the string value is in scientific notation it should have a negative exponent. Split it there. $explodedValue = explode('E-', strtoupper($stringValue)); if (count($explodedValue) === 2) { // The second entry tells us how many decimal places are created via the exponent $decimalsFromExponent = (int)$explodedValue[1]; // The base hase the form x.xxxxx where x is any digit. We need to get the number of decimals after // the dot $decimalsFromBase = 0; $explodedBase = explode('.', $explodedValue[0]); if (count($explodedBase) === 2) { $decimalsFromBase = strlen($explodedBase[1]); } $totalDecimals = $decimalsFromBase + $decimalsFromExponent; $stringValueAsFloat = number_format($value, $totalDecimals); return [ $stringValue => $stringValueAsFloat ]; } return []; }
php
private static function getFloatMap($value) { if (!is_float($value)) { return []; } $stringValue = json_encode($value); // If the string value is in scientific notation it should have a negative exponent. Split it there. $explodedValue = explode('E-', strtoupper($stringValue)); if (count($explodedValue) === 2) { // The second entry tells us how many decimal places are created via the exponent $decimalsFromExponent = (int)$explodedValue[1]; // The base hase the form x.xxxxx where x is any digit. We need to get the number of decimals after // the dot $decimalsFromBase = 0; $explodedBase = explode('.', $explodedValue[0]); if (count($explodedBase) === 2) { $decimalsFromBase = strlen($explodedBase[1]); } $totalDecimals = $decimalsFromBase + $decimalsFromExponent; $stringValueAsFloat = number_format($value, $totalDecimals); return [ $stringValue => $stringValueAsFloat ]; } return []; }
[ "private", "static", "function", "getFloatMap", "(", "$", "value", ")", "{", "if", "(", "!", "is_float", "(", "$", "value", ")", ")", "{", "return", "[", "]", ";", "}", "$", "stringValue", "=", "json_encode", "(", "$", "value", ")", ";", "// If the s...
Helper function to build up the float map @param $value @return array
[ "Helper", "function", "to", "build", "up", "the", "float", "map" ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Utils/Json.php#L141-L169
45,073
Learnosity/learnosity-sdk-php
src/LearnositySdk/Request/DataApi.php
DataApi.request
public function request($endpoint, $securityPacket, $secret, /* FIXME: array */ $requestPacket = [], $action = null) { if (!is_array($requestPacket)) { Init::warnDeprecated( __CLASS__ . '::' . __FUNCTION__ . ':' . ' $requestPacket should be a PHP array.' ); } $init = new Init('data', $securityPacket, $secret, $requestPacket, $action); $params = $init->generate(); return $this->remote->post($endpoint, $params, $this->remoteOptions); }
php
public function request($endpoint, $securityPacket, $secret, /* FIXME: array */ $requestPacket = [], $action = null) { if (!is_array($requestPacket)) { Init::warnDeprecated( __CLASS__ . '::' . __FUNCTION__ . ':' . ' $requestPacket should be a PHP array.' ); } $init = new Init('data', $securityPacket, $secret, $requestPacket, $action); $params = $init->generate(); return $this->remote->post($endpoint, $params, $this->remoteOptions); }
[ "public", "function", "request", "(", "$", "endpoint", ",", "$", "securityPacket", ",", "$", "secret", ",", "/* FIXME: array */", "$", "requestPacket", "=", "[", "]", ",", "$", "action", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "req...
Makes a single request to the data api @param string $endpoint URL to send the request @param array $securityPacket Security details @param string $secret Private key @param array $requestPacket Request packet @param string $action Action for the request @return Remote Instance of the Remote class, the response can be obtained with the getBody() method
[ "Makes", "a", "single", "request", "to", "the", "data", "api" ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Request/DataApi.php#L45-L57
45,074
Learnosity/learnosity-sdk-php
src/LearnositySdk/Request/DataApi.php
DataApi.requestRecursive
public function requestRecursive($endpoint, $securityPacket, $secret, /* FIXME: array */ $requestPacket = [], $action = null, $callback = null) { $response = array(); if (!is_array($requestPacket)) { Init::warnDeprecated( __CLASS__ . '::' . __FUNCTION__ . ':' . ' $requestPacket should be a PHP array.' ); } do { $request = $this->request($endpoint, $securityPacket, $secret, $requestPacket, $action); $data = Json::isJson($request->getBody()) ? json_decode($request->getBody(), true) : $request->getBody(); if ($data['meta']['status'] === true) { if (!empty($callback) && is_callable($callback)) { call_user_func($callback, $data); } else { $response = array_merge($response, $data['data']); } } else { throw new Exception(Json::encode($data)); } if (array_key_exists('next', $data['meta']) && !empty($data['data'])) { $requestPacket['next'] = $data['meta']['next']; } else { unset($requestPacket['next']); } } while (array_key_exists('next', $requestPacket)); return $response; }
php
public function requestRecursive($endpoint, $securityPacket, $secret, /* FIXME: array */ $requestPacket = [], $action = null, $callback = null) { $response = array(); if (!is_array($requestPacket)) { Init::warnDeprecated( __CLASS__ . '::' . __FUNCTION__ . ':' . ' $requestPacket should be a PHP array.' ); } do { $request = $this->request($endpoint, $securityPacket, $secret, $requestPacket, $action); $data = Json::isJson($request->getBody()) ? json_decode($request->getBody(), true) : $request->getBody(); if ($data['meta']['status'] === true) { if (!empty($callback) && is_callable($callback)) { call_user_func($callback, $data); } else { $response = array_merge($response, $data['data']); } } else { throw new Exception(Json::encode($data)); } if (array_key_exists('next', $data['meta']) && !empty($data['data'])) { $requestPacket['next'] = $data['meta']['next']; } else { unset($requestPacket['next']); } } while (array_key_exists('next', $requestPacket)); return $response; }
[ "public", "function", "requestRecursive", "(", "$", "endpoint", ",", "$", "securityPacket", ",", "$", "secret", ",", "/* FIXME: array */", "$", "requestPacket", "=", "[", "]", ",", "$", "action", "=", "null", ",", "$", "callback", "=", "null", ")", "{", ...
Makes a recursive request to the data api, dependant on whether 'next' is returned in the meta object @param string $endpoint URL to send the request @param array $securityPacket Security details @param string $secret Private key @param array $requestPacket Request packet @param string $action Action for the request @param mixed $callback Optional callback to execute instead of returning data @return array Array of all data requests or [] or using a callback
[ "Makes", "a", "recursive", "request", "to", "the", "data", "api", "dependant", "on", "whether", "next", "is", "returned", "in", "the", "meta", "object" ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Request/DataApi.php#L71-L102
45,075
Learnosity/learnosity-sdk-php
src/LearnositySdk/Request/Remote.php
Remote.normalizeRequestHeaders
private function normalizeRequestHeaders(array $headers) { // Explicitly set an empty Expect header, so that the server will not // respond with a "100 Continue" status code for large uploads. $emptyExpectHeader = 'Expect: '; $haveExpectHeader = false; for ($i = 0; $i < count($headers); $i++) { if ($this->isExpectHeader($headers[$i])) { // There is already an expect header - let's set it to empty $headers[$i] = $emptyExpectHeader; $haveExpectHeader = true; break; } } if (!$haveExpectHeader) { // There is no expect header - let's add one $headers[] = $emptyExpectHeader; } return $headers; }
php
private function normalizeRequestHeaders(array $headers) { // Explicitly set an empty Expect header, so that the server will not // respond with a "100 Continue" status code for large uploads. $emptyExpectHeader = 'Expect: '; $haveExpectHeader = false; for ($i = 0; $i < count($headers); $i++) { if ($this->isExpectHeader($headers[$i])) { // There is already an expect header - let's set it to empty $headers[$i] = $emptyExpectHeader; $haveExpectHeader = true; break; } } if (!$haveExpectHeader) { // There is no expect header - let's add one $headers[] = $emptyExpectHeader; } return $headers; }
[ "private", "function", "normalizeRequestHeaders", "(", "array", "$", "headers", ")", "{", "// Explicitly set an empty Expect header, so that the server will not", "// respond with a \"100 Continue\" status code for large uploads.", "$", "emptyExpectHeader", "=", "'Expect: '", ";", "$...
Normalize the headers to be used for a request. @param array $headers - the array of headers. Each element is a string. @return array
[ "Normalize", "the", "headers", "to", "be", "used", "for", "a", "request", "." ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Request/Remote.php#L73-L95
45,076
Learnosity/learnosity-sdk-php
src/LearnositySdk/Request/Remote.php
Remote.request
private function request($url, $post = false, $options = array()) { $defaults = array( 'connect_timeout' => 10, 'timeout' => 40, 'headers' => array(), 'encoding' => 'utf-8', 'ssl_verify' => true ); $options = array_merge($defaults, $options); // normalize the headers $options['headers'] = $this->normalizeRequestHeaders($options['headers']); $ch = curl_init(); $params = array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => $options['encoding'], CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => $options['connect_timeout'], CURLOPT_TIMEOUT => $options['timeout'], CURLOPT_MAXREDIRS => 10, CURLOPT_SSL_VERIFYPEER => $options['ssl_verify'] ); if (!empty($options['headers'])) { $params[CURLOPT_HTTPHEADER] = $options['headers']; } if (!empty($post)) { $params[CURLOPT_POST] = true; $params[CURLOPT_POSTFIELDS] = $post; } curl_setopt_array($ch, $params); $body = curl_exec($ch); $error_code = curl_errno($ch); $error_message = curl_error($ch); $response = curl_getinfo($ch); curl_close($ch); $response['error_code'] = $error_code; $response['error_message'] = $error_message; $response['body'] = $body; $this->result = $response; }
php
private function request($url, $post = false, $options = array()) { $defaults = array( 'connect_timeout' => 10, 'timeout' => 40, 'headers' => array(), 'encoding' => 'utf-8', 'ssl_verify' => true ); $options = array_merge($defaults, $options); // normalize the headers $options['headers'] = $this->normalizeRequestHeaders($options['headers']); $ch = curl_init(); $params = array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => $options['encoding'], CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => $options['connect_timeout'], CURLOPT_TIMEOUT => $options['timeout'], CURLOPT_MAXREDIRS => 10, CURLOPT_SSL_VERIFYPEER => $options['ssl_verify'] ); if (!empty($options['headers'])) { $params[CURLOPT_HTTPHEADER] = $options['headers']; } if (!empty($post)) { $params[CURLOPT_POST] = true; $params[CURLOPT_POSTFIELDS] = $post; } curl_setopt_array($ch, $params); $body = curl_exec($ch); $error_code = curl_errno($ch); $error_message = curl_error($ch); $response = curl_getinfo($ch); curl_close($ch); $response['error_code'] = $error_code; $response['error_message'] = $error_message; $response['body'] = $body; $this->result = $response; }
[ "private", "function", "request", "(", "$", "url", ",", "$", "post", "=", "false", ",", "$", "options", "=", "array", "(", ")", ")", "{", "$", "defaults", "=", "array", "(", "'connect_timeout'", "=>", "10", ",", "'timeout'", "=>", "40", ",", "'header...
Makes a cURL request to an endpoint with an optional request payload and cURL options. @param string $url Full URL of where to POST the request @param array $request Payload of request @param bool $options Optional Curl options @return void
[ "Makes", "a", "cURL", "request", "to", "an", "endpoint", "with", "an", "optional", "request", "payload", "and", "cURL", "options", "." ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Request/Remote.php#L106-L158
45,077
Learnosity/learnosity-sdk-php
src/LearnositySdk/Request/Remote.php
Remote.getHeader
public function getHeader($type = 'content_type') { return (array_key_exists($type, $this->result)) ? $this->result[$type] : null; }
php
public function getHeader($type = 'content_type') { return (array_key_exists($type, $this->result)) ? $this->result[$type] : null; }
[ "public", "function", "getHeader", "(", "$", "type", "=", "'content_type'", ")", "{", "return", "(", "array_key_exists", "(", "$", "type", ",", "$", "this", "->", "result", ")", ")", "?", "$", "this", "->", "result", "[", "$", "type", "]", ":", "null...
Returns part of the response headers @param string $type Which key in the headers packet to return @return string Header from the response packet
[ "Returns", "part", "of", "the", "response", "headers" ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Request/Remote.php#L191-L194
45,078
Learnosity/learnosity-sdk-php
src/LearnositySdk/Request/Remote.php
Remote.getSize
public function getSize($format = true) { if ($format) { return Conversion::formatSizeUnits($this->result['size_download']); } return $this->result['size_download']; }
php
public function getSize($format = true) { if ($format) { return Conversion::formatSizeUnits($this->result['size_download']); } return $this->result['size_download']; }
[ "public", "function", "getSize", "(", "$", "format", "=", "true", ")", "{", "if", "(", "$", "format", ")", "{", "return", "Conversion", "::", "formatSizeUnits", "(", "$", "this", "->", "result", "[", "'size_download'", "]", ")", ";", "}", "return", "$"...
Returns the size in bytes of the request body @return mixed Formatted string or raw float (bytes)
[ "Returns", "the", "size", "in", "bytes", "of", "the", "request", "body" ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Request/Remote.php#L201-L207
45,079
Learnosity/learnosity-sdk-php
src/LearnositySdk/Request/Init.php
Init.validate
public function validate($service, &$securityPacket, $secret, $requestPacket, $action) { if (empty($service)) { throw new ValidationException('The `service` argument wasn\'t found or was empty'); } elseif (!in_array(strtolower($service), $this->validServices)) { throw new ValidationException("The service provided ($service) is not valid"); } // In case the user gave us a JSON securityPacket, convert to an array if (!is_array($securityPacket) && is_string($securityPacket)) { $securityPacket = json_decode($securityPacket, true); } if (empty($securityPacket) || !is_array($securityPacket)) { throw new ValidationException('The security packet must be an array'); } else { foreach (array_keys($securityPacket) as $key) { if (!in_array($key, $this->validSecurityKeys)) { throw new ValidationException('Invalid key found in the security packet: ' . $key); } } if ($service === "questions" && !array_key_exists('user_id', $securityPacket)) { throw new ValidationException('Questions API requires a `user_id` in the security packet'); } if (!array_key_exists('timestamp', $securityPacket)) { $securityPacket['timestamp'] = gmdate('Ymd-Hi'); } } if (empty($secret) || !is_string($secret)) { throw new ValidationException('The `secret` argument must be a valid string'); } if (!empty($requestPacket) && !is_array($requestPacket)) { throw new ValidationException('The request packet must be an array or a valid JSON string'); } if (!empty($action) && !is_string($action)) { throw new ValidationException('The `action` argument must be a string'); } }
php
public function validate($service, &$securityPacket, $secret, $requestPacket, $action) { if (empty($service)) { throw new ValidationException('The `service` argument wasn\'t found or was empty'); } elseif (!in_array(strtolower($service), $this->validServices)) { throw new ValidationException("The service provided ($service) is not valid"); } // In case the user gave us a JSON securityPacket, convert to an array if (!is_array($securityPacket) && is_string($securityPacket)) { $securityPacket = json_decode($securityPacket, true); } if (empty($securityPacket) || !is_array($securityPacket)) { throw new ValidationException('The security packet must be an array'); } else { foreach (array_keys($securityPacket) as $key) { if (!in_array($key, $this->validSecurityKeys)) { throw new ValidationException('Invalid key found in the security packet: ' . $key); } } if ($service === "questions" && !array_key_exists('user_id', $securityPacket)) { throw new ValidationException('Questions API requires a `user_id` in the security packet'); } if (!array_key_exists('timestamp', $securityPacket)) { $securityPacket['timestamp'] = gmdate('Ymd-Hi'); } } if (empty($secret) || !is_string($secret)) { throw new ValidationException('The `secret` argument must be a valid string'); } if (!empty($requestPacket) && !is_array($requestPacket)) { throw new ValidationException('The request packet must be an array or a valid JSON string'); } if (!empty($action) && !is_string($action)) { throw new ValidationException('The `action` argument must be a string'); } }
[ "public", "function", "validate", "(", "$", "service", ",", "&", "$", "securityPacket", ",", "$", "secret", ",", "$", "requestPacket", ",", "$", "action", ")", "{", "if", "(", "empty", "(", "$", "service", ")", ")", "{", "throw", "new", "ValidationExce...
Validate the arguments passed to the constructor @param string $service @param array $securityPacket @param string $secret @param array $requestPacket @param string $action
[ "Validate", "the", "arguments", "passed", "to", "the", "constructor" ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Request/Init.php#L435-L476
45,080
Learnosity/learnosity-sdk-php
src/LearnositySdk/Utils/Conversion.php
Conversion.formatSizeUnits
public static function formatSizeUnits($bytes) { if ($bytes >= 1073741824) { $bytes = number_format($bytes / 1073741824, 2) . ' GB'; } elseif ($bytes >= 1048576) { $bytes = number_format($bytes / 1048576, 2) . ' MB'; } elseif ($bytes >= 1024) { $bytes = number_format($bytes / 1024, 2) . ' KB'; } elseif ($bytes > 1) { $bytes = $bytes . ' bytes'; } elseif ($bytes === 1) { $bytes = $bytes . ' byte'; } else { $bytes = '0 bytes'; } return $bytes; }
php
public static function formatSizeUnits($bytes) { if ($bytes >= 1073741824) { $bytes = number_format($bytes / 1073741824, 2) . ' GB'; } elseif ($bytes >= 1048576) { $bytes = number_format($bytes / 1048576, 2) . ' MB'; } elseif ($bytes >= 1024) { $bytes = number_format($bytes / 1024, 2) . ' KB'; } elseif ($bytes > 1) { $bytes = $bytes . ' bytes'; } elseif ($bytes === 1) { $bytes = $bytes . ' byte'; } else { $bytes = '0 bytes'; } return $bytes; }
[ "public", "static", "function", "formatSizeUnits", "(", "$", "bytes", ")", "{", "if", "(", "$", "bytes", ">=", "1073741824", ")", "{", "$", "bytes", "=", "number_format", "(", "$", "bytes", "/", "1073741824", ",", "2", ")", ".", "' GB'", ";", "}", "e...
Converts a raw value in bytes to a friendly format. Either Bytes, KB, MB or GB @param int $bytes Raw value to convert @return string
[ "Converts", "a", "raw", "value", "in", "bytes", "to", "a", "friendly", "format", ".", "Either", "Bytes", "KB", "MB", "or", "GB" ]
5bcb69d2d099808cab5ef8fb87c9de27b9be27ed
https://github.com/Learnosity/learnosity-sdk-php/blob/5bcb69d2d099808cab5ef8fb87c9de27b9be27ed/src/LearnositySdk/Utils/Conversion.php#L14-L31
45,081
rl404/MAL-Scraper
src/MalScraper/Model/User/UserListModel.php
UserListModel.getAllInfo
private function getAllInfo() { $data = []; $offset = 0; while (true) { $url = $this->_myAnimeListUrl.'/'.$this->_type.'list/'.$this->_user.'/load.json?offset='.$offset.'&status='.$this->_status; $content = json_decode(file_get_contents($url), true); if ($content) { $count = count($content); for ($i = 0; $i < $count; $i++) { if (!empty($content[$i]['anime_image_path'])) { $content[$i]['anime_image_path'] = Helper::imageUrlCleaner($content[$i]['anime_image_path']); } else { $content[$i]['manga_image_path'] = Helper::imageUrlCleaner($content[$i]['manga_image_path']); } } $data = array_merge($data, $content); $offset += 300; } else { break; } } return $data; }
php
private function getAllInfo() { $data = []; $offset = 0; while (true) { $url = $this->_myAnimeListUrl.'/'.$this->_type.'list/'.$this->_user.'/load.json?offset='.$offset.'&status='.$this->_status; $content = json_decode(file_get_contents($url), true); if ($content) { $count = count($content); for ($i = 0; $i < $count; $i++) { if (!empty($content[$i]['anime_image_path'])) { $content[$i]['anime_image_path'] = Helper::imageUrlCleaner($content[$i]['anime_image_path']); } else { $content[$i]['manga_image_path'] = Helper::imageUrlCleaner($content[$i]['manga_image_path']); } } $data = array_merge($data, $content); $offset += 300; } else { break; } } return $data; }
[ "private", "function", "getAllInfo", "(", ")", "{", "$", "data", "=", "[", "]", ";", "$", "offset", "=", "0", ";", "while", "(", "true", ")", "{", "$", "url", "=", "$", "this", "->", "_myAnimeListUrl", ".", "'/'", ".", "$", "this", "->", "_type",...
Get user list. @return array
[ "Get", "user", "list", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/UserListModel.php#L77-L105
45,082
rl404/MAL-Scraper
src/MalScraper/Model/Top/TopPeopleModel.php
TopPeopleModel.getJapaneseName
private function getJapaneseName($name_area) { $name = $name_area->find('.information', 0)->find('span', 0); if ($name) { $name = $name->plaintext; return substr($name, 1, strlen($name) - 3); } return ''; }
php
private function getJapaneseName($name_area) { $name = $name_area->find('.information', 0)->find('span', 0); if ($name) { $name = $name->plaintext; return substr($name, 1, strlen($name) - 3); } return ''; }
[ "private", "function", "getJapaneseName", "(", "$", "name_area", ")", "{", "$", "name", "=", "$", "name_area", "->", "find", "(", "'.information'", ",", "0", ")", "->", "find", "(", "'span'", ",", "0", ")", ";", "if", "(", "$", "name", ")", "{", "$...
Get japanese name. @param \simplehtmldom_1_5\simple_html_dom $name_area @return string
[ "Get", "japanese", "name", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Top/TopPeopleModel.php#L102-L112
45,083
rl404/MAL-Scraper
src/MalScraper/Model/Top/TopPeopleModel.php
TopPeopleModel.getBirthday
private function getBirthday($each_char) { $day = $each_char->find('.birthday', 0)->plaintext; $day = preg_replace('/\s+/', ' ', $day); $day = trim($day); return $day == 'Unknown' ? '' : $day; }
php
private function getBirthday($each_char) { $day = $each_char->find('.birthday', 0)->plaintext; $day = preg_replace('/\s+/', ' ', $day); $day = trim($day); return $day == 'Unknown' ? '' : $day; }
[ "private", "function", "getBirthday", "(", "$", "each_char", ")", "{", "$", "day", "=", "$", "each_char", "->", "find", "(", "'.birthday'", ",", "0", ")", "->", "plaintext", ";", "$", "day", "=", "preg_replace", "(", "'/\\s+/'", ",", "' '", ",", "$", ...
Get birthday. @param \simplehtmldom_1_5\simple_html_dom $each_char @return string
[ "Get", "birthday", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/Top/TopPeopleModel.php#L135-L142
45,084
rl404/MAL-Scraper
src/MalScraper/Model/MainModel.php
MainModel.getHeader
public static function getHeader($url) { $file_headers = @get_headers($url); if (empty($file_headers) || $file_headers[0] == 'HTTP/1.1 404 Not Found') { return 404; } if (empty($file_headers) || $file_headers[0] == 'HTTP/1.1 403 Forbidden') { return 403; } return 200; }
php
public static function getHeader($url) { $file_headers = @get_headers($url); if (empty($file_headers) || $file_headers[0] == 'HTTP/1.1 404 Not Found') { return 404; } if (empty($file_headers) || $file_headers[0] == 'HTTP/1.1 403 Forbidden') { return 403; } return 200; }
[ "public", "static", "function", "getHeader", "(", "$", "url", ")", "{", "$", "file_headers", "=", "@", "get_headers", "(", "$", "url", ")", ";", "if", "(", "empty", "(", "$", "file_headers", ")", "||", "$", "file_headers", "[", "0", "]", "==", "'HTTP...
Get URL header. @param string $url URL of full MyAnimeList page @return int
[ "Get", "URL", "header", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/MainModel.php#L58-L70
45,085
rl404/MAL-Scraper
src/MalScraper/Model/MainModel.php
MainModel.getParser
public static function getParser($url, $contentDiv, $additionalSetting = false) { $html = HtmlDomParser::file_get_html($url)->find($contentDiv, 0); $html = !$additionalSetting ? $html : $html->next_sibling(); $html = $html->outertext; $html = str_replace('&quot;', '\"', $html); $html = str_replace('&lt;', '&l-t;', $html); // handle '<' $html = html_entity_decode($html, ENT_QUOTES, 'UTF-8'); $html = str_replace('&l-t;', '&lt;', $html); $html = HtmlDomParser::str_get_html($html); return $html; }
php
public static function getParser($url, $contentDiv, $additionalSetting = false) { $html = HtmlDomParser::file_get_html($url)->find($contentDiv, 0); $html = !$additionalSetting ? $html : $html->next_sibling(); $html = $html->outertext; $html = str_replace('&quot;', '\"', $html); $html = str_replace('&lt;', '&l-t;', $html); // handle '<' $html = html_entity_decode($html, ENT_QUOTES, 'UTF-8'); $html = str_replace('&l-t;', '&lt;', $html); $html = HtmlDomParser::str_get_html($html); return $html; }
[ "public", "static", "function", "getParser", "(", "$", "url", ",", "$", "contentDiv", ",", "$", "additionalSetting", "=", "false", ")", "{", "$", "html", "=", "HtmlDomParser", "::", "file_get_html", "(", "$", "url", ")", "->", "find", "(", "$", "contentD...
Get trimmed HtmlDomParser class. @param string $url URL of full MyAnimeList page @param string $contentDiv Specific area to be parsed @return \simplehtmldom_1_5\simple_html_dom
[ "Get", "trimmed", "HtmlDomParser", "class", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/MainModel.php#L80-L92
45,086
rl404/MAL-Scraper
src/MalScraper/Model/MainModel.php
MainModel.errorCheck
public static function errorCheck($model) { $className = self::getCleanClassName($model); if (strpos($className, 'Search') !== false) { if (strlen($model->_query) < 3) { $model->_error = 400; } } if (!$model->_error) { $header = self::getHeader($model->_url); if ($header == 200) { if ($className != 'UserListModel') { $additionalSetting = ($className == 'CharacterPeoplePictureModel'); $model->_parser = self::getParser($model->_url, $model->_parserArea, $additionalSetting); } } else { $model->_error = $header; } } }
php
public static function errorCheck($model) { $className = self::getCleanClassName($model); if (strpos($className, 'Search') !== false) { if (strlen($model->_query) < 3) { $model->_error = 400; } } if (!$model->_error) { $header = self::getHeader($model->_url); if ($header == 200) { if ($className != 'UserListModel') { $additionalSetting = ($className == 'CharacterPeoplePictureModel'); $model->_parser = self::getParser($model->_url, $model->_parserArea, $additionalSetting); } } else { $model->_error = $header; } } }
[ "public", "static", "function", "errorCheck", "(", "$", "model", ")", "{", "$", "className", "=", "self", "::", "getCleanClassName", "(", "$", "model", ")", ";", "if", "(", "strpos", "(", "$", "className", ",", "'Search'", ")", "!==", "false", ")", "{"...
Header error check. @param MainModel $model Any model @return void
[ "Header", "error", "check", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/MainModel.php#L101-L122
45,087
rl404/MAL-Scraper
src/MalScraper/Model/MainModel.php
MainModel.getCleanClassName
public static function getCleanClassName($model) { $className = get_class($model); $className = explode('\\', $className); return $className[count($className) - 1]; }
php
public static function getCleanClassName($model) { $className = get_class($model); $className = explode('\\', $className); return $className[count($className) - 1]; }
[ "public", "static", "function", "getCleanClassName", "(", "$", "model", ")", "{", "$", "className", "=", "get_class", "(", "$", "model", ")", ";", "$", "className", "=", "explode", "(", "'\\\\'", ",", "$", "className", ")", ";", "return", "$", "className...
Get clean class name. @param MainModel $model Any model @return string
[ "Get", "clean", "class", "name", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/MainModel.php#L131-L137
45,088
rl404/MAL-Scraper
src/MalScraper/Model/User/HistoryModel.php
HistoryModel.getAllInfo
private function getAllInfo() { $data = []; $history_area = $this->_parser->find('table', 0); if ($history_area) { foreach ($history_area->find('tr') as $history) { if ($history->find('td', 0)->class != 'borderClass') { continue; } $h_temp = []; $name_area = $history->find('td', 0); $h_temp['id'] = $this->getId($name_area); $h_temp['title'] = $this->getTitle($name_area); $h_temp['type'] = $this->getType($name_area); $h_temp['progress'] = $this->getProgress($name_area); $h_temp['date'] = $this->getDate($history); $data[] = $h_temp; } } return $data; }
php
private function getAllInfo() { $data = []; $history_area = $this->_parser->find('table', 0); if ($history_area) { foreach ($history_area->find('tr') as $history) { if ($history->find('td', 0)->class != 'borderClass') { continue; } $h_temp = []; $name_area = $history->find('td', 0); $h_temp['id'] = $this->getId($name_area); $h_temp['title'] = $this->getTitle($name_area); $h_temp['type'] = $this->getType($name_area); $h_temp['progress'] = $this->getProgress($name_area); $h_temp['date'] = $this->getDate($history); $data[] = $h_temp; } } return $data; }
[ "private", "function", "getAllInfo", "(", ")", "{", "$", "data", "=", "[", "]", ";", "$", "history_area", "=", "$", "this", "->", "_parser", "->", "find", "(", "'table'", ",", "0", ")", ";", "if", "(", "$", "history_area", ")", "{", "foreach", "(",...
Get user history list. @return array
[ "Get", "user", "history", "list", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/User/HistoryModel.php#L143-L166
45,089
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getCleanInfo
private function getCleanInfo($info_type, $next_info) { $info_value = $next_info->plaintext; $clean_info_value = trim(str_replace($info_type, '', $info_value)); $clean_info_value = preg_replace("/([\s])+/", ' ', $clean_info_value); return str_replace([', add some', '?', 'Not yet aired', 'Unknown'], '', $clean_info_value); }
php
private function getCleanInfo($info_type, $next_info) { $info_value = $next_info->plaintext; $clean_info_value = trim(str_replace($info_type, '', $info_value)); $clean_info_value = preg_replace("/([\s])+/", ' ', $clean_info_value); return str_replace([', add some', '?', 'Not yet aired', 'Unknown'], '', $clean_info_value); }
[ "private", "function", "getCleanInfo", "(", "$", "info_type", ",", "$", "next_info", ")", "{", "$", "info_value", "=", "$", "next_info", "->", "plaintext", ";", "$", "clean_info_value", "=", "trim", "(", "str_replace", "(", "$", "info_type", ",", "''", ","...
Get clean other info. @param string $info_type @param \simplehtmldom_1_5\simple_html_dom $next_info @return string
[ "Get", "clean", "other", "info", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L283-L290
45,090
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getRelatedDetail
private function getRelatedDetail($r) { $related = []; $rel_anime_link = $r->href; $separated_anime_link = explode('/', $rel_anime_link); $related['id'] = $separated_anime_link[2]; $related['title'] = $r->plaintext; $related['type'] = $separated_anime_link[1]; return $related; }
php
private function getRelatedDetail($r) { $related = []; $rel_anime_link = $r->href; $separated_anime_link = explode('/', $rel_anime_link); $related['id'] = $separated_anime_link[2]; $related['title'] = $r->plaintext; $related['type'] = $separated_anime_link[1]; return $related; }
[ "private", "function", "getRelatedDetail", "(", "$", "r", ")", "{", "$", "related", "=", "[", "]", ";", "$", "rel_anime_link", "=", "$", "r", "->", "href", ";", "$", "separated_anime_link", "=", "explode", "(", "'/'", ",", "$", "rel_anime_link", ")", "...
Get related detail. @param \simplehtmldom_1_5\simple_html_dom $r @return array
[ "Get", "related", "detail", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L390-L401
45,091
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getStaffId
private function getStaffId($st) { $staff_id = $st->find('a', 0)->href; $staff_id = explode('/', $staff_id); return $staff_id[4]; }
php
private function getStaffId($st) { $staff_id = $st->find('a', 0)->href; $staff_id = explode('/', $staff_id); return $staff_id[4]; }
[ "private", "function", "getStaffId", "(", "$", "st", ")", "{", "$", "staff_id", "=", "$", "st", "->", "find", "(", "'a'", ",", "0", ")", "->", "href", ";", "$", "staff_id", "=", "explode", "(", "'/'", ",", "$", "staff_id", ")", ";", "return", "$"...
Get staff id. @param \simplehtmldom_1_5\simple_html_dom $st @return string
[ "Get", "staff", "id", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L489-L495
45,092
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getStaffName
private function getStaffName($st, $va = false) { if ($va) { return $st->find('a', 0)->plaintext; } return trim(preg_replace('/\s+/', ' ', $st->find('a', 0)->plaintext)); }
php
private function getStaffName($st, $va = false) { if ($va) { return $st->find('a', 0)->plaintext; } return trim(preg_replace('/\s+/', ' ', $st->find('a', 0)->plaintext)); }
[ "private", "function", "getStaffName", "(", "$", "st", ",", "$", "va", "=", "false", ")", "{", "if", "(", "$", "va", ")", "{", "return", "$", "st", "->", "find", "(", "'a'", ",", "0", ")", "->", "plaintext", ";", "}", "return", "trim", "(", "pr...
Get staff name. @param \simplehtmldom_1_5\simple_html_dom $st @param bool $va (Optional) @return string
[ "Get", "staff", "name", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L505-L512
45,093
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getStaffImage
private function getStaffImage($each_staff, $va = false) { if ($va) { $staff_image = $each_staff->find('table td', 1)->find('img', 0)->getAttribute('data-src'); } else { $staff_image = $each_staff->find('tr td', 0)->find('img', 0)->getAttribute('data-src'); } return Helper::imageUrlCleaner($staff_image); }
php
private function getStaffImage($each_staff, $va = false) { if ($va) { $staff_image = $each_staff->find('table td', 1)->find('img', 0)->getAttribute('data-src'); } else { $staff_image = $each_staff->find('tr td', 0)->find('img', 0)->getAttribute('data-src'); } return Helper::imageUrlCleaner($staff_image); }
[ "private", "function", "getStaffImage", "(", "$", "each_staff", ",", "$", "va", "=", "false", ")", "{", "if", "(", "$", "va", ")", "{", "$", "staff_image", "=", "$", "each_staff", "->", "find", "(", "'table td'", ",", "1", ")", "->", "find", "(", "...
Get staff image. @param \simplehtmldom_1_5\simple_html_dom $each_staff @param bool $va (Optional) @return string
[ "Get", "staff", "image", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L534-L543
45,094
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getReviewId
private function getReviewId($very_bottom_area) { $id = $very_bottom_area->find('a', 0)->href; $id = explode('?id=', $id); return $id[1]; }
php
private function getReviewId($very_bottom_area) { $id = $very_bottom_area->find('a', 0)->href; $id = explode('?id=', $id); return $id[1]; }
[ "private", "function", "getReviewId", "(", "$", "very_bottom_area", ")", "{", "$", "id", "=", "$", "very_bottom_area", "->", "find", "(", "'a'", ",", "0", ")", "->", "href", ";", "$", "id", "=", "explode", "(", "'?id='", ",", "$", "id", ")", ";", "...
Get review user. @param \simplehtmldom_1_5\simple_html_dom $very_bottom_area @return string
[ "Get", "review", "user", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L616-L622
45,095
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getReviewImage
private function getReviewImage($top_area) { $image = $top_area->find('table', 0); $image = $image->find('td', 0)->find('img', 0)->src; return Helper::imageUrlCleaner($image); }
php
private function getReviewImage($top_area) { $image = $top_area->find('table', 0); $image = $image->find('td', 0)->find('img', 0)->src; return Helper::imageUrlCleaner($image); }
[ "private", "function", "getReviewImage", "(", "$", "top_area", ")", "{", "$", "image", "=", "$", "top_area", "->", "find", "(", "'table'", ",", "0", ")", ";", "$", "image", "=", "$", "image", "->", "find", "(", "'td'", ",", "0", ")", "->", "find", ...
Get review image. @param \simplehtmldom_1_5\simple_html_dom $top_area @return string
[ "Get", "review", "image", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L645-L651
45,096
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getReviewHelpful
private function getReviewHelpful($top_area) { $helpful = $top_area->find('table', 0); $helpful = $helpful->find('td', 1)->find('strong', 0)->plaintext; return trim($helpful); }
php
private function getReviewHelpful($top_area) { $helpful = $top_area->find('table', 0); $helpful = $helpful->find('td', 1)->find('strong', 0)->plaintext; return trim($helpful); }
[ "private", "function", "getReviewHelpful", "(", "$", "top_area", ")", "{", "$", "helpful", "=", "$", "top_area", "->", "find", "(", "'table'", ",", "0", ")", ";", "$", "helpful", "=", "$", "helpful", "->", "find", "(", "'td'", ",", "1", ")", "->", ...
Get review helful. @param \simplehtmldom_1_5\simple_html_dom $top_area @return string
[ "Get", "review", "helful", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L660-L666
45,097
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getReviewEpisode
private function getReviewEpisode($top_area) { $episode = $top_area->find('div div', 1)->plaintext; $episode = str_replace(['episodes seen', 'chapters read'], '', $episode); return trim($episode); }
php
private function getReviewEpisode($top_area) { $episode = $top_area->find('div div', 1)->plaintext; $episode = str_replace(['episodes seen', 'chapters read'], '', $episode); return trim($episode); }
[ "private", "function", "getReviewEpisode", "(", "$", "top_area", ")", "{", "$", "episode", "=", "$", "top_area", "->", "find", "(", "'div div'", ",", "1", ")", "->", "plaintext", ";", "$", "episode", "=", "str_replace", "(", "[", "'episodes seen'", ",", ...
Get review episode seen. @param \simplehtmldom_1_5\simple_html_dom $top_area @return string
[ "Get", "review", "episode", "seen", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L692-L698
45,098
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getReviewScore
private function getReviewScore($bottom_area) { $score = []; $score_area = $bottom_area->find('table', 0); if ($score_area) { foreach ($score_area->find('tr') as $each_score) { $score_type = strtolower($each_score->find('td', 0)->plaintext); $score_value = $each_score->find('td', 1)->plaintext; $score[$score_type] = $score_value; } } return $score; }
php
private function getReviewScore($bottom_area) { $score = []; $score_area = $bottom_area->find('table', 0); if ($score_area) { foreach ($score_area->find('tr') as $each_score) { $score_type = strtolower($each_score->find('td', 0)->plaintext); $score_value = $each_score->find('td', 1)->plaintext; $score[$score_type] = $score_value; } } return $score; }
[ "private", "function", "getReviewScore", "(", "$", "bottom_area", ")", "{", "$", "score", "=", "[", "]", ";", "$", "score_area", "=", "$", "bottom_area", "->", "find", "(", "'table'", ",", "0", ")", ";", "if", "(", "$", "score_area", ")", "{", "forea...
Get review score. @param \simplehtmldom_1_5\simple_html_dom $bottom_area @return array
[ "Get", "review", "score", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L707-L720
45,099
rl404/MAL-Scraper
src/MalScraper/Model/General/InfoModel.php
InfoModel.getRecomId
private function getRecomId($each_recom) { $id = $each_recom->find('a', 0)->href; $id = explode('/', $id); $id = explode('-', $id[5]); if ($id[0] == $this->_id) { return $id[1]; } else { return $id[0]; } }
php
private function getRecomId($each_recom) { $id = $each_recom->find('a', 0)->href; $id = explode('/', $id); $id = explode('-', $id[5]); if ($id[0] == $this->_id) { return $id[1]; } else { return $id[0]; } }
[ "private", "function", "getRecomId", "(", "$", "each_recom", ")", "{", "$", "id", "=", "$", "each_recom", "->", "find", "(", "'a'", ",", "0", ")", "->", "href", ";", "$", "id", "=", "explode", "(", "'/'", ",", "$", "id", ")", ";", "$", "id", "=...
Get recommendation id. @param \simplehtmldom_1_5\simple_html_dom $each_recom @return string
[ "Get", "recommendation", "id", "." ]
3e378a60dfaaef94949bccce4ff06f9399869bee
https://github.com/rl404/MAL-Scraper/blob/3e378a60dfaaef94949bccce4ff06f9399869bee/src/MalScraper/Model/General/InfoModel.php#L772-L782