repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
BoltApp/bolt-magento2
Block/Js.php
Js.getToggleCheckout
private function getToggleCheckout() { $storeId = $this->getMagentoStoreId(); $toggleCheckout = $this->configHelper->getToggleCheckout($storeId); return $toggleCheckout && $toggleCheckout->active ? $toggleCheckout : null; }
php
private function getToggleCheckout() { $storeId = $this->getMagentoStoreId(); $toggleCheckout = $this->configHelper->getToggleCheckout($storeId); return $toggleCheckout && $toggleCheckout->active ? $toggleCheckout : null; }
[ "private", "function", "getToggleCheckout", "(", ")", "{", "$", "storeId", "=", "$", "this", "->", "getMagentoStoreId", "(", ")", ";", "$", "toggleCheckout", "=", "$", "this", "->", "configHelper", "->", "getToggleCheckout", "(", "$", "storeId", ")", ";", ...
Get Toggle Checkout configuration @return mixed
[ "Get", "Toggle", "Checkout", "configuration" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Block/Js.php#L348-L354
train
BoltApp/bolt-magento2
Block/Js.php
Js.getMagentoStoreId
public function getMagentoStoreId() { if ($this->checkoutSession instanceof BackendSessionQuote) { $quote = $this->checkoutSession; } else { $quote = $this->checkoutSession->getQuote(); } return (int) (($quote && $quote->getStoreId()) ? $quote->getStoreId() : 0); }
php
public function getMagentoStoreId() { if ($this->checkoutSession instanceof BackendSessionQuote) { $quote = $this->checkoutSession; } else { $quote = $this->checkoutSession->getQuote(); } return (int) (($quote && $quote->getStoreId()) ? $quote->getStoreId() : 0); }
[ "public", "function", "getMagentoStoreId", "(", ")", "{", "if", "(", "$", "this", "->", "checkoutSession", "instanceof", "BackendSessionQuote", ")", "{", "$", "quote", "=", "$", "this", "->", "checkoutSession", ";", "}", "else", "{", "$", "quote", "=", "$"...
If we have multi-website, we need current quote store_id @return int
[ "If", "we", "have", "multi", "-", "website", "we", "need", "current", "quote", "store_id" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Block/Js.php#L443-L453
train
BoltApp/bolt-magento2
Helper/Geolocation.php
Geolocation.getLocationJson
private function getLocationJson($ip, $apiKey) { $endpoint = sprintf($this->endpointFormat, $ip, $apiKey); $client = $this->httpClientFactory->create(); $client->setUri($endpoint); $client->setConfig(['maxredirects' => 0, 'timeout' => 30]); // Dependant on third party API, wrapping in try/catch block. // On error notify bugsnag and proceed (return null) try { return $client->request()->getBody(); } catch (\Exception $e) { $this->bugsnag->notifyException($e); return null; } }
php
private function getLocationJson($ip, $apiKey) { $endpoint = sprintf($this->endpointFormat, $ip, $apiKey); $client = $this->httpClientFactory->create(); $client->setUri($endpoint); $client->setConfig(['maxredirects' => 0, 'timeout' => 30]); // Dependant on third party API, wrapping in try/catch block. // On error notify bugsnag and proceed (return null) try { return $client->request()->getBody(); } catch (\Exception $e) { $this->bugsnag->notifyException($e); return null; } }
[ "private", "function", "getLocationJson", "(", "$", "ip", ",", "$", "apiKey", ")", "{", "$", "endpoint", "=", "sprintf", "(", "$", "this", "->", "endpointFormat", ",", "$", "ip", ",", "$", "apiKey", ")", ";", "$", "client", "=", "$", "this", "->", ...
Make a Geolocation API call @param string $ip The IP address @param $apiKey ipstack.com API key @return null|string JSON formated response @throws \Zend_Http_Client_Exception
[ "Make", "a", "Geolocation", "API", "call" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Geolocation.php#L101-L118
train
BoltApp/bolt-magento2
Helper/Log.php
Log.addInfoLog
public function addInfoLog($info) { if ($this->configHelper->isDebugModeOn()) { $this->boltLogger->info($info); } return $this; }
php
public function addInfoLog($info) { if ($this->configHelper->isDebugModeOn()) { $this->boltLogger->info($info); } return $this; }
[ "public", "function", "addInfoLog", "(", "$", "info", ")", "{", "if", "(", "$", "this", "->", "configHelper", "->", "isDebugModeOn", "(", ")", ")", "{", "$", "this", "->", "boltLogger", "->", "info", "(", "$", "info", ")", ";", "}", "return", "$", ...
Add info log @param mixed $info log message @return Log
[ "Add", "info", "log" ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Helper/Log.php#L67-L73
train
BoltApp/bolt-magento2
Plugin/QuotePlugin.php
QuotePlugin.aroundAfterSave
public function aroundAfterSave(\Magento\Quote\Model\Quote $subject, callable $proceed) { if ($subject->getIsActive()) { return $proceed(); } return $subject; }
php
public function aroundAfterSave(\Magento\Quote\Model\Quote $subject, callable $proceed) { if ($subject->getIsActive()) { return $proceed(); } return $subject; }
[ "public", "function", "aroundAfterSave", "(", "\\", "Magento", "\\", "Quote", "\\", "Model", "\\", "Quote", "$", "subject", ",", "callable", "$", "proceed", ")", "{", "if", "(", "$", "subject", "->", "getIsActive", "(", ")", ")", "{", "return", "$", "p...
Override Quote afterSave method. Skip execution for inactive quotes, thus preventing dispatching the after save events. @param \Magento\Quote\Model\Quote $subject @param callable $proceed @return \Magento\Quote\Model\Quote
[ "Override", "Quote", "afterSave", "method", ".", "Skip", "execution", "for", "inactive", "quotes", "thus", "preventing", "dispatching", "the", "after", "save", "events", "." ]
1d91576a88ec3ea4748e5ccc755a580eecf5aff7
https://github.com/BoltApp/bolt-magento2/blob/1d91576a88ec3ea4748e5ccc755a580eecf5aff7/Plugin/QuotePlugin.php#L34-L40
train
kitpages/KitpagesDataGridBundle
Grid/GridConfig.php
GridConfig.getFieldByName
public function getFieldByName($name) { foreach ($this->fieldList as $field) { if ($field->getFieldName() === $name) { return $field; } } return null; }
php
public function getFieldByName($name) { foreach ($this->fieldList as $field) { if ($field->getFieldName() === $name) { return $field; } } return null; }
[ "public", "function", "getFieldByName", "(", "$", "name", ")", "{", "foreach", "(", "$", "this", "->", "fieldList", "as", "$", "field", ")", "{", "if", "(", "$", "field", "->", "getFieldName", "(", ")", "===", "$", "name", ")", "{", "return", "$", ...
returns the field corresponding to the name @param string $name @return Field|null $field
[ "returns", "the", "field", "corresponding", "to", "the", "name" ]
426b6dbdbd16e923e01bce9a0dc67a7da46a8987
https://github.com/kitpages/KitpagesDataGridBundle/blob/426b6dbdbd16e923e01bce9a0dc67a7da46a8987/Grid/GridConfig.php#L137-L146
train
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/oxConfigConstructor.php
oxConfigConstructor._formSaveConfigParameters
private function _formSaveConfigParameters($configKey, $configParameters) { $type = null; if (isset($configParameters['type'])) { $type = $configParameters['type']; } $value = null; if (isset($configParameters['value'])) { $value = $configParameters['value']; } $module = null; if (isset($configParameters['module'])) { $module = $configParameters['module']; } if (($type == "arr" || $type == 'aarr') && !is_array($value)) { $value = unserialize(htmlspecialchars_decode($value)); } return !empty($type) ? array($type, $configKey, $value, null, $module) : false; }
php
private function _formSaveConfigParameters($configKey, $configParameters) { $type = null; if (isset($configParameters['type'])) { $type = $configParameters['type']; } $value = null; if (isset($configParameters['value'])) { $value = $configParameters['value']; } $module = null; if (isset($configParameters['module'])) { $module = $configParameters['module']; } if (($type == "arr" || $type == 'aarr') && !is_array($value)) { $value = unserialize(htmlspecialchars_decode($value)); } return !empty($type) ? array($type, $configKey, $value, null, $module) : false; }
[ "private", "function", "_formSaveConfigParameters", "(", "$", "configKey", ",", "$", "configParameters", ")", "{", "$", "type", "=", "null", ";", "if", "(", "isset", "(", "$", "configParameters", "[", "'type'", "]", ")", ")", "{", "$", "type", "=", "$", ...
Forms parameters for saveShopConfVar function from given parameters @param string $configKey @param array $configParameters @return array|bool
[ "Forms", "parameters", "for", "saveShopConfVar", "function", "from", "given", "parameters" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/oxConfigConstructor.php#L68-L89
train
OXID-eSales/testing_library
library/Services/Library/DatabaseHandler.php
DatabaseHandler.import
public function import($sqlFile, $charsetMode = null) { if (!file_exists($sqlFile)) { throw new Exception("File '$sqlFile' was not found."); } $credentialsFile = $this->databaseDefaultsFileGenerator->generate(); $charsetMode = $charsetMode ? $charsetMode : $this->getCharsetMode(); $command = 'mysql --defaults-file=' . $credentialsFile; $command .= ' --default-character-set=' . $charsetMode; $command .= ' ' .escapeshellarg($this->getDbName()); $command .= ' < ' . escapeshellarg($sqlFile); $this->executeCommand($command); unlink($credentialsFile); }
php
public function import($sqlFile, $charsetMode = null) { if (!file_exists($sqlFile)) { throw new Exception("File '$sqlFile' was not found."); } $credentialsFile = $this->databaseDefaultsFileGenerator->generate(); $charsetMode = $charsetMode ? $charsetMode : $this->getCharsetMode(); $command = 'mysql --defaults-file=' . $credentialsFile; $command .= ' --default-character-set=' . $charsetMode; $command .= ' ' .escapeshellarg($this->getDbName()); $command .= ' < ' . escapeshellarg($sqlFile); $this->executeCommand($command); unlink($credentialsFile); }
[ "public", "function", "import", "(", "$", "sqlFile", ",", "$", "charsetMode", "=", "null", ")", "{", "if", "(", "!", "file_exists", "(", "$", "sqlFile", ")", ")", "{", "throw", "new", "Exception", "(", "\"File '$sqlFile' was not found.\"", ")", ";", "}", ...
Execute sql statements from sql file @param string $sqlFile SQL File name to import. @param string $charsetMode Charset of imported file. Will use shop charset mode if not set. @throws Exception
[ "Execute", "sql", "statements", "from", "sql", "file" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseHandler.php#L68-L82
train
OXID-eSales/testing_library
library/Services/Library/DatabaseHandler.php
DatabaseHandler.query
public function query($sql) { $this->useConfiguredDatabase(); $return = $this->getDbConnection()->query($sql); $this->checkForDatabaseError($sql, 'query'); return $return; }
php
public function query($sql) { $this->useConfiguredDatabase(); $return = $this->getDbConnection()->query($sql); $this->checkForDatabaseError($sql, 'query'); return $return; }
[ "public", "function", "query", "(", "$", "sql", ")", "{", "$", "this", "->", "useConfiguredDatabase", "(", ")", ";", "$", "return", "=", "$", "this", "->", "getDbConnection", "(", ")", "->", "query", "(", "$", "sql", ")", ";", "$", "this", "->", "c...
Executes query on database. @param string $sql Sql query to execute. @return PDOStatement|false
[ "Executes", "query", "on", "database", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseHandler.php#L109-L115
train
OXID-eSales/testing_library
library/Services/Library/DatabaseHandler.php
DatabaseHandler.exec
public function exec($sql) { $this->useConfiguredDatabase(); $success = $this->getDbConnection()->exec($sql); $this->checkForDatabaseError($sql, 'exec'); return $success; }
php
public function exec($sql) { $this->useConfiguredDatabase(); $success = $this->getDbConnection()->exec($sql); $this->checkForDatabaseError($sql, 'exec'); return $success; }
[ "public", "function", "exec", "(", "$", "sql", ")", "{", "$", "this", "->", "useConfiguredDatabase", "(", ")", ";", "$", "success", "=", "$", "this", "->", "getDbConnection", "(", ")", "->", "exec", "(", "$", "sql", ")", ";", "$", "this", "->", "ch...
This function is intended for write access to the database like INSERT, UPDATE @param string $sql Sql query to execute. @return int
[ "This", "function", "is", "intended", "for", "write", "access", "to", "the", "database", "like", "INSERT", "UPDATE" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseHandler.php#L124-L130
train
OXID-eSales/testing_library
library/Services/Library/DatabaseHandler.php
DatabaseHandler.checkForDatabaseError
protected function checkForDatabaseError($query, $callingFunctionName) { $dbCon = $this->getDbConnection(); if (is_a($dbCon, 'PDO') && ('00000' !== $dbCon->errorCode())) { $errorInfo = $dbCon->errorInfo(); throw new Exception('PDO error code: ' . $dbCon->errorCode() . ' in function ' . $callingFunctionName . ' -- ' . $errorInfo[2] . ' -- ' . $query); } }
php
protected function checkForDatabaseError($query, $callingFunctionName) { $dbCon = $this->getDbConnection(); if (is_a($dbCon, 'PDO') && ('00000' !== $dbCon->errorCode())) { $errorInfo = $dbCon->errorInfo(); throw new Exception('PDO error code: ' . $dbCon->errorCode() . ' in function ' . $callingFunctionName . ' -- ' . $errorInfo[2] . ' -- ' . $query); } }
[ "protected", "function", "checkForDatabaseError", "(", "$", "query", ",", "$", "callingFunctionName", ")", "{", "$", "dbCon", "=", "$", "this", "->", "getDbConnection", "(", ")", ";", "if", "(", "is_a", "(", "$", "dbCon", ",", "'PDO'", ")", "&&", "(", ...
Check for error code in database connection. @param string $query @param string $callingFunctionName @throws Exception
[ "Check", "for", "error", "code", "in", "database", "connection", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseHandler.php#L266-L273
train
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.setupDatabase
public function setupDatabase() { $dbHandler = $this->getDbHandler(); $dbHandler->getDbConnection()->exec('drop database `' . $dbHandler->getDbName() . '`'); $dbHandler->getDbConnection()->exec('create database `' . $dbHandler->getDbName() . '` collate ' . $dbHandler->getCharsetMode() . '_general_ci'); $baseEditionPathProvider = new EditionPathProvider(new EditionRootPathProvider(new EditionSelector(EditionSelector::COMMUNITY))); $dbHandler->import($baseEditionPathProvider->getDatabaseSqlDirectory() . "/database_schema.sql"); $dbHandler->import($baseEditionPathProvider->getDatabaseSqlDirectory() . "/initial_data.sql"); $output = new ConsoleOutput(); $output->setVerbosity(ConsoleOutputInterface::VERBOSITY_QUIET); $utilities = new Utilities(); $utilities->executeExternalDatabaseMigrationCommand($output); $this->callShellDbViewsRegenerate(); }
php
public function setupDatabase() { $dbHandler = $this->getDbHandler(); $dbHandler->getDbConnection()->exec('drop database `' . $dbHandler->getDbName() . '`'); $dbHandler->getDbConnection()->exec('create database `' . $dbHandler->getDbName() . '` collate ' . $dbHandler->getCharsetMode() . '_general_ci'); $baseEditionPathProvider = new EditionPathProvider(new EditionRootPathProvider(new EditionSelector(EditionSelector::COMMUNITY))); $dbHandler->import($baseEditionPathProvider->getDatabaseSqlDirectory() . "/database_schema.sql"); $dbHandler->import($baseEditionPathProvider->getDatabaseSqlDirectory() . "/initial_data.sql"); $output = new ConsoleOutput(); $output->setVerbosity(ConsoleOutputInterface::VERBOSITY_QUIET); $utilities = new Utilities(); $utilities->executeExternalDatabaseMigrationCommand($output); $this->callShellDbViewsRegenerate(); }
[ "public", "function", "setupDatabase", "(", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "dbHandler", "->", "getDbConnection", "(", ")", "->", "exec", "(", "'drop database `'", ".", "$", "dbHandler", "->", "getDbN...
Sets up database.
[ "Sets", "up", "database", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L101-L120
train
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.insertDemoData
public function insertDemoData() { $testConfig = new TestConfig(); $testDirectory = $testConfig->getEditionTestsPath($testConfig->getShopEdition()); $this->getDbHandler()->import($testDirectory . "/Fixtures/testdemodata.sql"); }
php
public function insertDemoData() { $testConfig = new TestConfig(); $testDirectory = $testConfig->getEditionTestsPath($testConfig->getShopEdition()); $this->getDbHandler()->import($testDirectory . "/Fixtures/testdemodata.sql"); }
[ "public", "function", "insertDemoData", "(", ")", "{", "$", "testConfig", "=", "new", "TestConfig", "(", ")", ";", "$", "testDirectory", "=", "$", "testConfig", "->", "getEditionTestsPath", "(", "$", "testConfig", "->", "getShopEdition", "(", ")", ")", ";", ...
Inserts test demo data to shop.
[ "Inserts", "test", "demo", "data", "to", "shop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L151-L156
train
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.setConfigurationParameters
public function setConfigurationParameters() { $dbHandler = $this->getDbHandler(); $sShopId = $this->getShopId(); $dbHandler->query("delete from oxconfig where oxvarname in ('iSetUtfMode','blSendTechnicalInformationToOxid');"); $dbHandler->query( "insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue) values " . "('config1', '{$sShopId}', 'iSetUtfMode', 'str', ENCODE('0', '{$this->getConfigKey()}') )," . "('config2', '{$sShopId}', 'blSendTechnicalInformationToOxid', 'bool', ENCODE('1', '{$this->getConfigKey()}') )" ); }
php
public function setConfigurationParameters() { $dbHandler = $this->getDbHandler(); $sShopId = $this->getShopId(); $dbHandler->query("delete from oxconfig where oxvarname in ('iSetUtfMode','blSendTechnicalInformationToOxid');"); $dbHandler->query( "insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue) values " . "('config1', '{$sShopId}', 'iSetUtfMode', 'str', ENCODE('0', '{$this->getConfigKey()}') )," . "('config2', '{$sShopId}', 'blSendTechnicalInformationToOxid', 'bool', ENCODE('1', '{$this->getConfigKey()}') )" ); }
[ "public", "function", "setConfigurationParameters", "(", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "sShopId", "=", "$", "this", "->", "getShopId", "(", ")", ";", "$", "dbHandler", "->", "query", "(", "\"delet...
Inserts missing configuration parameters
[ "Inserts", "missing", "configuration", "parameters" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L161-L172
train
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.setSerialNumber
public function setSerialNumber($serialNumber = null) { if (strtolower($this->getShopConfig()->getVar('edition')) !== strtolower(EditionSelector::COMMUNITY) && class_exists(Serial::class)) { $dbHandler = $this->getDbHandler(); $shopId = $this->getShopId(); $serial = new Serial(); $serial->setEd($this->getServiceConfig()->getShopEdition() == 'EE' ? 2 : 1); $serial->isValidSerial($serialNumber); $maxDays = $serial->getMaxDays($serialNumber); $maxArticles = $serial->getMaxArticles($serialNumber); $maxShops = $serial->getMaxShops($serialNumber); $dbHandler->query("update oxshops set oxserial = '{$serialNumber}'"); $dbHandler->query("delete from oxconfig where oxvarname in ('aSerials','sTagList','IMD','IMA','IMS')"); $dbHandler->query( "insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue) values " . "('serial1', '{$shopId}', 'aSerials', 'arr', ENCODE('" . serialize(array($serialNumber)) . "','{$this->getConfigKey()}') )," . "('serial2', '{$shopId}', 'sTagList', 'str', ENCODE('" . time() . "','{$this->getConfigKey()}') )," . "('serial3', '{$shopId}', 'IMD', 'str', ENCODE('" . $maxDays . "','{$this->getConfigKey()}') )," . "('serial4', '{$shopId}', 'IMA', 'str', ENCODE('" . $maxArticles . "','{$this->getConfigKey()}') )," . "('serial5', '{$shopId}', 'IMS', 'str', ENCODE('" . $maxShops . "','{$this->getConfigKey()}') )" ); } }
php
public function setSerialNumber($serialNumber = null) { if (strtolower($this->getShopConfig()->getVar('edition')) !== strtolower(EditionSelector::COMMUNITY) && class_exists(Serial::class)) { $dbHandler = $this->getDbHandler(); $shopId = $this->getShopId(); $serial = new Serial(); $serial->setEd($this->getServiceConfig()->getShopEdition() == 'EE' ? 2 : 1); $serial->isValidSerial($serialNumber); $maxDays = $serial->getMaxDays($serialNumber); $maxArticles = $serial->getMaxArticles($serialNumber); $maxShops = $serial->getMaxShops($serialNumber); $dbHandler->query("update oxshops set oxserial = '{$serialNumber}'"); $dbHandler->query("delete from oxconfig where oxvarname in ('aSerials','sTagList','IMD','IMA','IMS')"); $dbHandler->query( "insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue) values " . "('serial1', '{$shopId}', 'aSerials', 'arr', ENCODE('" . serialize(array($serialNumber)) . "','{$this->getConfigKey()}') )," . "('serial2', '{$shopId}', 'sTagList', 'str', ENCODE('" . time() . "','{$this->getConfigKey()}') )," . "('serial3', '{$shopId}', 'IMD', 'str', ENCODE('" . $maxDays . "','{$this->getConfigKey()}') )," . "('serial4', '{$shopId}', 'IMA', 'str', ENCODE('" . $maxArticles . "','{$this->getConfigKey()}') )," . "('serial5', '{$shopId}', 'IMS', 'str', ENCODE('" . $maxShops . "','{$this->getConfigKey()}') )" ); } }
[ "public", "function", "setSerialNumber", "(", "$", "serialNumber", "=", "null", ")", "{", "if", "(", "strtolower", "(", "$", "this", "->", "getShopConfig", "(", ")", "->", "getVar", "(", "'edition'", ")", ")", "!==", "strtolower", "(", "EditionSelector", "...
Adds serial number to shop. @param string $serialNumber
[ "Adds", "serial", "number", "to", "shop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L179-L208
train
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.convertToUtf
public function convertToUtf() { $dbHandler = $this->getDbHandler(); $rs = $dbHandler->query( "SELECT oxvarname, oxvartype, DECODE( oxvarvalue, '{$this->getConfigKey()}') AS oxvarvalue FROM oxconfig WHERE oxvartype IN ('str', 'arr', 'aarr')" ); while ( (false !== $rs) && ($aRow = $rs->fetch())) { if ($aRow['oxvartype'] == 'arr' || $aRow['oxvartype'] == 'aarr') { $aRow['oxvarvalue'] = unserialize($aRow['oxvarvalue']); } if (!empty($aRow['oxvarvalue']) && !is_int($aRow['oxvarvalue'])) { $this->updateConfigValue($aRow['oxid'], $this->stringToUtf($aRow['oxvarvalue'])); } } // Change currencies value to same as after 4.6 setup because previous encoding break it. $shopId = 1; $query = "REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('3c4f033dfb8fd4fe692715dda19ecd28', $shopId, '', 'aCurrencies', 'arr', 0x4dbace2972e14bf2cbd3a9a45157004422e928891572b281961cdebd1e0bbafe8b2444b15f2c7b1cfcbe6e5982d87434c3b19629dacd7728776b54d7caeace68b4b05c6ddeff2df9ff89b467b14df4dcc966c504477a9eaeadd5bdfa5195a97f46768ba236d658379ae6d371bfd53acd9902de08a1fd1eeab18779b191f3e31c258a87b58b9778f5636de2fab154fc0a51a2ecc3a4867db070f85852217e9d5e9aa60507);"; $dbHandler->query($query); }
php
public function convertToUtf() { $dbHandler = $this->getDbHandler(); $rs = $dbHandler->query( "SELECT oxvarname, oxvartype, DECODE( oxvarvalue, '{$this->getConfigKey()}') AS oxvarvalue FROM oxconfig WHERE oxvartype IN ('str', 'arr', 'aarr')" ); while ( (false !== $rs) && ($aRow = $rs->fetch())) { if ($aRow['oxvartype'] == 'arr' || $aRow['oxvartype'] == 'aarr') { $aRow['oxvarvalue'] = unserialize($aRow['oxvarvalue']); } if (!empty($aRow['oxvarvalue']) && !is_int($aRow['oxvarvalue'])) { $this->updateConfigValue($aRow['oxid'], $this->stringToUtf($aRow['oxvarvalue'])); } } // Change currencies value to same as after 4.6 setup because previous encoding break it. $shopId = 1; $query = "REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('3c4f033dfb8fd4fe692715dda19ecd28', $shopId, '', 'aCurrencies', 'arr', 0x4dbace2972e14bf2cbd3a9a45157004422e928891572b281961cdebd1e0bbafe8b2444b15f2c7b1cfcbe6e5982d87434c3b19629dacd7728776b54d7caeace68b4b05c6ddeff2df9ff89b467b14df4dcc966c504477a9eaeadd5bdfa5195a97f46768ba236d658379ae6d371bfd53acd9902de08a1fd1eeab18779b191f3e31c258a87b58b9778f5636de2fab154fc0a51a2ecc3a4867db070f85852217e9d5e9aa60507);"; $dbHandler->query($query); }
[ "public", "function", "convertToUtf", "(", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "rs", "=", "$", "dbHandler", "->", "query", "(", "\"SELECT oxvarname, oxvartype, DECODE( oxvarvalue, '{$this->getConfigKey()}') AS oxvarv...
Converts shop to utf8.
[ "Converts", "shop", "to", "utf8", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L213-L239
train
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.getDefaultSerial
protected function getDefaultSerial() { if ($this->getServiceConfig()->getShopEdition() != 'CE') { $core = new Core(); /** @var \OxidEsales\EshopProfessional\Setup\Setup|\OxidEsales\EshopEnterprise\Setup\Setup $setup */ $setup = $core->getInstance('Setup'); return $setup->getDefaultSerial(); } return null; }
php
protected function getDefaultSerial() { if ($this->getServiceConfig()->getShopEdition() != 'CE') { $core = new Core(); /** @var \OxidEsales\EshopProfessional\Setup\Setup|\OxidEsales\EshopEnterprise\Setup\Setup $setup */ $setup = $core->getInstance('Setup'); return $setup->getDefaultSerial(); } return null; }
[ "protected", "function", "getDefaultSerial", "(", ")", "{", "if", "(", "$", "this", "->", "getServiceConfig", "(", ")", "->", "getShopEdition", "(", ")", "!=", "'CE'", ")", "{", "$", "core", "=", "new", "Core", "(", ")", ";", "/** @var \\OxidEsales\\EshopP...
Returns default demo serial number for testing. @return string
[ "Returns", "default", "demo", "serial", "number", "for", "testing", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L285-L295
train
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.insertConfigValue
private function insertConfigValue($type, $name, $value) { $dbHandler = $this->getDbHandler(); $shopId = 1; $oxid = md5("${name}_1"); $dbHandler->query("DELETE from oxconfig WHERE oxvarname = '$name';"); $dbHandler->query("REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('$oxid', $shopId, '', '$name', '$type', ENCODE('{$value}','{$this->getConfigKey()}'));"); if ($this->getServiceConfig()->getShopEdition() == EditionSelector::ENTERPRISE) { $oxid = md5("${name}_subshop"); $shopId = 2; $dbHandler->query("REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('$oxid', $shopId, '', '$name', '$type', ENCODE('{$value}','{$this->getConfigKey()}'));"); } }
php
private function insertConfigValue($type, $name, $value) { $dbHandler = $this->getDbHandler(); $shopId = 1; $oxid = md5("${name}_1"); $dbHandler->query("DELETE from oxconfig WHERE oxvarname = '$name';"); $dbHandler->query("REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('$oxid', $shopId, '', '$name', '$type', ENCODE('{$value}','{$this->getConfigKey()}'));"); if ($this->getServiceConfig()->getShopEdition() == EditionSelector::ENTERPRISE) { $oxid = md5("${name}_subshop"); $shopId = 2; $dbHandler->query("REPLACE INTO `oxconfig` (`OXID`, `OXSHOPID`, `OXMODULE`, `OXVARNAME`, `OXVARTYPE`, `OXVARVALUE`) VALUES ('$oxid', $shopId, '', '$name', '$type', ENCODE('{$value}','{$this->getConfigKey()}'));"); } }
[ "private", "function", "insertConfigValue", "(", "$", "type", ",", "$", "name", ",", "$", "value", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "shopId", "=", "1", ";", "$", "oxid", "=", "md5", "(", "\"${n...
Insert new configuration value to database. @param string $type @param string $name @param string $value
[ "Insert", "new", "configuration", "value", "to", "database", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L336-L351
train
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.updateConfigValue
private function updateConfigValue($id, $value) { $dbHandler = $this->getDbHandler(); $value = is_array($value) ? serialize($value) : $value; $value = $dbHandler->escape($value); $dbHandler->query("update oxconfig set oxvarvalue = ENCODE( '{$value}','{$this->getConfigKey()}') where oxvarname = '{$id}';"); }
php
private function updateConfigValue($id, $value) { $dbHandler = $this->getDbHandler(); $value = is_array($value) ? serialize($value) : $value; $value = $dbHandler->escape($value); $dbHandler->query("update oxconfig set oxvarvalue = ENCODE( '{$value}','{$this->getConfigKey()}') where oxvarname = '{$id}';"); }
[ "private", "function", "updateConfigValue", "(", "$", "id", ",", "$", "value", ")", "{", "$", "dbHandler", "=", "$", "this", "->", "getDbHandler", "(", ")", ";", "$", "value", "=", "is_array", "(", "$", "value", ")", "?", "serialize", "(", "$", "valu...
Updates configuration value. @param string $id @param string $value
[ "Updates", "configuration", "value", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L359-L366
train
OXID-eSales/testing_library
library/Services/ShopInstaller/ShopInstaller.php
ShopInstaller.stringToUtf
private function stringToUtf($input) { if (is_array($input)) { $temp = array(); foreach ($input as $key => $value) { $temp[$this->stringToUtf($key)] = $this->stringToUtf($value); } $input = $temp; } elseif (is_string($input)) { $input = iconv('iso-8859-15', 'utf-8', $input); } return $input; }
php
private function stringToUtf($input) { if (is_array($input)) { $temp = array(); foreach ($input as $key => $value) { $temp[$this->stringToUtf($key)] = $this->stringToUtf($value); } $input = $temp; } elseif (is_string($input)) { $input = iconv('iso-8859-15', 'utf-8', $input); } return $input; }
[ "private", "function", "stringToUtf", "(", "$", "input", ")", "{", "if", "(", "is_array", "(", "$", "input", ")", ")", "{", "$", "temp", "=", "array", "(", ")", ";", "foreach", "(", "$", "input", "as", "$", "key", "=>", "$", "value", ")", "{", ...
Converts input string to utf8. @param string $input String for conversion. @return array|string
[ "Converts", "input", "string", "to", "utf8", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopInstaller/ShopInstaller.php#L375-L388
train
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php
ObjectConstructor.load
public function load($objectId) { if (!empty($objectId)) { $blResult = is_array($objectId)? $this->_loadByArray($objectId) : $this->_loadById($objectId); if ($blResult === false) { $sClass = get_class($this->getObject()); throw new Exception("Failed to load $sClass with id $objectId"); } } }
php
public function load($objectId) { if (!empty($objectId)) { $blResult = is_array($objectId)? $this->_loadByArray($objectId) : $this->_loadById($objectId); if ($blResult === false) { $sClass = get_class($this->getObject()); throw new Exception("Failed to load $sClass with id $objectId"); } } }
[ "public", "function", "load", "(", "$", "objectId", ")", "{", "if", "(", "!", "empty", "(", "$", "objectId", ")", ")", "{", "$", "blResult", "=", "is_array", "(", "$", "objectId", ")", "?", "$", "this", "->", "_loadByArray", "(", "$", "objectId", "...
Loads object by given id @param mixed $objectId @throws Exception
[ "Loads", "object", "by", "given", "id" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php#L45-L54
train
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php
ObjectConstructor.callFunction
public function callFunction($functionName, $parameters) { $parameters = is_array($parameters) ? $parameters : array(); $response = call_user_func_array(array($this->getObject(), $functionName), $parameters); return $response; }
php
public function callFunction($functionName, $parameters) { $parameters = is_array($parameters) ? $parameters : array(); $response = call_user_func_array(array($this->getObject(), $functionName), $parameters); return $response; }
[ "public", "function", "callFunction", "(", "$", "functionName", ",", "$", "parameters", ")", "{", "$", "parameters", "=", "is_array", "(", "$", "parameters", ")", "?", "$", "parameters", ":", "array", "(", ")", ";", "$", "response", "=", "call_user_func_ar...
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/ObjectConstructor.php#L124-L130
train
OXID-eSales/testing_library
library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php
ObjectConstructor._getLastInsertedId
protected function _getLastInsertedId() { $objectId = null; $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $tableName = $this->getObject()->getCoreTableName(); $query = 'SELECT OXID FROM '. $tableName .' ORDER BY OXTIMESTAMP DESC LIMIT 1'; $result = $oDb->select($query); if ($result != false && $result->count() > 0) { $fields = $result->fields; $objectId = $fields['OXID']; } return $objectId; }
php
protected function _getLastInsertedId() { $objectId = null; $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $tableName = $this->getObject()->getCoreTableName(); $query = 'SELECT OXID FROM '. $tableName .' ORDER BY OXTIMESTAMP DESC LIMIT 1'; $result = $oDb->select($query); if ($result != false && $result->count() > 0) { $fields = $result->fields; $objectId = $fields['OXID']; } return $objectId; }
[ "protected", "function", "_getLastInsertedId", "(", ")", "{", "$", "objectId", "=", "null", ";", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core"...
Get id of latest created row. @return string|null
[ "Get", "id", "of", "latest", "created", "row", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ShopObjectConstructor/Constructor/ObjectConstructor.php#L164-L179
train
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.callService
public function callService($serviceName, $shopId = null) { $testConfig = $this->getTestConfig(); if (!is_null($shopId) && $testConfig->getShopEdition() == 'EE') { $this->setParameter('shp', $shopId); } elseif ($testConfig->isSubShop()) { $this->setParameter('shp', $testConfig->getShopId()); } if ($testConfig->getRemoteDirectory()) { $response = $this->callRemoteService($serviceName); } else { $this->callLocalService(ChangeExceptionLogRights::class); $response = $this->callLocalService($serviceName); } $this->parameters = array(); return $response; }
php
public function callService($serviceName, $shopId = null) { $testConfig = $this->getTestConfig(); if (!is_null($shopId) && $testConfig->getShopEdition() == 'EE') { $this->setParameter('shp', $shopId); } elseif ($testConfig->isSubShop()) { $this->setParameter('shp', $testConfig->getShopId()); } if ($testConfig->getRemoteDirectory()) { $response = $this->callRemoteService($serviceName); } else { $this->callLocalService(ChangeExceptionLogRights::class); $response = $this->callLocalService($serviceName); } $this->parameters = array(); return $response; }
[ "public", "function", "callService", "(", "$", "serviceName", ",", "$", "shopId", "=", "null", ")", "{", "$", "testConfig", "=", "$", "this", "->", "getTestConfig", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "shopId", ")", "&&", "$", "testCo...
Call shop service to execute code in shop. @param string $serviceName @param string $shopId @example call to update information to database. @throws \Exception @return string $sResult
[ "Call", "shop", "service", "to", "execute", "code", "in", "shop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L74-L94
train
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.callRemoteService
protected function callRemoteService($serviceName) { if (!self::$servicesCopied) { self::$servicesCopied = true; $this->copyServicesToShop(); } $oCurl = new Curl(); $this->setParameter('service', $serviceName); $oCurl->setUrl($this->getTestConfig()->getShopUrl() . '/Services/service.php'); $oCurl->setParameters($this->getParameters()); $sResponse = $oCurl->execute(); if ($oCurl->getStatusCode() >= 300) { $sResponse = $oCurl->execute(); } return $this->unserializeResponse($sResponse); }
php
protected function callRemoteService($serviceName) { if (!self::$servicesCopied) { self::$servicesCopied = true; $this->copyServicesToShop(); } $oCurl = new Curl(); $this->setParameter('service', $serviceName); $oCurl->setUrl($this->getTestConfig()->getShopUrl() . '/Services/service.php'); $oCurl->setParameters($this->getParameters()); $sResponse = $oCurl->execute(); if ($oCurl->getStatusCode() >= 300) { $sResponse = $oCurl->execute(); } return $this->unserializeResponse($sResponse); }
[ "protected", "function", "callRemoteService", "(", "$", "serviceName", ")", "{", "if", "(", "!", "self", "::", "$", "servicesCopied", ")", "{", "self", "::", "$", "servicesCopied", "=", "true", ";", "$", "this", "->", "copyServicesToShop", "(", ")", ";", ...
Calls service on remote server. @param string $serviceName @throws \Exception @return string
[ "Calls", "service", "on", "remote", "server", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L105-L126
train
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.callLocalService
protected function callLocalService($serviceName) { if (!defined('TMP_PATH')) { define('TMP_PATH', $this->getTestConfig()->getTempDirectory()); } $config = new ServiceConfig($this->getTestConfig()->getShopPath(), $this->getTestConfig()->getTempDirectory()); $config->setShopEdition($this->getTestConfig()->getShopEdition()); $serviceCaller = new ServiceFactory($config); $request = new Request($this->getParameters()); $service = $serviceCaller->createService($serviceName); return $service->init($request); }
php
protected function callLocalService($serviceName) { if (!defined('TMP_PATH')) { define('TMP_PATH', $this->getTestConfig()->getTempDirectory()); } $config = new ServiceConfig($this->getTestConfig()->getShopPath(), $this->getTestConfig()->getTempDirectory()); $config->setShopEdition($this->getTestConfig()->getShopEdition()); $serviceCaller = new ServiceFactory($config); $request = new Request($this->getParameters()); $service = $serviceCaller->createService($serviceName); return $service->init($request); }
[ "protected", "function", "callLocalService", "(", "$", "serviceName", ")", "{", "if", "(", "!", "defined", "(", "'TMP_PATH'", ")", ")", "{", "define", "(", "'TMP_PATH'", ",", "$", "this", "->", "getTestConfig", "(", ")", "->", "getTempDirectory", "(", ")",...
Calls service on local server. @param string $serviceName @return mixed|null
[ "Calls", "service", "on", "local", "server", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L135-L149
train
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.copyServicesToShop
protected function copyServicesToShop() { $fileCopier = new FileCopier(); $target = $this->getTestConfig()->getRemoteDirectory() . '/Services'; $fileCopier->copyFiles(TEST_LIBRARY_PATH.'/Services', $target, true); }
php
protected function copyServicesToShop() { $fileCopier = new FileCopier(); $target = $this->getTestConfig()->getRemoteDirectory() . '/Services'; $fileCopier->copyFiles(TEST_LIBRARY_PATH.'/Services', $target, true); }
[ "protected", "function", "copyServicesToShop", "(", ")", "{", "$", "fileCopier", "=", "new", "FileCopier", "(", ")", ";", "$", "target", "=", "$", "this", "->", "getTestConfig", "(", ")", "->", "getRemoteDirectory", "(", ")", ".", "'/Services'", ";", "$", ...
Copies services directory to shop.
[ "Copies", "services", "directory", "to", "shop", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L164-L169
train
OXID-eSales/testing_library
library/ServiceCaller.php
ServiceCaller.unserializeResponse
private function unserializeResponse($response) { $result = unserialize($response); if ($response !== 'b:0;' && $result === false) { throw new \Exception(substr($response, 0, 5000)); } return $result; }
php
private function unserializeResponse($response) { $result = unserialize($response); if ($response !== 'b:0;' && $result === false) { throw new \Exception(substr($response, 0, 5000)); } return $result; }
[ "private", "function", "unserializeResponse", "(", "$", "response", ")", "{", "$", "result", "=", "unserialize", "(", "$", "response", ")", ";", "if", "(", "$", "response", "!==", "'b:0;'", "&&", "$", "result", "===", "false", ")", "{", "throw", "new", ...
Unserializes given string. Throws exception if incorrect string is passed @param string $response @throws \Exception @return mixed
[ "Unserializes", "given", "string", ".", "Throws", "exception", "if", "incorrect", "string", "is", "passed" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ServiceCaller.php#L180-L188
train
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.resetStaticVariables
public function resetStaticVariables() { \oxArticleHelper::cleanup(); \oxSeoEncoderHelper::cleanup(); \oxDeliveryHelper::cleanup(); \oxManufacturerHelper::cleanup(); \oxAdminViewHelper::cleanup(); \oxVendorHelper::cleanup(); }
php
public function resetStaticVariables() { \oxArticleHelper::cleanup(); \oxSeoEncoderHelper::cleanup(); \oxDeliveryHelper::cleanup(); \oxManufacturerHelper::cleanup(); \oxAdminViewHelper::cleanup(); \oxVendorHelper::cleanup(); }
[ "public", "function", "resetStaticVariables", "(", ")", "{", "\\", "oxArticleHelper", "::", "cleanup", "(", ")", ";", "\\", "oxSeoEncoderHelper", "::", "cleanup", "(", ")", ";", "\\", "oxDeliveryHelper", "::", "cleanup", "(", ")", ";", "\\", "oxManufacturerHel...
Resets static variables of most classes.
[ "Resets", "static", "variables", "of", "most", "classes", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L31-L39
train
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.backupRegistry
public function backupRegistry() { $this->registryCache = array(); foreach (\OxidEsales\Eshop\Core\Registry::getKeys() as $class) { $instance = \OxidEsales\Eshop\Core\Registry::get($class); $this->registryCache[$class] = clone $instance; } }
php
public function backupRegistry() { $this->registryCache = array(); foreach (\OxidEsales\Eshop\Core\Registry::getKeys() as $class) { $instance = \OxidEsales\Eshop\Core\Registry::get($class); $this->registryCache[$class] = clone $instance; } }
[ "public", "function", "backupRegistry", "(", ")", "{", "$", "this", "->", "registryCache", "=", "array", "(", ")", ";", "foreach", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getKeys", "(", ")", "as", "$", "class", ")...
Creates registry clone
[ "Creates", "registry", "clone" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L44-L51
train
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.resetRegistry
public function resetRegistry() { $aRegKeys = \OxidEsales\Eshop\Core\Registry::getKeys(); $aSkippedClasses = array(); foreach ($aRegKeys as $sKey) { if (!in_array($sKey, $aSkippedClasses)) { $oInstance = null; if (!isset($this->registryCache[$sKey])) { try { $oNewInstance = oxNew($sKey); $this->registryCache[$sKey] = $oNewInstance; } catch (\OxidEsales\Eshop\Core\Exception\SystemComponentException $oException) { \OxidEsales\Eshop\Core\Registry::set($sKey, null); continue; } } $oInstance = clone $this->registryCache[$sKey]; \OxidEsales\Eshop\Core\Registry::set($sKey, $oInstance); } } }
php
public function resetRegistry() { $aRegKeys = \OxidEsales\Eshop\Core\Registry::getKeys(); $aSkippedClasses = array(); foreach ($aRegKeys as $sKey) { if (!in_array($sKey, $aSkippedClasses)) { $oInstance = null; if (!isset($this->registryCache[$sKey])) { try { $oNewInstance = oxNew($sKey); $this->registryCache[$sKey] = $oNewInstance; } catch (\OxidEsales\Eshop\Core\Exception\SystemComponentException $oException) { \OxidEsales\Eshop\Core\Registry::set($sKey, null); continue; } } $oInstance = clone $this->registryCache[$sKey]; \OxidEsales\Eshop\Core\Registry::set($sKey, $oInstance); } } }
[ "public", "function", "resetRegistry", "(", ")", "{", "$", "aRegKeys", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getKeys", "(", ")", ";", "$", "aSkippedClasses", "=", "array", "(", ")", ";", "foreach", "(", "$", "aR...
Cleans up the registry
[ "Cleans", "up", "the", "registry" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L56-L78
train
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.backupRequestVariables
public function backupRequestVariables() { $this->requestCache['_SERVER'] = $_SERVER; $this->requestCache['_POST'] = $_POST; $this->requestCache['_GET'] = $_GET; $this->requestCache['_SESSION'] = $_SESSION; $this->requestCache['_COOKIE'] = $_COOKIE; }
php
public function backupRequestVariables() { $this->requestCache['_SERVER'] = $_SERVER; $this->requestCache['_POST'] = $_POST; $this->requestCache['_GET'] = $_GET; $this->requestCache['_SESSION'] = $_SESSION; $this->requestCache['_COOKIE'] = $_COOKIE; }
[ "public", "function", "backupRequestVariables", "(", ")", "{", "$", "this", "->", "requestCache", "[", "'_SERVER'", "]", "=", "$", "_SERVER", ";", "$", "this", "->", "requestCache", "[", "'_POST'", "]", "=", "$", "_POST", ";", "$", "this", "->", "request...
Backs up global request variables for reverting them back after test run.
[ "Backs", "up", "global", "request", "variables", "for", "reverting", "them", "back", "after", "test", "run", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L83-L90
train
OXID-eSales/testing_library
library/ShopStateBackup.php
ShopStateBackup.resetRequestVariables
public function resetRequestVariables() { $_SERVER = $this->requestCache['_SERVER']; $_POST = $this->requestCache['_POST']; $_GET = $this->requestCache['_GET']; $_SESSION = $this->requestCache['_SESSION']; $_COOKIE = $this->requestCache['_COOKIE']; }
php
public function resetRequestVariables() { $_SERVER = $this->requestCache['_SERVER']; $_POST = $this->requestCache['_POST']; $_GET = $this->requestCache['_GET']; $_SESSION = $this->requestCache['_SESSION']; $_COOKIE = $this->requestCache['_COOKIE']; }
[ "public", "function", "resetRequestVariables", "(", ")", "{", "$", "_SERVER", "=", "$", "this", "->", "requestCache", "[", "'_SERVER'", "]", ";", "$", "_POST", "=", "$", "this", "->", "requestCache", "[", "'_POST'", "]", ";", "$", "_GET", "=", "$", "th...
Sets global request variables to backed up ones after every test run.
[ "Sets", "global", "request", "variables", "to", "backed", "up", "ones", "after", "every", "test", "run", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ShopStateBackup.php#L95-L102
train
OXID-eSales/testing_library
library/ObjectValidator.php
ObjectValidator.getErrorMessage
public function getErrorMessage() { $sMessage = ''; $aErrors = $this->_getErrors(); if (!empty($aErrors)) { $sMessage = "Expected and actual parameters do not match: \n"; $sMessage .= implode("\n", $aErrors); } return $sMessage; }
php
public function getErrorMessage() { $sMessage = ''; $aErrors = $this->_getErrors(); if (!empty($aErrors)) { $sMessage = "Expected and actual parameters do not match: \n"; $sMessage .= implode("\n", $aErrors); } return $sMessage; }
[ "public", "function", "getErrorMessage", "(", ")", "{", "$", "sMessage", "=", "''", ";", "$", "aErrors", "=", "$", "this", "->", "_getErrors", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "aErrors", ")", ")", "{", "$", "sMessage", "=", "\"Expe...
Returns formed error message if parameters was not valid @return string
[ "Returns", "formed", "error", "message", "if", "parameters", "was", "not", "valid" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ObjectValidator.php#L43-L53
train
OXID-eSales/testing_library
library/ObjectValidator.php
ObjectValidator._getObjectParameters
protected function _getObjectParameters($sClass, $aObjectParams, $sOxId = null, $sShopId = null) { $oServiceCaller = new ServiceCaller(); $oServiceCaller->setParameter('cl', $sClass); $sOxId = $sOxId ? $sOxId : 'lastInsertedId'; $oServiceCaller->setParameter('oxid', $sOxId); $oServiceCaller->setParameter('classparams', $aObjectParams); return $oServiceCaller->callService('ShopObjectConstructor', $sShopId); }
php
protected function _getObjectParameters($sClass, $aObjectParams, $sOxId = null, $sShopId = null) { $oServiceCaller = new ServiceCaller(); $oServiceCaller->setParameter('cl', $sClass); $sOxId = $sOxId ? $sOxId : 'lastInsertedId'; $oServiceCaller->setParameter('oxid', $sOxId); $oServiceCaller->setParameter('classparams', $aObjectParams); return $oServiceCaller->callService('ShopObjectConstructor', $sShopId); }
[ "protected", "function", "_getObjectParameters", "(", "$", "sClass", ",", "$", "aObjectParams", ",", "$", "sOxId", "=", "null", ",", "$", "sShopId", "=", "null", ")", "{", "$", "oServiceCaller", "=", "new", "ServiceCaller", "(", ")", ";", "$", "oServiceCal...
Returns object parameters @param string $sClass @param array $aObjectParams @param string $sOxId @param string $sShopId @return mixed
[ "Returns", "object", "parameters" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/ObjectValidator.php#L85-L95
train
OXID-eSales/testing_library
library/Services/ServiceFactory.php
ServiceFactory.createService
public function createService($serviceClass) { $className = $serviceClass; if (!$this->isNamespacedClass($serviceClass)) { // Used for backwards compatibility. $className = $this->formClassName($serviceClass); } if (!class_exists($className)) { throw new Exception("Service '$serviceClass' was not found!"); } $service = new $className($this->getServiceConfig()); if (!($service instanceof ShopServiceInterface)) { throw new Exception("Service '$className' does not implement ShopServiceInterface interface!"); } return $service; }
php
public function createService($serviceClass) { $className = $serviceClass; if (!$this->isNamespacedClass($serviceClass)) { // Used for backwards compatibility. $className = $this->formClassName($serviceClass); } if (!class_exists($className)) { throw new Exception("Service '$serviceClass' was not found!"); } $service = new $className($this->getServiceConfig()); if (!($service instanceof ShopServiceInterface)) { throw new Exception("Service '$className' does not implement ShopServiceInterface interface!"); } return $service; }
[ "public", "function", "createService", "(", "$", "serviceClass", ")", "{", "$", "className", "=", "$", "serviceClass", ";", "if", "(", "!", "$", "this", "->", "isNamespacedClass", "(", "$", "serviceClass", ")", ")", "{", "// Used for backwards compatibility.", ...
Creates Service object. All services must implement ShopService interface @param string $serviceClass @throws Exception @return ShopServiceInterface
[ "Creates", "Service", "object", ".", "All", "services", "must", "implement", "ShopService", "interface" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ServiceFactory.php#L38-L55
train
OXID-eSales/testing_library
library/Services/Library/Cache.php
Cache.clearCacheBackend
public function clearCacheBackend() { if (class_exists('\OxidEsales\EshopEnterprise\Core\Cache\Generic\Cache')) { $oCache = oxNew(\OxidEsales\Eshop\Core\Cache\Generic\Cache::class); $oCache->flush(); } }
php
public function clearCacheBackend() { if (class_exists('\OxidEsales\EshopEnterprise\Core\Cache\Generic\Cache')) { $oCache = oxNew(\OxidEsales\Eshop\Core\Cache\Generic\Cache::class); $oCache->flush(); } }
[ "public", "function", "clearCacheBackend", "(", ")", "{", "if", "(", "class_exists", "(", "'\\OxidEsales\\EshopEnterprise\\Core\\Cache\\Generic\\Cache'", ")", ")", "{", "$", "oCache", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Cache...
Clears cache backend.
[ "Clears", "cache", "backend", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Cache.php#L18-L24
train
OXID-eSales/testing_library
library/Services/Library/Cache.php
Cache.clearReverseProxyCache
public function clearReverseProxyCache() { if (class_exists('\OxidEsales\VarnishModule\Core\OeVarnishModule', false)) { \OxidEsales\VarnishModule\Core\OeVarnishModule::flushReverseProxyCache(); } if (class_exists('\OxidEsales\EshopEnterprise\Core\Cache\ReverseProxy\ReverseProxyBackend', false)) { $oReverseProxy = oxNew(\OxidEsales\EshopEnterprise\Core\Cache\ReverseProxy\ReverseProxyBackend::class); $oReverseProxy->setFlush(); $oReverseProxy->execute(); } if (class_exists('\OxidEsales\NginxModule\Core\Module', false)) { \OxidEsales\NginxModule\Core\Module::clearNginxCache(); } }
php
public function clearReverseProxyCache() { if (class_exists('\OxidEsales\VarnishModule\Core\OeVarnishModule', false)) { \OxidEsales\VarnishModule\Core\OeVarnishModule::flushReverseProxyCache(); } if (class_exists('\OxidEsales\EshopEnterprise\Core\Cache\ReverseProxy\ReverseProxyBackend', false)) { $oReverseProxy = oxNew(\OxidEsales\EshopEnterprise\Core\Cache\ReverseProxy\ReverseProxyBackend::class); $oReverseProxy->setFlush(); $oReverseProxy->execute(); } if (class_exists('\OxidEsales\NginxModule\Core\Module', false)) { \OxidEsales\NginxModule\Core\Module::clearNginxCache(); } }
[ "public", "function", "clearReverseProxyCache", "(", ")", "{", "if", "(", "class_exists", "(", "'\\OxidEsales\\VarnishModule\\Core\\OeVarnishModule'", ",", "false", ")", ")", "{", "\\", "OxidEsales", "\\", "VarnishModule", "\\", "Core", "\\", "OeVarnishModule", "::", ...
Clears reverse proxy cache.
[ "Clears", "reverse", "proxy", "cache", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Cache.php#L29-L42
train
OXID-eSales/testing_library
library/Services/Library/Cache.php
Cache.clearTemporaryDirectory
public function clearTemporaryDirectory() { if ($sCompileDir = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\ConfigFile::class)->getVar('sCompileDir')) { CliExecutor::executeCommand("sudo chmod 777 -R $sCompileDir"); $this->removeTemporaryDirectory($sCompileDir, false); } }
php
public function clearTemporaryDirectory() { if ($sCompileDir = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\ConfigFile::class)->getVar('sCompileDir')) { CliExecutor::executeCommand("sudo chmod 777 -R $sCompileDir"); $this->removeTemporaryDirectory($sCompileDir, false); } }
[ "public", "function", "clearTemporaryDirectory", "(", ")", "{", "if", "(", "$", "sCompileDir", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "get", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "ConfigFile", ":...
Clears temporary directory.
[ "Clears", "temporary", "directory", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Cache.php#L47-L53
train
OXID-eSales/testing_library
library/Services/Library/Cache.php
Cache.removeTemporaryDirectory
private function removeTemporaryDirectory($dir, $rmBaseDir = false) { $itemsToIgnore = array('.', '..', '.htaccess'); $files = array_diff(scandir($dir), $itemsToIgnore); foreach ($files as $file) { if (is_dir("$dir/$file")) { $this->removeTemporaryDirectory( "$dir/$file", $file == 'smarty' ? $rmBaseDir : true ); } else { @unlink("$dir/$file"); } } if ($rmBaseDir) { @rmdir($dir); } }
php
private function removeTemporaryDirectory($dir, $rmBaseDir = false) { $itemsToIgnore = array('.', '..', '.htaccess'); $files = array_diff(scandir($dir), $itemsToIgnore); foreach ($files as $file) { if (is_dir("$dir/$file")) { $this->removeTemporaryDirectory( "$dir/$file", $file == 'smarty' ? $rmBaseDir : true ); } else { @unlink("$dir/$file"); } } if ($rmBaseDir) { @rmdir($dir); } }
[ "private", "function", "removeTemporaryDirectory", "(", "$", "dir", ",", "$", "rmBaseDir", "=", "false", ")", "{", "$", "itemsToIgnore", "=", "array", "(", "'.'", ",", "'..'", ",", "'.htaccess'", ")", ";", "$", "files", "=", "array_diff", "(", "scandir", ...
Delete all files and dirs recursively @param string $dir Directory to delete @param bool $rmBaseDir Keep target directory
[ "Delete", "all", "files", "and", "dirs", "recursively" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Cache.php#L61-L79
train
OXID-eSales/testing_library
library/Services/Library/CliExecutor.php
CliExecutor.executeCommand
static function executeCommand($command) { exec($command, $output, $resultCode); if ($resultCode > 0) { $output = implode("\n", $output); throw new Exception("Failed to execute command: '$command' with output: '$output' "); } }
php
static function executeCommand($command) { exec($command, $output, $resultCode); if ($resultCode > 0) { $output = implode("\n", $output); throw new Exception("Failed to execute command: '$command' with output: '$output' "); } }
[ "static", "function", "executeCommand", "(", "$", "command", ")", "{", "exec", "(", "$", "command", ",", "$", "output", ",", "$", "resultCode", ")", ";", "if", "(", "$", "resultCode", ">", "0", ")", "{", "$", "output", "=", "implode", "(", "\"\\n\"",...
Execute shell command. Throw an exception in if shell command fails. @param string $command @throws Exception
[ "Execute", "shell", "command", ".", "Throw", "an", "exception", "in", "if", "shell", "command", "fails", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/CliExecutor.php#L21-L29
train
OXID-eSales/testing_library
library/Services/Library/Request.php
Request.getUploadedFile
public function getUploadedFile($name) { $filePath = ''; if (array_key_exists($name, $_FILES)) { $filePath = $_FILES[$name]['tmp_name']; } elseif (array_key_exists($name, $this->parameters)) { $filePath = substr($this->parameters[$name], 1); } return $filePath; }
php
public function getUploadedFile($name) { $filePath = ''; if (array_key_exists($name, $_FILES)) { $filePath = $_FILES[$name]['tmp_name']; } elseif (array_key_exists($name, $this->parameters)) { $filePath = substr($this->parameters[$name], 1); } return $filePath; }
[ "public", "function", "getUploadedFile", "(", "$", "name", ")", "{", "$", "filePath", "=", "''", ";", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "_FILES", ")", ")", "{", "$", "filePath", "=", "$", "_FILES", "[", "$", "name", "]", "[...
Returns uploaded file parameter @param string $name param name @return mixed
[ "Returns", "uploaded", "file", "parameter" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/Request.php#L49-L59
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.read
public function read() { if ($this->isExistingMetricsFile()) { $this->_resetTotalValues(); foreach ($this->_oMetrics->package as $oPackage) { $this->_readClassMetricsPerPackage($oPackage); } } }
php
public function read() { if ($this->isExistingMetricsFile()) { $this->_resetTotalValues(); foreach ($this->_oMetrics->package as $oPackage) { $this->_readClassMetricsPerPackage($oPackage); } } }
[ "public", "function", "read", "(", ")", "{", "if", "(", "$", "this", "->", "isExistingMetricsFile", "(", ")", ")", "{", "$", "this", "->", "_resetTotalValues", "(", ")", ";", "foreach", "(", "$", "this", "->", "_oMetrics", "->", "package", "as", "$", ...
To start generated metrics xml file analysis for CCN, Crap index and NPath
[ "To", "start", "generated", "metrics", "xml", "file", "analysis", "for", "CCN", "Crap", "index", "and", "NPath" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L96-L105
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics._readMetricsForClass
protected function _readMetricsForClass($oClass) { $sClass = (string)$oClass['name']; foreach ($oClass as $oFunction) { $this->_readFunctionMetrics($sClass, $oFunction); } $iLocSum = $this->_aStats[$sClass]['sum']['locExecutable']; // Statistics if ($iLocSum) { $this->_aStats[$sClass]['stat']['cnn'] = $this->_aStats[$sClass]['sum']['cnn'] / $iLocSum; $this->_aStats[$sClass]['stat']['crap'] = $this->_aStats[$sClass]['sum']['crap'] / $iLocSum; $this->_aStats[$sClass]['stat']['npath'] = $this->_aStats[$sClass]['sum']['npath'] / $iLocSum; } }
php
protected function _readMetricsForClass($oClass) { $sClass = (string)$oClass['name']; foreach ($oClass as $oFunction) { $this->_readFunctionMetrics($sClass, $oFunction); } $iLocSum = $this->_aStats[$sClass]['sum']['locExecutable']; // Statistics if ($iLocSum) { $this->_aStats[$sClass]['stat']['cnn'] = $this->_aStats[$sClass]['sum']['cnn'] / $iLocSum; $this->_aStats[$sClass]['stat']['crap'] = $this->_aStats[$sClass]['sum']['crap'] / $iLocSum; $this->_aStats[$sClass]['stat']['npath'] = $this->_aStats[$sClass]['sum']['npath'] / $iLocSum; } }
[ "protected", "function", "_readMetricsForClass", "(", "$", "oClass", ")", "{", "$", "sClass", "=", "(", "string", ")", "$", "oClass", "[", "'name'", "]", ";", "foreach", "(", "$", "oClass", "as", "$", "oFunction", ")", "{", "$", "this", "->", "_readFun...
To make analysis for class @param object $oClass class xml object
[ "To", "make", "analysis", "for", "class" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L124-L140
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics._readFunctionMetrics
protected function _readFunctionMetrics($sClass, $oFunction) { $iCcn = (int)$oFunction['ccn']; $iCrap = (int)$oFunction['ccn2']; $iNPath = (int)$oFunction['npath']; $iLoc = (int)$oFunction['lloc']; // Sums $this->appendClassTotalCNN($sClass, (int)$iCcn * $iLoc); $this->appendClassTotalCrapIndex($sClass, (int)$iCrap * $iLoc); $this->appendClassTotalNPath($sClass, (int)$iNPath * $iLoc); $this->appendClassTotalLLOC($sClass, $iLoc); // Max $this->updateClassMaxCCN($sClass, $iCcn); $this->updateClassMaxCrapIndex($sClass, $iCrap); $this->updateClassMaxNPath($sClass, $iNPath); $this->updateClassMaxLLOC($sClass, $iLoc); $this->setGlobalValues($iCcn, $iCrap, $iNPath, $iLoc); }
php
protected function _readFunctionMetrics($sClass, $oFunction) { $iCcn = (int)$oFunction['ccn']; $iCrap = (int)$oFunction['ccn2']; $iNPath = (int)$oFunction['npath']; $iLoc = (int)$oFunction['lloc']; // Sums $this->appendClassTotalCNN($sClass, (int)$iCcn * $iLoc); $this->appendClassTotalCrapIndex($sClass, (int)$iCrap * $iLoc); $this->appendClassTotalNPath($sClass, (int)$iNPath * $iLoc); $this->appendClassTotalLLOC($sClass, $iLoc); // Max $this->updateClassMaxCCN($sClass, $iCcn); $this->updateClassMaxCrapIndex($sClass, $iCrap); $this->updateClassMaxNPath($sClass, $iNPath); $this->updateClassMaxLLOC($sClass, $iLoc); $this->setGlobalValues($iCcn, $iCrap, $iNPath, $iLoc); }
[ "protected", "function", "_readFunctionMetrics", "(", "$", "sClass", ",", "$", "oFunction", ")", "{", "$", "iCcn", "=", "(", "int", ")", "$", "oFunction", "[", "'ccn'", "]", ";", "$", "iCrap", "=", "(", "int", ")", "$", "oFunction", "[", "'ccn2'", "]...
To make metrics analysis for class @param string $sClass class name @param object $oFunction class method metrics
[ "To", "make", "metrics", "analysis", "for", "class" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L148-L168
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics._resetTotalValues
protected function _resetTotalValues() { $this->_iTotalCnn = 0; $this->_iTotalCrapIndex = 0; $this->_iTotalNPath = 0; $this->_iTotalLLOC = 0; $this->_aStats = array(); }
php
protected function _resetTotalValues() { $this->_iTotalCnn = 0; $this->_iTotalCrapIndex = 0; $this->_iTotalNPath = 0; $this->_iTotalLLOC = 0; $this->_aStats = array(); }
[ "protected", "function", "_resetTotalValues", "(", ")", "{", "$", "this", "->", "_iTotalCnn", "=", "0", ";", "$", "this", "->", "_iTotalCrapIndex", "=", "0", ";", "$", "this", "->", "_iTotalNPath", "=", "0", ";", "$", "this", "->", "_iTotalLLOC", "=", ...
To reset total values
[ "To", "reset", "total", "values" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L174-L181
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.appendClassTotalCNN
public function appendClassTotalCNN($sClassName, $iCNN) { if (!isset($this->_aStats[$sClassName]['sum']['cnn'])) { $this->_aStats[$sClassName]['sum']['cnn'] = 0; } $this->_aStats[$sClassName]['sum']['cnn'] += $iCNN; }
php
public function appendClassTotalCNN($sClassName, $iCNN) { if (!isset($this->_aStats[$sClassName]['sum']['cnn'])) { $this->_aStats[$sClassName]['sum']['cnn'] = 0; } $this->_aStats[$sClassName]['sum']['cnn'] += $iCNN; }
[ "public", "function", "appendClassTotalCNN", "(", "$", "sClassName", ",", "$", "iCNN", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'sum'", "]", "[", "'cnn'", "]", ")", ")", "{", "$", "thi...
To append total CCN for needed class @param string $sClassName class name @param int $iCNN new ccn value which needs to add
[ "To", "append", "total", "CCN", "for", "needed", "class" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L199-L206
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.appendClassTotalCrapIndex
public function appendClassTotalCrapIndex($sClassName, $iCrapIndex) { if (!isset($this->_aStats[$sClassName]['sum']['crap'])) { $this->_aStats[$sClassName]['sum']['crap'] = 0; } $this->_aStats[$sClassName]['sum']['crap'] += $iCrapIndex; }
php
public function appendClassTotalCrapIndex($sClassName, $iCrapIndex) { if (!isset($this->_aStats[$sClassName]['sum']['crap'])) { $this->_aStats[$sClassName]['sum']['crap'] = 0; } $this->_aStats[$sClassName]['sum']['crap'] += $iCrapIndex; }
[ "public", "function", "appendClassTotalCrapIndex", "(", "$", "sClassName", ",", "$", "iCrapIndex", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'sum'", "]", "[", "'crap'", "]", ")", ")", "{", ...
To append total crap index for class @param string $sClassName class name @param string $iCrapIndex Crap index
[ "To", "append", "total", "crap", "index", "for", "class" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L234-L240
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.appendClassTotalNPath
public function appendClassTotalNPath($sClassName, $iNPath) { if (!isset($this->_aStats[$sClassName]['sum']['npath'])) { $this->_aStats[$sClassName]['sum']['npath'] = 0; } $this->_aStats[$sClassName]['sum']['npath'] += $iNPath; }
php
public function appendClassTotalNPath($sClassName, $iNPath) { if (!isset($this->_aStats[$sClassName]['sum']['npath'])) { $this->_aStats[$sClassName]['sum']['npath'] = 0; } $this->_aStats[$sClassName]['sum']['npath'] += $iNPath; }
[ "public", "function", "appendClassTotalNPath", "(", "$", "sClassName", ",", "$", "iNPath", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'sum'", "]", "[", "'npath'", "]", ")", ")", "{", "$", ...
To append new value to class total NPath @param string $sClassName class name @param int $iNPath new value of NPath
[ "To", "append", "new", "value", "to", "class", "total", "NPath" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L268-L275
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.appendClassTotalLLOC
public function appendClassTotalLLOC($sClassName, $iTotalLLOC) { if (!isset($this->_aStats[$sClassName]['sum']['locExecutable'])) { $this->_aStats[$sClassName]['sum']['locExecutable'] = 0; } $this->_aStats[$sClassName]['sum']['locExecutable'] += $iTotalLLOC; }
php
public function appendClassTotalLLOC($sClassName, $iTotalLLOC) { if (!isset($this->_aStats[$sClassName]['sum']['locExecutable'])) { $this->_aStats[$sClassName]['sum']['locExecutable'] = 0; } $this->_aStats[$sClassName]['sum']['locExecutable'] += $iTotalLLOC; }
[ "public", "function", "appendClassTotalLLOC", "(", "$", "sClassName", ",", "$", "iTotalLLOC", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'sum'", "]", "[", "'locExecutable'", "]", ")", ")", "...
To append class total logical lines of code @param string $sClassName name of class @param int $iTotalLLOC number of logical code lines
[ "To", "append", "class", "total", "logical", "lines", "of", "code" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L303-L310
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.updateClassMaxCCN
public function updateClassMaxCCN($sClassName, $iCCN) { if (!isset($this->_aStats[$sClassName]['max']['cnn']) || $this->_aStats[$sClassName]['max']['cnn'] < $iCCN) { $this->_aStats[$sClassName]['max']['cnn'] = $iCCN; } }
php
public function updateClassMaxCCN($sClassName, $iCCN) { if (!isset($this->_aStats[$sClassName]['max']['cnn']) || $this->_aStats[$sClassName]['max']['cnn'] < $iCCN) { $this->_aStats[$sClassName]['max']['cnn'] = $iCCN; } }
[ "public", "function", "updateClassMaxCCN", "(", "$", "sClassName", ",", "$", "iCCN", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'max'", "]", "[", "'cnn'", "]", ")", "||", "$", "this", "-...
To update class value of CCN if new one is bigger then older one @param string $sClassName class name @param int $iCCN new value of CCN
[ "To", "update", "class", "value", "of", "CCN", "if", "new", "one", "is", "bigger", "then", "older", "one" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L338-L343
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.updateClassMaxCrapIndex
public function updateClassMaxCrapIndex($sClassName, $iCrapIndex) { if (!isset($this->_aStats[$sClassName]['max']['crap']) || $this->_aStats[$sClassName]['max']['crap'] < $iCrapIndex ) { $this->_aStats[$sClassName]['max']['crap'] = $iCrapIndex; } }
php
public function updateClassMaxCrapIndex($sClassName, $iCrapIndex) { if (!isset($this->_aStats[$sClassName]['max']['crap']) || $this->_aStats[$sClassName]['max']['crap'] < $iCrapIndex ) { $this->_aStats[$sClassName]['max']['crap'] = $iCrapIndex; } }
[ "public", "function", "updateClassMaxCrapIndex", "(", "$", "sClassName", ",", "$", "iCrapIndex", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'max'", "]", "[", "'crap'", "]", ")", "||", "$", ...
To update class value of Crap index with new one if is bigger then older @param string $sClassName class name @param int $iCrapIndex value of Crap index
[ "To", "update", "class", "value", "of", "Crap", "index", "with", "new", "one", "if", "is", "bigger", "then", "older" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L373-L380
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.updateClassMaxNPath
public function updateClassMaxNPath($sClassName, $iNPath) { if (!isset($this->_aStats[$sClassName]['max']['npath']) || $this->_aStats[$sClassName]['max']['npath'] < $iNPath ) { $this->_aStats[$sClassName]['max']['npath'] = $iNPath; } }
php
public function updateClassMaxNPath($sClassName, $iNPath) { if (!isset($this->_aStats[$sClassName]['max']['npath']) || $this->_aStats[$sClassName]['max']['npath'] < $iNPath ) { $this->_aStats[$sClassName]['max']['npath'] = $iNPath; } }
[ "public", "function", "updateClassMaxNPath", "(", "$", "sClassName", ",", "$", "iNPath", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'max'", "]", "[", "'npath'", "]", ")", "||", "$", "this"...
To update class NPath value if new one is bigger then existing @param string $sClassName class name @param int $iNPath NPath value
[ "To", "update", "class", "NPath", "value", "if", "new", "one", "is", "bigger", "then", "existing" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L422-L429
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.updateClassMaxLLOC
public function updateClassMaxLLOC($sClassName, $iLLOC) { if (!isset($this->_aStats[$sClassName]['max']['locExecutable']) || $this->_aStats[$sClassName]['max']['locExecutable'] < $iLLOC ) { $this->_aStats[$sClassName]['max']['locExecutable'] = $iLLOC; } }
php
public function updateClassMaxLLOC($sClassName, $iLLOC) { if (!isset($this->_aStats[$sClassName]['max']['locExecutable']) || $this->_aStats[$sClassName]['max']['locExecutable'] < $iLLOC ) { $this->_aStats[$sClassName]['max']['locExecutable'] = $iLLOC; } }
[ "public", "function", "updateClassMaxLLOC", "(", "$", "sClassName", ",", "$", "iLLOC", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_aStats", "[", "$", "sClassName", "]", "[", "'max'", "]", "[", "'locExecutable'", "]", ")", "||", "$", ...
To update class max LLOC value if new one is bigger then older one @param string $sClassName class name @param int $iLLOC value of LLOC
[ "To", "update", "class", "max", "LLOC", "value", "if", "new", "one", "is", "bigger", "then", "older", "one" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L459-L466
train
OXID-eSales/testing_library
library/MC_Metrics.php
Metrics.setGlobalValues
public function setGlobalValues($iCCN, $iCrapIndex, $iNPath, $iLLOC) { //Global total $this->appendTotalCCN((int)$iCCN * $iLLOC); $this->appendToTotalCrapIndex((int)$iCrapIndex * $iLLOC); $this->appendToTotalNPath((int)$iNPath * $iLLOC); $this->appendToTotalLLOC($iLLOC); // Global Max $this->updateMaxCCN($iCCN); $this->updateMaxCrapIndex($iCrapIndex); $this->updateMaxNPath($iNPath); $this->updateMaxLLOC($iLLOC); }
php
public function setGlobalValues($iCCN, $iCrapIndex, $iNPath, $iLLOC) { //Global total $this->appendTotalCCN((int)$iCCN * $iLLOC); $this->appendToTotalCrapIndex((int)$iCrapIndex * $iLLOC); $this->appendToTotalNPath((int)$iNPath * $iLLOC); $this->appendToTotalLLOC($iLLOC); // Global Max $this->updateMaxCCN($iCCN); $this->updateMaxCrapIndex($iCrapIndex); $this->updateMaxNPath($iNPath); $this->updateMaxLLOC($iLLOC); }
[ "public", "function", "setGlobalValues", "(", "$", "iCCN", ",", "$", "iCrapIndex", ",", "$", "iNPath", ",", "$", "iLLOC", ")", "{", "//Global total", "$", "this", "->", "appendTotalCCN", "(", "(", "int", ")", "$", "iCCN", "*", "$", "iLLOC", ")", ";", ...
To set global values @param int $iCCN value of CCN @param int $iCrapIndex Crap index @param int $iNPath NPath value @param int $iLLOC logical lines of code
[ "To", "set", "global", "values" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/MC_Metrics.php#L486-L499
train
OXID-eSales/testing_library
library/VfsStreamWrapper.php
VfsStreamWrapper.createFile
public function createFile($filePath, $content = '') { $this->createStructure([ltrim($filePath, '/') => $content]); return $this->getRootPath() . $filePath; }
php
public function createFile($filePath, $content = '') { $this->createStructure([ltrim($filePath, '/') => $content]); return $this->getRootPath() . $filePath; }
[ "public", "function", "createFile", "(", "$", "filePath", ",", "$", "content", "=", "''", ")", "{", "$", "this", "->", "createStructure", "(", "[", "ltrim", "(", "$", "filePath", ",", "'/'", ")", "=>", "$", "content", "]", ")", ";", "return", "$", ...
Creates file with given content. If file contains path, directories will also be created. Creating multiple files in the same directory does not work as parent directories gets cleared on creation. NOTE: this can be used only once! If you call it twice, the first file is gone and not found by is_file, file_exists and others! @param string $filePath @param string $content Will try to convent any value to string if non string is given. @return string Path to created file.
[ "Creates", "file", "with", "given", "content", ".", "If", "file", "contains", "path", "directories", "will", "also", "be", "created", ".", "Creating", "multiple", "files", "in", "the", "same", "directory", "does", "not", "work", "as", "parent", "directories", ...
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/VfsStreamWrapper.php#L46-L50
train
OXID-eSales/testing_library
library/Services/ViewsGenerator/ViewsGenerator.php
ViewsGenerator.init
public function init($request) { $oGenerator = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class); $oGenerator->updateViews(); }
php
public function init($request) { $oGenerator = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class); $oGenerator->updateViews(); }
[ "public", "function", "init", "(", "$", "request", ")", "{", "$", "oGenerator", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DbMetaDataHandler", "::", "class", ")", ";", "$", "oGenerator", "->", "updateViews", "(", ")", ";",...
Clears shop cache @param Request $request
[ "Clears", "shop", "cache" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/ViewsGenerator/ViewsGenerator.php#L27-L31
train
OXID-eSales/testing_library
library/Services/Library/DatabaseRestorer/DatabaseRestorerFactory.php
DatabaseRestorerFactory.createRestorer
public function createRestorer($className) { if (!class_exists($className)) { $className = __NAMESPACE__ . '\\' . $className; } $restorer = class_exists($className) ? new $className : new DatabaseRestorer(); if (!($restorer instanceof DatabaseRestorerInterface)) { throw new Exception("Database restorer class should implement DatabaseRestorerInterface interface!"); } return $restorer; }
php
public function createRestorer($className) { if (!class_exists($className)) { $className = __NAMESPACE__ . '\\' . $className; } $restorer = class_exists($className) ? new $className : new DatabaseRestorer(); if (!($restorer instanceof DatabaseRestorerInterface)) { throw new Exception("Database restorer class should implement DatabaseRestorerInterface interface!"); } return $restorer; }
[ "public", "function", "createRestorer", "(", "$", "className", ")", "{", "if", "(", "!", "class_exists", "(", "$", "className", ")", ")", "{", "$", "className", "=", "__NAMESPACE__", ".", "'\\\\'", ".", "$", "className", ";", "}", "$", "restorer", "=", ...
Creates and returns database restoration object. @param $className @return mixed @throws Exception
[ "Creates", "and", "returns", "database", "restoration", "object", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Services/Library/DatabaseRestorer/DatabaseRestorerFactory.php#L22-L35
train
OXID-eSales/testing_library
library/helpers/oxArticleHelper.php
oxArticleHelper.resetCache
public static function resetCache() { parent::$_aArticleVendors = array(); parent::$_aArticleManufacturers = array(); parent::$_aLoadedParents = null; parent::$_aSelList = null; }
php
public static function resetCache() { parent::$_aArticleVendors = array(); parent::$_aArticleManufacturers = array(); parent::$_aLoadedParents = null; parent::$_aSelList = null; }
[ "public", "static", "function", "resetCache", "(", ")", "{", "parent", "::", "$", "_aArticleVendors", "=", "array", "(", ")", ";", "parent", "::", "$", "_aArticleManufacturers", "=", "array", "(", ")", ";", "parent", "::", "$", "_aLoadedParents", "=", "nul...
Reset cached private variable values.
[ "Reset", "cached", "private", "variable", "values", "." ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/helpers/oxArticleHelper.php#L60-L66
train
OXID-eSales/testing_library
library/Translator.php
Translator._isTranslateAble
protected function _isTranslateAble($sString) { $sPattern = $this->getTranslationPattern(); $aMatches = array(); if (is_array($sString)) { $sString = implode('_DELIMITER_', $sString); } preg_match_all("|{$sPattern}|", $sString, $aMatches); if ($aMatches['key'] > 0) { $this->_setKeys($aMatches['key']); return true; } return false; }
php
protected function _isTranslateAble($sString) { $sPattern = $this->getTranslationPattern(); $aMatches = array(); if (is_array($sString)) { $sString = implode('_DELIMITER_', $sString); } preg_match_all("|{$sPattern}|", $sString, $aMatches); if ($aMatches['key'] > 0) { $this->_setKeys($aMatches['key']); return true; } return false; }
[ "protected", "function", "_isTranslateAble", "(", "$", "sString", ")", "{", "$", "sPattern", "=", "$", "this", "->", "getTranslationPattern", "(", ")", ";", "$", "aMatches", "=", "array", "(", ")", ";", "if", "(", "is_array", "(", "$", "sString", ")", ...
Checks if string can be translated @param $sString @return bool
[ "Checks", "if", "string", "can", "be", "translated" ]
b28f560a1c3fa8b273a914e64fecda8fbb6295a5
https://github.com/OXID-eSales/testing_library/blob/b28f560a1c3fa8b273a914e64fecda8fbb6295a5/library/Translator.php#L200-L214
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train