query stringlengths 10 8.11k | document stringlengths 17 398k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Get the most occurring value from array. | public static function mostOccurring(array $array, $key = ''); | [
"function array_most_common_value($array) {\n\t$values = array_count_values($array);\n\tarsort($values);\n\treturn array_slice(array_keys($values), 0, 5, true)[0];\n}",
"public static function highest($array) {\n asort($array);\n return end($array);\n }",
"function getLargestValue($array) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store a view inside CouchDB if it is not yet defined. Creates the design document on the fly if it does not exist already. | public function storeView(ViewInterface $view) {
try {
$design = $this->doOperation(function($client) use ($view) {
return $client->getDocument('_design/' . $view->getDesignName());
});
if (isset($design->views->{$view->getViewName()})) {
return;
}
} catch(Client\NotFoundException $notFoundException) {
$design = new \stdClass();
$design->_id = '_design/' . $view->getDesignName();
$design->views = new \stdClass();
}
$design->views->{$view->getViewName()} = new \stdClass();
$design->views->{$view->getViewName()}->map = $view->getMapFunctionSource();
if ($view->getReduceFunctionSource() !== NULL) {
$design->views->{$view->getViewName()}->reduce = $view->getReduceFunctionSource();
}
$this->doOperation(function($client) use ($design) {
if (isset($design->_rev)) {
$client->updateDocument($design, $design->_id);
} else {
$client->createDocument($design);
}
});
} | [
"public function saveView(BrowserView $view)\n {\n $dbh = $this->dbh;\n\n $def = $this->definitionLoader->get($view->getObjType());\n\n if (!$def)\n throw new \\RuntimeException(\"Could not get entity definition for: \" . $view->getObjType());\n\n $data = $view->toArray();\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Note: The `:app_slug` is just the URLfriendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., ` If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a [personal access token]( or an [installation access token]( to access this endpoint. | public function appsGetBySlug(string $appSlug, string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \Github\Endpoint\AppsGetBySlug($appSlug), $fetch);
} | [
"public function getBossUrl($appId);",
"public function get_app_url()\n {\n clearos_profile(__METHOD__, __LINE__);\n\n return $this->details['url'];\n }",
"function app_name() : string {\n\t\treturn get_instance()->config->item(\"app_name\");\n\t}",
"function apps_app_details_page($server_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function checks if the given hashtag exists in the database. | function checkIfHashtagExists($hashtag)
{
$exists = 0;
// Create connection
$con=mysqli_connect("cse.unl.edu","rcarlso","a@9VUi","rcarlso");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else
{
$query = mysqli_prepare($con,"SELECT * FROM Hashtag");
$query->execute();
$result = $query->get_result();
while($row = mysqli_fetch_array($result))
{
if(strcmp($hashtag,$row['Hashtag']) == 0)
{
$exists = 1;
}
}
}
//close connections
mysqli_close($con);
return $exists;
} | [
"public static function exists\n\t(\n\t\t$hashtag\t\t// <str> The hashtag to verify if it exists or not.\n\t)\t\t\t\t\t// RETURNS <bool>\n\t\n\t// AppHashtags::exists($hashtag);\n\t{\n\t\tif($check = Database::selectValue(\"SELECT hashtag FROM micro_hashtags WHERE hashtag=? LIMIT 1\", array($hashtag)))\n\t\t{\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove um professor do banco de dados | function deleteId($professor_id)
{
$stmt = $this->conn->prepare('DELETE FROM professor WHERE id = :uprofessor_id');
if (!$stmt->execute(array(':uprofessor_id' => $professor_id)))
throw new Exception("Erro ao excluir item.", 1);
} | [
"public function deleted(Professor $professor)\n {\n //\n }",
"function delete(Professor $professor)\r\n {\r\n return $this->deleteId($professor->getId());\r\n }",
"public function delete(Professor $prof)\n {\n $prof->delete();\n }",
"public function kick_professor($clas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
decode an encoded string and return an array | function array_decode($string){
return explode("|", $string);
} | [
"public function decode(string $content): array;",
"public function decode($string);",
"function decode($str)\n {\n\n global $exemptRequest;\n\n //decode using the appropriate protocol handler\n $arr = $this->M->decode($str);\n\n //sanitize all data from the request\n $arr = sanitize($arr,$exemp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
list all families belongs to this church | public function getFamilies(Church $church){
$families = $church->families()->get();
return view('churches.families', compact(['families','church']));
} | [
"public function getFamiliesList()\n {\n $sql = \"SELECT id, name FROM families\";\n return $this->execute($sql);\n }",
"public function getFamilies()\n {\n return $this->families;\n }",
"function getChildFamilies() {\n\t\tglobal $pgv_lang, $SHOW_LIVING_NAMES;\n\n\t\tif (is_null... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get URL of page request by index | protected function getPageByIndex($index) {
return $this->aStateUrls[$index];
} | [
"public function getPageURL($number);",
"public function firstPageUrl();",
"public function getFirstPageUrl();",
"public function pageUrl();",
"public function get_url_for_page($page);",
"public function getPageUrl();",
"public function getNextPageUrl();",
"public function firstPageURL() {\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests whether the single parameters text can be output correctly in the command's final text. | public function testCanOutputParameter()
{
$mainCommand = 'ls';
$parameter = '/var/log';
$command = $this->createInstance($mainCommand);
$command->addParameter($parameter);
$this->assertEquals(sprintf('%1$s %2$s', $mainCommand, $parameter), (string) $command, 'Must be able to output the command and parameter string correctly');
} | [
"function test_apertium_command() {\n\tglobal $config;\n\t\n\t$command_to_test = array($config['apertium_command'], $config['apertium_unformat_command']);\n\t$return = TRUE;\n\tforeach ($command_to_test as $command) {\n\t\tif (!test_command($command)) {\n\t\t\techo $command;\n\t\t\t$return = FALSE;\n\t\t\tbreak;\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the data at the given location. | public function setData($loc, $val) {
if ($loc == null) { $loc = $this->getLocation(); }
if (isset($this->data[$loc])) {
$this->data[$loc] = $val;
} else {
throw new Exception('Unknown Data Location: ' . $loc);
}
} | [
"public function setLocationData()\n\t{\n\t\t$location = Locations::where('id', '=', $this->location_id)->first();\n\t\t$this->location = $location;\n\t}",
"public function setData($loc, $val, $mode = 0) {\n\t\t\tif ($loc === null) { $loc = $this->getLocation(); }\n\n\t\t\tif ($mode == 0) {\n\t\t\t\t$this->data[$... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine if location testing is enabled. | protected function isTesting(): bool
{
return config('location.testing.enabled', true);
} | [
"public function isLocationProvided(): bool;",
"public function supportsLocation()\n {\n }",
"public static function is_enabled(){\n\t\t$location_types = get_option('dbem_location_types', array());\n\t\treturn !empty($location_types[static::$type]);\n\t}",
"public function isKnownLocation()\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FIN Gestion des utilisateurs DEBUT Gestion des Profil Affectation droit | public function affectation__()
{
$data['idProfil'] = $this->paramGET[0];
$data['droit'] = $this->droitModels->getDroit($param);
$data['droitprofil'] = $this->profilModels->getDroitprofil($data['idProfil']);
$droitprofil = array();
foreach ($data['droitprofil'] as $dp) {
array_push($droitprofil, $dp->fk_droit);
}
//array_search(40489, array_column($userdb, 'uid'));
foreach ($data['droit'] as $droit) {
if (in_array($droit->id, $droitprofil)) {
$droit->exite = 1;
} else {
$droit->exite = 0;
}
}
//echo '<pre>'; var_dump($data['droit']);exit;
$this->views->setData($data);
$this->views->getTemplate("administration/affectation");
} | [
"private function profil() {\n\n\t\tif(isset($_POST['modifie-profile'])) {\n\t\t\t$modeleUser = new ModeleUtilisateurs;\n\n\t\t\t$id_user = Utils::getPost('permis_u_m');\n\t\t\t$nom_user = Utils::getPost('nom_u_m');\n\t\t\t$prenom_user = Utils::getPost('prenom_u_m');\n\t\t\t$email = Utils::getPost('email_u_m');\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the LDAP error message of the last LDAP command | public function error()
{
return @ldap_error($this->link);
} | [
"private function fetchLDAPError() {\n $errno = ldap_errno($this->link);\n $this->lastError = \"[LDAP] \" . $errno . \": \" . ldap_err2str($errno) . \"\";\n }",
"public function get_last_error() {\n return @ldap_error($this->_conn);\n }",
"private function _get_ldap_error() {\r\n\t\treturn (!$t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a panel at a given position. The x and y position is affected by the current grid layout. | public function getPanel( $x, $y ) {
return $this->panels[ ( $x * count( $this->widths ) ) + $y ];
} | [
"public function getPanel()\n {\n return $this->panel;\n }",
"public function getPanel() {\n\t\treturn $this->panel;\n\t}",
"public function getPanel()\n\t{\n\t\t$panel = new Panels($this->tab, $this->tab_id, $this->forms);\n\n\t\treturn $panel;\n\t}",
"public function newPanel() {\n $pane... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Add common admin markup to bottom of custom post type pages | function custom_post_type_markup_bottom()
{
if ( C_NextGen_Admin_Page_Manager::is_requested_post_type() && !$this->is_ngg_post_type_with_template() ) {
echo '</div></div>';
}
} | [
"public function admin_page() {\n\t\t?>\n\t\t<div class=\"wrap\">\n\t\t\t<h1><?php esc_html_e( 'Member Types', 'bp-mt-extended' ) ;?></h1>\n\n\t\t\t<p class=\"description bpmt-guide\">\n\t\t\t\t<?php esc_html_e( 'Add your type in the field below and hit the return key to save it.', 'bp-mt-extended' ) ;?>\n\t\t\t\t<... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Index QA Manager Category Page | public function index(){
$data = new \stdClass;
$data->page_title = __('label.qamanager.category_index');
$data->user_role = auth()->user()->user_role->name;
return view( 'backend.qamanager.category.index', (array) $data );
} | [
"public function category()\n {\n echo \"<h1>PAGE CATEGORY DU CONTROLLEUR</h1>\";\n }",
"function category() {\n\t\tif ( !$this->aranax_auth->is_logged_in() || !$this->aranax_auth->has_access() ) {\n\t\t\tredirect(\"unauthorised\");\n\t\t}\n\t\telse {\n\t\t\t$data[\"role_options\"] =\t$this->aranax_a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test the readHtml method with a Model. | public function testModelReadHtml()
{
require_once __DIR__ . '/../auxiliary/TestModel.php';
$model = new \TestModel;
$actual = $this->controller->readHtml($model);
$this->assertInstanceOf('\Backend\Base\Utilities\Renderable', $actual);
$this->assertEquals('TestModel/display', $actual->getTemplate());
$this->assertContains($model, $actual->getValues());
} | [
"public function testFormHtml()\n {\n require_once __DIR__ . '/../auxiliary/TestModel.php';\n\n $model = new \\TestModel;\n $actual = $this->controller->formHtml($model);\n $this->assertInstanceOf('\\Backend\\Base\\Utilities\\Renderable', $actual);\n $this->assertEquals('TestMo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation ezsigntemplateformfieldgroupGetObjectV2AsyncWithHttpInfo Retrieve an existing Ezsigntemplateformfieldgroup | public function ezsigntemplateformfieldgroupGetObjectV2AsyncWithHttpInfo($pkiEzsigntemplateformfieldgroupID, string $contentType = self::contentTypes['ezsigntemplateformfieldgroupGetObjectV2'][0])
{
$returnType = '\eZmaxAPI\Model\EzsigntemplateformfieldgroupGetObjectV2Response';
$request = $this->ezsigntemplateformfieldgroupGetObjectV2Request($pkiEzsigntemplateformfieldgroupID, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
} | [
"public function ezsigntemplateformfieldgroupCreateObjectV1AsyncWithHttpInfo($ezsigntemplateformfieldgroupCreateObjectV1Request, string $contentType = self::contentTypes['ezsigntemplateformfieldgroupCreateObjectV1'][0])\n {\n $returnType = '\\eZmaxAPI\\Model\\EzsigntemplateformfieldgroupCreateObjectV1Resp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the id_file property | public function setIdFile($id_file)
{
$this->id_file = $id_file;
return $this;
} | [
"public function setIdentifier(){\n\n \t$this->fileIdentifier = $this->getIdentifier();\n }",
"protected function setFileID($id) {\n $this->fileid = $id;\n $this->prepare_isValidModID();\n }",
"public function setFileId( $file_id ) {\n\t\t$this->file_id = $file_id;\n\t\t$this->cache_key... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get ransack options depends on this PDO driver. | public function ransackOptions() : array; | [
"function queryOptions()\n\t{\n\t\t$options = new SapphoQueryOptions($this);\n\t\treturn $options;\n\t}",
"private static function getOption()\n {\n return [\n \\PDO::ATTR_ERRMODE => \\PDO::ERRMODE_EXCEPTION,\n \\PDO::MYSQL_ATTR_INIT_COMMAND => \"SET NAMES '\".self::$default_charse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a list of members associated to a specific job | public function getJobMembers($iJobID)
{
$oReq = new GetJobMembers();
$oReq->authKey = $this->authKey;
$oReq->jobId = $iJobID;
$oResponse = new GetJobMembersResponse();
try {
$oResponse = $this->oSOAP->getJobMembers($oReq);
} catch (SoapFault $e) {
throw isset($e->detail) ? $this->_convertSoapFault($e) : $e;
}
return $oResponse->apiJobMemberList->apiJobMemberList;
} | [
"public function getMembers()\n {\n $members = [];\n $results = $this->chatworkApi->getRoomMembersById($this->room_id);\n foreach ($results as $result) {\n $members[] = new ChatworkUser($result);\n }\n\n $this->listMembers = $members;\n\n return $members;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets a webhook for the specified MailChimp list | private function set_webhook( $list_id ) {
error_log('MCE4M_Widget::set_webhook() Called.');
// the webhook url
$url = get_site_url() . '/?_mce4m_webhook_secret=' . $this->webhook_secret;
// check to see if webhook is already set
$webhooks = $this->api->get_list_webhooks( $list_id );
foreach ( $webhooks as $hook ) {
if ( $hook->url === $url ) {
return true;
}
}
// if webhook not found, create it
$success = $this->api->set_list_webhook( $list_id, $url, array(
'subscribe' => true,
'unsubscribe' => false,
'profile' => false,
'cleaned' => false,
'upemail' => false,
'campaign' => false
) );
return $success;
} | [
"public function webhook() \n\t {\n\t \t// If webhooks is enabled and that a valid key is set.\n\t \tif ($this->config->get('mailchimp_webhooks') && $this->config->get('mailchimp_webhooks_key')) {\n\t \t\tif (isset($_GET['key']) && $_GET['key'] == $this->config->get('mailchimp_webhooks_key')) {\n\t \t\t\t$this->loa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
\param $sIdPev Identifiant de la partie d'Evaluation \param $oBD Objet de connexion PDO_BD | function __construct($sIdPev,$oBD){
include $this->sRessourcesFile;
$this->sSql=$aSql[$oBD->sgbd]['prof_descr'];
$this->sSql=str_replace('$sIdPev', $sIdPev, $this->sSql);
$oPDOresult=$oBD->execute($this->sSql);
if ( $oBD->enErreur()) {
$this->sStatus=1;
$this->sMessage=$oBD->getBDMessage();
}
else{
$this->aFields=$oBD->ligneSuivante ($oPDOresult);
$this->sStatus=0;
}
} | [
"public function GetPorId($pId)\r\n {\r\n \t$this->Consultar(\"SELECT * FROM evaluacion WHERE id = $pId;\", false);\r\n }",
"public function consultaPAIActual(){\n\t\t$conect= Yii::app()->db;\n\t\t$sqlConsPai=\"select * from pai where num_doc=:num_doc and pai_actual='true'\";\n\t\t$consPai=$conect->creat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether the primary key was modified | public function hasModifiedPk(): bool
{
return
!$this->renamedPkFields->isEmpty() ||
!$this->removedPkFields->isEmpty() ||
!$this->addedPkFields->isEmpty()
;
} | [
"public function isUpdate(){\n\t\treturn isset($this->{$this->getPrimaryKey()}) ? true : false;\n\t}",
"public function isPrimaryKey(): bool;",
"public function isPrimaryKey()\r\n {\r\n return $this->name == 'PRIMARY';\r\n }",
"public function hasPrimaryKey(){\n return !empty($this->primar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get instance includes collection | public function getIncludes() {
return $this->includes;
} | [
"public function getIncludes();",
"public function getIncluded()\n {\n $included = collect();\n\n foreach ($this->records as $record) {\n $included = $included->merge(\n (new ResourceSerializer($record, $this->fields, $this->include, $this->relationships))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get landmarks by unit id | public function getLandmarksByUnitId($unit_id, $reference = null, $verified = '')
{
$and_reference = $and_verified = "";
$landmarks = array();
if ($reference === true) {
$and_reference = "AND lm.territorytype = 'reference' ";
if (! empty($verified)) {
switch ($verified) {
case 'verified':
$and_verified = "AND lm.verifydate > '0000-00-00' ";
break;
case 'no-verified':
$and_verified = "AND lm.verifydate = '0000-00-00' ";
break;
case 'all':
$and_verified = "";
break;
}
}
} else if ($reference === false) {
$and_reference = "AND lm.territorytype = 'landmark' ";
}
$sql = "SELECT
lm.territory_id,
lm.account_id,
lm.shape,
lm.territoryname,
lm.latitude,
lm.longitude,
lm.radius,
lm.streetaddress,
lm.city,
lm.state,
lm.zipcode,
lm.country,
lm.territorytype,
lm.verifydate,
lm.active,
ul.unit_id as unit_id
FROM crossbones.unit_territory AS ul
LEFT JOIN crossbones.territory AS lm ON lm.territory_id = ul.territory_id
WHERE ul.unit_id = ? {$and_reference}{$and_verified}AND lm.active = 1";
if ($landmarks = $this->db_read->fetchAll($sql, array($unit_id))) {
//print_rb($landmarks);
return $landmarks;
}
return false;
} | [
"public function landmarks()\n {\n return $this->landmarks;\n }",
"public function getLandmarks()\n {\n return $this->landmarks;\n }",
"function get_landmarks () {\n\n $query = $this->db->get('itms_landmarks', array('company_id'=>$this->session->userdata('itms_company_id')));\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test removing multiple paths from a query. | public function testRemovePaths()
{
$tests = array(
array(
'label' => __LINE__ .': null',
'argument' => null,
'error' => array('InvalidArgumentException' => 'Cannot remove paths; argument must be an array.'),
'expected' => null,
),
array(
'label' => __LINE__ .': numeric',
'argument' => 1,
'error' => array('InvalidArgumentException' => 'Cannot remove paths; argument must be an array.'),
'expected' => null,
),
array(
'label' => __LINE__ .': string',
'argument' => 'string',
'error' => array('InvalidArgumentException' => 'Cannot remove paths; argument must be an array.'),
'expected' => null,
),
array(
'label' => __LINE__ .': array',
'argument' => array('string'),
'error' => null,
'expected' => array(),
),
array(
'label' => __LINE__ .': object',
'argument' => new stdClass,
'error' => array('InvalidArgumentException' => 'Cannot remove paths; argument must be an array.'),
'expected' => null,
),
);
foreach ($tests as $test) {
$label = $test['label'];
$query = new P4Cms_Record_Query;
try {
$query->removePaths($test['argument']);
if ($test['error']) {
$this->fail("$label - unexpected success");
} else {
$this->assertEquals(
$test['expected'],
$query->getPaths(),
"$label - expected value"
);
}
} catch (PHPUnit_Framework_AssertionFailedError $e) {
$this->fail($e->getMessage());
} catch (PHPUnit_Framework_ExpectationFailedError $e) {
$this->fail($e->getMessage());
} catch (Exception $e) {
if (!$test['error']) {
$this->fail("$label - Unexpected exception (". get_class($e) .') :'. $e->getMessage());
} else {
list($class, $error) = each($test['error']);
$this->assertEquals(
$class,
get_class($e),
"$label - expected exception class: ". $e->getMessage()
);
$this->assertEquals(
$error,
$e->getMessage(),
"$label - expected exception message"
);
}
}
}
$query = P4Cms_Record_Query::create()->addPaths(array('one', 'two', 'three', 'two', 'four'));
$this->assertEquals(
array('one', 'two', 'three', 'two', 'four'),
$query->getPaths(),
'Expected paths after add'
);
$query->removePaths(array('two', 'four'));
$this->assertEquals(
array('one', 'three', 'two'),
$query->getPaths(),
'Expected paths after remove #1'
);
} | [
"public function removeAllInPath($path) {\n\t\t$path = strtolower($path);\n\t\t$query = $this->entityManager->createQuery('DELETE FROM TYPO3\\TYPO3CR\\Domain\\Model\\NodeData n WHERE n.path LIKE :path');\n\t\t$query->setParameter('path', $path . '/%');\n\t\t$query->execute();\n\t}",
"abstract public function tes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allows to compose message from a job using the specified template. | public function composeMessage(int $jobId, int $templateId): string; | [
"protected function buildJob(\n \\tx_mkmailer_models_Template $template = null\n ) {\n /* @var $job \\tx_mkmailer_mail_MailJob */\n $job = GeneralUtility::makeInstance('tx_mkmailer_mail_MailJob');\n if ($template instanceof \\tx_mkmailer_models_Template) {\n $job->setFrom($... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build iterator to find buckets in a file hierarchy | protected function getBucketFinderIterator($dirPath) {
$iter = new RecursiveDirectoryIterator($dirPath);
$iter = new RecursiveIteratorIterator($iter, RecursiveIteratorIterator::SELF_FIRST);
$iter = new ForgeUpgrade_BucketFilter($iter);
$iter->setIncludePaths($this->includePaths);
$iter->setExcludePaths($this->excludePaths);
return $iter;
} | [
"function fileScanner()\n { # Generator that yields [fileName, filenameHash]\n // skip BigData Archive Files\n $fileCallback = function ($dir, $file) {\n if (@Packer::$EXCLUDE_FILES[$file])\n return 1;\n };\n // skip directories with BigData Archives\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Will call the /sites/menu and write it to disk. The generation of the menu can take a couple of minutes | function generate_menu() {
$msg = 'Success!';
try {
$menu = $this->Species->find_species_types_exps();
file_put_contents(CACHE . 'menu.array', serialize($menu));
} catch (Exception $ex) {
$msg = $ex;
}
$this->Session->setFlash($msg);
} | [
"function create_SitemenModmenu_CacheFile($image_path,$site_id)\n{\n\n\tglobal $db;\n\t$consolecache_path = $image_path.'/cache';\n\t$file_path = $image_path .'/settings_cache';\n\tif(!file_exists($file_path))\n\t\tmkdir($file_path);\n\t\t\n\t// Case of writing Site menu\t\n\t$file_name = $file_path.'/site_menu.php... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Temporadas compradas por usuario [Se filtra por el ID del usuario] | public function temporadascompradas($id){
$users = Usuario::find($id);
if (is_null($users)) {
return $this->sendError('Usuario no encontrado');
}
$temporadas = Usuario::with('venta_temporadas')
->where('usuario.email',$id)->get();
$temporadas_p = compact('temporadas');
return $this->sendResponse($temporadas_p, 'Temporadas compradas devueltas con éxito');
} | [
"function perfilUsuario( $id = null ) {\r\n\t// Retorna uma array unificada com todos os campos do user data e meta, junto com status, função e campos necessários à sincronização com o SAP\r\n\t// @requer obterUsuario, funcaoDesteUsuario, usuarioEstaAtivo, mapMeta, obterItem\r\n\t$perfil = array();\r\n\t$user = obt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Outputs a dropdown list of days of the week | function daysList ( $name, $day="" ) {
$value = array('1','2','3','4','5','6','7');
$display = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
echo '<select name="'.$name.'">'."\n";
echo "\t".'<option value="">select a day</option>'."\n";
for ($i=0; $i<count($value); $i++) {
if ($value[$i]==$day) $selected = ' selected="selected"'; else $selected = '';
echo "\t".'<option value="'.$value[$i].'"'.$selected.'>'.$display[$i].'</option>'."\n";
}
echo '</select>'."\n";
} | [
"function getDays($selDay=\"\"){\n\t\t$strDays = \"\";\n\t\t$strDays = \"<option value=''>00</option>\";\n\t\tfor($ind=1;$ind<=31;$ind++){\n\t\t\tif($ind == $selDay)\n\t\t\t\t$strSel = \"selected\";\n\t\t\telse\n\t\t\t\t$strSel = \"\";\n\t\t\t\t\n\t\t\t$strDays.=\"<option value=\".$ind.\" $strSel>\".(strlen($ind)==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation crceBundleAdministrationGetByReferenceIdWithHttpInfo returns the requested bundle | public function crceBundleAdministrationGetByReferenceIdWithHttpInfo($id, $correlation_id = null, $transaction_id = null, $user = null)
{
// verify the required parameter 'id' is set
if ($id === null) {
throw new \InvalidArgumentException('Missing the required parameter $id when calling crceBundleAdministrationGetByReferenceId');
}
// parse inputs
$resourcePath = "/bundles/reference/{id}";
$httpBody = '';
$queryParams = [];
$headerParams = [];
$formParams = [];
$_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);
// header params
if ($correlation_id !== null) {
$headerParams['correlationId'] = $this->apiClient->getSerializer()->toHeaderValue($correlation_id);
}
// header params
if ($transaction_id !== null) {
$headerParams['transactionId'] = $this->apiClient->getSerializer()->toHeaderValue($transaction_id);
}
// header params
if ($user !== null) {
$headerParams['user'] = $this->apiClient->getSerializer()->toHeaderValue($user);
}
// path params
if ($id !== null) {
$resourcePath = str_replace(
"{" . "id" . "}",
$this->apiClient->getSerializer()->toPathValue($id),
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('accessKey');
if (strlen($apiKey) !== 0) {
$headerParams['accessKey'] = $apiKey;
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath,
'GET',
$queryParams,
$httpBody,
$headerParams,
'\iNew\Rest6_1\Model\GetBundleResponse',
'/bundles/reference/{id}'
);
return [$this->apiClient->getSerializer()->deserialize($response, '\iNew\Rest6_1\Model\GetBundleResponse', $httpHeader), $statusCode, $httpHeader];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\iNew\Rest6_1\Model\GetBundleResponse', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 400:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\iNew\Rest6_1\Model\RestError', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 500:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\iNew\Rest6_1\Model\RestError', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
} | [
"public function crceBundleAdministrationGetWithHttpInfo($bundle_code, $correlation_id = null, $transaction_id = null, $user = null)\n {\n // verify the required parameter 'bundle_code' is set\n if ($bundle_code === null) {\n throw new \\InvalidArgumentException('Missing the required par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace WordPress smilies by Lazy Load | function rocket_lazyload_smilies() {
if ( ! rocket_lazyload_get_option( 'images' ) || ! apply_filters( 'do_rocket_lazyload', true ) ) {
return;
}
remove_filter( 'the_content', 'convert_smilies' );
remove_filter( 'the_excerpt', 'convert_smilies' );
remove_filter( 'comment_text', 'convert_smilies', 20 );
add_filter( 'the_content', 'rocket_convert_smilies' );
add_filter( 'the_excerpt', 'rocket_convert_smilies' );
add_filter( 'comment_text', 'rocket_convert_smilies', 20 );
} | [
"public function lazyloadSmilies()\r\n {\r\n if (! $this->shouldLazyload()) {\r\n return;\r\n }\r\n\r\n if (! $this->option_array->get('images')) {\r\n return;\r\n }\r\n\r\n $filters = [\r\n 'the_content' => 10,\r\n 'the_excerpt' =>... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Envia "ManagerAction_JabberSend" Envia un mensaje a cliente Jabber | function jabberSend($jabber,$jid,$message){
return $this->eventSimple("JabberSend",array("Jabber"=>$jabber,"JID"=>$jid,"Message"=>$message));
} | [
"public function action_chat() {\n\t\t$recepient = $this->request->param('id');\n\t\t$sender = $this->_current_user;\n\t\t$avatar = ($sender->personnel_info->personnel_avatar) ? $sender->personnel_info->personnel_avatar : 'default.png';\n\t\t//STEP1: Save the chat message;\n\t\t$message = ORM::factory('Message');\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store a newly created ResearchArea in storage. | public function store(ResearchAreaRequest $request)
{
ResearchArea::create([
'name' => $request->name
]);
Flash::success('Research area created successfully.');
return redirect('/admin/research_area');
} | [
"public function save(): void\n {\n $areas = [];\n foreach($this->areas as $area)\n {\n $areas[$area->getName()] = $area->toArray();\n }\n\n file_put_contents($this->areaFile, json_encode($areas));\n }",
"public function store(Area $area)\n {\n session... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a generic Solr document object for this entity. This function will do the basic processing for the document that is common to all entities, but virtually all entities will need their own additional processing. | function _apachesolr_index_process_entity_get_document($entity, $entity_type) {
list($entity_id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
$document = new ApacheSolrDocument();
// Define our url options in advance. This differs depending on the
// language
$languages = language_list();
$url_options = array('absolute' => TRUE);
if (isset($entity->language) && isset($languages[$entity->language])) {
$url_options['language'] = $languages[$entity->language];
}
$document->id = apachesolr_document_id($entity_id, $entity_type);
$document->site = url(NULL, $url_options);
$document->hash = apachesolr_site_hash();
$document->entity_id = $entity_id;
$document->entity_type = $entity_type;
$document->bundle = $bundle;
$document->bundle_name = entity_bundle_label($entity_type, $bundle);
if (empty($entity->language)) {
// 'und' is the language-neutral code in Drupal 7.
$document->ss_language = LANGUAGE_NONE;
}
else {
$document->ss_language = $entity->language;
}
$path = entity_uri($entity_type, $entity);
// A path is not a requirement of an entity
if (!empty($path)) {
$document->path = $path['path'];
$document->url = url($path['path'], $path['options'] + $url_options);
// Path aliases can have important information about the content.
// Add them to the index as well.
if (function_exists('drupal_get_path_alias')) {
// Add any path alias to the index, looking first for language specific
// aliases but using language neutral aliases otherwise.
$output = drupal_get_path_alias($document->path, $document->ss_language);
if ($output && $output != $document->path) {
$document->path_alias = $output;
}
}
}
return $document;
} | [
"function makeSolrDocument($solrDocument = false){\n\t\n\t\t if(!$solrDocument){\n\t\t\t\t $solrDocument = new Apache_Solr_Document();\n\t\t }\n\t\t \n\t\t //$solrDocument->id = $this->itemUUID;\n\t\t $solrDocument->uuid = $this->itemUUID;\n\t\t $solrDocument->item_label = $this->itemLabel; //primary label f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve customer IDs for reindex | protected function getCustomerIdsForReindex()
{
$connection = $this->resource->getConnection();
$gridTableName = $this->flatScopeResolver->resolve(Customer::CUSTOMER_GRID_INDEXER_ID, []);
$select = $connection->select()
->from($this->resource->getTableName($gridTableName), 'last_visit_at')
->order('last_visit_at DESC')
->limit(1);
$lastVisitAt = $connection->query($select)->fetchColumn();
$select = $connection->select()
->from($this->resource->getTableName('customer_log'), 'customer_id')
->where('last_login_at > ?', $lastVisitAt);
$customerIds = [];
foreach ($connection->query($select)->fetchAll() as $row) {
$customerIds[] = $row['customer_id'];
}
return $customerIds;
} | [
"protected function _recentCustomerIds()\n\t{\n\t\t$this->_allCustomerIds($this->getRequest()->getParam('date', date('Y-m-d')));\n\t}",
"public function getAllCustomerID(): array\n {\n \\Logger::getLogger(\\get_class($this))->info(__METHOD__);\n if (\\count($this->customerID) === 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
print_r($contents); print_r($demographics); $likedTags = explode("\n", trim($contents[4])); print_r($dislikedTags); | function parseFile($string) {
global $contents, $demographics, $likedArticles, $dislikedAricles, $dislikedTags;
$file = file_get_contents($string);
$contents = explode("\n\n\n", $file);
$demographics = explode("\n", trim($contents[0]));
$likedArticles = explode("\n", trim($contents[1]));
$dislikedArticles = explode("\n", trim($contents[2]));
$readLater = explode("\n", trim($contents[3]));
echo "CONTENTS 3 : </br>";
print_r($readLater);
echo "</br></br></br>";
} | [
"function GetAllPostTags($contents, &$tag_list=array(\"\"), $caseSensitive=true) {\n global $tagstr;\n $startPos = 0;\n do { \n $tag = GetNextTag($contents,$startPos);\n //echo $tag . \" \";\n if (($startPos < 0) | ($tag == \"\"))\n break; //tag could not be assigned, list is done\n \n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
main This function is a redirect to modifyconfig | public function main()
{
return $this->modifyconfig();
} | [
"protected function _after_config()\n\t{\n\t}",
"function autolinks_admin_modifyconfig()\n{\n // Security check\n if (!pnSecAuthAction(0, 'Autolinks::', '::', ACCESS_ADMIN)) {\n return pnVarPrepHTMLDisplay(_MODULENOAUTH);\n }\n\n // Create output object - this object will store all of our outpu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tries to add passed HTML code to the HTML page head section and returns insertion position. False otherwise. | public static function addCodeToHead(&$html, $code, $append = true)
{
// Try to find head tag to insert passed code.
if (Utils::match(
'/<head(?:\s[^>]+>|>)|<title[^>]*>|<\/head>|<\/title>/',
$html,
$matches,
PREG_OFFSET_CAPTURE
)) {
$index = -1;
if ($append) {
$matches = array_reverse($matches);
}
foreach ($matches as $no => $match) {
if ($append && ($match[0][0] == '</head>' || $match[0][0] == '</title>')) {
$index = $no;
break;
} elseif (!$append && ($match[0][0] == '<head>' || $match[0][0] == '<title>')) {
$index = $no;
break;
}
}
if ($index === -1) {
$index = 0;
}
$tag = $matches[$index][0];
if ($tag[0] == '</head>' || strpos($tag[0], '<title') === 0) {
// Closing head tag or opening title tag found. Insert passed HTML before it
$html = mb_substr($html, 0, $tag[1]) .
$code . "\n" . mb_substr($html, $tag[1]);
$insertionPosition = $tag[1];
} else {
// Opening head tag or closing title tag found. Insert passed HTML right after it
$insertionPosition = $tag[1] + strlen($tag[0]);
$html = mb_substr($html, 0, $insertionPosition) .
"\n" . $code . mb_substr($html, $insertionPosition);
}
return $insertionPosition;
}
return false;
} | [
"private function addHeadElementIfMissing()\n {\n if ($this->getElementsByTagName('head')->item(0) === null) {\n $htmlElement = $this->getElementsByTagName('html')->item(0);\n $headElement = new \\DOMElement('head');\n if ($htmlElement->childNodes->length === 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check the username. Alfanumeric characters and if existe same username in the DB | public function username_check($username) {
$this->db->where('username', $username);
$query = $this->db->get('instagram_users');
if ($query->num_rows == 0) {
if (ctype_alnum($username)) {
return true;
} else {
$this->form_validation->set_message('username_check', 'The %s field only can be alphanumeric');
return false;
}
} else {
$this->form_validation->set_message('username_check', 'The %s record already exists in the database');
return false;
}
} | [
"function verify_username(&$username)\n\t{\n\t\t// this is duplicated from the user manager\n\n\t\t// fix extra whitespace and invisible ascii stuff\n\t\t$username = trim(preg_replace('#\\s+#si', ' ', strip_blank_ascii($username, ' ')));\n\n\t\t$length = vbstrlen($username);\n\t\tif ($length < $this->registry->opti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function gives you the next working days based on the buffer | function getWorkingDays($date,$buffer=1,$holidays='') {
if ($holidays==='') $holidays = 'https://www.gov.uk/bank-holidays/england-and-wales.ics';
if (!is_array($holidays)) {
$ch = curl_init($holidays);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$ics = curl_exec($ch);
curl_close($ch);
$ics = explode("\n",$ics);
$ics = preg_grep('/^DTSTART;/',$ics);
$holidays = preg_replace('/^DTSTART;VALUE=DATE:(\\d{4})(\\d{2})(\\d{2}).*/s','$1-$2-$3',$ics);
}
$addDay = 0;
while ($buffer--) {
while (true) {
$addDay++;
$newDate = date('Y-m-d', strtotime("$date +$addDay Days"));
$newDayOfWeek = date('w', strtotime($newDate));
if ( $newDayOfWeek>0 && $newDayOfWeek<6 && !in_array($newDate,$holidays)) break;
}
}
return $newDate;
} | [
"public static function getNextWorkingDay(){\n $invalid_day = array('sat','sun');\n $tomorrow_unix = mktime(0, 0, 0, date(\"m\"), date(\"d\")+1, date(\"y\"));\n $tomorrow_date = date('Ymd',$tomorrow_unix);\n $tomorrow_day = strtolower(date('D',$tomorrow_unix));\n\n $datetime = new \\Da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return value of controller ['cl'] key from $_GET array | public static function getRequestController(): string
{
return SecurityHelper::sanitizeVar($_GET['cl']) ?? '';
} | [
"private function getControllerNameFromQueryString() : string {\n return explode('=', $_SERVER['QUERY_STRING'])[0];\n }",
"public function lget(){\n\t\treset($_GET);\n\t\techo \"<hr>\";\n\t\twhile (list ($clave, $val) = each($_GET)) {\n\t\t\techo \"$clave = \" . $_GET[\"$clave\"] . \" \";\n\t\t}\n\t\tec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle the accounts "deleted" event. | public function deleted(Accounts $accounts)
{
//
} | [
"public function handleAssetDeleted(AssetDeleted $event)\n {\n $this->addEntry(\"Deleted asset '\".$event->asset->url().\"'\");\n }",
"public function deleted()\n {\n // do something after delete\n }",
"public function deleted(Accion $accion)\n {\n //\n }",
"public funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws a boxes plot (Box Plot or Box and Whisker plot) This is the main function for drawing a boxes plot. Supported data types are textdata and datadata, each with 5 or more Y values per row. The first 5 values are Ymin, YQ1, Ymid, YQ3, Ymax. Any additional values are outliers. PHPlot requires Ymin <= YQ1 <= Ymin <= YQ3 <= Ymax but does not assume anything about specific values (quartile, median). | protected function DrawBoxes()
{
if (!$this->CheckDataType('text-data, data-data'))
return FALSE;
if ($this->data_columns < 5) // early error check (more inside the loop)
return $this->PrintError("DrawBoxes(): rows must have 5 or more values.");
// Set up the point shapes/sizes arrays - needed for outliers:
$this->CheckPointParams();
// Calculate the half-width of the boxes.
// This is scaled based on the plot density, but within tight limits.
$width1 = max($this->boxes_min_width, min($this->boxes_max_width,
(int)($this->boxes_frac_width * $this->plot_area_width / $this->num_data_rows)));
// This is the half-width of the upper and lower T's and the ends of the whiskers:
$width2 = $this->boxes_t_width * $width1;
// A box plot can use up to 3 different line widths:
list($box_thickness, $belt_thickness, $whisker_thickness) = $this->line_widths;
$gcvars = []; // For GetDataColor, which initializes and uses this.
for ($row = 0; $row < $this->num_data_rows; $row++) {
$record = 1; // Skip record #0 (data label)
if ($this->datatype_implied) // Implied X values?
$xw = 0.5 + $row; // Place text-data at X = 0.5, 1.5, 2.5, etc...
else
$xw = $this->data[$row][$record++]; // Read it, advance record index
$xd = $this->xtr($xw); // Convert X to device coordinates
$x_left = $xd - $width1;
$x_right = $xd + $width1;
if ($this->x_data_label_pos != 'none') // Draw X Data labels?
$this->DrawXDataLabel($this->data[$row][0], $xd, $row);
// Each row must have at least 5 values:
$num_y = $this->num_recs[$row] - $record;
if ($num_y < 5) {
return $this->PrintError("DrawBoxes(): row $row must have at least 5 values.");
}
// Collect the 5 primary Y values, plus any outliers:
$yd = []; // Device coords
for ($i = 0; $i < $num_y; $i++) {
$yd[$i] = is_numeric($y = $this->data[$row][$record++]) ? $this->ytr($y) : NULL;
}
// Skip the row if either YQ1 or YQ3 is missing:
if (!isset($yd[1], $yd[3])) continue;
// Box plot uses 4 colors, and 1 dashed line style for the whiskers:
$this->GetDataColor($row, 0, $gcvars, $box_color);
$this->GetDataColor($row, 1, $gcvars, $belt_color);
$this->GetDataColor($row, 2, $gcvars, $outlier_color);
$this->GetDataColor($row, 3, $gcvars, $whisker_color);
$whisker_style = $this->SetDashedStyle($whisker_color, $this->line_styles[0] == 'dashed');
// Draw the lower whisker and T
if (isset($yd[0]) && $yd[0] > $yd[1]) { // Note device Y coordinates are inverted (*-1)
imagesetthickness($this->img, $whisker_thickness);
imageline($this->img, $xd, $yd[0], $xd, $yd[1], $whisker_style);
imageline($this->img, $xd - $width2, $yd[0], $xd + $width2, $yd[0], $whisker_color);
}
// Draw the upper whisker and T
if (isset($yd[4]) && $yd[3] > $yd[4]) { // Meaning: Yworld[3] < Yworld[4]
imagesetthickness($this->img, $whisker_thickness);
imageline($this->img, $xd, $yd[3], $xd, $yd[4], $whisker_style);
imageline($this->img, $xd - $width2, $yd[4], $xd + $width2, $yd[4], $whisker_color);
}
// Draw the median belt (before the box, so the ends of the belt don't break up the box.)
if (isset($yd[2])) {
imagesetthickness($this->img, $belt_thickness);
imageline($this->img, $x_left, $yd[2], $x_right, $yd[2], $belt_color);
}
// Draw the box
imagesetthickness($this->img, $box_thickness);
imagerectangle($this->img, $x_left, $yd[3], $x_right, $yd[1], $box_color);
imagesetthickness($this->img, 1);
// Draw any outliers, all using the same shape marker (index 0) and color:
for ($i = 5; $i < $num_y; $i++) {
if (isset($yd[$i]))
$this->DrawShape($xd, $yd[$i], 0, $outlier_color);
}
$this->DoCallback('data_points', 'rect', $row, 0, $x_left, $yd[4], $x_right, $yd[0]);
}
return TRUE;
} | [
"function box1group($fe, $av, $ylim = \"0, 100, 10\"){\n\t\t$p = getcwd(); $t = \"/eigenes/downs/temp/\";\n\t\tif ($this->name == \"\") $this->name = __FUNCTION__.\".png\";\n\t\t$ofi = $p.\"/out/\".$this->name;\n\t\tif ($this->neu == 1) {\n\t\t\t$l = chr(10);\n\t\t\t$fe = data::get($fe, $av);\n\t\t\t$fe = data::com... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the type of the expression. | public function removeExpressionType(O\Expression $expression); | [
"private function unrollExpression($type): void\n {\n for($i = count($this->tokens); $i > 0; $i++) {\n $token = $this->tokens[$i - 1];\n if (($token->getTokenType() & $type) != 0)\n {\n unset($this->tokens[i - 1]);\n }\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation organizationIdPutAsyncWithHttpInfo Update info on one organization | public function organizationIdPutAsyncWithHttpInfo($id, $organization = null)
{
$returnType = '';
$request = $this->organizationIdPutRequest($id, $organization);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}
);
} | [
"public function organizationIdPutWithHttpInfo($id, $organization = null)\n {\n $request = $this->organizationIdPutRequest($id, $organization);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a default "application/json" body parser. | public function getDefaultJsonParser(): callable
{
return function (StreamInterface $body) {
return json_decode($body);
};
} | [
"protected static function parse_json_body() {\n\t\tif(\n\t\t\t($reqbody = trim(file_get_contents('php://input'))) &&\n\t\t\tstrlen($reqbody) > 0\n\t\t) {\n\t\t\t$body = json_decode($reqbody, true);\n\t\t}\n\t\t// Return nuthin'\n\t\telse {\n\t\t\t$body = null;\n\t\t}\n\t\t\n\t\treturn $body;\n\t}",
"public funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set up a name for current Web Transaction | public function setTransactionName($name)
{
newrelic_name_transaction($name);
} | [
"public static function useRequestAsTransactionName()\n {\n self::setTransactionName(self::guessOperationName());\n }",
"public function nameTransaction($name);",
"public function setTransactionName( string $name ) {\n $this->name = $name;\n }",
"public function getTransactionName(): st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to get instance of Twig loader by type | public function getLoaderInstance($type)
{
$type = strtolower($type);
$loader = null;
switch ($type) {
case 'array' :
$loader = new \Twig_Loader_Array();
break;
case 'string' :
$loader = new \Twig_Loader_String();
break;
case 'filesystem' :
$loader = new \Twig_Loader_Filesystem();
/**
* @todo change it on config value
*/
$loader->addPath(PARSER_TEMPLATES_PATH, 'main', true);
break;
default :
if (clsSysCommon::getCommonDebug()) {
$search = array('{__field_name__}');
$repl = array(__CLASS__ . '::' . $name);
$error_message = clsSysCommon::getMessage('call_undefined_func', 'Errors', $search, $repl);
throw new \Exception($error_message);
}
/**
* @todo for the clients error
*/
}
return $loader;
} | [
"public function getTemplateLoader(): TemplateLoaderInterface;",
"public function getLoader()\n {\n if ( is_null($this->loader) ) {\n if ( ($resolver = $this->resolver()) instanceof Twig_LoaderInterface ) {\n $this->setLoader($resolver);\n }\n }\n\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store a newly created XrefDistrict in storage. | public function store(CreateXrefDistrictRequest $request)
{
$input = $request->all();
$xrefDistrict = $this->xrefDistrictRepository->create($input);
Flash::success('XrefDistrict saved successfully.');
return redirect(route('xrefDistricts.index'));
} | [
"public function store(CreateDistrictRequest $request)\n\t{\n\t \n\t\tDistrict::create($request->all());\n\n\t\treturn redirect()->route(config('quickadmin.route').'.district.index');\n\t}",
"public function store(CreateDistrictRequest $request)\n {\n $input = $request->all();\n\n $district = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle the user goods favorite "deleted" event. | public function deleted(UserGoodsFavorite $userGoodsFavorite)
{
//
} | [
"public function onRemoveFavorite() {\n try {\n if (!$user = $this->user()) {\n return;\n }\n\n $eventId = (int)post('id');\n\n $favorite = FavoriteModel::where('event_id', $eventId)\n ->where('user_id', $user->id)\n ->f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if an article with the specified id has been created by certain user | public function isAuthoredBy($article, $user): bool
{
if($article instanceof $this->modelClass)
{
return $article->isAuthoredBy($user);
}
return $this->has($article) && $this->find($article)->isAuthoredBy($user);
} | [
"protected function hasUserCreated($userId) {\n\t\t$article = $this->xml->find(self::FIELD_NAME_ARTICLE);\n\t\t$createdBy = $article->getAttribute(self::FIELD_NAME_CREATED_BY);\n\t\treturn $createdBy === $userId;\n\t}",
"public function create($user)\n {\n return $user->hasPermission('create_articles');... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Our own implementation for the groups_non_member shortcode. | public function shortcode_groups_non_member( $atts, $content ) {
return ! $this->shortcode_member( $atts, $content, true );
} | [
"public static function nonmember( $atts, $content = null ) {\n\n\t\t$non_member_content = '';\n\n\t\t// hide non-member messages for super users\n\t\tif ( ! current_user_can( 'wc_memberships_access_all_restricted_content' ) ) {\n\n\t\t\t$plans = wc_memberships_get_membership_plans();\n\t\t\t$exclude_plans ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the [nomor_telepon] column value. | public function getNomorTelepon()
{
return $this->nomor_telepon;
} | [
"public function getTelefno()\n {\n return $this->telefno;\n }",
"public function getTelefono()\n {\n return $this->telefono;\n }",
"public function getTelefono()\r\n {\r\n return $this->telefono;\r\n }",
"public function getTelefono()\r\n {\r\n return $this->telef... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the value of compatibility | public function getCompatibility()
{
return $this->compatibility;
} | [
"public function compatibility() {\n\t\treturn $this->compatibility;\n\t}",
"function getCompatibilityLevel()\n {\n return $this->_props['CompatibilityLevel'];\n }",
"public function getCompatibility();",
"public static function getCompatibilityMode() {\n\t\treturn self::$compatibilityMode;\n\t}",
"pub... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create full field name for current module | public function create_full_field_name($name) {
return 'HW_HOANGWEB_Settings['.$this->create_field_name($name).']';
} | [
"public function get_field_name();",
"function name( $field ) {\n return $field;\n }",
"public function create_full_field_name($name) {\r\n return 'HW_Module_Settings_page['.$this->create_field_name($name).']';\r\n }",
"function hc_field_name($field){\n\t\techo hc_get_field_name($field);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fails the test with specified error message | private static function fail($message, \PHPUnit_Framework_TestCase $test)
{
$test->fail("{$message} in the test '{$test->toString()}'");
throw new \Exception('The above line was supposed to throw an exception.');
} | [
"abstract protected function _testFailed($message);",
"public function testErrorMessagePassedCorrectly(): void\n {\n $this->expectExceptionMessage($this->message);\n\n throw $this->class;\n }",
"public function fail($message)\n {\n throw new SpecFailedException($message);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the name of the action the controller is supposed to execute. | public function getControllerActionName() {} | [
"public function getControllerActionName();",
"protected function getActionName()\n {\n $action = $this->request->getParam('action');\n if (empty($action)) $action = 'index';\n return $action;\n }",
"public function getActionName()\r\n {\r\n return $this->action;\r\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the value of prazo | public function setPrazo($prazo)
{
$this->prazo = $prazo;
return $this;
} | [
"function setSorpresa($_caja){\r\n $this->sorpresa=$_caja;\r\n }",
"public function setPano($value) {\n return $this->set(self::PANO, $value);\n }",
"public function setAtaqueProgramador($valor){\n $this->ataqueProgramador=$valor;\n }",
"public function setNapetiKozena(int $value)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the 'finite.callback.cascade_transition' service. This service is shared. This method always returns the same instance of the service. | protected function getFinite_Callback_CascadeTransitionService()
{
return $this->services['finite.callback.cascade_transition'] = new \Finite\Callback\CascadeTransitionCallback($this->get('finite.factory'));
} | [
"final public function getCascadeController()\n\t{\n\t\treturn $this->cascade_controller;\n\t}",
"protected function getOroWorkflow_Prototype_TransitionManagerService()\n {\n return new \\Oro\\Bundle\\WorkflowBundle\\Model\\TransitionManager();\n }",
"public function getTransition()\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Information about the destination Freight Service Center. | public function setDestinationDetail(FreightServiceCenterDetail $destinationDetail)
{
$this->DestinationDetail = $destinationDetail;
return $this;
} | [
"public function getDestinationFulfillmentCenterId() \n {\n return $this->_fields['DestinationFulfillmentCenterId']['FieldValue'];\n }",
"public function getCostCenter()\n {\n return $this->costCenter;\n }",
"public function getCost_centre()\n {\n return isset($this->cost_cen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Option to search affiliate systems in the basic search panel | function HookResourceConnectAllSearchfiltertop()
{
global $lang,$language,$resourceconnect_affiliates,$baseurl,$resourceconnect_selected;
if (!checkperm("resourceconnect")) {return false;}
?>
<div class="SearchItem"><?php echo $lang["resourceconnect_affiliate"];?><br />
<select class="SearchWidth" name="resourceconnect_selected">
<?php for ($n=0;$n<count($resourceconnect_affiliates);$n++)
{
?>
<option value="<?php echo $n ?>" <?php if ($resourceconnect_selected==$n) { ?>selected<?php } ?>><?php echo i18n_get_translated($resourceconnect_affiliates[$n]["name"]) ?></option>
<?php
}
?>
</select>
</div>
<?php
} | [
"function affiliates_search( $search, $page = 1, $perpage = 6 )\n {\n $request['page'] = $page;\n $request['perpage'] = $perpage;\n $request['search'] = $search;\n\n return $this->hook( \"/affiliates/search\", \"user\", $request, 'GET' );\n }",
"function search()\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add attachments in employee info | public function addAttachmentsAction()
{
if (true === $this->getRequest()->isXmlHttpRequest()) {
$response = new JsonModel();
$response->setVariables(
[
'errors' => [],
'id' => 0,
]
);
$data = $this->getRequest()->getPost();
$id = $data['id'];
$employee = $this->getEntityManager()
->getRepository(EmployeeModel::class)
->findOneBy(
[
'id' => $id
]
);
$fileManager = new FileManager();
$files = $fileManager->storeFiles($this->getRequest()->getFiles('attachments', []), 'files/employee/' . EmployeeModel::hashKey());
foreach ($files as $file) {
$file->setEmployee($employee);
$this->getEntityManager()->persist($file);
$this->getEntityManager()->flush();
}
$url = $this->url()->fromRoute('show-employee', ['hash' => $employee->getHash()]);
$response->setVariables(
[
'id' => $id,
'redirect' => $url
]
);
return $response;
} else {
return $this->notFoundAction();
}
} | [
"public function addAttachments()\n {\n $attachments_relations = [\n 'spots',\n 'plans',\n 'albumPhotos',\n 'areas',\n 'links'\n ];\n $this->addHidden($attachments_relations);\n $this->append('attachments');\n }",
"function a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load default symfony bundles. Load Doctrine also. | protected function loadSymfonyBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
];
$this->loadedBundles = array_merge($this->loadedBundles, $bundles);
} | [
"private function LoadBundles(){\n\n $this->FetchAllBundles();\n $bundleConfigDir = \\Get::Config('APPDIRS.BUNDLES.CONFIG');\n $bundleRoutesDir = \\Get::Config('APPDIRS.BUNDLES.ROUTES');\n\n foreach(self::$bundles as $bundle)\n {\n if(is_dir($bundle))\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Comment wall page setup | function commentwall_pagesetup()
{
} | [
"function comment() {\n\t\tif(!$this->isLogged())\n\t\t\theader('Location: '.URL.'/member/login');\n\t\t\t\n\t\t$sess = $this->mapSession();\n\t\t$post\t= $this->mapPost();\n\t\t\n\t\t$res = $this->comment_model->comment($post->post_id, $post->content, $_SESSION);\n\t\t\n\t\tif($res) {\n\t\t\techo '<script>locati... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method used to get the associated customer and customer contact from a given set of support emails. This is especially useful to automatically associate an issue to the appropriate customer contact that sent a support email. | function getCustomerInfoFromEmails($sup_ids)
{
} | [
"function getContactEmailAssocList($customer_id)\n {\n }",
"private function fetchContactOrLead() {\n\t\t/* @var $message MailMessage */\n\t\t$queries = array();\n\t\t\n\t\t// Loop through each mail item and construct a DQL query to match a Contact with\n\t\t// the message sender. First test for an email ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get_object_tags method to get tags on webit_id | function get_object_tags($webit_id) {
$sql = " SELECT w.webit_id, w.story, t.tag FROM dfm_webits w, dfm_webit_tags wt, dfm_tags t ";
$sql = $sql . " where w.webit_id = wt.webit_id and wt.tag_id = t.tag_id ";
$sql = $sql . " and w.webit_id = " . $webit_id ;
$taglist = array();
$result = $this->_con->query($sql);
if ($result) {
while($row = $result->fetch_row()) {
$taglist[] = $row[2];
}
}
return $taglist;
} | [
"public function getOwnTags($object)\n {\n return self::getTags($this->getValueId(), $object);\n }",
"public function getTags($obj)\n {\n\n $tag = DB_DataObject::factory('tag');\n $tag->whereAdd('strip in (\"'.implode('\",\"',$this->getTagsArray($obj)).'\")');\n $tag->find();\n return se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle the delivery "restored" event. | public function restored(Delivery $delivery)
{
//
} | [
"function post_restoreItem() {\n }",
"public function handleAfterRestoreOrderEvent(Event $e)\n {\n $subOrders = SubOrder::find()->commerceOrderId($e->sender->id)->trashed()->all();\n if( empty($subOrders) ) return;\n\n Craft::$app->getElements()->restoreElements($subOrders);\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the validation mapping files for the format and extends them with files matching a doctrine search pattern (Resources/config/validation.orm.xml). | private function updateValidatorMappingFiles(ContainerBuilder $container, string $mapping, string $extension): void
{
if (!$container->hasParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files')) {
return;
}
$files = $container->getParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files');
$validationPath = '/config/validation.'.$this->managerType.'.'.$extension;
foreach ($container->getParameter('kernel.bundles_metadata') as $bundle) {
if ($container->fileExists($file = $bundle['path'].'/Resources'.$validationPath) || $container->fileExists($file = $bundle['path'].$validationPath)) {
$files[] = $file;
}
}
$container->setParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files', $files);
} | [
"protected function checkExtbaseMappings(): void\n {\n $configurationManager = $this->objectManager->get(ConfigurationManagerInterface::class);\n $configuration = $configurationManager->getConfiguration(\n ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK\n );\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the number of rows matching criteria, joining the related MemberRelatedByCopilotId table | public static function doCountJoinMemberRelatedByCopilotId(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(MissionLegPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
MissionLegPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(MissionLegPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(array(MissionLegPeer::COPILOT_ID,), array(MemberPeer::ID,), $join_behavior);
foreach (sfMixer::getCallables('BaseMissionLegPeer:doCount:doCount') as $callable)
{
call_user_func($callable, 'BaseMissionLegPeer', $criteria, $con);
}
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
} | [
"public function getJoinCount() {\n return $this->getCountByKey('nr','membership');\n }",
"public function getJoinedCandidatesCount() {\n $HierarchyIdList = join(\",\",$this->hierarchy());\n\n $query = \"WITH P AS\n (\n SELECT \tCP.job_id,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the last user id | public function getLastUserId() {
$returnValue = -1;
$query = 'SELECT MAX(`id`) AS `id`'
. 'FROM `' . config::PREFIX . 'user`';
if ($result = database::getInstance()->query($query)) {
$returnValue = $result->fetch(PDO::FETCH_COLUMN);
}
return $returnValue;
} | [
"public function getLastUserId()\n\t{\n\t\treturn $this->last_user_id;\n\t}",
"public function getUserID() {\n return $this->last_id;\n }",
"public static function getLastUserID(){\n $row = getDatabase()->queryFirstRow('SELECT `id` FROM `users` ORDER BY `id` DESC');\n return $row['id'];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print out the log when we're destructed. I'm assuming this will be at the end of the page. If not you might want to remove this destructor and manually call LoggedPDO::printLog(); | public function __destruct()
{
LoggedPDO::printLog();
} | [
"public function __destruct()\n {\n if(Debug::$redirect){\n $_SESSION[\"debug.redirect\"] = Debug::$debug;\n }\n if(defined(\"APPTIMING\") && APPTIMING == true){\n $t = microtime(true);\n Debug::debug(PHP_EOL . \"Start time: \" . APPSTARTUPTIME . PHP_EOL . \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Count and returns the number of full pattern matches. | public function matchesCount($subject) {
return (int)preg_match_all($this, $subject);
} | [
"public function count_matched_subpatterns() {\n return count($this->index_first) - 1;//-1 to not include full match\n }",
"public function countMatches() {\n\t\treturn 0;\n\t}",
"public function countMatches($pat) {\r\n $num = preg_match_all($pat, $this->contents, $matches);\r\n //var_d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allows for notes to be NULL to save database storage. | function checkNotes($notes){
if($notes == "Notes"){
$notes = "NULL";
}
else{
$notes = "'".$notes."'"; # SQL-friendly string.
}
return $notes;
} | [
"private function _save_notes(){\n\t\t\n\t\t\n\t\t\n\t}",
"function saveNotes($data=null) {\n\n\t\tif (!$data) $data = $_POST;\n\t\n\t\t$opt = null;\n\t\t$opt[\"notes\"] = $data[\"notes\"];\n\t\t$opt[\"where\"] = \"id='\".$this->taskId.\"'\"; \n\t\t$this->DB->update(\"task.task\",$opt);\n\n\t\t$this->index();\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolve a URI or pointer against a base | private static function resolve(string $base, string $uri) : string
{
$target = explode('#', Uri\resolve($base, $uri), 2);
return implode(array_pad($target, 2, ''), '#');
} | [
"abstract public function resolveURL();",
"function uri_resolve( $uri ) {\n global $config;\n\n $base_path = $config->router_baseuri;\n\n if(substr($base_path, strlen($base_path) -1) == '/') {\n $base_path = substr($base_path, 0, strlen($base_path) -1);\n } \n\n return $base_path . $uri;\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns mail server hostname. | public function get_hostname()
{
clearos_profile(__METHOD__, __LINE__);
$postfix = new Postfix();
$hostname = $postfix->get_hostname();
return $hostname;
} | [
"public function getHostname() : string\n {\n $hostname = Director::absoluteBaseURL();\n $config = SiteConfig::current_site_config();\n if ($config->AlternateHostnameForEmail) {\n $hostname = $config->AlternateHostnameForEmail;\n }\n\n return $hostname;\n }",
"p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show the form for editing the specified environmentendpoint. | public function edit($appUid, $endpointUid, $id)
{
$environmentendpoint = EnvironmentEndpoint::findOrFail($id);
if( $environmentendpoint->endpoint->uid != $endpointUid
|| $environmentendpoint->endpoint->application->uid != $appUid
) {
return App::abort('404'); // no html view
}
return View::make('environment_endpoints.edit', compact('environmentendpoint'));
} | [
"public function editAction(\\TYPO3\\Semantic\\Domain\\Model\\Sparql\\Endpoint $endpoint) {\n\t\t$this->view->assign('endpoint', $endpoint);\n\t}",
"public function edit_form()\n {\n return View::make(\"app.edit\");\n }",
"public function edit()\n {\n $instance_id = $this->inp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Moves the curl session in debug mode to display extra info. | public function set_debug_mode()
{
curl_setopt($this->ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($this->ch, CURLOPT_HEADER, TRUE);
curl_setopt($this->ch, CURLOPT_NOPROGRESS, FALSE);
return $this;
} | [
"private function setDebug(&$curl)\n {\n $this->debug = [\n 'errorNum' => curl_errno($curl),\n 'error' => curl_error($curl),\n 'info' => curl_getinfo($curl),\n 'raw' => $this->contents,\n ];\n }",
"private function debug()\n\t{\n\t\t$this->response['... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the pattern plugin manager | public static function setPluginManager(PatternPluginManager $plugins)
{
static::$plugins = $plugins;
} | [
"public function setInstance()\n {\n foreach (array_keys($this->plugins) as $plugin) {\n $this->plugins[$plugin]->setInstance($this);\n }\n }",
"public static function setAdapterPluginManager(AdapterPluginManager $adapters)\n {\n static::$adapters = $adapters;\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ check valid file for project | function validate_project_file() {
return validate_post_file($this->input->post("file_name"));
} | [
"public function isValidConfigFile($file);",
"public function IsValid($fileName);",
"protected function validate_file(){\n\t\tif( filter_var( $this->value , FILTER_VALIDATE_URL ) ){ \n\t\t\tif( strpos( $this->value, 'file://' ) !== false )\n\t\t\t\t$this->valid = true; \n\t\t} else {\n\t\t\tif( $this->log )\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a new game from the database with 3 random questions First creates a random game, then picks 3 questions using ORDER BY RAND for randomness. Then links the game and the questions. | function generateNewGame($db){
$gameId = false;
try{
$statement = $db->exec('INSERT INTO `game` (`id_game`) VALUES (NULL)');
$gameId = $db->lastInsertId();
}
catch (PDOException $exception){
error_log('Request error on game insertion: '.$exception->getMessage());
return false;
}
try{
$statement = $db->query('SELECT `id_topic`,`num_question` FROM `question` WHERE `enabled` = 1 ORDER BY RAND() LIMIT 3');
// Three questions, chosen randomly
$questions = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($questions as $key => $question) {
try {
$statement = $db->prepare("INSERT INTO `game_question` (`id_game`, `id_topic`, `num_question`) VALUES (:id_game, :id_topic, :num_question)");
if (!$statement->execute(array(':id_game'=>$gameId, ':id_topic'=>$question['id_topic'], ':num_question'=>$question['num_question']))) {
error_log("Linking between game and questions failed");
return false;
}
} catch (PDOException $exception){
error_log('Request error on game_question insertion: '.$exception->getMessage());
return false;
}
}
}
catch (PDOException $exception){
error_log('Request error on question query: '.$exception->getMessage());
return false;
}
return $gameId;
} | [
"public function getRandomQuiz() {\n\t\t$sql = \"SELECT * from {$this->_dbName}.{$this->_tableName} ORDER BY RAND()\";\n\t\treturn $this->getRecord($sql);\n\t}",
"function randomlyAddGame(){\n\t\t$myRandomNumber = rand(1,2);\n\t\tglobal $connection;\n\t\t$nextGameDate = getDayForNewGame();\n\t\t$randTeam1id = ran... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all of members of an access collection | function get_members_of_access_collection($collection, $idonly = FALSE) {
global $CONFIG;
$collection = (int)$collection;
if (!$idonly) {
$query = "SELECT e.* FROM {$CONFIG->dbprefix}access_collection_membership m"
. " JOIN {$CONFIG->dbprefix}entities e ON e.guid = m.user_guid"
. " WHERE m.access_collection_id = {$collection}";
$collection_members = get_data($query, "entity_row_to_elggstar");
} else {
$query = "SELECT e.guid FROM {$CONFIG->dbprefix}access_collection_membership m"
. " JOIN {$CONFIG->dbprefix}entities e ON e.guid = m.user_guid"
. " WHERE m.access_collection_id = {$collection}";
$collection_members = get_data($query);
if (!$collection_members) {
return FALSE;
}
foreach ($collection_members as $key => $val) {
$collection_members[$key] = $val->guid;
}
}
return $collection_members;
} | [
"public function getMembers();",
"public function getMembers(): Collection\n {\n return $this->members;\n }",
"public function getAllMembers();",
"public function getMembers()\r\n {\r\n }",
"public function getUsers()\n {\n return EnvironmentAccess::getCollection($this->getLink(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
\fninit($className, $objectId, $limit, $skip) \briefInit CommentBox instance all over the website \param$className for the instance of the class that has been commented, $objectId for object that has been commented, \param $limit number of objects to retreive, $skip number of objects to skip | public function init($objectId, $className, $limit = DEFAULTQUERY, $skip = 0) {
$info = array();
$commentP = new CommentParse();
$commentP->wherePointer(strtolower($className), $className, $objectId);
$commentP->where('type', 'C');
$commentP->where('active', true);
$commentP->setLimit((!is_null($limit) && is_int($limit) && $limit >= MIN && MAX >= $limit ) ? $limit : DEFAULTQUERY);
$commentP->setSkip((!is_null($skip) && is_int($skip) && $skip >= 0) ? $skip : 0);
$commentP->whereInclude('fromUser,' . strtolower($className));
$commentP->orderByDescending('createdAt');
$comments = $commentP->getComments();
if ($comments instanceof Error) {
$this->commentArray = array();
$this->error = $comments->getErrorMessage();
return;
} elseif (is_null($comments)) {
$this->commentArray = array();
$this->error = null;
return;
} else {
foreach ($comments as $comment) {
if (!is_null($comment->getFromUser()))
array_push($info, $comment);
}
$this->commentArray = $info;
$this->error = null;
}
} | [
"public function initForMediaPage($objectId, $className, $limit = null, $skip = null) {\r $reviewArray = array();\r $this->mediaInfo = array();\r $review = new CommentParse();\r if ($className == 'Event') {\r $review->wherePointer('event', $className, $objectId);\r ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rename an existing folder | public function renameFolder(string $old, string $new): Response; | [
"public function renameDir($path, $new_name);",
"function renameFolder($newname,$oldname){\n return rename ( WWW_ROOT .'files' . DS . $oldname , WWW_ROOT .'files' . DS . $newname );\n }",
"function rename_folder()\r\n\t{\r\n\t\t$this->Kalkun_model->rename_folder();\r\n\t\tredirect($this->input->post... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a key value array of alternatives from a Doctrine collection of QuestionAlternatives. The key and the value are the same. | public function createChoices(InterviewAnswer $interviewAnswer)
{
$alternatives = $interviewAnswer->getInterviewQuestion()->getAlternatives();
$values = array_map(function (InterviewQuestionAlternative $a) {
return $a->getAlternative();
}, $alternatives->getValues());
return array_combine($values, $values);
} | [
"public function AlternativesPerProduct()\n {\n $dos = ArrayList::create();\n $altCount = Config::inst()->get('RepeatOrderForm', 'number_of_product_alternatives');\n for ($i = 1; $i <= $altCount; $i++) {\n $alternativeField = \"Alternative\".$i.\"ID\";\n if ($this->$alt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the cascade candidate change fraction | function fann_set_cascade_candidate_change_fraction($ann, $cascade_candidate_change_fraction){} | [
"function fann_set_cascade_output_change_fraction($ann, $cascade_output_change_fraction){}",
"function fann_get_cascade_output_change_fraction($ann)\n{\n}",
"private function change(){\n\t\t$k = count($this->coinage);\n\t\t$remain;\n\t\t$total;\n\t\t$amnt;\n\t\tfor($a = 0; $a < $k; $a++){\n\t\t\t/** calculate t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test saving custom fields along the recordAction | public function testRecordActionWithCustomFields() {
$this->User->id = 1;
$expected = array('record_action_on_item', array('pio_action' => 'like', 'pio_iid' => 'Article:52', 'rating' => 6, 'level' => 'medium'));
$this->PredictionIOClient->expects($this->once())->method('getCommand')->with(
$this->equalTo($expected[0]),
$this->equalTo($expected[1])
);
$this->PredictionIOClient->expects($this->once())->method('identify')->with($this->equalTo('User:1'));
$this->PredictionIOClient->expects($this->once())->method('execute');
$this->User->recordAction($expected[1]['pio_action'], array('id' => 52, 'model' => 'Article'), array('rating' => 6, 'level' => 'medium'));
} | [
"public function test_updateReplenishmentProcessCustomFields() {\n\n }",
"public function testPutContactCustomFields()\n {\n }",
"public function test_updateReceivingProcessCustomFields() {\n\n }",
"public function testActiveSave()\n {\n \n }",
"public function test_updateCustomerCustomFields... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Type checks a list of CBValues against a given container type and then constructs a container CBValue for them | public function containerValueFromCBValues($values, CBType $type)
{
$errorVal = NULL;
$checkValues = $this->containerValue_checkIfInputIsArrayOrNull($values, $type);
if ($checkValues !== TRUE) {
return $checkValues;
}
$valueFactory = $this->createContainerValueFactory($type);
if ($valueFactory === NULL) {
return $errorVal;
}
return $valueFactory->factoryContainerValueFromCBValues($values, $type);
} | [
"public function test_nested_list_plain_where_inner_values_are_cbvalues()\n {\n $type = $this->test_nested_list_cbvalues__type();\n $input = $this->test_nested_list_cbvalues__input();\n $res = $this->listFact->factoryContainerValueFromPlainValues($input, $type);\n $this->assertNull($r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Data filter for submitted requisitions (By different staff levels) | public function filterByDateSubmitted(Request $request)
{
$from = Carbon::parse($request->from);
$to = Carbon::parse($request->to);
$Submittedrequisitions = Requisition::join('budgets','requisitions.budget_id','budgets.id')->join('items','requisitions.item_id','items.id')->join('accounts','requisitions.account_id','accounts.id')->join('users','requisitions.user_id','users.id')->join('departments','users.department_id','departments.id')->select('requisitions.*','users.*','departments.*','budgets.title as budget','items.item_name as item','accounts.account_name as account', 'users.username as username','departments.name as department','requisitions.status as status')->get();
$user = User::where('id', Auth::user()->id)->first();
$requisition = Requisition::where('user_id', Auth::user()->id)->first();
$staff_levels = StaffLevel::all();
$departments = Department::all();
$hod = $staff_levels[0]->id;
$ceo = $staff_levels[1]->id;
$supervisor = $staff_levels[2]->id;
$normalStaff = $staff_levels[3]->id;
$financeDirector = $staff_levels[4]->id;
// $submitted_requisitions = Requisition::where('user_id', Auth::user()->id)->select('user_id')->distinct('user_id','created_at')->get();
// foreach ($submitted_requisitions as $requisition) {
if (Auth::user()->stafflevel_id == $hod)
{
$user_dept = User::join('departments','users.department_id','departments.id')
->where('departments.id', Auth::user()->department_id)
->select('users.department_id as dept_id')
->distinct('dept_id')
->first();
$limitHOD = Limit::where('stafflevel_id',$hod)->select('max_amount')->first();
$limitNormalStaff = Limit::where('stafflevel_id',$normalStaff)
->select('max_amount')->first();
$submitted_requisitions = Requisition::join('users','users.id','requisitions.user_id')
->join('departments','users.department_id','departments.id')
->select('requisitions.req_no','users.*','user_id','users.username as username','departments.name as department')
->where('departments.id',$user_dept->dept_id)
->where('users.stafflevel_id','!=',[$ceo])
// ->whereBetween('requisitions.gross_amount', [0,$limitSupervisor->max_amount])
->whereIn('users.stafflevel_id',[$normalStaff, $supervisor, $hod])
->where('requisitions.status', 'like', '%Approved%')
// ->orWhere('requisitions.status', 'like', '%Confirmed%')
// ->orWhere('requisitions.status', 'like', '%Paid%')
->orWhere('requisitions.status', 'like', '%onprocess%')
// ->where('requisitions.gross_amount','>',$limitNormalStaff->max_amount)
->whereDate('requisitions.created_at', '>=', $from)
->whereDate('requisitions.created_at', '<=', $to)
->distinct('req_no')
->get();
return view('requisitions.hod-requisitions', compact('submitted_requisitions','staff_levels','requisition','Submittedrequisitions'))->withUser($user);
}elseif (Auth::user()->stafflevel_id == $supervisor)
{
$user_dept = User::join('departments','users.department_id','departments.id')
->where('departments.id', Auth::user()->department_id)
->select('users.department_id as dept_id')
->distinct('dept_id')
->first();
$limitNormalStaff = Limit::where('stafflevel_id',$normalStaff)
->select('max_amount')->first();
$limitSupervisor = Limit::where('stafflevel_id',$supervisor)
->select('max_amount')->first();
$submitted_requisitions = Requisition::join('users','users.id','requisitions.user_id')
->join('departments','users.department_id','departments.id')
->select('requisitions.req_no','users.*','user_id','users.username as username','departments.name as department')
->where('departments.id',$user_dept->dept_id)
->where('users.stafflevel_id','!=',[$hod])
// ->whereBetween('requisitions.gross_amount', [0,$limitSupervisor->max_amount])
->whereIn('users.stafflevel_id',[$normalStaff, $supervisor])
->where('requisitions.status', 'like', '%Approved%')
// ->orWhere('requisitions.status', 'like', '%Confirmed%')
// ->orWhere('requisitions.status', 'like', '%Paid%')
->orWhere('requisitions.status', 'like', '%onprocess%')
// ->where('requisitions.gross_amount','>',$limitNormalStaff->max_amount)
->whereDate('requisitions.created_at', '>=', $from)
->whereDate('requisitions.created_at', '<=', $to)
->distinct('req_no')
->get();
return view('requisitions.supervisor-requisitions', compact('submitted_requisitions','staff_levels','requisition'))->withUser($user);
}elseif (Auth::user()->stafflevel_id == $ceo)
{
$hodLimit = Limit::where('stafflevel_id',$hod)->select('max_amount')->first();
$ceoLimit = Limit::where('stafflevel_id',$ceo)->select('max_amount')->first();
$submitted_requisitions = Requisition::select('user_id')
->join('users','users.id','requisitions.user_id')
->join('departments','users.department_id','departments.id')
->select('requisitions.req_no','users.*','user_id','users.username as username','departments.name as department')
->where('requisitions.status', 'like', '%Approved%')
// ->orWhere('requisitions.status', 'like', '%Confirmed%')
// ->orWhere('requisitions.status', 'like', '%Paid%')
->orWhere('requisitions.status', 'like', '%onprocess%')
->whereIn('users.stafflevel_id', [$hod,$financeDirector])
// ->orWhere('users.stafflevel_id', ['4','3'])
// ->whereBetween('requisitions.gross_amount', ['500000','5000000'])
->whereDate('requisitions.created_at', '>=', $from)
->whereDate('requisitions.created_at', '<=', $to)
->distinct('req_no')
->get();
return view('requisitions.ceo-requisitions', compact('submitted_requisitions','staff_levels','requisition'))->withUser($user);
}elseif (Auth::user()->stafflevel_id == $normalStaff)
{
$user_dept = User::join('departments','users.department_id','departments.id')
->where('departments.id', Auth::user()->department_id)
->select('users.department_id as dept_id')
->distinct('dept_id')
->first();
$submitted_requisitions = Requisition::join('users','users.id','requisitions.user_id')
->join('departments','users.department_id','departments.id')
->select('requisitions.req_no','users.*','user_id','users.username as username','departments.name as department')
->where('departments.id',$user_dept->dept_id)
->where('users.stafflevel_id','!=',$hod)
->where('users.stafflevel_id','!=',$ceo)
->where('users.stafflevel_id','!=',$supervisor)
->where('users.stafflevel_id','!=',$financeDirector)
->where('requisitions.status', 'like', '%Approved%')
// ->orWhere('requisitions.status', 'like', '%Confirmed%')
// ->orWhere('requisitions.status', 'like', '%Paid%')
->orWhere('requisitions.status', 'like', '%onprocess%')
->whereIn('users.stafflevel_id', [$normalStaff])
->whereDate('requisitions.created_at', '>=', $from)
->whereDate('requisitions.created_at', '<=', $to)
->distinct('req_no')
->get();
return view('requisitions.normal-staff-requisitions', compact('submitted_requisitions','staff_levels','requisition'))->withUser($user);
}elseif (Auth::user()->stafflevel_id == $financeDirector)
{
$user_dept = User::join('departments','users.department_id','departments.id')
->where('departments.id', Auth::user()->department_id)
->select('users.department_id as dept_id')
->distinct('dept_id')
->first();
$submitted_requisitions = Requisition::join('users','users.id','requisitions.user_id')
->join('staff_levels','users.stafflevel_id','staff_levels.id')
->join('departments','users.department_id','departments.id')
->select('requisitions.req_no','users.*','user_id','users.username as username','departments.name as department')
->where('requisitions.status', 'like', '%Approved%')
// ->orWhere('requisitions.status', 'like', '%Confirmed%')
// ->orWhere('requisitions.status', 'like', '%Paid%')
->orWhere('requisitions.status', 'like', '%onprocess%')
->whereDate('requisitions.created_at', '>=', $from)
->whereDate('requisitions.created_at', '<=', $to)
->distinct('req_no')
->get();
return view('requisitions.finance-requisitions', compact('submitted_requisitions','staff_levels','requisition','Submittedrequisitions'))->withUser($user);
}else {
$user_dept = User::join('departments','users.department_id','departments.id')
->where('departments.id', Auth::user()->department_id)
->select('users.department_id as dept_id')
->distinct('dept_id')
->first();
$submitted_requisitions = Requisition::join('users','users.id','requisitions.user_id')
->join('staff_levels','users.stafflevel_id','staff_levels.id')
->join('departments','users.department_id','departments.id')
->where('departments.name','Finance')
->select('requisitions.req_no','users.*','user_id','users.username as username','departments.name as department')
->where('requisitions.status', 'like', '%Approved%')
// ->orWhere('requisitions.status', 'like', '%Confirmed%')
// ->orWhere('requisitions.status', 'like', '%Paid%')
->orWhere('requisitions.status', 'like', '%onprocess%')
->whereDate('requisitions.created_at', '>=', $from)
->whereDate('requisitions.created_at', '<=', $to)
->distinct('req_no')
->get();
return view('requisitions.finance-requisitions', compact('submitted_requisitions','staff_levels','requisition','Submittedrequisitions'))->withUser($user);
}
} | [
"function scorecardUserCond() {\n //getting all users under this supervisor \n $accessBranchList = $this->_getAccessBranchListArray();\n $accessDeptList = $this->_getAccessDeptListArray();\n $conditions = array();\n\n //$conditions = array();\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retorna nome da Cidade pelo id | public function getNameCity($cidade_id)
{
$city = $this->model()->where('id', $cidade_id)->select('nome')->get();
if(sizeof($city)>0){
return $city[0]->nome;
}
} | [
"function get_city_name($id)\n {\n $ci = & get_instance();\n return $ci->db->get_where('ci_cities', array('id' => $id))->row_array()['name'];\n }",
"function get_city_name($id)\n {\n $ci = & get_instance();\n return $ci->db->get_where('xx_cities', array('id' => $id))->row_arra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
With a given key, it checks the $_GET superglobal for the index matching the given key, it then sanitizing the input string, if found, and returns a string safe for ouput to a client. If $filter_array is 0 then it will check if the value of the $_GET array at subscript key is an array and will return false. | public static function get($key, $filter_array = 0, $default = NULL)
{
$item = isset($_GET[$key]) ? $_GET[$key] : NULL;
if($filter_array === 0) {
if(is_array($item))
return $default;
}
return isset($_GET[$key]) ? self::clean($_GET[$key]) : $default;
} | [
"static function filterQueryString() {\n\t\t$clean = array();\n\t\tforeach ($_GET as $key => $val) {\n\t\t\t$clean[$key] = htmlspecialchars_decode(filter_var($val, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW));\n\t\t}\n\t\treturn $clean;\n\t}",
"function knowledgebank_get_filters(){\n $allowed_keys = array('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ $this>addParam('method sp_B2_DG_addSocioEconomico Agraga el niviel socioeconomico de la persona NO SON HIGUALES LOS FORM | public function sp_B2_DG_addSocioEconomico($model){
$this->arrayToPost($model);
$this->load->library('form_validation');
$this->addParam('pID_ALTERNA','pID_ALTERNA','',array('rule'=>'trim|required|numeric|max_length[10]'));
$this->addParam('pID_ESTADO_EMISOR','pID_ESTADO_EMISOR_Socioeconomico','',array('rule'=>'trim|numeric'));
$this->addParam('pID_EMISOR','pID_EMISOR_Socioeconomico','',array('rule'=>'trim|numeric'));
$this->addParam('pVIVE_FAMILIA','pVIVE_FAMILIA','N',array('name'=>'¿Vive con su familia?','rule'=>'trim|max_length[1]'));
$this->addParam('pINGRESO_FAMILIAR','pINGRESO_FAMILIAR','',array('name'=>'Ingreso familiar adicional (mensual)','rule'=>'trim|numeric|max_length[10]'));
$this->addParam('pID_TIPO_DOMIC','pID_TIPO_DOMICILIO','',array('name'=>'Su domicilio es','rule'=>'trim|numeric|max_length[30]'));
$this->addParam('pACTIVIDAD_CULTURAL','pACTIVIDAD_CULTURAL','N',array('name'=>'Actividades culturales o deportivas que practica','rule'=>'trim|max_length[100]'));
$this->addParam('pINMUEBLES','pINMUEBLES','N',array('name'=>'Especificación de inmuebles y costos','rule'=>'trim|max_length[100]'));
$this->addParam('pINVERSIONES','pINVERSIONES','N',array('name'=>'Inversión y monto aproximado','rule'=>'trim|max_length[100]'));
$this->addParam('pNUMERO_AUTOS','pNUMERO_AUTOS','N',array('name'=>'Vehículo y costo aproximado','rule'=>'trim|max_length[100]'));
$this->addParam('pCALIDAD_VIDA','pCALIDAD_VIDA','N',array('name'=>'Calidad de vida','rule'=>'trim|max_length[50]'));
$this->addParam('pVICIOS','pVICIOS','N',array('name'=>'Vicios','rule'=>'trim|max_length[100]'));
$this->addParam('pIMAGEN_PUBLICA','pIMAGEN_PUBLICA','N',array('name'=>'Imagen pública','rule'=>'trim|max_length[50]'));
$this->addParam('pCOMPORTA_SOCIAL','pCOMPORTA_SOCIAL','N',array('name'=>'Comportamiento social ','rule'=>'trim|max_length[40]'));
// $this->addParam('pINGRESO_MENSUAL','pINGRESO_MENSUAL','N',array('name'=>'Ingreso mensual adicional','rule'=>'trim|max_length[30]'));
$this->addParam('pRESPONSABLE_CORP',null); // no se encontro en el formulario
if ($this->form_validation->run() === true) {
$this->procedure('sp_B2_DG_addSocioEconomico');
$this->iniParam('txtError','varchar','250');
$this->iniParam('msg','varchar','80');
$this->iniParam('tranEstatus','int');
$query = $this->db->query($this->build_query());
$response = $this->query_row($query);
if($response == FALSE){
$this->response['status'] = false;
$this->response['message'] = 'Ha ocurrido un error al procesar su última acción.' . " [ GUID = {$this->config->item('GUID')} ]";
}else{
$this->response['status'] = (bool)$response['tranEstatus'];
$this->response['message'] = ($response['tranEstatus'] == 1)? $response['msg'] : $response['txtError'];
}
} else {
$this->load->helper('html');
$this->response['status'] = false;
$message = $this->form_validation->error_array();
$this->response['message'] = ul($message);
$this->response['validation'] = $message;
}
return $this->response;
} | [
"function agregarServicio($codigo, $cantidad, $tipo, $promo=\"\", $grupo=\"N\", $costo=\"\"){\r\n\t\t$servicios = Session::getVar(\"venta_servicios_adicionales\");\r\n\t\t//Session::setVar(\"venta_servicios_adicionales\", array() );\r\n\t\t\r\n\t\tif($codigo == \"\" || $cantidad == \"\" ){\r\n\t\t\treturn JText::_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display a listing of the resource. GET /financial_categories | public function index()
{
$input = Request::all();
$categories = $this->repo->getCategories($input);
return ApiResponse::success($this->response->collection($categories, new FinancialCategoriesTransformer));
} | [
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $finCategories = $em->getRepository('EmpBundle:FinCategory')->findAll();\n\n return $this->render('fincategory/index.html.twig', array(\n 'finCategories' => $finCategories,\n ));\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ $param=['id'=>$request>id]; $item=DB::select('select from people where id=:id',$param); return view('hello.del',['form'=>$item[0]]); | public function del(Request $request){
$item=DB::table('people')->where ('id',$request->id)->first();
return view('hello.del',['form'=>$item]);
} | [
"public function getCreate($id,$SOLICITUD_id)\n {\n // $alumno = alumno::lists('id', 'id');\n\n$solicitud=solicitud::where('id', '=', $SOLICITUD_id)\n ->first();\n $alumno = alumno::where('id', '=', $id)\n ->first();\n\n return view('presenta3.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get character_ids by input | public function getExpectedCharacterIds($tagName)
{
return DB::table('characters')
->where('character','like',$tagName.'%')
->pluck('character_id')->all();
} | [
"public static function searchableIds();",
"function getCharacterList() {\n try {\n $items = $this->perform_query_no_param(\"SELECT id,name from characters\");\n return $this->result_to_array($items);\n } catch(Exception $ex) {\n $this->print_error_message(\"Unable t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the prefixed `site` table name. | public function grabSiteTableName()
{
return $this->grabPrefixedTableNameFor('site');
} | [
"public function grabSiteTableName() {\n\t\treturn $this->grabPrefixedTableNameFor( 'site' );\n\t}",
"function get_table_prefix()\n{\n global $SITE_INFO;\n if (!isset($SITE_INFO['table_prefix'])) {\n return 'cms' . strval(cms_version()) . '_';\n }\n return $SITE_INFO['table_prefix'];\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the component has width defined | public function hasWidth(): bool {
return $this->attrs()->exists('width');
} | [
"public function hasWidth(): bool;",
"protected function _checkWidth()\r\n\t{\r\n\t\t$width = $this->_mapData->getWidth();\r\n\t\tif (is_null($width) || !is_numeric($width) || $width <= 0) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}",
"public function hasWidth() : bool\n {\n return is... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle the given request. Remember that Slack expects a response within three seconds after the slash command was issued. If there is more time needed, dispatch a job. | public function handle(Request $request): Response
{
if (is_numeric($request->text)) {
$this->dispatch(new ShowTDTicketJob());
return $this->respondToSlack('One moment please…');
} else {
$this->dispatch(new SearchTDTicketJob());
return $this->respondToSlack('One moment please…');
}
} | [
"protected function executeRequest(): void\n {\n $jobName = strtolower($this->action);\n if ($this->triggerBackgroundJob($jobName) === true) {\n $this->responder->respond('OK');\n } else {\n $this->responder->respondError('Could not start job.');\n }\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |