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
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Library/OAuthClient/v10/BaseOAuth.php
BaseOAuth.oAuthParseResponse
function oAuthParseResponse($responseString) { $r = array(); foreach (explode('&', $responseString) as $param) { $pair = explode('=', $param, 2); if (count($pair) != 2) continue; $r[urldecode($pair[0])] = urldecode($pair[1]); } return $r; }
php
function oAuthParseResponse($responseString) { $r = array(); foreach (explode('&', $responseString) as $param) { $pair = explode('=', $param, 2); if (count($pair) != 2) continue; $r[urldecode($pair[0])] = urldecode($pair[1]); } return $r; }
[ "function", "oAuthParseResponse", "(", "$", "responseString", ")", "{", "$", "r", "=", "array", "(", ")", ";", "foreach", "(", "explode", "(", "'&'", ",", "$", "responseString", ")", "as", "$", "param", ")", "{", "$", "pair", "=", "explode", "(", "'=...
Parse a URL-encoded OAuth response @return a key/value array
[ "Parse", "a", "URL", "-", "encoded", "OAuth", "response" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/OAuthClient/v10/BaseOAuth.php#L104-L112
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Library/OAuthClient/v10/BaseOAuth.php
BaseOAuth.getAccessToken
function getAccessToken($args = array()) {/*{{{*/ $r = $this->oAuthRequest($this->accessTokenURL(), $args); //var_dump($r); $token = $this->oAuthParseResponse($r); $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); return $token; }
php
function getAccessToken($args = array()) {/*{{{*/ $r = $this->oAuthRequest($this->accessTokenURL(), $args); //var_dump($r); $token = $this->oAuthParseResponse($r); $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); return $token; }
[ "function", "getAccessToken", "(", "$", "args", "=", "array", "(", ")", ")", "{", "/*{{{*/", "$", "r", "=", "$", "this", "->", "oAuthRequest", "(", "$", "this", "->", "accessTokenURL", "(", ")", ",", "$", "args", ")", ";", "//var_dump($r);", "$", "to...
Exchange the request token and secret for an access token and secret, to sign API calls. @returns array("oauth_token" => the access token, "oauth_token_secret" => the access secret)
[ "Exchange", "the", "request", "token", "and", "secret", "for", "an", "access", "token", "and", "secret", "to", "sign", "API", "calls", "." ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/OAuthClient/v10/BaseOAuth.php#L131-L137
train
Celarius/spin-framework
src/Database/Drivers/Pdo/SqLite.php
SqLite.getDsn
public function getDsn(): string { /* # File connection $connection = new PDO('sqlite:<filename>', null, null array(PDO::ATTR_PERSISTENT => true) ); # Memory connection $connection = new PDO('sqlite::memory:', null, null array(PDO::ATTR_PERSISTENT => true) ); */ # Build the DSN $_dsn = $this->getDriver().':'.$this->getFilename(); # Set it $this->setDsn($_dsn); return $_dsn; }
php
public function getDsn(): string { /* # File connection $connection = new PDO('sqlite:<filename>', null, null array(PDO::ATTR_PERSISTENT => true) ); # Memory connection $connection = new PDO('sqlite::memory:', null, null array(PDO::ATTR_PERSISTENT => true) ); */ # Build the DSN $_dsn = $this->getDriver().':'.$this->getFilename(); # Set it $this->setDsn($_dsn); return $_dsn; }
[ "public", "function", "getDsn", "(", ")", ":", "string", "{", "/*\n # File connection\n $connection = new PDO('sqlite:<filename>', null, null\n array(PDO::ATTR_PERSISTENT => true)\n );\n\n # Memory connection\n $connection = new PDO('sqlite::memory:', null, null\n array(PDO::ATTR_PERSISTE...
Get DSN - SqLite formatting sqlite:/tmp/foo.db @return string [description]
[ "Get", "DSN", "-", "SqLite", "formatting" ]
2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0
https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Database/Drivers/Pdo/SqLite.php#L51-L71
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/ChatCommand/RestartExpansion.php
RestartExpansion.execute
public function execute($login, InputInterface $input) { $scriptToExecute = 'run.sh'; if ($this->gameData->getServerOs() == GameDataStorage::OS_WINDOWS) { $scriptToExecute = 'run.bat'; } $player = $this->playerStorage->getPlayerInfo($login); $this->chatNotification->sendMessage( 'expansion_core.chat_commands.restart.message', null, ['%nickname%' => $player->getNickName()] ); $this->application->stopApplication(); $process = new Process("bin/" . $scriptToExecute . " &"); $process->start(); }
php
public function execute($login, InputInterface $input) { $scriptToExecute = 'run.sh'; if ($this->gameData->getServerOs() == GameDataStorage::OS_WINDOWS) { $scriptToExecute = 'run.bat'; } $player = $this->playerStorage->getPlayerInfo($login); $this->chatNotification->sendMessage( 'expansion_core.chat_commands.restart.message', null, ['%nickname%' => $player->getNickName()] ); $this->application->stopApplication(); $process = new Process("bin/" . $scriptToExecute . " &"); $process->start(); }
[ "public", "function", "execute", "(", "$", "login", ",", "InputInterface", "$", "input", ")", "{", "$", "scriptToExecute", "=", "'run.sh'", ";", "if", "(", "$", "this", "->", "gameData", "->", "getServerOs", "(", ")", "==", "GameDataStorage", "::", "OS_WIN...
Method called to execute the chat command. @param string $login @param InputInterface $input @return mixed
[ "Method", "called", "to", "execute", "the", "chat", "command", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/ChatCommand/RestartExpansion.php#L62-L79
train
ansas/php-component
src/Component/File/CsvReader.php
CsvReader.getHeader
public function getHeader() { if (null == $this->header) { $header = $this->getNextDataSet(); if (null === $header) { throw new Exception("Cannot retrieve header"); } $this->setHeader($header); } return $this->header; }
php
public function getHeader() { if (null == $this->header) { $header = $this->getNextDataSet(); if (null === $header) { throw new Exception("Cannot retrieve header"); } $this->setHeader($header); } return $this->header; }
[ "public", "function", "getHeader", "(", ")", "{", "if", "(", "null", "==", "$", "this", "->", "header", ")", "{", "$", "header", "=", "$", "this", "->", "getNextDataSet", "(", ")", ";", "if", "(", "null", "===", "$", "header", ")", "{", "throw", ...
Return CSV header as array. @return array @throws Exception
[ "Return", "CSV", "header", "as", "array", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/File/CsvReader.php#L157-L168
train
ansas/php-component
src/Component/File/CsvReader.php
CsvReader.reset
public function reset() { $this->header = null; $this->line = 0; $this->file->rewind(); return $this; }
php
public function reset() { $this->header = null; $this->line = 0; $this->file->rewind(); return $this; }
[ "public", "function", "reset", "(", ")", "{", "$", "this", "->", "header", "=", "null", ";", "$", "this", "->", "line", "=", "0", ";", "$", "this", "->", "file", "->", "rewind", "(", ")", ";", "return", "$", "this", ";", "}" ]
Reset file. @return $this
[ "Reset", "file", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/File/CsvReader.php#L271-L278
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php
SimpleEmailService.listVerifiedEmailAddresses
public function listVerifiedEmailAddresses() { $rest = new SimpleEmailServiceRequest($this, 'GET'); $rest->setParameter('Action', 'ListVerifiedEmailAddresses'); $rest = $rest->getResponse(); if($rest->error === false && $rest->code !== 200) { $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); } if($rest->error !== false) { $this->__triggerError('listVerifiedEmailAddresses', $rest->error); return false; } $response = array(); if(!isset($rest->body)) { return $response; } $addresses = array(); foreach($rest->body->ListVerifiedEmailAddressesResult->VerifiedEmailAddresses->member as $address) { $addresses[] = (string)$address; } $response['Addresses'] = $addresses; $response['RequestId'] = (string)$rest->body->ResponseMetadata->RequestId; return $response; }
php
public function listVerifiedEmailAddresses() { $rest = new SimpleEmailServiceRequest($this, 'GET'); $rest->setParameter('Action', 'ListVerifiedEmailAddresses'); $rest = $rest->getResponse(); if($rest->error === false && $rest->code !== 200) { $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); } if($rest->error !== false) { $this->__triggerError('listVerifiedEmailAddresses', $rest->error); return false; } $response = array(); if(!isset($rest->body)) { return $response; } $addresses = array(); foreach($rest->body->ListVerifiedEmailAddressesResult->VerifiedEmailAddresses->member as $address) { $addresses[] = (string)$address; } $response['Addresses'] = $addresses; $response['RequestId'] = (string)$rest->body->ResponseMetadata->RequestId; return $response; }
[ "public", "function", "listVerifiedEmailAddresses", "(", ")", "{", "$", "rest", "=", "new", "SimpleEmailServiceRequest", "(", "$", "this", ",", "'GET'", ")", ";", "$", "rest", "->", "setParameter", "(", "'Action'", ",", "'ListVerifiedEmailAddresses'", ")", ";", ...
Lists the email addresses that have been verified and can be used as the 'From' address @return An array containing two items: a list of verified email addresses, and the request id.
[ "Lists", "the", "email", "addresses", "that", "have", "been", "verified", "and", "can", "be", "used", "as", "the", "From", "address" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php#L102-L129
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php
SimpleEmailService.deleteVerifiedEmailAddress
public function deleteVerifiedEmailAddress($email) { $rest = new SimpleEmailServiceRequest($this, 'DELETE'); $rest->setParameter('Action', 'DeleteVerifiedEmailAddress'); $rest->setParameter('EmailAddress', $email); $rest = $rest->getResponse(); if($rest->error === false && $rest->code !== 200) { $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); } if($rest->error !== false) { $this->__triggerError('deleteVerifiedEmailAddress', $rest->error); return false; } $response['RequestId'] = (string)$rest->body->ResponseMetadata->RequestId; return $response; }
php
public function deleteVerifiedEmailAddress($email) { $rest = new SimpleEmailServiceRequest($this, 'DELETE'); $rest->setParameter('Action', 'DeleteVerifiedEmailAddress'); $rest->setParameter('EmailAddress', $email); $rest = $rest->getResponse(); if($rest->error === false && $rest->code !== 200) { $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); } if($rest->error !== false) { $this->__triggerError('deleteVerifiedEmailAddress', $rest->error); return false; } $response['RequestId'] = (string)$rest->body->ResponseMetadata->RequestId; return $response; }
[ "public", "function", "deleteVerifiedEmailAddress", "(", "$", "email", ")", "{", "$", "rest", "=", "new", "SimpleEmailServiceRequest", "(", "$", "this", ",", "'DELETE'", ")", ";", "$", "rest", "->", "setParameter", "(", "'Action'", ",", "'DeleteVerifiedEmailAddr...
Removes the specified email address from the list of verified addresses. @param string email The email address to remove @return The request id for this request.
[ "Removes", "the", "specified", "email", "address", "from", "the", "list", "of", "verified", "addresses", "." ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php#L165-L181
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php
SimpleEmailService.__triggerError
public function __triggerError($functionname, $error) { if($error == false) { trigger_error(sprintf("SimpleEmailService::%s(): Encountered an error, but no description given", $functionname), E_USER_WARNING); } else if(isset($error['curl']) && $error['curl']) { trigger_error(sprintf("SimpleEmailService::%s(): %s %s", $functionname, $error['code'], $error['message']), E_USER_WARNING); } else if(isset($error['Error'])) { $e = $error['Error']; $message = sprintf("SimpleEmailService::%s(): %s - %s: %s\nRequest Id: %s\n", $functionname, $e['Type'], $e['Code'], $e['Message'], $error['RequestId']); trigger_error($message, E_USER_WARNING); } else { trigger_error(sprintf("SimpleEmailService::%s(): Encountered an error: %s", $functionname, $error), E_USER_WARNING); } }
php
public function __triggerError($functionname, $error) { if($error == false) { trigger_error(sprintf("SimpleEmailService::%s(): Encountered an error, but no description given", $functionname), E_USER_WARNING); } else if(isset($error['curl']) && $error['curl']) { trigger_error(sprintf("SimpleEmailService::%s(): %s %s", $functionname, $error['code'], $error['message']), E_USER_WARNING); } else if(isset($error['Error'])) { $e = $error['Error']; $message = sprintf("SimpleEmailService::%s(): %s - %s: %s\nRequest Id: %s\n", $functionname, $e['Type'], $e['Code'], $e['Message'], $error['RequestId']); trigger_error($message, E_USER_WARNING); } else { trigger_error(sprintf("SimpleEmailService::%s(): Encountered an error: %s", $functionname, $error), E_USER_WARNING); } }
[ "public", "function", "__triggerError", "(", "$", "functionname", ",", "$", "error", ")", "{", "if", "(", "$", "error", "==", "false", ")", "{", "trigger_error", "(", "sprintf", "(", "\"SimpleEmailService::%s(): Encountered an error, but no description given\"", ",", ...
Trigger an error message @internal Used by member functions to output errors @param array $error Array containing error information @return string
[ "Trigger", "an", "error", "message" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php#L352-L370
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php
SimpleEmailServiceRequest.setParameter
public function setParameter($key, $value, $replace = true) { if(!$replace && isset($this->parameters[$key])) { $temp = (array)($this->parameters[$key]); $temp[] = $value; $this->parameters[$key] = $temp; } else { $this->parameters[$key] = $value; } }
php
public function setParameter($key, $value, $replace = true) { if(!$replace && isset($this->parameters[$key])) { $temp = (array)($this->parameters[$key]); $temp[] = $value; $this->parameters[$key] = $temp; } else { $this->parameters[$key] = $value; } }
[ "public", "function", "setParameter", "(", "$", "key", ",", "$", "value", ",", "$", "replace", "=", "true", ")", "{", "if", "(", "!", "$", "replace", "&&", "isset", "(", "$", "this", "->", "parameters", "[", "$", "key", "]", ")", ")", "{", "$", ...
Set request parameter @param string $key Key @param string $value Value @param boolean $replace Whether to replace the key if it already exists (default true) @return void
[ "Set", "request", "parameter" ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php#L401-L412
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php
SimpleEmailServiceMessage.validate
public function validate() { if(count($this->to) == 0) return false; if($this->from == null || strlen($this->from) == 0) return false; // messages require at least one of: subject, messagetext, messagehtml. if(($this->subject == null || strlen($this->subject) == 0) && ($this->messagetext == null || strlen($this->messagetext) == 0) && ($this->messagehtml == null || strlen($this->messagehtml) == 0)) { return false; } return true; }
php
public function validate() { if(count($this->to) == 0) return false; if($this->from == null || strlen($this->from) == 0) return false; // messages require at least one of: subject, messagetext, messagehtml. if(($this->subject == null || strlen($this->subject) == 0) && ($this->messagetext == null || strlen($this->messagetext) == 0) && ($this->messagehtml == null || strlen($this->messagehtml) == 0)) { return false; } return true; }
[ "public", "function", "validate", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "to", ")", "==", "0", ")", "return", "false", ";", "if", "(", "$", "this", "->", "from", "==", "null", "||", "strlen", "(", "$", "this", "->", "from", ...
Validates whether the message object has sufficient information to submit a request to SES. This does not guarantee the message will arrive, nor that the request will succeed; instead, it makes sure that no required fields are missing. This is used internally before attempting a SendEmail or SendRawEmail request, but it can be used outside of this file if verification is desired. May be useful if e.g. the data is being populated from a form; developers can generally use this function to verify completeness instead of writing custom logic. @return boolean
[ "Validates", "whether", "the", "message", "object", "has", "sufficient", "information", "to", "submit", "a", "request", "to", "SES", ".", "This", "does", "not", "guarantee", "the", "message", "will", "arrive", "nor", "that", "the", "request", "will", "succeed"...
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/AWS/SimpleEmailService.php#L694-L708
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php
GamecurrencyQuery.filterBySenderlogin
public function filterBySenderlogin($senderlogin = null, $comparison = null) { if (null === $comparison) { if (is_array($senderlogin)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_SENDERLOGIN, $senderlogin, $comparison); }
php
public function filterBySenderlogin($senderlogin = null, $comparison = null) { if (null === $comparison) { if (is_array($senderlogin)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_SENDERLOGIN, $senderlogin, $comparison); }
[ "public", "function", "filterBySenderlogin", "(", "$", "senderlogin", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "senderlogin", ")", ")", "{", "$",...
Filter the query on the senderLogin column Example usage: <code> $query->filterBySenderlogin('fooValue'); // WHERE senderLogin = 'fooValue' $query->filterBySenderlogin('%fooValue%', Criteria::LIKE); // WHERE senderLogin LIKE '%fooValue%' </code> @param string $senderlogin The value to use as filter. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildGamecurrencyQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "senderLogin", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php#L329-L338
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php
GamecurrencyQuery.filterByReceiverlogin
public function filterByReceiverlogin($receiverlogin = null, $comparison = null) { if (null === $comparison) { if (is_array($receiverlogin)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_RECEIVERLOGIN, $receiverlogin, $comparison); }
php
public function filterByReceiverlogin($receiverlogin = null, $comparison = null) { if (null === $comparison) { if (is_array($receiverlogin)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_RECEIVERLOGIN, $receiverlogin, $comparison); }
[ "public", "function", "filterByReceiverlogin", "(", "$", "receiverlogin", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "receiverlogin", ")", ")", "{", ...
Filter the query on the receiverLogin column Example usage: <code> $query->filterByReceiverlogin('fooValue'); // WHERE receiverLogin = 'fooValue' $query->filterByReceiverlogin('%fooValue%', Criteria::LIKE); // WHERE receiverLogin LIKE '%fooValue%' </code> @param string $receiverlogin The value to use as filter. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildGamecurrencyQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "receiverLogin", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php#L354-L363
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php
GamecurrencyQuery.filterByTransactionid
public function filterByTransactionid($transactionid = null, $comparison = null) { if (is_array($transactionid)) { $useMinMax = false; if (isset($transactionid['min'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_TRANSACTIONID, $transactionid['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($transactionid['max'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_TRANSACTIONID, $transactionid['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_TRANSACTIONID, $transactionid, $comparison); }
php
public function filterByTransactionid($transactionid = null, $comparison = null) { if (is_array($transactionid)) { $useMinMax = false; if (isset($transactionid['min'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_TRANSACTIONID, $transactionid['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($transactionid['max'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_TRANSACTIONID, $transactionid['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_TRANSACTIONID, $transactionid, $comparison); }
[ "public", "function", "filterByTransactionid", "(", "$", "transactionid", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "transactionid", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset"...
Filter the query on the transactionId column Example usage: <code> $query->filterByTransactionid(1234); // WHERE transactionId = 1234 $query->filterByTransactionid(array(12, 34)); // WHERE transactionId IN (12, 34) $query->filterByTransactionid(array('min' => 12)); // WHERE transactionId > 12 </code> @param mixed $transactionid The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildGamecurrencyQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "transactionId", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php#L383-L404
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php
GamecurrencyQuery.filterByBillid
public function filterByBillid($billid = null, $comparison = null) { if (is_array($billid)) { $useMinMax = false; if (isset($billid['min'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_BILLID, $billid['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($billid['max'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_BILLID, $billid['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_BILLID, $billid, $comparison); }
php
public function filterByBillid($billid = null, $comparison = null) { if (is_array($billid)) { $useMinMax = false; if (isset($billid['min'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_BILLID, $billid['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($billid['max'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_BILLID, $billid['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_BILLID, $billid, $comparison); }
[ "public", "function", "filterByBillid", "(", "$", "billid", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "billid", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$", "bi...
Filter the query on the billId column Example usage: <code> $query->filterByBillid(1234); // WHERE billId = 1234 $query->filterByBillid(array(12, 34)); // WHERE billId IN (12, 34) $query->filterByBillid(array('min' => 12)); // WHERE billId > 12 </code> @param mixed $billid The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildGamecurrencyQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "billId", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php#L424-L445
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php
GamecurrencyQuery.filterByAmount
public function filterByAmount($amount = null, $comparison = null) { if (is_array($amount)) { $useMinMax = false; if (isset($amount['min'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_AMOUNT, $amount['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($amount['max'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_AMOUNT, $amount['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_AMOUNT, $amount, $comparison); }
php
public function filterByAmount($amount = null, $comparison = null) { if (is_array($amount)) { $useMinMax = false; if (isset($amount['min'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_AMOUNT, $amount['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($amount['max'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_AMOUNT, $amount['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_AMOUNT, $amount, $comparison); }
[ "public", "function", "filterByAmount", "(", "$", "amount", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "amount", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$", "am...
Filter the query on the amount column Example usage: <code> $query->filterByAmount(1234); // WHERE amount = 1234 $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34) $query->filterByAmount(array('min' => 12)); // WHERE amount > 12 </code> @param mixed $amount The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildGamecurrencyQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "amount", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php#L465-L486
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php
GamecurrencyQuery.filterByMessage
public function filterByMessage($message = null, $comparison = null) { if (null === $comparison) { if (is_array($message)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_MESSAGE, $message, $comparison); }
php
public function filterByMessage($message = null, $comparison = null) { if (null === $comparison) { if (is_array($message)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_MESSAGE, $message, $comparison); }
[ "public", "function", "filterByMessage", "(", "$", "message", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "message", ")", ")", "{", "$", "comparis...
Filter the query on the message column Example usage: <code> $query->filterByMessage('fooValue'); // WHERE message = 'fooValue' $query->filterByMessage('%fooValue%', Criteria::LIKE); // WHERE message LIKE '%fooValue%' </code> @param string $message The value to use as filter. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildGamecurrencyQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "message", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php#L502-L511
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php
GamecurrencyQuery.filterByDatetime
public function filterByDatetime($datetime = null, $comparison = null) { if (is_array($datetime)) { $useMinMax = false; if (isset($datetime['min'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_DATETIME, $datetime['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($datetime['max'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_DATETIME, $datetime['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_DATETIME, $datetime, $comparison); }
php
public function filterByDatetime($datetime = null, $comparison = null) { if (is_array($datetime)) { $useMinMax = false; if (isset($datetime['min'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_DATETIME, $datetime['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($datetime['max'])) { $this->addUsingAlias(GamecurrencyTableMap::COL_DATETIME, $datetime['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(GamecurrencyTableMap::COL_DATETIME, $datetime, $comparison); }
[ "public", "function", "filterByDatetime", "(", "$", "datetime", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "datetime", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$",...
Filter the query on the datetime column Example usage: <code> $query->filterByDatetime('2011-03-14'); // WHERE datetime = '2011-03-14' $query->filterByDatetime('now'); // WHERE datetime = '2011-03-14' $query->filterByDatetime(array('max' => 'yesterday')); // WHERE datetime > '2011-03-13' </code> @param mixed $datetime The value to use as filter. Values can be integers (unix timestamps), DateTime objects, or strings. Empty strings are treated as NULL. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildGamecurrencyQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "datetime", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Model/Base/GamecurrencyQuery.php#L574-L595
train
TheBnl/event-tickets
code/model/PriceModifier.php
PriceModifier.setPriceModification
public function setPriceModification($value) { if ($this->exists()) { $join = $this->manyMany('Reservations'); $table = end($join); $where = $this->getSourceQueryParam('Foreign.Filter'); $where["`{$this->baseTable()}ID`"] = $this->ID; SQLUpdate::create( "`{$table}`", array('`PriceModification`' => $value), $where )->execute(); } }
php
public function setPriceModification($value) { if ($this->exists()) { $join = $this->manyMany('Reservations'); $table = end($join); $where = $this->getSourceQueryParam('Foreign.Filter'); $where["`{$this->baseTable()}ID`"] = $this->ID; SQLUpdate::create( "`{$table}`", array('`PriceModification`' => $value), $where )->execute(); } }
[ "public", "function", "setPriceModification", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "exists", "(", ")", ")", "{", "$", "join", "=", "$", "this", "->", "manyMany", "(", "'Reservations'", ")", ";", "$", "table", "=", "end", "(", ...
Set the price modification on the join @param $value
[ "Set", "the", "price", "modification", "on", "the", "join" ]
d18db4146a141795fd50689057130a6fd41ac397
https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/PriceModifier.php#L108-L121
train
mmerian/csv
lib/Csv/Reader.php
Reader.setOptions
public function setOptions(array $options) { foreach ($options as $opt => $val) { $this->setOption($opt, $val); } return $this; }
php
public function setOptions(array $options) { foreach ($options as $opt => $val) { $this->setOption($opt, $val); } return $this; }
[ "public", "function", "setOptions", "(", "array", "$", "options", ")", "{", "foreach", "(", "$", "options", "as", "$", "opt", "=>", "$", "val", ")", "{", "$", "this", "->", "setOption", "(", "$", "opt", ",", "$", "val", ")", ";", "}", "return", "...
Sets the reader options. @param array $options @return Csv\Reader
[ "Sets", "the", "reader", "options", "." ]
1e88277ca7b7ecc3392ced40f43d26a9e80b4025
https://github.com/mmerian/csv/blob/1e88277ca7b7ecc3392ced40f43d26a9e80b4025/lib/Csv/Reader.php#L207-L214
train
mmerian/csv
lib/Csv/Reader.php
Reader.setOption
public function setOption($name, $value) { if (! in_array($name, $this->validOptions)) { throw new Error('Invalid option ' . $name . '. Valid options are : ' . join(', ', $this->validOptions)); } // Check duplicate fields in header if ('header' == $name) { $cnt = array_count_values($value); $duplicates = array(); foreach ($cnt as $f => $c) { if ($c > 1) { $duplicates[$f] = $c; } } if (sizeof($duplicates) > 0) { $msg = 'Duplicate fields found in header : ' . join(', ', array_keys($duplicates)); throw new Error($msg); } } $this->$name = $value; return $this; }
php
public function setOption($name, $value) { if (! in_array($name, $this->validOptions)) { throw new Error('Invalid option ' . $name . '. Valid options are : ' . join(', ', $this->validOptions)); } // Check duplicate fields in header if ('header' == $name) { $cnt = array_count_values($value); $duplicates = array(); foreach ($cnt as $f => $c) { if ($c > 1) { $duplicates[$f] = $c; } } if (sizeof($duplicates) > 0) { $msg = 'Duplicate fields found in header : ' . join(', ', array_keys($duplicates)); throw new Error($msg); } } $this->$name = $value; return $this; }
[ "public", "function", "setOption", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "!", "in_array", "(", "$", "name", ",", "$", "this", "->", "validOptions", ")", ")", "{", "throw", "new", "Error", "(", "'Invalid option '", ".", "$", "name"...
Sets an option @param string $name @param mixed $value @return Csv\Reader @throws Csv\Error
[ "Sets", "an", "option" ]
1e88277ca7b7ecc3392ced40f43d26a9e80b4025
https://github.com/mmerian/csv/blob/1e88277ca7b7ecc3392ced40f43d26a9e80b4025/lib/Csv/Reader.php#L226-L248
train
mmerian/csv
lib/Csv/Reader.php
Reader.openFile
protected function openFile() { if (is_null($this->fp)) { $this->fp = @fopen($this->file, $this->mode); if (! $this->fp) { throw new Error('Unable to open ' . $this->file); } } return $this; }
php
protected function openFile() { if (is_null($this->fp)) { $this->fp = @fopen($this->file, $this->mode); if (! $this->fp) { throw new Error('Unable to open ' . $this->file); } } return $this; }
[ "protected", "function", "openFile", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "fp", ")", ")", "{", "$", "this", "->", "fp", "=", "@", "fopen", "(", "$", "this", "->", "file", ",", "$", "this", "->", "mode", ")", ";", "if", ...
Opens the CSV file for read @return \Csv\Reader
[ "Opens", "the", "CSV", "file", "for", "read" ]
1e88277ca7b7ecc3392ced40f43d26a9e80b4025
https://github.com/mmerian/csv/blob/1e88277ca7b7ecc3392ced40f43d26a9e80b4025/lib/Csv/Reader.php#L255-L265
train
mmerian/csv
lib/Csv/Reader.php
Reader.readLine
protected function readLine() { if (! $this->valid()) { throw new Error('End of stream reached, no data to read'); } $this->currentData = fgetcsv($this->fp, null, $this->delimiter, $this->enclosure); // Check if EOF is reached if (false === $this->currentData) { return false; } elseif (array(null) == $this->currentData) { /* * An empty line in the csv file * is returned as an array containing a NULL value. */ if (! $this->ignoreEmptyLines) { throw new Error('Empty line found in file'); } return $this->readLine(); } $this->curLine++; if ($this->inputEncoding != $this->outputEncoding) { $inEnc = $this->inputEncoding; $outEnc = $this->outputEncoding; array_walk($this->currentData, function (&$str) use ($inEnc, $outEnc) { $str = mb_convert_encoding($str, $outEnc, $inEnc); }); } return $this->currentData; }
php
protected function readLine() { if (! $this->valid()) { throw new Error('End of stream reached, no data to read'); } $this->currentData = fgetcsv($this->fp, null, $this->delimiter, $this->enclosure); // Check if EOF is reached if (false === $this->currentData) { return false; } elseif (array(null) == $this->currentData) { /* * An empty line in the csv file * is returned as an array containing a NULL value. */ if (! $this->ignoreEmptyLines) { throw new Error('Empty line found in file'); } return $this->readLine(); } $this->curLine++; if ($this->inputEncoding != $this->outputEncoding) { $inEnc = $this->inputEncoding; $outEnc = $this->outputEncoding; array_walk($this->currentData, function (&$str) use ($inEnc, $outEnc) { $str = mb_convert_encoding($str, $outEnc, $inEnc); }); } return $this->currentData; }
[ "protected", "function", "readLine", "(", ")", "{", "if", "(", "!", "$", "this", "->", "valid", "(", ")", ")", "{", "throw", "new", "Error", "(", "'End of stream reached, no data to read'", ")", ";", "}", "$", "this", "->", "currentData", "=", "fgetcsv", ...
Read the next line, and applies encoding conversion if required @return array @throws Csv\Error if no line can be read
[ "Read", "the", "next", "line", "and", "applies", "encoding", "conversion", "if", "required" ]
1e88277ca7b7ecc3392ced40f43d26a9e80b4025
https://github.com/mmerian/csv/blob/1e88277ca7b7ecc3392ced40f43d26a9e80b4025/lib/Csv/Reader.php#L274-L304
train
mmerian/csv
lib/Csv/Reader.php
Reader.fetch
public function fetch() { if (! $this->valid()) { return false; } $line = $this->current(); $this->readLine(); return $line; }
php
public function fetch() { if (! $this->valid()) { return false; } $line = $this->current(); $this->readLine(); return $line; }
[ "public", "function", "fetch", "(", ")", "{", "if", "(", "!", "$", "this", "->", "valid", "(", ")", ")", "{", "return", "false", ";", "}", "$", "line", "=", "$", "this", "->", "current", "(", ")", ";", "$", "this", "->", "readLine", "(", ")", ...
Fetches and returns the next line. Returns false if end of file is reached. @return array|bool
[ "Fetches", "and", "returns", "the", "next", "line", "." ]
1e88277ca7b7ecc3392ced40f43d26a9e80b4025
https://github.com/mmerian/csv/blob/1e88277ca7b7ecc3392ced40f43d26a9e80b4025/lib/Csv/Reader.php#L313-L321
train
mmerian/csv
lib/Csv/Reader.php
Reader.getHtmlPreview
public function getHtmlPreview($numLines = 5) { $html = '<table>'; if ($this->header) { $html .= '<thead><tr>'; foreach ($this->header as $h) { $html .= '<th>' . htmlentities($h, ENT_QUOTES, 'UTF-8') . '</th>'; } $html .= '</tr></thead>'; } $html .= '<tbody>'; $i = 0; foreach ($this as $line) { if ($i >= $numLines) { break; } $html .= '<tr>'; foreach ($line as $v) { $html .= '<td>' . htmlentities($v, ENT_QUOTES, 'UTF-8') . '</td>'; } $html .= '</tr>'; $i++; } $html .= '</tbody></table>'; return $html; }
php
public function getHtmlPreview($numLines = 5) { $html = '<table>'; if ($this->header) { $html .= '<thead><tr>'; foreach ($this->header as $h) { $html .= '<th>' . htmlentities($h, ENT_QUOTES, 'UTF-8') . '</th>'; } $html .= '</tr></thead>'; } $html .= '<tbody>'; $i = 0; foreach ($this as $line) { if ($i >= $numLines) { break; } $html .= '<tr>'; foreach ($line as $v) { $html .= '<td>' . htmlentities($v, ENT_QUOTES, 'UTF-8') . '</td>'; } $html .= '</tr>'; $i++; } $html .= '</tbody></table>'; return $html; }
[ "public", "function", "getHtmlPreview", "(", "$", "numLines", "=", "5", ")", "{", "$", "html", "=", "'<table>'", ";", "if", "(", "$", "this", "->", "header", ")", "{", "$", "html", ".=", "'<thead><tr>'", ";", "foreach", "(", "$", "this", "->", "heade...
Returns an HTML table preview of the csv data @return string
[ "Returns", "an", "HTML", "table", "preview", "of", "the", "csv", "data" ]
1e88277ca7b7ecc3392ced40f43d26a9e80b4025
https://github.com/mmerian/csv/blob/1e88277ca7b7ecc3392ced40f43d26a9e80b4025/lib/Csv/Reader.php#L328-L354
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Services/FiscalYearManagement/FiscalYearManager.php
FiscalYearManager.getNextFiscalYear
public function getNextFiscalYear() { $fiscalYearId = $this->FiscalYear->lastFiscalYearByOrganization($this->AuthenticationManager->getCurrentUserOrganizationId()); $FiscalYear = $this->FiscalYear->byId($fiscalYearId); return json_encode(array('fiscalYear' => $FiscalYear->year + 1)); }
php
public function getNextFiscalYear() { $fiscalYearId = $this->FiscalYear->lastFiscalYearByOrganization($this->AuthenticationManager->getCurrentUserOrganizationId()); $FiscalYear = $this->FiscalYear->byId($fiscalYearId); return json_encode(array('fiscalYear' => $FiscalYear->year + 1)); }
[ "public", "function", "getNextFiscalYear", "(", ")", "{", "$", "fiscalYearId", "=", "$", "this", "->", "FiscalYear", "->", "lastFiscalYearByOrganization", "(", "$", "this", "->", "AuthenticationManager", "->", "getCurrentUserOrganizationId", "(", ")", ")", ";", "$...
Echo grid data in a jqGrid compatible format @return JSON encoded string A string as follows: In case of success: {"year" : $year}
[ "Echo", "grid", "data", "in", "a", "jqGrid", "compatible", "format" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Services/FiscalYearManagement/FiscalYearManager.php#L185-L192
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/FmlManialink.php
FmlManialink.addDictionaryInformation
protected function addDictionaryInformation() { $translations = []; $this->dictionary->removeAllEntries(); $this->getDictionaryInformation($this->manialink, $translations); foreach ($translations as $msgId => $messages) { foreach ($messages as $message) { $this->dictionary->setEntry($message['Lang'], $msgId, htmlspecialchars($message['Text'])); } } }
php
protected function addDictionaryInformation() { $translations = []; $this->dictionary->removeAllEntries(); $this->getDictionaryInformation($this->manialink, $translations); foreach ($translations as $msgId => $messages) { foreach ($messages as $message) { $this->dictionary->setEntry($message['Lang'], $msgId, htmlspecialchars($message['Text'])); } } }
[ "protected", "function", "addDictionaryInformation", "(", ")", "{", "$", "translations", "=", "[", "]", ";", "$", "this", "->", "dictionary", "->", "removeAllEntries", "(", ")", ";", "$", "this", "->", "getDictionaryInformation", "(", "$", "this", "->", "man...
Add translations to dictionary.
[ "Add", "translations", "to", "dictionary", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/FmlManialink.php#L125-L136
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Model/Gui/FmlManialink.php
FmlManialink.getDictionaryInformation
protected function getDictionaryInformation($control, &$translations) { foreach ($control->getChildren() as $child) { if (($child instanceof Label || $child instanceof FmlLabel) && $child->getTranslate()) { $id = $child->getTextId(); if (!isset($this->cachedMessages[$id])) { $textId = 'exp_'.md5($id); $messages = $this->translationHelper->getTranslations($child->getTextId(), []); $translations[$textId] = $messages; $this->cachedMessages[$textId] = $messages; // Replaces with text id that can be used in the xml. $child->setTextId($textId); } else { $translations[$id] = $this->cachedMessages[$id]; } } else { if ($child instanceof Container) { $this->getDictionaryInformation($child, $translations); } } } }
php
protected function getDictionaryInformation($control, &$translations) { foreach ($control->getChildren() as $child) { if (($child instanceof Label || $child instanceof FmlLabel) && $child->getTranslate()) { $id = $child->getTextId(); if (!isset($this->cachedMessages[$id])) { $textId = 'exp_'.md5($id); $messages = $this->translationHelper->getTranslations($child->getTextId(), []); $translations[$textId] = $messages; $this->cachedMessages[$textId] = $messages; // Replaces with text id that can be used in the xml. $child->setTextId($textId); } else { $translations[$id] = $this->cachedMessages[$id]; } } else { if ($child instanceof Container) { $this->getDictionaryInformation($child, $translations); } } } }
[ "protected", "function", "getDictionaryInformation", "(", "$", "control", ",", "&", "$", "translations", ")", "{", "foreach", "(", "$", "control", "->", "getChildren", "(", ")", "as", "$", "child", ")", "{", "if", "(", "(", "$", "child", "instanceof", "L...
Recursive search all dome tree in order to find all translatable labels. @param Container|\FML\ManiaLink $control @param $translations
[ "Recursive", "search", "all", "dome", "tree", "in", "order", "to", "find", "all", "translatable", "labels", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/FmlManialink.php#L144-L168
train
Malwarebytes/Altamira
src/Altamira/Type/TypeAbstract.php
TypeAbstract.configure
protected function configure( \Altamira\JsWriter\JsWriterAbstract $jsWriter ) { $confInstance = \Altamira\Config::getInstance(); $file = $confInstance['altamira.root'] . $confInstance['altamira.typeconfigpath']; $config = \parse_ini_file( $file, true ); $libConfig = $config[strtolower( $jsWriter->getLibrary() )]; $type = static::TYPE; $typeAttributes = preg_grep( "/$type\./i", array_keys( $libConfig ) ); foreach ( $typeAttributes as $key ) { $attribute = preg_replace( "/{$type}\./i", '', $key ); $this->{$attribute} = $libConfig[$key]; } }
php
protected function configure( \Altamira\JsWriter\JsWriterAbstract $jsWriter ) { $confInstance = \Altamira\Config::getInstance(); $file = $confInstance['altamira.root'] . $confInstance['altamira.typeconfigpath']; $config = \parse_ini_file( $file, true ); $libConfig = $config[strtolower( $jsWriter->getLibrary() )]; $type = static::TYPE; $typeAttributes = preg_grep( "/$type\./i", array_keys( $libConfig ) ); foreach ( $typeAttributes as $key ) { $attribute = preg_replace( "/{$type}\./i", '', $key ); $this->{$attribute} = $libConfig[$key]; } }
[ "protected", "function", "configure", "(", "\\", "Altamira", "\\", "JsWriter", "\\", "JsWriterAbstract", "$", "jsWriter", ")", "{", "$", "confInstance", "=", "\\", "Altamira", "\\", "Config", "::", "getInstance", "(", ")", ";", "$", "file", "=", "$", "conf...
configures instance upon construct @param \Altamira\JsWriter\JsWriterAbstract $jsWriter
[ "configures", "instance", "upon", "construct" ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Type/TypeAbstract.php#L61-L74
train
Malwarebytes/Altamira
src/Altamira/Type/TypeAbstract.php
TypeAbstract.getRendererOptions
public function getRendererOptions() { $opts = array(); foreach( $this->allowedRendererOptions as $opt ) { if( isset( $this->options[$opt] ) ) $opts[$opt] = $this->options[$opt]; } return $opts; }
php
public function getRendererOptions() { $opts = array(); foreach( $this->allowedRendererOptions as $opt ) { if( isset( $this->options[$opt] ) ) $opts[$opt] = $this->options[$opt]; } return $opts; }
[ "public", "function", "getRendererOptions", "(", ")", "{", "$", "opts", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "allowedRendererOptions", "as", "$", "opt", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "options", "[", ...
Return options specific to the renderer @return multitype:multitype:
[ "Return", "options", "specific", "to", "the", "renderer" ]
38e320f68070d7a0b6902c6c3f904995d4a8cdfc
https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Type/TypeAbstract.php#L118-L126
train
byjg/xmlnuke
xmlnuke-php5/src/Xmlnuke/Core/Admin/NewBaseAdminModule.php
NewBaseAdminModule.isUserAdmin
public function isUserAdmin() { $user = $this->getUsersDatabase(); $sr = $user->getById($this->_context->authenticatedUserId()); return ($sr->getField($user->getUserTable()->admin) == "yes"); }
php
public function isUserAdmin() { $user = $this->getUsersDatabase(); $sr = $user->getById($this->_context->authenticatedUserId()); return ($sr->getField($user->getUserTable()->admin) == "yes"); }
[ "public", "function", "isUserAdmin", "(", ")", "{", "$", "user", "=", "$", "this", "->", "getUsersDatabase", "(", ")", ";", "$", "sr", "=", "$", "user", "->", "getById", "(", "$", "this", "->", "_context", "->", "authenticatedUserId", "(", ")", ")", ...
Return true if the current user is an administrator. @return bool
[ "Return", "true", "if", "the", "current", "user", "is", "an", "administrator", "." ]
aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7
https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Admin/NewBaseAdminModule.php#L175-L180
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Services/JournalManagement/JournalManager.php
JournalManager.getVoucherTypes
public function getVoucherTypes() { $voucherTypes = array(); $this->VoucherType->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($VoucherType) use (&$voucherTypes) { array_push($voucherTypes, array('label'=> $this->Lang->has($VoucherType->lang_key) ? $this->Lang->get($VoucherType->lang_key) : $VoucherType->name, 'value'=>$VoucherType->id)); }); return $voucherTypes; }
php
public function getVoucherTypes() { $voucherTypes = array(); $this->VoucherType->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($VoucherType) use (&$voucherTypes) { array_push($voucherTypes, array('label'=> $this->Lang->has($VoucherType->lang_key) ? $this->Lang->get($VoucherType->lang_key) : $VoucherType->name, 'value'=>$VoucherType->id)); }); return $voucherTypes; }
[ "public", "function", "getVoucherTypes", "(", ")", "{", "$", "voucherTypes", "=", "array", "(", ")", ";", "$", "this", "->", "VoucherType", "->", "byOrganization", "(", "$", "this", "->", "AuthenticationManager", "->", "getCurrentUserOrganizationId", "(", ")", ...
Get voucher types @return array An array of arrays as follows: array( array('label'=>$name0, 'value'=>$id0), array('label'=>$name1, 'value'=>$id1),…)
[ "Get", "voucher", "types" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Services/JournalManagement/JournalManager.php#L508-L518
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Services/JournalManagement/JournalManager.php
JournalManager.getFiscalYears
public function getFiscalYears() { $fiscalYears = array(); $this->FiscalYear->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($FiscalYear) use (&$fiscalYears) { array_push($fiscalYears, $FiscalYear->year); }); return $fiscalYears; }
php
public function getFiscalYears() { $fiscalYears = array(); $this->FiscalYear->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($FiscalYear) use (&$fiscalYears) { array_push($fiscalYears, $FiscalYear->year); }); return $fiscalYears; }
[ "public", "function", "getFiscalYears", "(", ")", "{", "$", "fiscalYears", "=", "array", "(", ")", ";", "$", "this", "->", "FiscalYear", "->", "byOrganization", "(", "$", "this", "->", "AuthenticationManager", "->", "getCurrentUserOrganizationId", "(", ")", ")...
Get organization fiscal years @return array An array of arrays as follows: array( $label0, label1,…)
[ "Get", "organization", "fiscal", "years" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Services/JournalManagement/JournalManager.php#L563-L573
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Services/JournalManagement/JournalManager.php
JournalManager.getFirstAndLastDayOfCurrentMonth
public function getFirstAndLastDayOfCurrentMonth() { $Date = new Carbon('first day of this month'); $Date2 = new Carbon('last day of this month'); return array('userFormattedFrom' => $Date->format($this->Lang->get('form.phpShortDateFormat')), 'userFormattedTo' => $Date2->format($this->Lang->get('form.phpShortDateFormat')), 'databaseFormattedFrom' => $Date->format('Y-m-d'), 'databaseFormattedTo' => $Date2->format('Y-m-d')); }
php
public function getFirstAndLastDayOfCurrentMonth() { $Date = new Carbon('first day of this month'); $Date2 = new Carbon('last day of this month'); return array('userFormattedFrom' => $Date->format($this->Lang->get('form.phpShortDateFormat')), 'userFormattedTo' => $Date2->format($this->Lang->get('form.phpShortDateFormat')), 'databaseFormattedFrom' => $Date->format('Y-m-d'), 'databaseFormattedTo' => $Date2->format('Y-m-d')); }
[ "public", "function", "getFirstAndLastDayOfCurrentMonth", "(", ")", "{", "$", "Date", "=", "new", "Carbon", "(", "'first day of this month'", ")", ";", "$", "Date2", "=", "new", "Carbon", "(", "'last day of this month'", ")", ";", "return", "array", "(", "'userF...
Get first day of current month @return array An array as follows: array( 'userFormattedFrom' => $date0, 'userFormattedTo' => $date1, 'databaseFormattedFrom' => $date2, 'databaseFormattedTo' => $date3)
[ "Get", "first", "day", "of", "current", "month" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Services/JournalManagement/JournalManager.php#L653-L659
train
mgallegos/decima-accounting
src/Mgallegos/DecimaAccounting/Accounting/Services/JournalManagement/JournalManager.php
JournalManager.updateJournalVoucherStatus
public function updateJournalVoucherStatus($id, $Journal = null, $JournalVoucher = null, $newStatus = null, $databaseConnectionName = null) { if(empty($newStatus)) { $debitSum = $this->JournalEntry->getJournalVoucherDebitSum($id, $databaseConnectionName); $creditSum = $this->JournalEntry->getJournalVoucherCreditSum($id, $databaseConnectionName); // var_dump((string) $debitSum, (string) $creditSum, $debitSum == $creditSum, round($debitSum) == round($creditSum), (string) $debitSum == (string) $creditSum ); // var_dump(round($debitSum, 2), round($creditSum, 2), round($debitSum, 2) == round($creditSum, 2)); if(round($debitSum, 2) == round($creditSum, 2)) { $status = 'B'; } else { $status = 'A'; } } else { $status = $newStatus; } if(empty($JournalVoucher)) { $JournalVoucher = $this->JournalVoucher->byId($id, $databaseConnectionName); } $currentStatus = $JournalVoucher->status; if($currentStatus != $status) { $this->JournalVoucher->update(array('status' => $status), $JournalVoucher, $databaseConnectionName); if(!empty($Journal)) { $this->Journal->attachDetail($Journal->id, array('field' => $this->Lang->get('decima-accounting::journal-management.status'), 'field_lang_key' => 'decima-accounting::journal-management.status', 'old_value' => $this->Lang->get('decima-accounting::journal-management.' . $currentStatus), 'new_value' => $this->Lang->get('decima-accounting::journal-management.' . $status)), $Journal); } } return $status; }
php
public function updateJournalVoucherStatus($id, $Journal = null, $JournalVoucher = null, $newStatus = null, $databaseConnectionName = null) { if(empty($newStatus)) { $debitSum = $this->JournalEntry->getJournalVoucherDebitSum($id, $databaseConnectionName); $creditSum = $this->JournalEntry->getJournalVoucherCreditSum($id, $databaseConnectionName); // var_dump((string) $debitSum, (string) $creditSum, $debitSum == $creditSum, round($debitSum) == round($creditSum), (string) $debitSum == (string) $creditSum ); // var_dump(round($debitSum, 2), round($creditSum, 2), round($debitSum, 2) == round($creditSum, 2)); if(round($debitSum, 2) == round($creditSum, 2)) { $status = 'B'; } else { $status = 'A'; } } else { $status = $newStatus; } if(empty($JournalVoucher)) { $JournalVoucher = $this->JournalVoucher->byId($id, $databaseConnectionName); } $currentStatus = $JournalVoucher->status; if($currentStatus != $status) { $this->JournalVoucher->update(array('status' => $status), $JournalVoucher, $databaseConnectionName); if(!empty($Journal)) { $this->Journal->attachDetail($Journal->id, array('field' => $this->Lang->get('decima-accounting::journal-management.status'), 'field_lang_key' => 'decima-accounting::journal-management.status', 'old_value' => $this->Lang->get('decima-accounting::journal-management.' . $currentStatus), 'new_value' => $this->Lang->get('decima-accounting::journal-management.' . $status)), $Journal); } } return $status; }
[ "public", "function", "updateJournalVoucherStatus", "(", "$", "id", ",", "$", "Journal", "=", "null", ",", "$", "JournalVoucher", "=", "null", ",", "$", "newStatus", "=", "null", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty"...
Update the status of an existing journal voucher @param int $id Voucher id @param App\Kwaai\Security\Repositories\Journal\JournalInterface $Journal @return string
[ "Update", "the", "status", "of", "an", "existing", "journal", "voucher" ]
6410585303a13892e64e9dfeacbae0ca212b458b
https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Services/JournalManagement/JournalManager.php#L1041-L1084
train
paulbunyannet/wordpress-artisan
src/Commands/Wordpress/Cache/ClearTransientCache.php
ClearTransientCache.clearTransients
protected function clearTransients() { // https://coderwall.com/p/yrqrkw/delete-all-existing-wordpress-transients-in-mysql-database // DELETE FROM `wp_options` WHERE `option_name` LIKE ('_transient_%'); // DELETE FROM `wp_options` WHERE `option_name` LIKE ('_site_transient_%'); Option::where('option_name', 'like', '_transient_%')->delete(); Option::where('option_name', 'like', '_site_transient_%')->delete(); return Option::where('option_name', 'like', '%_transient_%')->count(); }
php
protected function clearTransients() { // https://coderwall.com/p/yrqrkw/delete-all-existing-wordpress-transients-in-mysql-database // DELETE FROM `wp_options` WHERE `option_name` LIKE ('_transient_%'); // DELETE FROM `wp_options` WHERE `option_name` LIKE ('_site_transient_%'); Option::where('option_name', 'like', '_transient_%')->delete(); Option::where('option_name', 'like', '_site_transient_%')->delete(); return Option::where('option_name', 'like', '%_transient_%')->count(); }
[ "protected", "function", "clearTransients", "(", ")", "{", "// https://coderwall.com/p/yrqrkw/delete-all-existing-wordpress-transients-in-mysql-database", "// DELETE FROM `wp_options` WHERE `option_name` LIKE ('_transient_%');", "// DELETE FROM `wp_options` WHERE `option_name` LIKE ('_site_transient...
Clear the transients and check that they are all gone @return integer
[ "Clear", "the", "transients", "and", "check", "that", "they", "are", "all", "gone" ]
05518f8aa5d0f31090d0c2a891e4f4d0239a65bc
https://github.com/paulbunyannet/wordpress-artisan/blob/05518f8aa5d0f31090d0c2a891e4f4d0239a65bc/src/Commands/Wordpress/Cache/ClearTransientCache.php#L59-L67
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/Core/Services/DedicatedConnection/Factory.php
Factory.createConnection
public function createConnection($maxAttempts = 3) { if (is_null($this->connection)) { $lastExcelption = $this->attemptConnection($maxAttempts); if (!is_null($lastExcelption)) { $this->console->getSfStyleOutput()->error( [ "Looks like your Dedicated server is either offline or has wrong config settings", "Error message: " . $lastExcelption->getMessage() ] ); $this->logger->error("Unable to open connection for Dedicated server", ["exception" => $lastExcelption]); throw $lastExcelption; } // Dispatch connected event. $event = new GenericEvent($this->connection); $this->eventDispatcher->dispatch(self::EVENT_CONNECTED, $event); } return $this->connection; }
php
public function createConnection($maxAttempts = 3) { if (is_null($this->connection)) { $lastExcelption = $this->attemptConnection($maxAttempts); if (!is_null($lastExcelption)) { $this->console->getSfStyleOutput()->error( [ "Looks like your Dedicated server is either offline or has wrong config settings", "Error message: " . $lastExcelption->getMessage() ] ); $this->logger->error("Unable to open connection for Dedicated server", ["exception" => $lastExcelption]); throw $lastExcelption; } // Dispatch connected event. $event = new GenericEvent($this->connection); $this->eventDispatcher->dispatch(self::EVENT_CONNECTED, $event); } return $this->connection; }
[ "public", "function", "createConnection", "(", "$", "maxAttempts", "=", "3", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "connection", ")", ")", "{", "$", "lastExcelption", "=", "$", "this", "->", "attemptConnection", "(", "$", "maxAttempts", ...
Attempt to connect to the dedicated server. @param int $maxAttempts @return Connection @throws TransportException when connection fails.
[ "Attempt", "to", "connect", "to", "the", "dedicated", "server", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Services/DedicatedConnection/Factory.php#L94-L118
train
k-gun/oppa
src/Link/Linker.php
Linker.isLinked
public function isLinked(string $host = null): bool { // link exists? // e.g: isLinked('localhost') if ($host && isset($this->links[$host])) { return ($this->links[$host]->status() === Link::STATUS_CONNECTED); } // without master/slave directives // e.g: isLinked() if (true !== $this->config->get('sharding')) { foreach ($this->links as $link) { return ($link->status() === Link::STATUS_CONNECTED); } } // with master/slave directives, check by host switch (trim((string) $host)) { // e.g: isLinked(), isLinked('master') case '': case Link::TYPE_MASTER: foreach ($this->links as $link) { if ($link->getType() == Link::TYPE_MASTER) { return ($link->status() === Link::STATUS_CONNECTED); } } break; // e.g: isLinked('slave1.mysql.local'), isLinked('slave') case Link::TYPE_SLAVE: foreach ($this->links as $link) { if ($link->getType() == Link::TYPE_SLAVE) { return ($link->status() === Link::STATUS_CONNECTED); } } break; } return false; }
php
public function isLinked(string $host = null): bool { // link exists? // e.g: isLinked('localhost') if ($host && isset($this->links[$host])) { return ($this->links[$host]->status() === Link::STATUS_CONNECTED); } // without master/slave directives // e.g: isLinked() if (true !== $this->config->get('sharding')) { foreach ($this->links as $link) { return ($link->status() === Link::STATUS_CONNECTED); } } // with master/slave directives, check by host switch (trim((string) $host)) { // e.g: isLinked(), isLinked('master') case '': case Link::TYPE_MASTER: foreach ($this->links as $link) { if ($link->getType() == Link::TYPE_MASTER) { return ($link->status() === Link::STATUS_CONNECTED); } } break; // e.g: isLinked('slave1.mysql.local'), isLinked('slave') case Link::TYPE_SLAVE: foreach ($this->links as $link) { if ($link->getType() == Link::TYPE_SLAVE) { return ($link->status() === Link::STATUS_CONNECTED); } } break; } return false; }
[ "public", "function", "isLinked", "(", "string", "$", "host", "=", "null", ")", ":", "bool", "{", "// link exists?", "// e.g: isLinked('localhost')", "if", "(", "$", "host", "&&", "isset", "(", "$", "this", "->", "links", "[", "$", "host", "]", ")", ")",...
Is linked. @param string|null $host @return bool
[ "Is", "linked", "." ]
3a20b5cc85cb3899c41737678798ec3de73a3836
https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Link/Linker.php#L209-L247
train
k-gun/oppa
src/Link/Linker.php
Linker.getLink
public function getLink(string $host = null): ?Link { // link exists? // e.g: getLink('localhost') if ($host && isset($this->links[$host])) { return $this->links[$host]; } $host = trim((string) $host); // with master/slave directives if (true === $this->config->get('sharding')) { // e.g: getLink(), getLink('master'), getLink('master.mysql.local') if ($host == '' || $host == Link::TYPE_MASTER) { return Util::arrayRand( array_filter($this->links, function($link) { return $link->getType() == Link::TYPE_MASTER; })); } // e.g: getLink(), getLink('slave'), getLink('slave1.mysql.local') elseif ($host == Link::TYPE_SLAVE) { return Util::arrayRand( array_filter($this->links, function($link) { return $link->getType() == Link::TYPE_SLAVE; })); } } else { // e.g: getLink() if ($host == '') { return Util::arrayRand( array_filter($this->links, function($link) { return $link->getType() == Link::TYPE_SINGLE; })); } } }
php
public function getLink(string $host = null): ?Link { // link exists? // e.g: getLink('localhost') if ($host && isset($this->links[$host])) { return $this->links[$host]; } $host = trim((string) $host); // with master/slave directives if (true === $this->config->get('sharding')) { // e.g: getLink(), getLink('master'), getLink('master.mysql.local') if ($host == '' || $host == Link::TYPE_MASTER) { return Util::arrayRand( array_filter($this->links, function($link) { return $link->getType() == Link::TYPE_MASTER; })); } // e.g: getLink(), getLink('slave'), getLink('slave1.mysql.local') elseif ($host == Link::TYPE_SLAVE) { return Util::arrayRand( array_filter($this->links, function($link) { return $link->getType() == Link::TYPE_SLAVE; })); } } else { // e.g: getLink() if ($host == '') { return Util::arrayRand( array_filter($this->links, function($link) { return $link->getType() == Link::TYPE_SINGLE; })); } } }
[ "public", "function", "getLink", "(", "string", "$", "host", "=", "null", ")", ":", "?", "Link", "{", "// link exists?", "// e.g: getLink('localhost')", "if", "(", "$", "host", "&&", "isset", "(", "$", "this", "->", "links", "[", "$", "host", "]", ")", ...
Get link. @param string|null $host @return ?Oppa\Link\Link
[ "Get", "link", "." ]
3a20b5cc85cb3899c41737678798ec3de73a3836
https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/Link/Linker.php#L265-L299
train
AXN-Informatique/laravel-crud-generator
src/Generator.php
Generator.getStub
protected function getStub($name) { if (is_file($path = base_path("resources/stubs/vendor/crud-generator/{$this->stubsGroup}/$name.stub"))) { return file_get_contents($path); } if (is_file($path = __DIR__."/../resources/stubs/{$this->stubsGroup}/$name.stub")) { return file_get_contents($path); } return ''; }
php
protected function getStub($name) { if (is_file($path = base_path("resources/stubs/vendor/crud-generator/{$this->stubsGroup}/$name.stub"))) { return file_get_contents($path); } if (is_file($path = __DIR__."/../resources/stubs/{$this->stubsGroup}/$name.stub")) { return file_get_contents($path); } return ''; }
[ "protected", "function", "getStub", "(", "$", "name", ")", "{", "if", "(", "is_file", "(", "$", "path", "=", "base_path", "(", "\"resources/stubs/vendor/crud-generator/{$this->stubsGroup}/$name.stub\"", ")", ")", ")", "{", "return", "file_get_contents", "(", "$", ...
Retourne le contenu d'un template. @param string $name @return string
[ "Retourne", "le", "contenu", "d", "un", "template", "." ]
4fde6bf6cd3702f2da9a9ee00fd9d9dbf9bacff6
https://github.com/AXN-Informatique/laravel-crud-generator/blob/4fde6bf6cd3702f2da9a9ee00fd9d9dbf9bacff6/src/Generator.php#L564-L575
train
AXN-Informatique/laravel-crud-generator
src/Generator.php
Generator.getLangPath
protected function getLangPath() { $sectionSegments = $this->sectionSegments; if ($this->langDir) { array_unshift($sectionSegments, $this->langDir); } return base_path('resources/lang/fr/'.implode('/', $sectionSegments).'.php'); }
php
protected function getLangPath() { $sectionSegments = $this->sectionSegments; if ($this->langDir) { array_unshift($sectionSegments, $this->langDir); } return base_path('resources/lang/fr/'.implode('/', $sectionSegments).'.php'); }
[ "protected", "function", "getLangPath", "(", ")", "{", "$", "sectionSegments", "=", "$", "this", "->", "sectionSegments", ";", "if", "(", "$", "this", "->", "langDir", ")", "{", "array_unshift", "(", "$", "sectionSegments", ",", "$", "this", "->", "langDir...
Retourne le chemin vers le fichier des traductions. @return string
[ "Retourne", "le", "chemin", "vers", "le", "fichier", "des", "traductions", "." ]
4fde6bf6cd3702f2da9a9ee00fd9d9dbf9bacff6
https://github.com/AXN-Informatique/laravel-crud-generator/blob/4fde6bf6cd3702f2da9a9ee00fd9d9dbf9bacff6/src/Generator.php#L601-L610
train
williamdes/mariadb-mysql-kbs
src/Search.php
Search.loadData
public static function loadData(): void { if (Search::$loaded === false) { $filePath = Search::$DATA_DIR."merged-ultraslim.json"; $contents = @file_get_contents($filePath); if ($contents === false) { throw new KBException("$filePath does not exist !"); } Search::$data = json_decode($contents); Search::$loaded = true; } }
php
public static function loadData(): void { if (Search::$loaded === false) { $filePath = Search::$DATA_DIR."merged-ultraslim.json"; $contents = @file_get_contents($filePath); if ($contents === false) { throw new KBException("$filePath does not exist !"); } Search::$data = json_decode($contents); Search::$loaded = true; } }
[ "public", "static", "function", "loadData", "(", ")", ":", "void", "{", "if", "(", "Search", "::", "$", "loaded", "===", "false", ")", "{", "$", "filePath", "=", "Search", "::", "$", "DATA_DIR", ".", "\"merged-ultraslim.json\"", ";", "$", "contents", "="...
Load data from disk @return void @throws KBException
[ "Load", "data", "from", "disk" ]
c5cafc66b59aee56e0db8ca42a0ddb8e0fc14f7e
https://github.com/williamdes/mariadb-mysql-kbs/blob/c5cafc66b59aee56e0db8ca42a0ddb8e0fc14f7e/src/Search.php#L36-L47
train
williamdes/mariadb-mysql-kbs
src/Search.php
Search.getByName
public static function getByName(string $name, int $type = Search::ANY): string { self::loadData(); $kbEntrys = self::getVariable($name); if (isset($kbEntrys->a)) { foreach ($kbEntrys->a as $kbEntry) { if ($type === Search::ANY) { return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a; } elseif ($type === Search::MYSQL) { if ($kbEntry->t === Search::MYSQL) { return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a; } } elseif ($type === Search::MARIADB) { if ($kbEntry->t === Search::MARIADB) { return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a; } } } } throw new KBException("$name does not exist for this type of documentation !"); }
php
public static function getByName(string $name, int $type = Search::ANY): string { self::loadData(); $kbEntrys = self::getVariable($name); if (isset($kbEntrys->a)) { foreach ($kbEntrys->a as $kbEntry) { if ($type === Search::ANY) { return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a; } elseif ($type === Search::MYSQL) { if ($kbEntry->t === Search::MYSQL) { return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a; } } elseif ($type === Search::MARIADB) { if ($kbEntry->t === Search::MARIADB) { return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a; } } } } throw new KBException("$name does not exist for this type of documentation !"); }
[ "public", "static", "function", "getByName", "(", "string", "$", "name", ",", "int", "$", "type", "=", "Search", "::", "ANY", ")", ":", "string", "{", "self", "::", "loadData", "(", ")", ";", "$", "kbEntrys", "=", "self", "::", "getVariable", "(", "$...
get the first link to doc available @param string $name Name of variable @param int $type (optional) Type of link Search::MYSQL/Search::MARIADB/Search::ANY @return string @throws KBException
[ "get", "the", "first", "link", "to", "doc", "available" ]
c5cafc66b59aee56e0db8ca42a0ddb8e0fc14f7e
https://github.com/williamdes/mariadb-mysql-kbs/blob/c5cafc66b59aee56e0db8ca42a0ddb8e0fc14f7e/src/Search.php#L69-L90
train
williamdes/mariadb-mysql-kbs
src/Search.php
Search.getVariable
public static function getVariable(string $name): stdClass { self::loadData(); if (isset(Search::$data->vars->{$name})) { return Search::$data->vars->{$name}; } else { throw new KBException("$name does not exist !"); } }
php
public static function getVariable(string $name): stdClass { self::loadData(); if (isset(Search::$data->vars->{$name})) { return Search::$data->vars->{$name}; } else { throw new KBException("$name does not exist !"); } }
[ "public", "static", "function", "getVariable", "(", "string", "$", "name", ")", ":", "stdClass", "{", "self", "::", "loadData", "(", ")", ";", "if", "(", "isset", "(", "Search", "::", "$", "data", "->", "vars", "->", "{", "$", "name", "}", ")", ")"...
Get a variable @param string $name Name of variable @return stdClass @throws KBException
[ "Get", "a", "variable" ]
c5cafc66b59aee56e0db8ca42a0ddb8e0fc14f7e
https://github.com/williamdes/mariadb-mysql-kbs/blob/c5cafc66b59aee56e0db8ca42a0ddb8e0fc14f7e/src/Search.php#L99-L107
train
williamdes/mariadb-mysql-kbs
src/Search.php
Search.getVariableType
public static function getVariableType(string $name): string { self::loadData(); $kbEntry = self::getVariable($name); if (isset($kbEntry->t)) { return Search::$data->varTypes->{$kbEntry->t}; } else { throw new KBException("$name does have a known type !"); } }
php
public static function getVariableType(string $name): string { self::loadData(); $kbEntry = self::getVariable($name); if (isset($kbEntry->t)) { return Search::$data->varTypes->{$kbEntry->t}; } else { throw new KBException("$name does have a known type !"); } }
[ "public", "static", "function", "getVariableType", "(", "string", "$", "name", ")", ":", "string", "{", "self", "::", "loadData", "(", ")", ";", "$", "kbEntry", "=", "self", "::", "getVariable", "(", "$", "name", ")", ";", "if", "(", "isset", "(", "$...
get the type of the variable @param string $name Name of variable @return string @throws KBException
[ "get", "the", "type", "of", "the", "variable" ]
c5cafc66b59aee56e0db8ca42a0ddb8e0fc14f7e
https://github.com/williamdes/mariadb-mysql-kbs/blob/c5cafc66b59aee56e0db8ca42a0ddb8e0fc14f7e/src/Search.php#L116-L125
train
ansas/php-component
src/Slim/Controller/AbstractController.php
AbstractController.notFound
public function notFound(Request $request, Response $response) { $handler = $this->container->get('notFoundHandler'); return $handler($request, $response); }
php
public function notFound(Request $request, Response $response) { $handler = $this->container->get('notFoundHandler'); return $handler($request, $response); }
[ "public", "function", "notFound", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "$", "handler", "=", "$", "this", "->", "container", "->", "get", "(", "'notFoundHandler'", ")", ";", "return", "$", "handler", "(", "$", "reque...
Not found. @param Request $request @param Response $response @return Response
[ "Not", "found", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Slim/Controller/AbstractController.php#L67-L72
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/WidgetBestCheckpoints/Plugins/Gui/UpdaterWidgetFactory.php
UpdaterWidgetFactory.setLocalRecord
public function setLocalRecord($nick, $checkpoints) { if (count($checkpoints) > 0) { $this->updateValue($this->playerGroup, 'LocalRecordCheckpoints', Builder::getArray($checkpoints, true)); $this->updateValue($this->playerGroup, 'LocalRecordHolder', Builder::escapeText($nick)); } else { $this->updateValue($this->playerGroup, 'LocalRecordCheckpoints', "Integer[Integer]"); $this->updateValue($this->playerGroup, 'LocalRecordHolder', Builder::escapeText("-")); } }
php
public function setLocalRecord($nick, $checkpoints) { if (count($checkpoints) > 0) { $this->updateValue($this->playerGroup, 'LocalRecordCheckpoints', Builder::getArray($checkpoints, true)); $this->updateValue($this->playerGroup, 'LocalRecordHolder', Builder::escapeText($nick)); } else { $this->updateValue($this->playerGroup, 'LocalRecordCheckpoints', "Integer[Integer]"); $this->updateValue($this->playerGroup, 'LocalRecordHolder', Builder::escapeText("-")); } }
[ "public", "function", "setLocalRecord", "(", "$", "nick", ",", "$", "checkpoints", ")", "{", "if", "(", "count", "(", "$", "checkpoints", ")", ">", "0", ")", "{", "$", "this", "->", "updateValue", "(", "$", "this", "->", "playerGroup", ",", "'LocalReco...
Update with new local record. @param array $checkpoints
[ "Update", "with", "new", "local", "record", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/WidgetBestCheckpoints/Plugins/Gui/UpdaterWidgetFactory.php#L30-L39
train
locphp/xcs
src/Helper/Strs.php
Strs.cutstr
public static function cutstr($string, $length, $suffix = true, $charset = "utf-8", $start = 0, $dot = ' ...') { $str = str_replace(['&amp;', '&quot;', '&lt;', '&gt;'], ['&', '"', '<', '>'], $string); if (function_exists("mb_substr")) { $strcut = mb_substr($str, $start, $length, $charset); if (mb_strlen($str, $charset) > $length) { return $suffix ? $strcut . $dot : $strcut; } return $strcut; } $re = []; $match = ['']; $re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/"; $re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/"; $re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/"; $re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/"; preg_match_all($re[$charset], $str, $match); $slice = join("", array_slice($match[0], $start, $length)); $strcut = str_replace(['&', '"', '<', '>'], ['&amp;', '&quot;', '&lt;', '&gt;'], $slice); return $suffix ? $strcut . $dot : $strcut; }
php
public static function cutstr($string, $length, $suffix = true, $charset = "utf-8", $start = 0, $dot = ' ...') { $str = str_replace(['&amp;', '&quot;', '&lt;', '&gt;'], ['&', '"', '<', '>'], $string); if (function_exists("mb_substr")) { $strcut = mb_substr($str, $start, $length, $charset); if (mb_strlen($str, $charset) > $length) { return $suffix ? $strcut . $dot : $strcut; } return $strcut; } $re = []; $match = ['']; $re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/"; $re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/"; $re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/"; $re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/"; preg_match_all($re[$charset], $str, $match); $slice = join("", array_slice($match[0], $start, $length)); $strcut = str_replace(['&', '"', '<', '>'], ['&amp;', '&quot;', '&lt;', '&gt;'], $slice); return $suffix ? $strcut . $dot : $strcut; }
[ "public", "static", "function", "cutstr", "(", "$", "string", ",", "$", "length", ",", "$", "suffix", "=", "true", ",", "$", "charset", "=", "\"utf-8\"", ",", "$", "start", "=", "0", ",", "$", "dot", "=", "' ...'", ")", "{", "$", "str", "=", "str...
cut string to set length return string @param $string @param $length @param bool $suffix @param string $charset @param int $start @param string $dot @return mixed|string
[ "cut", "string", "to", "set", "length", "return", "string" ]
46681165e9c055967ad7f4cf2158a174d30cdb27
https://github.com/locphp/xcs/blob/46681165e9c055967ad7f4cf2158a174d30cdb27/src/Helper/Strs.php#L35-L55
train
rmrevin/yii2-rbac-command
Command.php
Command.updateRoles
protected function updateRoles() { foreach ($this->roles() as $Role) { $this->authManager->add($Role); echo sprintf(' > role `%s` added.', $Role->name) . PHP_EOL; } }
php
protected function updateRoles() { foreach ($this->roles() as $Role) { $this->authManager->add($Role); echo sprintf(' > role `%s` added.', $Role->name) . PHP_EOL; } }
[ "protected", "function", "updateRoles", "(", ")", "{", "foreach", "(", "$", "this", "->", "roles", "(", ")", "as", "$", "Role", ")", "{", "$", "this", "->", "authManager", "->", "add", "(", "$", "Role", ")", ";", "echo", "sprintf", "(", "' > role ...
Update roles method
[ "Update", "roles", "method" ]
b94d95b9f929c9351db9e98b7839c6c6bbfccc8a
https://github.com/rmrevin/yii2-rbac-command/blob/b94d95b9f929c9351db9e98b7839c6c6bbfccc8a/Command.php#L182-L189
train
rmrevin/yii2-rbac-command
Command.php
Command.updateRules
protected function updateRules() { foreach ($this->rules() as $Rule) { $this->authManager->add($Rule); echo sprintf(' > rule `%s` added.', $Rule->name) . PHP_EOL; } }
php
protected function updateRules() { foreach ($this->rules() as $Rule) { $this->authManager->add($Rule); echo sprintf(' > rule `%s` added.', $Rule->name) . PHP_EOL; } }
[ "protected", "function", "updateRules", "(", ")", "{", "foreach", "(", "$", "this", "->", "rules", "(", ")", "as", "$", "Rule", ")", "{", "$", "this", "->", "authManager", "->", "add", "(", "$", "Rule", ")", ";", "echo", "sprintf", "(", "' > rule ...
Update rules method
[ "Update", "rules", "method" ]
b94d95b9f929c9351db9e98b7839c6c6bbfccc8a
https://github.com/rmrevin/yii2-rbac-command/blob/b94d95b9f929c9351db9e98b7839c6c6bbfccc8a/Command.php#L194-L201
train
rmrevin/yii2-rbac-command
Command.php
Command.updatePermission
protected function updatePermission() { foreach ($this->permissions() as $Permission) { $this->authManager->add($Permission); echo sprintf(' > permission `%s` added.', $Permission->name) . PHP_EOL; } }
php
protected function updatePermission() { foreach ($this->permissions() as $Permission) { $this->authManager->add($Permission); echo sprintf(' > permission `%s` added.', $Permission->name) . PHP_EOL; } }
[ "protected", "function", "updatePermission", "(", ")", "{", "foreach", "(", "$", "this", "->", "permissions", "(", ")", "as", "$", "Permission", ")", "{", "$", "this", "->", "authManager", "->", "add", "(", "$", "Permission", ")", ";", "echo", "sprintf",...
Update permissions method
[ "Update", "permissions", "method" ]
b94d95b9f929c9351db9e98b7839c6c6bbfccc8a
https://github.com/rmrevin/yii2-rbac-command/blob/b94d95b9f929c9351db9e98b7839c6c6bbfccc8a/Command.php#L206-L213
train
rmrevin/yii2-rbac-command
Command.php
Command.updateInheritanceRoles
protected function updateInheritanceRoles() { foreach ($this->inheritanceRoles() as $role => $items) { foreach ($items as $item) { $this->authManager ->addChild(RbacFactory::Role($role), RbacFactory::Role($item)); echo sprintf(' > role `%s` inherited role `%s`.', $role, $item) . PHP_EOL; } } }
php
protected function updateInheritanceRoles() { foreach ($this->inheritanceRoles() as $role => $items) { foreach ($items as $item) { $this->authManager ->addChild(RbacFactory::Role($role), RbacFactory::Role($item)); echo sprintf(' > role `%s` inherited role `%s`.', $role, $item) . PHP_EOL; } } }
[ "protected", "function", "updateInheritanceRoles", "(", ")", "{", "foreach", "(", "$", "this", "->", "inheritanceRoles", "(", ")", "as", "$", "role", "=>", "$", "items", ")", "{", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "$", "this", ...
Update inheritance roles method
[ "Update", "inheritance", "roles", "method" ]
b94d95b9f929c9351db9e98b7839c6c6bbfccc8a
https://github.com/rmrevin/yii2-rbac-command/blob/b94d95b9f929c9351db9e98b7839c6c6bbfccc8a/Command.php#L218-L228
train
rmrevin/yii2-rbac-command
Command.php
Command.updateInheritancePermissions
protected function updateInheritancePermissions() { foreach ($this->inheritancePermissions() as $role => $items) { foreach ($items as $item) { $this->authManager ->addChild(RbacFactory::Role($role), RbacFactory::Permission($item)); echo sprintf(' > role `%s` inherited permission `%s`.', $role, $item) . PHP_EOL; } } }
php
protected function updateInheritancePermissions() { foreach ($this->inheritancePermissions() as $role => $items) { foreach ($items as $item) { $this->authManager ->addChild(RbacFactory::Role($role), RbacFactory::Permission($item)); echo sprintf(' > role `%s` inherited permission `%s`.', $role, $item) . PHP_EOL; } } }
[ "protected", "function", "updateInheritancePermissions", "(", ")", "{", "foreach", "(", "$", "this", "->", "inheritancePermissions", "(", ")", "as", "$", "role", "=>", "$", "items", ")", "{", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "$"...
Update inheritance permissions method
[ "Update", "inheritance", "permissions", "method" ]
b94d95b9f929c9351db9e98b7839c6c6bbfccc8a
https://github.com/rmrevin/yii2-rbac-command/blob/b94d95b9f929c9351db9e98b7839c6c6bbfccc8a/Command.php#L233-L243
train
melisplatform/melis-installer
src/Service/MelisInstallerModulesService.php
MelisInstallerModulesService.getModulePlugins
public function getModulePlugins($excludeModulesOnReturn = array()) { $modules = array(); $excludeModules = array_values($this->getCoreModules()); foreach($this->getAllModules() as $module) { if(!in_array($module, array_merge($excludeModules,$excludeModulesOnReturn))) { $modules[] = $module; } } return $modules; }
php
public function getModulePlugins($excludeModulesOnReturn = array()) { $modules = array(); $excludeModules = array_values($this->getCoreModules()); foreach($this->getAllModules() as $module) { if(!in_array($module, array_merge($excludeModules,$excludeModulesOnReturn))) { $modules[] = $module; } } return $modules; }
[ "public", "function", "getModulePlugins", "(", "$", "excludeModulesOnReturn", "=", "array", "(", ")", ")", "{", "$", "modules", "=", "array", "(", ")", ";", "$", "excludeModules", "=", "array_values", "(", "$", "this", "->", "getCoreModules", "(", ")", ")"...
Returns all modules plugins that does not belong or treated as core modules @param array $excludeModulesOnReturn @return array
[ "Returns", "all", "modules", "plugins", "that", "does", "not", "belong", "or", "treated", "as", "core", "modules" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/MelisInstallerModulesService.php#L242-L252
train
melisplatform/melis-installer
src/Service/MelisInstallerModulesService.php
MelisInstallerModulesService.getMelisModules
public function getMelisModules() { $modules = array(); foreach($this->getAllModules() as $module) { if(strpos($module, 'Melis') !== false || strpos($module, 'melis') !== false) { $modules[] = $module; } } return $modules; }
php
public function getMelisModules() { $modules = array(); foreach($this->getAllModules() as $module) { if(strpos($module, 'Melis') !== false || strpos($module, 'melis') !== false) { $modules[] = $module; } } return $modules; }
[ "public", "function", "getMelisModules", "(", ")", "{", "$", "modules", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getAllModules", "(", ")", "as", "$", "module", ")", "{", "if", "(", "strpos", "(", "$", "module", ",", "'Melis'",...
Returns all the modules that has been created by Melis @return array
[ "Returns", "all", "the", "modules", "that", "has", "been", "created", "by", "Melis" ]
f34d925b847c1389a5498844fdae890eeb34e461
https://github.com/melisplatform/melis-installer/blob/f34d925b847c1389a5498844fdae890eeb34e461/src/Service/MelisInstallerModulesService.php#L257-L266
train
anklimsk/cakephp-theme
Controller/Component/TreeComponent.php
TreeComponent.tree
public function tree($id = null) { Configure::write('debug', 0); if (!method_exists($this->_model, 'getTreeData')) { throw new InternalErrorException(__d( 'view_extension', 'Method "%s" is not exists in model "%s"', 'getTreeData()', $this->_model->name )); } if (!$this->_controller->request->is('ajax') || !$this->_controller->request->is('post') || !$this->_controller->RequestHandler->prefers('json')) { throw new BadRequestException(); } $data = [ [ 'text' => __d('view_extension', '&lt;None&gt;'), ] ]; $treeData = $this->_model->getTreeData($id); if (!empty($treeData)) { $data = $treeData; } $this->_controller->set(compact('data')); $this->_controller->set('_serialize', 'data'); }
php
public function tree($id = null) { Configure::write('debug', 0); if (!method_exists($this->_model, 'getTreeData')) { throw new InternalErrorException(__d( 'view_extension', 'Method "%s" is not exists in model "%s"', 'getTreeData()', $this->_model->name )); } if (!$this->_controller->request->is('ajax') || !$this->_controller->request->is('post') || !$this->_controller->RequestHandler->prefers('json')) { throw new BadRequestException(); } $data = [ [ 'text' => __d('view_extension', '&lt;None&gt;'), ] ]; $treeData = $this->_model->getTreeData($id); if (!empty($treeData)) { $data = $treeData; } $this->_controller->set(compact('data')); $this->_controller->set('_serialize', 'data'); }
[ "public", "function", "tree", "(", "$", "id", "=", "null", ")", "{", "Configure", "::", "write", "(", "'debug'", ",", "0", ")", ";", "if", "(", "!", "method_exists", "(", "$", "this", "->", "_model", ",", "'getTreeData'", ")", ")", "{", "throw", "n...
Return data for tree view @param int|string $id ID for parent element of tree. @throws InternalErrorException if method Model::getTreeData() is not exists. @throws BadRequestException if request is not AJAX, POST or JSON. @return object Return response object of exported file.
[ "Return", "data", "for", "tree", "view" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/TreeComponent.php#L88-L114
train
northwoods/container
src/InjectorBuilder.php
InjectorBuilder.build
public function build(Injector $injector = null): Injector { if ($injector === null) { $injector = new Injector(); } foreach ($this->configs as $config) { $config->apply($injector); } return $injector; }
php
public function build(Injector $injector = null): Injector { if ($injector === null) { $injector = new Injector(); } foreach ($this->configs as $config) { $config->apply($injector); } return $injector; }
[ "public", "function", "build", "(", "Injector", "$", "injector", "=", "null", ")", ":", "Injector", "{", "if", "(", "$", "injector", "===", "null", ")", "{", "$", "injector", "=", "new", "Injector", "(", ")", ";", "}", "foreach", "(", "$", "this", ...
Build the injector using the provided configuration.
[ "Build", "the", "injector", "using", "the", "provided", "configuration", "." ]
52a9db4450d7a7c883290d6c4990116185a9b6e3
https://github.com/northwoods/container/blob/52a9db4450d7a7c883290d6c4990116185a9b6e3/src/InjectorBuilder.php#L24-L35
train
p810/mysql-helper
src/Query/Where.php
Where.where
public function where(...$arguments): self { switch (count($arguments)) { case 1: if (! is_array($arguments[0])) { throw new InvalidArgumentException; } foreach ($arguments[0] as $column => $data) { if (is_array($data)) { $this->where($column, ...$data); } else { $this->where($column, $data); } } return $this; break; case 2: $arguments = [$arguments[0], '=', $arguments[1], 'AND']; break; case 3: array_push($arguments, 'AND'); break; } return $this->setWhere([ 'column' => $arguments[0], 'value' => $arguments[2], 'operator' => $arguments[3], 'comparison' => $arguments[1] ]); }
php
public function where(...$arguments): self { switch (count($arguments)) { case 1: if (! is_array($arguments[0])) { throw new InvalidArgumentException; } foreach ($arguments[0] as $column => $data) { if (is_array($data)) { $this->where($column, ...$data); } else { $this->where($column, $data); } } return $this; break; case 2: $arguments = [$arguments[0], '=', $arguments[1], 'AND']; break; case 3: array_push($arguments, 'AND'); break; } return $this->setWhere([ 'column' => $arguments[0], 'value' => $arguments[2], 'operator' => $arguments[3], 'comparison' => $arguments[1] ]); }
[ "public", "function", "where", "(", "...", "$", "arguments", ")", ":", "self", "{", "switch", "(", "count", "(", "$", "arguments", ")", ")", "{", "case", "1", ":", "if", "(", "!", "is_array", "(", "$", "arguments", "[", "0", "]", ")", ")", "{", ...
Prepares a WHERE clause to be appended to the query string. This is a flexible method that may be called a number of ways. Some examples: - where('column', 'value') - where('column', '>=', 'value') - where( ['column' => 'value', 'column2' => ['!=', 'value2', 'OR']] ) - where('column', '=', 'value', 'AND') @throws \InvalidArgumentException if only one value was passed and it isn't an array
[ "Prepares", "a", "WHERE", "clause", "to", "be", "appended", "to", "the", "query", "string", "." ]
67510e7298578883bc8bfcfc35bfc4d0d5e82348
https://github.com/p810/mysql-helper/blob/67510e7298578883bc8bfcfc35bfc4d0d5e82348/src/Query/Where.php#L32-L66
train
p810/mysql-helper
src/Query/Where.php
Where.getNextOperator
private function getNextOperator(string $column): ?string { reset($this->fragments['where']); while (key($this->fragments['where']) !== $column) { next($this->fragments['where']); } next($this->fragments['where']); $key = key($this->fragments['where']); return $this->fragments['where'][$key]['operator']; }
php
private function getNextOperator(string $column): ?string { reset($this->fragments['where']); while (key($this->fragments['where']) !== $column) { next($this->fragments['where']); } next($this->fragments['where']); $key = key($this->fragments['where']); return $this->fragments['where'][$key]['operator']; }
[ "private", "function", "getNextOperator", "(", "string", "$", "column", ")", ":", "?", "string", "{", "reset", "(", "$", "this", "->", "fragments", "[", "'where'", "]", ")", ";", "while", "(", "key", "(", "$", "this", "->", "fragments", "[", "'where'",...
To accurately concatenate conditions in a WHERE clause the operators between conditions should be found by looking ahead from the current position in an iteration. For example, for this clause: `WHERE foo = 'bar' OR bar = 'foo'` the first condition would look ahead to the second one to get the OR operator.
[ "To", "accurately", "concatenate", "conditions", "in", "a", "WHERE", "clause", "the", "operators", "between", "conditions", "should", "be", "found", "by", "looking", "ahead", "from", "the", "current", "position", "in", "an", "iteration", "." ]
67510e7298578883bc8bfcfc35bfc4d0d5e82348
https://github.com/p810/mysql-helper/blob/67510e7298578883bc8bfcfc35bfc4d0d5e82348/src/Query/Where.php#L172-L185
train
ansas/php-component
src/Slim/Handler/RedirectToRouteTrait.php
RedirectToRouteTrait.redirectToRoute
public function redirectToRoute(Response $response, $route, array $data = [], array $queryParams = [], $suffix = '') { $url = $this->router->pathFor($route, $data, $queryParams) . $suffix; return $response->withRedirect($url, 301); }
php
public function redirectToRoute(Response $response, $route, array $data = [], array $queryParams = [], $suffix = '') { $url = $this->router->pathFor($route, $data, $queryParams) . $suffix; return $response->withRedirect($url, 301); }
[ "public", "function", "redirectToRoute", "(", "Response", "$", "response", ",", "$", "route", ",", "array", "$", "data", "=", "[", "]", ",", "array", "$", "queryParams", "=", "[", "]", ",", "$", "suffix", "=", "''", ")", "{", "$", "url", "=", "$", ...
Redirect to specific route. @param Response $response @param string $route The route to redirect to @param array $data [optional] Route params @param array $queryParams [optional] Query string params @param string $suffix [optional] URL suffix like query string @return Response
[ "Redirect", "to", "specific", "route", "." ]
24574a1e32d5f1355a6e2b6f20f49b1eda7250ba
https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Slim/Handler/RedirectToRouteTrait.php#L37-L42
train
orkestra/OrkestraPdfBundle
Factory/FactoryRegistry.php
FactoryRegistry.getFactory
public function getFactory($name) { if (!isset($this->factories[$name])) { throw new \RuntimeException(sprintf('No factory registered with name "%s"', $name)); } return $this->factories[$name]; }
php
public function getFactory($name) { if (!isset($this->factories[$name])) { throw new \RuntimeException(sprintf('No factory registered with name "%s"', $name)); } return $this->factories[$name]; }
[ "public", "function", "getFactory", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "factories", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'No factory registered wit...
Get a factory by name @param string $name @throws \RuntimeException @return PdfFactoryInterface
[ "Get", "a", "factory", "by", "name" ]
45979a93b662e81787116f26b53362911878c685
https://github.com/orkestra/OrkestraPdfBundle/blob/45979a93b662e81787116f26b53362911878c685/Factory/FactoryRegistry.php#L44-L51
train
lukefor/Laravel4-SmartyView
src/Dark/SmartyView/Smarty/libs/sysplugins/smarty_internal_write_file.php
Smarty_Internal_Write_File.writeFile
public static function writeFile($_filepath, $_contents, Smarty $smarty) { $_error_reporting = error_reporting(); error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING); if ($smarty->_file_perms !== null) { $old_umask = umask(0); } $_dirpath = dirname($_filepath); // if subdirs, create dir structure if ($_dirpath !== '.' && !file_exists($_dirpath)) { mkdir($_dirpath, $smarty->_dir_perms === null ? 0777 : $smarty->_dir_perms, true); } // write to tmp file, then move to overt file lock race condition $_tmp_file = $_dirpath . DS . str_replace(array('.', ','), '_', uniqid('wrt', true)); if (!file_put_contents($_tmp_file, $_contents)) { error_reporting($_error_reporting); throw new SmartyException("unable to write file {$_tmp_file}"); } /* * Windows' rename() fails if the destination exists, * Linux' rename() properly handles the overwrite. * Simply unlink()ing a file might cause other processes * currently reading that file to fail, but linux' rename() * seems to be smart enough to handle that for us. */ if (Smarty::$_IS_WINDOWS) { // remove original file @unlink($_filepath); // rename tmp file $success = @rename($_tmp_file, $_filepath); } else { // rename tmp file $success = @rename($_tmp_file, $_filepath); if (!$success) { // remove original file @unlink($_filepath); // rename tmp file $success = @rename($_tmp_file, $_filepath); } } if (!$success) { error_reporting($_error_reporting); throw new SmartyException("unable to write file {$_filepath}"); } if ($smarty->_file_perms !== null) { // set file permissions chmod($_filepath, $smarty->_file_perms); umask($old_umask); } error_reporting($_error_reporting); return true; }
php
public static function writeFile($_filepath, $_contents, Smarty $smarty) { $_error_reporting = error_reporting(); error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING); if ($smarty->_file_perms !== null) { $old_umask = umask(0); } $_dirpath = dirname($_filepath); // if subdirs, create dir structure if ($_dirpath !== '.' && !file_exists($_dirpath)) { mkdir($_dirpath, $smarty->_dir_perms === null ? 0777 : $smarty->_dir_perms, true); } // write to tmp file, then move to overt file lock race condition $_tmp_file = $_dirpath . DS . str_replace(array('.', ','), '_', uniqid('wrt', true)); if (!file_put_contents($_tmp_file, $_contents)) { error_reporting($_error_reporting); throw new SmartyException("unable to write file {$_tmp_file}"); } /* * Windows' rename() fails if the destination exists, * Linux' rename() properly handles the overwrite. * Simply unlink()ing a file might cause other processes * currently reading that file to fail, but linux' rename() * seems to be smart enough to handle that for us. */ if (Smarty::$_IS_WINDOWS) { // remove original file @unlink($_filepath); // rename tmp file $success = @rename($_tmp_file, $_filepath); } else { // rename tmp file $success = @rename($_tmp_file, $_filepath); if (!$success) { // remove original file @unlink($_filepath); // rename tmp file $success = @rename($_tmp_file, $_filepath); } } if (!$success) { error_reporting($_error_reporting); throw new SmartyException("unable to write file {$_filepath}"); } if ($smarty->_file_perms !== null) { // set file permissions chmod($_filepath, $smarty->_file_perms); umask($old_umask); } error_reporting($_error_reporting); return true; }
[ "public", "static", "function", "writeFile", "(", "$", "_filepath", ",", "$", "_contents", ",", "Smarty", "$", "smarty", ")", "{", "$", "_error_reporting", "=", "error_reporting", "(", ")", ";", "error_reporting", "(", "$", "_error_reporting", "&", "~", "E_N...
Writes file in a safe way to disk @param string $_filepath complete filepath @param string $_contents file content @param Smarty $smarty smarty instance @throws SmartyException @return boolean true
[ "Writes", "file", "in", "a", "safe", "way", "to", "disk" ]
cb3a9bfae805e787cff179b3e41f1a9ad65b389e
https://github.com/lukefor/Laravel4-SmartyView/blob/cb3a9bfae805e787cff179b3e41f1a9ad65b389e/src/Dark/SmartyView/Smarty/libs/sysplugins/smarty_internal_write_file.php#L28-L85
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.fake
public function fake(EntityInterface $entity, array $options = array()) { if (!empty($options[self::OPTION_LOCALE])) { $loc = $options[self::OPTION_LOCALE]; if (!is_string($loc) || !preg_match('#[a-z]{2,6}_[A-Z]{2,6}#', $loc)) { throw new BadValueException( 'Given option "' . self::OPTION_LOCALE . '" is not a valid string. Use "languageCode_countryCode", e.g. "de_DE" or "en_UK".' ); } $this->locale = $loc; $this->faker = Factory::create($this->locale); } $attributes_to_exclude = array(); if (!empty($options[self::OPTION_EXCLUDED_FIELDS])) { $excluded = $options[self::OPTION_EXCLUDED_FIELDS]; if (!is_array($excluded)) { throw new BadValueException( 'Given option "' . self::OPTION_EXCLUDED_FIELDS . '" is not an array. It should be an array of attribute_names.' ); } $attributes_to_exclude = $excluded; } $type = $entity->getType(); foreach ($type->getAttributes() as $attribute_name => $attribute) { if (in_array($attribute_name, $attributes_to_exclude, true)) { continue; } $name = $this->getMethodNameFor($attribute); if (null !== $name) { $this->$name($entity, $attribute, $options); } else { $this->setValue($entity, $attribute, $attribute->getDefaultValue(), $options); } } if (array_key_exists(self::OPTION_MARK_CLEAN, $options) && true === $options[self::OPTION_MARK_CLEAN] ) { $entity->markClean(); } }
php
public function fake(EntityInterface $entity, array $options = array()) { if (!empty($options[self::OPTION_LOCALE])) { $loc = $options[self::OPTION_LOCALE]; if (!is_string($loc) || !preg_match('#[a-z]{2,6}_[A-Z]{2,6}#', $loc)) { throw new BadValueException( 'Given option "' . self::OPTION_LOCALE . '" is not a valid string. Use "languageCode_countryCode", e.g. "de_DE" or "en_UK".' ); } $this->locale = $loc; $this->faker = Factory::create($this->locale); } $attributes_to_exclude = array(); if (!empty($options[self::OPTION_EXCLUDED_FIELDS])) { $excluded = $options[self::OPTION_EXCLUDED_FIELDS]; if (!is_array($excluded)) { throw new BadValueException( 'Given option "' . self::OPTION_EXCLUDED_FIELDS . '" is not an array. It should be an array of attribute_names.' ); } $attributes_to_exclude = $excluded; } $type = $entity->getType(); foreach ($type->getAttributes() as $attribute_name => $attribute) { if (in_array($attribute_name, $attributes_to_exclude, true)) { continue; } $name = $this->getMethodNameFor($attribute); if (null !== $name) { $this->$name($entity, $attribute, $options); } else { $this->setValue($entity, $attribute, $attribute->getDefaultValue(), $options); } } if (array_key_exists(self::OPTION_MARK_CLEAN, $options) && true === $options[self::OPTION_MARK_CLEAN] ) { $entity->markClean(); } }
[ "public", "function", "fake", "(", "EntityInterface", "$", "entity", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "options", "[", "self", "::", "OPTION_LOCALE", "]", ")", ")", "{", "$", "loc", "...
This method fills the given entity with fake data. You may customize the fake data generation used for each attribute by using the options array. Supported options: - OPTION_LOCALE: Locale for fake data (e.g. 'en_UK', defaults to 'de_DE'). - OPTION_MARK_CLEAN: Calls `$entity->markClean()` at the end to prevent change events to occur after faking data. Default is false. - OPTION_FIELD_VALUES: array of `attribute_name` => `value` pairs to customize fake values per attribute of the given entity. You can either specify a direct value or provide a closure. The closure must return the value you want to set on that attribute. - OPTION_EXCLUDED_FIELDS: Array of attribute_names to excluded from filling with fake data. - OPTION_GUESS_PROVIDER_BY_NAME: Boolean true by default. Certain attribute_names trigger different providers (e.g. firstname or email). @param EntityInterface $entity an instance of the entity to fill with fake data. @param array $options array of options to customize fake data creation. @return void @throws \Trellis\Runtime\Entity\InvalidValueException in case of fake data being invalid for the given attribute @throws \Trellis\Runtime\Entity\BadValueException in case of invalid locale option string @throws \Trellis\Common\Error\RuntimeException on EmbeddedEntityListAttribute misconfiguration
[ "This", "method", "fills", "the", "given", "entity", "with", "fake", "data", ".", "You", "may", "customize", "the", "fake", "data", "generation", "used", "for", "each", "attribute", "by", "using", "the", "options", "array", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L93-L138
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.fakeData
public function fakeData(EntityTypeInterface $type, array $options = array()) { $entity = $type->createEntity(); $this->fake($entity, $options); return $entity->toArray(); }
php
public function fakeData(EntityTypeInterface $type, array $options = array()) { $entity = $type->createEntity(); $this->fake($entity, $options); return $entity->toArray(); }
[ "public", "function", "fakeData", "(", "EntityTypeInterface", "$", "type", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "entity", "=", "$", "type", "->", "createEntity", "(", ")", ";", "$", "this", "->", "fake", "(", "$", "ent...
Creates an array with fake data for the given type. @param EntityTypeInterface $type type to create fake data for @param array $options For valid options see fake() method @return array of fake data for the given type @throws \Trellis\Runtime\Entity\InvalidValueException in case of fake data being invalid for the given attribute @throws \Trellis\Runtime\Entity\BadValueException in case of invalid locale option string @throws \Trellis\Common\Error\RuntimeException on EmbeddedEntityListAttribute misconfiguration
[ "Creates", "an", "array", "with", "fake", "data", "for", "the", "given", "type", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L152-L157
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.createFakeEntity
public function createFakeEntity( EntityTypeInterface $type, array $options = array(), EntityInterface $parent = null ) { $options[self::OPTION_MARK_CLEAN] = true; $entity = $type->createEntity([], $parent); $this->fake($entity, $options); return $entity; }
php
public function createFakeEntity( EntityTypeInterface $type, array $options = array(), EntityInterface $parent = null ) { $options[self::OPTION_MARK_CLEAN] = true; $entity = $type->createEntity([], $parent); $this->fake($entity, $options); return $entity; }
[ "public", "function", "createFakeEntity", "(", "EntityTypeInterface", "$", "type", ",", "array", "$", "options", "=", "array", "(", ")", ",", "EntityInterface", "$", "parent", "=", "null", ")", "{", "$", "options", "[", "self", "::", "OPTION_MARK_CLEAN", "]"...
Creates a entity with fake data for the given type. @param EntityTypeInterface $type type to create entities for @param array $options For valid options see fake() method @param EntityInterface $parent Parent entity to create entity within @return EntityInterface newly created with fake data @throws \Trellis\Runtime\Entity\InvalidValueException in case of fake data being invalid for the given attribute @throws \Trellis\Runtime\Entity\BadValueException in case of invalid locale option string @throws \Trellis\Common\Error\RuntimeException on EmbeddedEntityListAttribute misconfiguration
[ "Creates", "a", "entity", "with", "fake", "data", "for", "the", "given", "type", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L172-L181
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addText
protected function addText(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $min_length = $attribute->getOption('min_length'); $max_length = $attribute->getOption('max_length'); if ($this->shouldGuessByName($options)) { $value = TextGuesser::guess($attribute->getName(), $this->faker); } if (!isset($value)) { $value = $this->faker->words($this->faker->numberBetween(2, 10), true); } if ($min_length && ($len = mb_strlen($value)) < $min_length) { $repeat = ceil(($min_length - $len) / $len); $value .= str_repeat($value, $repeat); } if ($max_length && mb_strlen($value) > $max_length) { $value = substr($value, 0, $max_length); $value = preg_replace('#\s$#', 'o', $value); } $this->setValue($entity, $attribute, $value, $options); }
php
protected function addText(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $min_length = $attribute->getOption('min_length'); $max_length = $attribute->getOption('max_length'); if ($this->shouldGuessByName($options)) { $value = TextGuesser::guess($attribute->getName(), $this->faker); } if (!isset($value)) { $value = $this->faker->words($this->faker->numberBetween(2, 10), true); } if ($min_length && ($len = mb_strlen($value)) < $min_length) { $repeat = ceil(($min_length - $len) / $len); $value .= str_repeat($value, $repeat); } if ($max_length && mb_strlen($value) > $max_length) { $value = substr($value, 0, $max_length); $value = preg_replace('#\s$#', 'o', $value); } $this->setValue($entity, $attribute, $value, $options); }
[ "protected", "function", "addText", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "min_length", "=", "$", "attribute", "->", "getOption", "(", "'min_le...
Generates and adds fake data for a Text on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Text to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "Text", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L318-L342
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addTextList
protected function addTextList( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $values = array(); $number_of_values = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $number_of_values; $i++) { $text = $this->faker->words($this->faker->numberBetween(1, 3), true); if ($this->shouldGuessByName($options)) { $closure = TextGuesser::guess($attribute->getName(), $this->faker); if (!empty($closure) && is_callable($closure)) { $text = call_user_func($closure); } } $values[] = $text; } $this->setValue($entity, $attribute, $values, $options); }
php
protected function addTextList( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $values = array(); $number_of_values = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $number_of_values; $i++) { $text = $this->faker->words($this->faker->numberBetween(1, 3), true); if ($this->shouldGuessByName($options)) { $closure = TextGuesser::guess($attribute->getName(), $this->faker); if (!empty($closure) && is_callable($closure)) { $text = call_user_func($closure); } } $values[] = $text; } $this->setValue($entity, $attribute, $values, $options); }
[ "protected", "function", "addTextList", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "number_of_values", ...
Generates and adds fake data for a TextCollection on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the TextCollection to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "TextCollection", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L353-L373
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addTextarea
protected function addTextarea(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $text = $this->faker->paragraphs($this->faker->numberBetween(1, 5)); $this->setValue($entity, $attribute, implode(PHP_EOL . PHP_EOL, $text), $options); }
php
protected function addTextarea(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $text = $this->faker->paragraphs($this->faker->numberBetween(1, 5)); $this->setValue($entity, $attribute, implode(PHP_EOL . PHP_EOL, $text), $options); }
[ "protected", "function", "addTextarea", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "text", "=", "$", "this", "->", "faker", "->", "paragraphs", "(...
Generates and adds fake data for a Textarea on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Textarea to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "Textarea", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L384-L388
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addInteger
protected function addInteger(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->randomNumber(5), $options); }
php
protected function addInteger(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->randomNumber(5), $options); }
[ "protected", "function", "addInteger", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "this", "->", "setValue", "(", "$", "entity", ",", "$", "attribu...
Generates and adds fake data for an Integer on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Integer to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "an", "Integer", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L399-L402
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addIntegerList
protected function addIntegerList( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $values = array(); $number_of_values = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $number_of_values; $i++) { $values[] = $this->faker->randomNumber(5); } $this->setValue($entity, $attribute, $values, $options); }
php
protected function addIntegerList( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $values = array(); $number_of_values = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $number_of_values; $i++) { $values[] = $this->faker->randomNumber(5); } $this->setValue($entity, $attribute, $values, $options); }
[ "protected", "function", "addIntegerList", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "number_of_values"...
Generates and adds fake data for an IntegerList on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the IntegerList to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "an", "IntegerList", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L413-L426
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addFloat
protected function addFloat(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->randomFloat(5), $options); }
php
protected function addFloat(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->randomFloat(5), $options); }
[ "protected", "function", "addFloat", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "this", "->", "setValue", "(", "$", "entity", ",", "$", "attribute...
Generates and adds fake data for a Float on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Float to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "Float", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L437-L440
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addUrl
protected function addUrl(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->url(), $options); }
php
protected function addUrl(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->url(), $options); }
[ "protected", "function", "addUrl", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "this", "->", "setValue", "(", "$", "entity", ",", "$", "attribute",...
Generates and adds fake data for a Url on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Url to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "Url", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L451-L454
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addUuid
protected function addUuid(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->uuid(), $options); }
php
protected function addUuid(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->uuid(), $options); }
[ "protected", "function", "addUuid", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "this", "->", "setValue", "(", "$", "entity", ",", "$", "attribute"...
Generates and adds fake data for a Uuid on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Uuid to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "Uuid", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L465-L468
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addChoice
protected function addChoice(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $allowed_values = $attribute->getOption('allowed_values'); $choice = $allowed_values[array_rand($allowed_values)]; $this->setValue($entity, $attribute, $choice, $options); }
php
protected function addChoice(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $allowed_values = $attribute->getOption('allowed_values'); $choice = $allowed_values[array_rand($allowed_values)]; $this->setValue($entity, $attribute, $choice, $options); }
[ "protected", "function", "addChoice", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "allowed_values", "=", "$", "attribute", "->", "getOption", "(", "'...
Generates and adds fake data for a choice attribute on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Choice to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "choice", "attribute", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L479-L484
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addKeyValue
protected function addKeyValue(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $values = array(); $number_of_values = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $number_of_values; $i++) { $values[$this->faker->word] = $this->faker->sentence; } $this->setValue($entity, $attribute, $values, $options); }
php
protected function addKeyValue(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $values = array(); $number_of_values = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $number_of_values; $i++) { $values[$this->faker->word] = $this->faker->sentence; } $this->setValue($entity, $attribute, $values, $options); }
[ "protected", "function", "addKeyValue", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "number_of_values", ...
Generates and adds fake data for a KeyValue on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the KeyValue to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "KeyValue", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L495-L505
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addKeyValueList
protected function addKeyValueList( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $collection = array(); $numberOfEntries = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $numberOfEntries; $i++) { $number_of_values = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $number_of_values; $i++) { $collection[$this->faker->word] = $this->faker->words($this->faker->numberBetween(1, 3), true); } } $this->setValue($entity, $attribute, $collection, $options); }
php
protected function addKeyValueList( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $collection = array(); $numberOfEntries = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $numberOfEntries; $i++) { $number_of_values = $this->faker->numberBetween(1, 5); for ($i = 0; $i < $number_of_values; $i++) { $collection[$this->faker->word] = $this->faker->words($this->faker->numberBetween(1, 3), true); } } $this->setValue($entity, $attribute, $collection, $options); }
[ "protected", "function", "addKeyValueList", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "collection", "=", "array", "(", ")", ";", "$", "numberOfEntr...
Generates and adds fake data for a KeyValueList on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the KeyValueList to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "KeyValueList", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L516-L532
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.createComplexValue
protected function createComplexValue(AttributeInterface $attribute, array $options = array()) { $values = array(); $value_holder = $attribute->createValueHolder(); $value_type = $value_holder->getValueType(); if (class_exists($value_type) && preg_grep('#ComplexValueInterface$#', class_implements($value_type)) ) { foreach ($value_type::getPropertyMap() as $property_name => $property_type) { switch ($property_type) { case ComplexValue::VALUE_TYPE_TEXT: if ($this->shouldGuessByName($options)) { $values[$property_name] = TextGuesser::guess($property_name, $this->faker); } if (empty($values[$property_name])) { $values[$property_name] = $this->faker->words(3, true); } break; case ComplexValue::VALUE_TYPE_URL: $values[$property_name] = $this->faker->url; break; case ComplexValue::VALUE_TYPE_BOOLEAN: $values[$property_name] = $this->faker->boolean(); break; case ComplexValue::VALUE_TYPE_INTEGER: $values[$property_name] = $this->faker->numberBetween(0, 10); break; case ComplexValue::VALUE_TYPE_FLOAT: $values[$property_name] = $this->faker->randomFloat(5); break; case ComplexValue::VALUE_TYPE_ARRAY: $numberOfEntries = $this->faker->numberBetween(0, 3); for ($i = 0; $i < $numberOfEntries; $i++) { $values[$property_name][$this->faker->word] = $this->faker->word; } break; default: throw new BadValueException(sprintf( 'Unexpected ComplexValue property type "%s" on %s', $property_type, $value_type )); } } } return new $value_type($values); }
php
protected function createComplexValue(AttributeInterface $attribute, array $options = array()) { $values = array(); $value_holder = $attribute->createValueHolder(); $value_type = $value_holder->getValueType(); if (class_exists($value_type) && preg_grep('#ComplexValueInterface$#', class_implements($value_type)) ) { foreach ($value_type::getPropertyMap() as $property_name => $property_type) { switch ($property_type) { case ComplexValue::VALUE_TYPE_TEXT: if ($this->shouldGuessByName($options)) { $values[$property_name] = TextGuesser::guess($property_name, $this->faker); } if (empty($values[$property_name])) { $values[$property_name] = $this->faker->words(3, true); } break; case ComplexValue::VALUE_TYPE_URL: $values[$property_name] = $this->faker->url; break; case ComplexValue::VALUE_TYPE_BOOLEAN: $values[$property_name] = $this->faker->boolean(); break; case ComplexValue::VALUE_TYPE_INTEGER: $values[$property_name] = $this->faker->numberBetween(0, 10); break; case ComplexValue::VALUE_TYPE_FLOAT: $values[$property_name] = $this->faker->randomFloat(5); break; case ComplexValue::VALUE_TYPE_ARRAY: $numberOfEntries = $this->faker->numberBetween(0, 3); for ($i = 0; $i < $numberOfEntries; $i++) { $values[$property_name][$this->faker->word] = $this->faker->word; } break; default: throw new BadValueException(sprintf( 'Unexpected ComplexValue property type "%s" on %s', $property_type, $value_type )); } } } return new $value_type($values); }
[ "protected", "function", "createComplexValue", "(", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "values", "=", "array", "(", ")", ";", "$", "value_holder", "=", "$", "attribute", "->", "creat...
Generates and adds fake data for a ComplexValue on a entity. @param AttributeInterface $attribute an instance of the ComplexValue to fill with fake data. @param array $options array of options to customize fake data creation. @return mixed
[ "Generates", "and", "adds", "fake", "data", "for", "a", "ComplexValue", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L542-L590
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addImage
protected function addImage( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $image = $this->createComplexValue($attribute, $options); $this->setValue($entity, $attribute, $image, $options); }
php
protected function addImage( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $image = $this->createComplexValue($attribute, $options); $this->setValue($entity, $attribute, $image, $options); }
[ "protected", "function", "addImage", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "image", "=", "$", "this", "->", "createComplexValue", "(", "$", "...
Generates and adds fake data for an Image on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Image to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "an", "Image", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L601-L608
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addImageList
protected function addImageList( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $collection = array(); $min_count = $attribute->getOption('min_count', 0); $max_count = $attribute->getOption('max_count', 3); $numberOfEntries = $this->faker->numberBetween($min_count, $max_count); $image_attribute = new ImageAttribute('someimage', $entity->getType()); // @todo should we have an ImageList collection? for ($i = 0; $i < $numberOfEntries; $i++) { $collection[] = $this->createComplexValue($image_attribute, $options); } $this->setValue($entity, $attribute, $collection, $options); }
php
protected function addImageList( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $collection = array(); $min_count = $attribute->getOption('min_count', 0); $max_count = $attribute->getOption('max_count', 3); $numberOfEntries = $this->faker->numberBetween($min_count, $max_count); $image_attribute = new ImageAttribute('someimage', $entity->getType()); // @todo should we have an ImageList collection? for ($i = 0; $i < $numberOfEntries; $i++) { $collection[] = $this->createComplexValue($image_attribute, $options); } $this->setValue($entity, $attribute, $collection, $options); }
[ "protected", "function", "addImageList", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "collection", "=", "array", "(", ")", ";", "$", "min_count", "...
Generates and adds fake data for a ImageList on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the ImageList to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "ImageList", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L619-L638
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addBoolean
protected function addBoolean(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->boolean, $options); }
php
protected function addBoolean(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->boolean, $options); }
[ "protected", "function", "addBoolean", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "this", "->", "setValue", "(", "$", "entity", ",", "$", "attribu...
Generates and adds fake data for a Boolean on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Boolean to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "Boolean", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L649-L652
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addEmbeddedEntityList
protected function addEmbeddedEntityList( EntityInterface $entity, EmbeddedEntityListAttribute $attribute, array $options = array() ) { $options_clone = $options; $entity_collection = new EntityList(); $embedded_type_map = $attribute->getEmbeddedEntityTypeMap(); $min_count = $attribute->getOption('min_count', 0); $max_count = $attribute->getOption('max_count', 3); $inline_mode = $attribute->getOption('inline_mode', false); if (true === $inline_mode) { $number_of_new_embed_entries = 1; } else { $number_of_new_embed_entries = $this->faker->numberBetween($min_count, $max_count); } // add new entities to collection for embed types for ($i = 0; $i < $number_of_new_embed_entries; $i++) { $embed_type = $this->faker->randomElement($embedded_type_map->getValues()); $new_entity = $this->createFakeEntity($embed_type, $options_clone, $entity); $entity_collection->addItem($new_entity); } $this->setValue($entity, $attribute, $entity_collection, $options); }
php
protected function addEmbeddedEntityList( EntityInterface $entity, EmbeddedEntityListAttribute $attribute, array $options = array() ) { $options_clone = $options; $entity_collection = new EntityList(); $embedded_type_map = $attribute->getEmbeddedEntityTypeMap(); $min_count = $attribute->getOption('min_count', 0); $max_count = $attribute->getOption('max_count', 3); $inline_mode = $attribute->getOption('inline_mode', false); if (true === $inline_mode) { $number_of_new_embed_entries = 1; } else { $number_of_new_embed_entries = $this->faker->numberBetween($min_count, $max_count); } // add new entities to collection for embed types for ($i = 0; $i < $number_of_new_embed_entries; $i++) { $embed_type = $this->faker->randomElement($embedded_type_map->getValues()); $new_entity = $this->createFakeEntity($embed_type, $options_clone, $entity); $entity_collection->addItem($new_entity); } $this->setValue($entity, $attribute, $entity_collection, $options); }
[ "protected", "function", "addEmbeddedEntityList", "(", "EntityInterface", "$", "entity", ",", "EmbeddedEntityListAttribute", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "options_clone", "=", "$", "options", ";", "$", ...
Generates and adds fake data for a embed entities. @param EntityInterface $entity an instance of the entity to fill with fake data. @param EmbeddedEntityListAttribute $attribute instance of the EmbeddedEntityListAttribute to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "embed", "entities", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L663-L690
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addTimestamp
protected function addTimestamp(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $default_value = $attribute->getDefaultValue(); $this->setValue($entity, $attribute, $default_value ?: $this->faker->iso8601, $options); }
php
protected function addTimestamp(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $default_value = $attribute->getDefaultValue(); $this->setValue($entity, $attribute, $default_value ?: $this->faker->iso8601, $options); }
[ "protected", "function", "addTimestamp", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "default_value", "=", "$", "attribute", "->", "getDefaultValue", "...
Generates and adds fake data for a Timestamp on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Timestamp to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "Timestamp", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L701-L705
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addGeoPoint
protected function addGeoPoint(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $geopoint = [ 'lon' => $this->faker->longitude, 'lat' => $this->faker->latitude ]; $this->setValue($entity, $attribute, $geopoint, $options); }
php
protected function addGeoPoint(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $geopoint = [ 'lon' => $this->faker->longitude, 'lat' => $this->faker->latitude ]; $this->setValue($entity, $attribute, $geopoint, $options); }
[ "protected", "function", "addGeoPoint", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "geopoint", "=", "[", "'lon'", "=>", "$", "this", "->", "faker"...
Generates and adds fake data for a GeoPoint on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the GeoPoint to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "GeoPoint", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L716-L723
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.addToken
protected function addToken(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $min_length = $attribute->getOption('min_length', 1); $max_length = $attribute->getOption('max_length', 40); $size = $this->faker->numberBetween($min_length, $max_length); $token = bin2hex(mcrypt_create_iv(ceil($size/2), MCRYPT_DEV_URANDOM)); $truncated_token = substr($token, 0, $size); $this->setValue($entity, $attribute, $truncated_token, $options); }
php
protected function addToken(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $min_length = $attribute->getOption('min_length', 1); $max_length = $attribute->getOption('max_length', 40); $size = $this->faker->numberBetween($min_length, $max_length); $token = bin2hex(mcrypt_create_iv(ceil($size/2), MCRYPT_DEV_URANDOM)); $truncated_token = substr($token, 0, $size); $this->setValue($entity, $attribute, $truncated_token, $options); }
[ "protected", "function", "addToken", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "min_length", "=", "$", "attribute", "->", "getOption", "(", "'min_l...
Generates and adds fake data for a Token on a entity. @param EntityInterface $entity an instance of the entity to fill with fake data. @param AttributeInterface $attribute an instance of the Token to fill with fake data. @param array $options array of options to customize fake data creation. @return void
[ "Generates", "and", "adds", "fake", "data", "for", "a", "Token", "on", "a", "entity", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L734-L742
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.setValue
protected function setValue( EntityInterface $entity, AttributeInterface $attribute, $default_value, array $options = array() ) { $attribute_name = $attribute->getName(); $attribute_options = array(); if (!empty($options[self::OPTION_FIELD_VALUES]) && is_array($options[self::OPTION_FIELD_VALUES]) ) { $attribute_options = $options[self::OPTION_FIELD_VALUES]; } if (empty($attribute_options[$attribute_name])) { $entity->setValue($attribute_name, $default_value); } else { $option = $attribute_options[$attribute_name]; if (is_callable($option)) { $entity->setValue($attribute_name, call_user_func($option)); } else { $entity->setValue($attribute_name, $option); } } }
php
protected function setValue( EntityInterface $entity, AttributeInterface $attribute, $default_value, array $options = array() ) { $attribute_name = $attribute->getName(); $attribute_options = array(); if (!empty($options[self::OPTION_FIELD_VALUES]) && is_array($options[self::OPTION_FIELD_VALUES]) ) { $attribute_options = $options[self::OPTION_FIELD_VALUES]; } if (empty($attribute_options[$attribute_name])) { $entity->setValue($attribute_name, $default_value); } else { $option = $attribute_options[$attribute_name]; if (is_callable($option)) { $entity->setValue($attribute_name, call_user_func($option)); } else { $entity->setValue($attribute_name, $option); } } }
[ "protected", "function", "setValue", "(", "EntityInterface", "$", "entity", ",", "AttributeInterface", "$", "attribute", ",", "$", "default_value", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "$", "attribute_name", "=", "$", "attribute", ...
Sets either given default value or value from option to the given attribute. @param EntityInterface $entity the entity to modify @param AttributeInterface $attribute the attribute to set a value for @param mixed $default_value Default value to set. @param array $options Array containing a `attribute_name => $mixed` entry. $mixed is set as value instead of $default_value. If $mixed is a closure it will be called and used. $mixed may also be another callable like an array `array($class, "$methodName")` or a string like `'Your\Namespace\Foo::getStaticTrololo'`. @return void
[ "Sets", "either", "given", "default", "value", "or", "value", "from", "option", "to", "the", "given", "attribute", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L759-L784
train
honeybee/trellis
src/Sham/DataGenerator.php
DataGenerator.shouldGuessByName
protected function shouldGuessByName(array $options = array()) { if (array_key_exists(self::OPTION_GUESS_PROVIDER_BY_NAME, $options) && false === $options[self::OPTION_GUESS_PROVIDER_BY_NAME] ) { return false; } return true; }
php
protected function shouldGuessByName(array $options = array()) { if (array_key_exists(self::OPTION_GUESS_PROVIDER_BY_NAME, $options) && false === $options[self::OPTION_GUESS_PROVIDER_BY_NAME] ) { return false; } return true; }
[ "protected", "function", "shouldGuessByName", "(", "array", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "array_key_exists", "(", "self", "::", "OPTION_GUESS_PROVIDER_BY_NAME", ",", "$", "options", ")", "&&", "false", "===", "$", "options", "...
Returns whether or not the fake data generation should be dependant on the attribute_names the used types have. @param array $options array of options to customize fake data creation. @return bool true if the fake data provider should be guessed by attribute_name. False if specified self::OPTION_GUESS_PROVIDER_BY_NAME is set to false.
[ "Returns", "whether", "or", "not", "the", "fake", "data", "generation", "should", "be", "dependant", "on", "the", "attribute_names", "the", "used", "types", "have", "." ]
511300e193b22adc48a22e8ea8294ad40d53f681
https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Sham/DataGenerator.php#L795-L803
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Framework/GameCurrencyBundle/Model/Map/GamecurrencyTableMap.php
GamecurrencyTableMap.doDelete
public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(GamecurrencyTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; } elseif ($values instanceof \eXpansion\Framework\GameCurrencyBundle\Model\Gamecurrency) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks $criteria = new Criteria(GamecurrencyTableMap::DATABASE_NAME); $criteria->add(GamecurrencyTableMap::COL_ID, (array) $values, Criteria::IN); } $query = GamecurrencyQuery::create()->mergeWith($criteria); if ($values instanceof Criteria) { GamecurrencyTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { GamecurrencyTableMap::removeInstanceFromPool($singleval); } } return $query->delete($con); }
php
public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(GamecurrencyTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; } elseif ($values instanceof \eXpansion\Framework\GameCurrencyBundle\Model\Gamecurrency) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks $criteria = new Criteria(GamecurrencyTableMap::DATABASE_NAME); $criteria->add(GamecurrencyTableMap::COL_ID, (array) $values, Criteria::IN); } $query = GamecurrencyQuery::create()->mergeWith($criteria); if ($values instanceof Criteria) { GamecurrencyTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { GamecurrencyTableMap::removeInstanceFromPool($singleval); } } return $query->delete($con); }
[ "public", "static", "function", "doDelete", "(", "$", "values", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "null", "===", "$", "con", ")", "{", "$", "con", "=", "Propel", "::", "getServiceContainer", "(", ")", "->", "getW...
Performs a DELETE on the database, given a Gamecurrency or Criteria object OR a primary key value. @param mixed $values Criteria or Gamecurrency object or primary key or array of primary keys which is used to create the DELETE statement @param ConnectionInterface $con the connection to use @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows if supported by native driver or if emulated using Propel. @throws PropelException Any exceptions caught during processing will be rethrown wrapped into a PropelException.
[ "Performs", "a", "DELETE", "on", "the", "database", "given", "a", "Gamecurrency", "or", "Criteria", "object", "OR", "a", "primary", "key", "value", "." ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/GameCurrencyBundle/Model/Map/GamecurrencyTableMap.php#L385-L413
train
laravie/predis-async
src/Client.php
Client.setErrorCallback
protected function setErrorCallback(ConnectionInterface $connection, callable $callback) { $connection->setErrorCallback(function ($connection, $exception) use ($callback) { \call_user_func($callback, $this, $exception, $connection); }); }
php
protected function setErrorCallback(ConnectionInterface $connection, callable $callback) { $connection->setErrorCallback(function ($connection, $exception) use ($callback) { \call_user_func($callback, $this, $exception, $connection); }); }
[ "protected", "function", "setErrorCallback", "(", "ConnectionInterface", "$", "connection", ",", "callable", "$", "callback", ")", "{", "$", "connection", "->", "setErrorCallback", "(", "function", "(", "$", "connection", ",", "$", "exception", ")", "use", "(", ...
Sets the callback used to notify the client about connection errors. @param ConnectionInterface $connection Connection instance. @param callable $callback Callback for error event.
[ "Sets", "the", "callback", "used", "to", "notify", "the", "client", "about", "connection", "errors", "." ]
dd98b10e752b1ed339c9c6e798b33c8810ecda2a
https://github.com/laravie/predis-async/blob/dd98b10e752b1ed339c9c6e798b33c8810ecda2a/src/Client.php#L132-L137
train
laravie/predis-async
src/Client.php
Client.wrapCallback
protected function wrapCallback(callable $callback) { return function ($response, $connection, $command) use ($callback) { if ($command && !$response instanceof ResponseInterface) { $response = $command->parseResponse($response); } \call_user_func($callback, $response, $this, $command); }; }
php
protected function wrapCallback(callable $callback) { return function ($response, $connection, $command) use ($callback) { if ($command && !$response instanceof ResponseInterface) { $response = $command->parseResponse($response); } \call_user_func($callback, $response, $this, $command); }; }
[ "protected", "function", "wrapCallback", "(", "callable", "$", "callback", ")", "{", "return", "function", "(", "$", "response", ",", "$", "connection", ",", "$", "command", ")", "use", "(", "$", "callback", ")", "{", "if", "(", "$", "command", "&&", "...
Wraps a command callback used to parse the raw response by adding more arguments that will be passed back to user code. @param callable $callback Response callback.
[ "Wraps", "a", "command", "callback", "used", "to", "parse", "the", "raw", "response", "by", "adding", "more", "arguments", "that", "will", "be", "passed", "back", "to", "user", "code", "." ]
dd98b10e752b1ed339c9c6e798b33c8810ecda2a
https://github.com/laravie/predis-async/blob/dd98b10e752b1ed339c9c6e798b33c8810ecda2a/src/Client.php#L258-L267
train
anklimsk/cakephp-theme
Controller/Component/UploadComponent.php
UploadComponent._setStorageTimeUpload
protected function _setStorageTimeUpload($time = null) { $time = (int)$time; if ($time > 0) { $this->_storageTimeUpload = $time; } }
php
protected function _setStorageTimeUpload($time = null) { $time = (int)$time; if ($time > 0) { $this->_storageTimeUpload = $time; } }
[ "protected", "function", "_setStorageTimeUpload", "(", "$", "time", "=", "null", ")", "{", "$", "time", "=", "(", "int", ")", "$", "time", ";", "if", "(", "$", "time", ">", "0", ")", "{", "$", "this", "->", "_storageTimeUpload", "=", "$", "time", "...
Set time for storage old uploaded files @param int $time Time limit in seconds for storage uploaded file. @return void
[ "Set", "time", "for", "storage", "old", "uploaded", "files" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/UploadComponent.php#L103-L108
train
anklimsk/cakephp-theme
Controller/Component/UploadComponent.php
UploadComponent._setUploadDir
protected function _setUploadDir($path = null) { $path = (string)$path; if (file_exists($path)) { $this->_pathUploadDir = $path; } }
php
protected function _setUploadDir($path = null) { $path = (string)$path; if (file_exists($path)) { $this->_pathUploadDir = $path; } }
[ "protected", "function", "_setUploadDir", "(", "$", "path", "=", "null", ")", "{", "$", "path", "=", "(", "string", ")", "$", "path", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")", "{", "$", "this", "->", "_pathUploadDir", "=", "$", "pa...
Set path to upload directory @param string $path Path to upload directory @return void
[ "Set", "path", "to", "upload", "directory" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/UploadComponent.php#L125-L130
train
anklimsk/cakephp-theme
Controller/Component/UploadComponent.php
UploadComponent._clearDir
protected function _clearDir($timeNow = null) { $clearPath = $this->getUploadDir(); $storageTime = $this->_getStorageTimeUpload(); $result = true; $oFolder = new Folder($clearPath, true); $uploadedFiles = $oFolder->find('.*', false); if (empty($uploadedFiles)) { return $result; } if (!empty($timeNow)) { $timeNow = (int)$timeNow; } else { $timeNow = time(); } $uploadedFilesPath = $oFolder->pwd(); foreach ($uploadedFiles as $uploadedFile) { $oFile = new File($uploadedFilesPath . DS . $uploadedFile); $lastChangeTime = $oFile->lastChange(); if ($lastChangeTime === false) { continue; } if (($timeNow - $lastChangeTime) > $storageTime) { if (!$oFile->delete()) { $result = false; } } } return true; }
php
protected function _clearDir($timeNow = null) { $clearPath = $this->getUploadDir(); $storageTime = $this->_getStorageTimeUpload(); $result = true; $oFolder = new Folder($clearPath, true); $uploadedFiles = $oFolder->find('.*', false); if (empty($uploadedFiles)) { return $result; } if (!empty($timeNow)) { $timeNow = (int)$timeNow; } else { $timeNow = time(); } $uploadedFilesPath = $oFolder->pwd(); foreach ($uploadedFiles as $uploadedFile) { $oFile = new File($uploadedFilesPath . DS . $uploadedFile); $lastChangeTime = $oFile->lastChange(); if ($lastChangeTime === false) { continue; } if (($timeNow - $lastChangeTime) > $storageTime) { if (!$oFile->delete()) { $result = false; } } } return true; }
[ "protected", "function", "_clearDir", "(", "$", "timeNow", "=", "null", ")", "{", "$", "clearPath", "=", "$", "this", "->", "getUploadDir", "(", ")", ";", "$", "storageTime", "=", "$", "this", "->", "_getStorageTimeUpload", "(", ")", ";", "$", "result", ...
Cleanup the upload directory from old files @param int $timeNow Timestamp of current date and time. @return bool Success
[ "Cleanup", "the", "upload", "directory", "from", "old", "files" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/UploadComponent.php#L147-L180
train
anklimsk/cakephp-theme
Controller/Component/UploadComponent.php
UploadComponent.upload
public function upload($maxFileSize = null, $acceptFileTypes = null) { Configure::write('debug', 0); if (!$this->_controller->request->is('ajax') || !$this->_controller->RequestHandler->prefers('json')) { throw new BadRequestException(__d('view_extension', 'Invalid request')); } $uploadDir = $this->getUploadDir(); if (empty($acceptFileTypes)) { $acceptFileTypes = '/.+$/i'; } $opt = [ 'script_url' => '', 'upload_url' => '', 'param_name' => 'files', 'upload_dir' => $uploadDir, 'max_file_size' => $maxFileSize, 'image_versions' => [ '' => ['auto_orient' => false] ], 'correct_image_extensions' => false, 'accept_file_types' => $acceptFileTypes ]; $uploadHandler = new UploadHandler($opt, false); switch ($this->_controller->request->method()) { case 'OPTIONS': case 'HEAD': $data = $uploadHandler->head(false); break; case 'GET': $data = $uploadHandler->get(false); break; case 'PATCH': case 'PUT': case 'POST': $data = $uploadHandler->post(false); break; default: throw new MethodNotAllowedException(); } return $data; }
php
public function upload($maxFileSize = null, $acceptFileTypes = null) { Configure::write('debug', 0); if (!$this->_controller->request->is('ajax') || !$this->_controller->RequestHandler->prefers('json')) { throw new BadRequestException(__d('view_extension', 'Invalid request')); } $uploadDir = $this->getUploadDir(); if (empty($acceptFileTypes)) { $acceptFileTypes = '/.+$/i'; } $opt = [ 'script_url' => '', 'upload_url' => '', 'param_name' => 'files', 'upload_dir' => $uploadDir, 'max_file_size' => $maxFileSize, 'image_versions' => [ '' => ['auto_orient' => false] ], 'correct_image_extensions' => false, 'accept_file_types' => $acceptFileTypes ]; $uploadHandler = new UploadHandler($opt, false); switch ($this->_controller->request->method()) { case 'OPTIONS': case 'HEAD': $data = $uploadHandler->head(false); break; case 'GET': $data = $uploadHandler->get(false); break; case 'PATCH': case 'PUT': case 'POST': $data = $uploadHandler->post(false); break; default: throw new MethodNotAllowedException(); } return $data; }
[ "public", "function", "upload", "(", "$", "maxFileSize", "=", "null", ",", "$", "acceptFileTypes", "=", "null", ")", "{", "Configure", "::", "write", "(", "'debug'", ",", "0", ")", ";", "if", "(", "!", "$", "this", "->", "_controller", "->", "request",...
AJAX upload file to server @param int $maxFileSize Maximum size of uploaded file @param string $acceptFileTypes The regular expression pattern to validate uploaded files. Default `/.+$/i`. @throws BadRequestException If request is not `AJAX` or not `JSON` @throws MethodNotAllowedException If request is not in list: - `OPTIONS`; - `HEAD`; - `GET`; - `PATCH`; - `PUT`; - `POST`. @return array Result of upload file @link https://github.com/blueimp/jQuery-File-Upload
[ "AJAX", "upload", "file", "to", "server" ]
b815a4aaabaaf03ef1df3d547200f73f332f38a7
https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/Component/UploadComponent.php#L200-L243
train
rokka-io/rokka-client-php-cli
src/Command/ImageDownloadCommand.php
ImageDownloadCommand.saveImageContents
private function saveImageContents(Image $client, SourceImage $image, $saveTo, OutputInterface $output, $stackName = null, $format = 'jpg') { if (!$stackName) { $output->writeln('Getting source image contents for <info>'.$image->hash.'</info> from <comment>'.$image->organization.'</comment>'); } else { $output->writeln('Rendering image <info>'.$image->hash.'</info> from <comment>'.$image->organization.'</comment> on stack <info>'.$stackName.'</info>'); } $contents = $this->rokkaHelper->getSourceImageContents($client, $image->hash, $image->organization, $stackName, $format); if (!$contents) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'Error getting image contents from Rokka.io!', ], 'error', true)); return false; } // TODO: verify if target file exists, ask for permission to overwrite unless --force $ret = file_put_contents($saveTo, $contents, FILE_BINARY); if (false == $ret) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'Error writing image contents to <info>'.$saveTo.'</info>!', ], 'error', true)); return false; } $output->writeln('Image saved to <info>'.$saveTo.'</info>'); return true; }
php
private function saveImageContents(Image $client, SourceImage $image, $saveTo, OutputInterface $output, $stackName = null, $format = 'jpg') { if (!$stackName) { $output->writeln('Getting source image contents for <info>'.$image->hash.'</info> from <comment>'.$image->organization.'</comment>'); } else { $output->writeln('Rendering image <info>'.$image->hash.'</info> from <comment>'.$image->organization.'</comment> on stack <info>'.$stackName.'</info>'); } $contents = $this->rokkaHelper->getSourceImageContents($client, $image->hash, $image->organization, $stackName, $format); if (!$contents) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'Error getting image contents from Rokka.io!', ], 'error', true)); return false; } // TODO: verify if target file exists, ask for permission to overwrite unless --force $ret = file_put_contents($saveTo, $contents, FILE_BINARY); if (false == $ret) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'Error writing image contents to <info>'.$saveTo.'</info>!', ], 'error', true)); return false; } $output->writeln('Image saved to <info>'.$saveTo.'</info>'); return true; }
[ "private", "function", "saveImageContents", "(", "Image", "$", "client", ",", "SourceImage", "$", "image", ",", "$", "saveTo", ",", "OutputInterface", "$", "output", ",", "$", "stackName", "=", "null", ",", "$", "format", "=", "'jpg'", ")", "{", "if", "(...
Downloads and saves an image from Rokka. @param Image $client The Image client to use @param SourceImage $image The image to download @param string $saveTo The destination stream to save the image to @param OutputInterface $output The output interface to display messages @param null $stackName The stack name to use, leave empty to use the source image on Rokka @param string $format The file format to retrieve the image if using a Stack @return bool the status of the operation, True if the image has been saved correctly, false otherwise
[ "Downloads", "and", "saves", "an", "image", "from", "Rokka", "." ]
ef22af122af65579a8607a0df976a9ce5248dbbb
https://github.com/rokka-io/rokka-client-php-cli/blob/ef22af122af65579a8607a0df976a9ce5248dbbb/src/Command/ImageDownloadCommand.php#L103-L135
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php
RecordQuery.filterByNbfinish
public function filterByNbfinish($nbfinish = null, $comparison = null) { if (is_array($nbfinish)) { $useMinMax = false; if (isset($nbfinish['min'])) { $this->addUsingAlias(RecordTableMap::COL_NBFINISH, $nbfinish['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($nbfinish['max'])) { $this->addUsingAlias(RecordTableMap::COL_NBFINISH, $nbfinish['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RecordTableMap::COL_NBFINISH, $nbfinish, $comparison); }
php
public function filterByNbfinish($nbfinish = null, $comparison = null) { if (is_array($nbfinish)) { $useMinMax = false; if (isset($nbfinish['min'])) { $this->addUsingAlias(RecordTableMap::COL_NBFINISH, $nbfinish['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($nbfinish['max'])) { $this->addUsingAlias(RecordTableMap::COL_NBFINISH, $nbfinish['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RecordTableMap::COL_NBFINISH, $nbfinish, $comparison); }
[ "public", "function", "filterByNbfinish", "(", "$", "nbfinish", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "nbfinish", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$",...
Filter the query on the nbFinish column Example usage: <code> $query->filterByNbfinish(1234); // WHERE nbFinish = 1234 $query->filterByNbfinish(array(12, 34)); // WHERE nbFinish IN (12, 34) $query->filterByNbfinish(array('min' => 12)); // WHERE nbFinish > 12 </code> @param mixed $nbfinish The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildRecordQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "nbFinish", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php#L459-L480
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php
RecordQuery.filterByAvgscore
public function filterByAvgscore($avgscore = null, $comparison = null) { if (is_array($avgscore)) { $useMinMax = false; if (isset($avgscore['min'])) { $this->addUsingAlias(RecordTableMap::COL_AVGSCORE, $avgscore['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($avgscore['max'])) { $this->addUsingAlias(RecordTableMap::COL_AVGSCORE, $avgscore['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RecordTableMap::COL_AVGSCORE, $avgscore, $comparison); }
php
public function filterByAvgscore($avgscore = null, $comparison = null) { if (is_array($avgscore)) { $useMinMax = false; if (isset($avgscore['min'])) { $this->addUsingAlias(RecordTableMap::COL_AVGSCORE, $avgscore['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($avgscore['max'])) { $this->addUsingAlias(RecordTableMap::COL_AVGSCORE, $avgscore['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RecordTableMap::COL_AVGSCORE, $avgscore, $comparison); }
[ "public", "function", "filterByAvgscore", "(", "$", "avgscore", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "avgscore", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$",...
Filter the query on the avgScore column Example usage: <code> $query->filterByAvgscore(1234); // WHERE avgScore = 1234 $query->filterByAvgscore(array(12, 34)); // WHERE avgScore IN (12, 34) $query->filterByAvgscore(array('min' => 12)); // WHERE avgScore > 12 </code> @param mixed $avgscore The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildRecordQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "avgScore", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php#L500-L521
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php
RecordQuery.filterByCheckpoints
public function filterByCheckpoints($checkpoints = null, $comparison = null) { if (null === $comparison) { if (is_array($checkpoints)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RecordTableMap::COL_CHECKPOINTS, $checkpoints, $comparison); }
php
public function filterByCheckpoints($checkpoints = null, $comparison = null) { if (null === $comparison) { if (is_array($checkpoints)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RecordTableMap::COL_CHECKPOINTS, $checkpoints, $comparison); }
[ "public", "function", "filterByCheckpoints", "(", "$", "checkpoints", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "checkpoints", ")", ")", "{", "$",...
Filter the query on the checkpoints column Example usage: <code> $query->filterByCheckpoints('fooValue'); // WHERE checkpoints = 'fooValue' $query->filterByCheckpoints('%fooValue%', Criteria::LIKE); // WHERE checkpoints LIKE '%fooValue%' </code> @param string $checkpoints The value to use as filter. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildRecordQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "checkpoints", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php#L537-L546
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php
RecordQuery.filterByPlayerId
public function filterByPlayerId($playerId = null, $comparison = null) { if (is_array($playerId)) { $useMinMax = false; if (isset($playerId['min'])) { $this->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $playerId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($playerId['max'])) { $this->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $playerId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $playerId, $comparison); }
php
public function filterByPlayerId($playerId = null, $comparison = null) { if (is_array($playerId)) { $useMinMax = false; if (isset($playerId['min'])) { $this->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $playerId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($playerId['max'])) { $this->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $playerId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $playerId, $comparison); }
[ "public", "function", "filterByPlayerId", "(", "$", "playerId", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "playerId", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$",...
Filter the query on the player_id column Example usage: <code> $query->filterByPlayerId(1234); // WHERE player_id = 1234 $query->filterByPlayerId(array(12, 34)); // WHERE player_id IN (12, 34) $query->filterByPlayerId(array('min' => 12)); // WHERE player_id > 12 </code> @see filterByPlayer() @param mixed $playerId The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return $this|ChildRecordQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "player_id", "column" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php#L568-L589
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php
RecordQuery.filterByPlayer
public function filterByPlayer($player, $comparison = null) { if ($player instanceof \eXpansion\Framework\PlayersBundle\Model\Player) { return $this ->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $player->getId(), $comparison); } elseif ($player instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this ->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $player->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByPlayer() only accepts arguments of type \eXpansion\Framework\PlayersBundle\Model\Player or Collection'); } }
php
public function filterByPlayer($player, $comparison = null) { if ($player instanceof \eXpansion\Framework\PlayersBundle\Model\Player) { return $this ->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $player->getId(), $comparison); } elseif ($player instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this ->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $player->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByPlayer() only accepts arguments of type \eXpansion\Framework\PlayersBundle\Model\Player or Collection'); } }
[ "public", "function", "filterByPlayer", "(", "$", "player", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "$", "player", "instanceof", "\\", "eXpansion", "\\", "Framework", "\\", "PlayersBundle", "\\", "Model", "\\", "Player", ")", "{", "return...
Filter the query by a related \eXpansion\Framework\PlayersBundle\Model\Player object @param \eXpansion\Framework\PlayersBundle\Model\Player|ObjectCollection $player The related object(s) to use as filter @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @throws \Propel\Runtime\Exception\PropelException @return ChildRecordQuery The current query, for fluid interface
[ "Filter", "the", "query", "by", "a", "related", "\\", "eXpansion", "\\", "Framework", "\\", "PlayersBundle", "\\", "Model", "\\", "Player", "object" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php#L687-L702
train
eXpansionPluginPack/eXpansion2
src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php
RecordQuery.usePlayerQuery
public function usePlayerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinPlayer($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'Player', '\eXpansion\Framework\PlayersBundle\Model\PlayerQuery'); }
php
public function usePlayerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinPlayer($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'Player', '\eXpansion\Framework\PlayersBundle\Model\PlayerQuery'); }
[ "public", "function", "usePlayerQuery", "(", "$", "relationAlias", "=", "null", ",", "$", "joinType", "=", "Criteria", "::", "INNER_JOIN", ")", "{", "return", "$", "this", "->", "joinPlayer", "(", "$", "relationAlias", ",", "$", "joinType", ")", "->", "use...
Use the Player relation Player object @see useQuery() @param string $relationAlias optional alias for the relation, to be used as main alias in the secondary query @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' @return \eXpansion\Framework\PlayersBundle\Model\PlayerQuery A secondary query class using the current class as primary query
[ "Use", "the", "Player", "relation", "Player", "object" ]
e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31
https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/LocalRecords/Model/Base/RecordQuery.php#L747-L752
train