query
stringlengths
10
8.11k
document
stringlengths
17
398k
negatives
listlengths
19
20
metadata
dict
Returns a list of entities using a fulltextsearch
public function findByFulltext($search, $limit = 10, $offset = 0);
[ "function elgg_tokeninput_search_all($term, $options = array()) {\n\n\t$term = sanitize_string($term);\n\n\t// replace mysql vars with escaped strings\n\t$q = str_replace(array('_', '%'), array('\\_', '\\%'), $term);\n\n\t$entities = elgg_get_config('registered_entities');\n\t$subtypes = array(0);\n\tforeach ($enti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a user ID return connections connections ids
function getConnectionsConnectionsIds($userConnections){ $userConnectionsConnections=[]; foreach($userConnections as $k=>$v){ array_push($userConnectionsConnections,getConnectionsFromUserId($v)); } return $userConnectionsConnections; }
[ "function getConnectionsFromUserID($userID){\n require \"includes/dbh-inc.php\";\n $userConnectionsIDs = [];\n $sql = \"SELECT Connections.UserB_Id\n FROM Connections\n WHERE Connections.UserA_Id = {$userID};\";\n $result = $conn->query($sql);\n if($result->num_rows > 0){\n while...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate MYSQL for float
public function generateMySQL($param) { $size = $this->getSize($param["params"]); $size = ($size == "") ? "(11)" : "($size)"; $null = $this->getNull($param["params"]); $null = ($null == true) ? "NULL" : "NOT NULL"; $default = $this->getDefault($param["params"]); $default = ($default == "") ? "" : "DEFAULT '$default'"; return "`" . $param['name'] . "` FLOAT$size $null $default"; }
[ "function getFloat($column_name) {}", "function SetColFormatFloat($col, $width=-1, $precision=-1){}", "function escapeFloat4Sql($f){\n\t\treturn (string)$f;\n\t}", "protected function getDecimalSql($value)\n {\n return (float) $value;\n }", "function writeFloat(){\r\n\t\tdie('Not implemented');...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update company member table and set permission values
function set_company_member_permission($user_id, $company_id, $values) { echo "<pre>"; print_r($values); exit(); $data = $this->get_company_member_data($user_id, $company_id); if ($data) { $original_values = !empty($data['permissions']) && $data['permissions'] != 'null' ? json_decode(stripslashes($data['permissions']), TRUE) : array(); $new_values = array_merge($original_values, $values); $this->db->where('id', $data['id']); $res = $this->db->update($this->company_member_table, array('permissions' => json_encode($new_values))); if ($res) { return true; } } return false; }
[ "function ncn_admin_assign_member_to_am($member_id, $am_uid)\n{\n// $query = \"UPDATE member_id_pool SET am_uid=$am_uid WHERE member_id='$member_id'\";\n $result = db_query('UPDATE {member_id_pool} SET am_uid=:a WHERE member_id=:b',\n array(':a'=>$am_uid ,':b'=>$member_id));\n if ($result->rowCount()=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the current node is a sibling of a supplied node. (Both have the same direct parent)
public function is_sibling($target) { if ( ! ($target instanceof $this)) { $target = self::factory($this->_object_name, $target); } if ((int) $this->pk() === (int) $target->pk()) return FALSE; return ((int) $this->{$this->_parent_column} === (int) $target->{$target->_parent_column}); }
[ "public function isSiblingOf($node)\n {\n $this->checkNotNewModel(); \n $owner = $this->owner;\n if ($this->isRoot() || $node->isRoot()) {\n return $owner === $node;\n }\n return $owner->{$this->getPathFieldName()} == $node->{$this->getPathFieldName()};\n }", "p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fungsi Add To Cart
function add_to_cart(){ $data = array( 'id' => $this->input->post('for_id'), 'name' => $this->input->post('title'), 'price' => $this->input->post('price'), 'qty' => $this->input->post('quantity'), //cart sesion dari controller cart ); $this->cart->insert($data); echo $this->show_cart(); //tampilkan cart setelah added }
[ "private function addToCart() {\n\t}", "public function add()\n\t{\n\t\t$product = ORM::factory('product', $this->input->post('product_id'));\n\t\t$quantity = $this->input->post('quantity', 1);\n\t\t$variant = ORM::factory('variant', $this->input->post('variant_id'));\n\t\t\n\t\t$this->cart->add_product($product,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get reverse path to current path part.
public function getReversePath() { return $this->pageContext->getReversePath(); }
[ "public function\t\t\tgetReversePath()\n\t{\n\t\treturn is_null($this->remainPath) ? \"\" : \\net\\dryuf\\core\\StringUtil::replaceRegExp(\\net\\dryuf\\core\\StringUtil::replaceRegExp($this->remainPath, \"[^/]+/\", \"../\"), \"[^/]+\\$\", \"\");\n\t}", "public function getRelativePath()\n\t{\n\t\t$baseName = $thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List all and search movies (/movies/index)
function index() { $search = isset($_POST["searchterm"]) ? $_POST["searchterm"] : ''; $this->set('active','list'); $this->set('search',$search); if($search) { $this->set('title','Results for '.$search . ' - Netflix Movies'); $this->set('data',$this->Movie->search($search)); } else { $this->set('title','All Results - Netflix Movies'); $this->set('data',$this->Movie->selectAll()); } }
[ "public function searchMovies() {\n $query = Input::get('title');\n\n if (!$query) {\n return Redirect::back();\n }\n\n $results = [];\n $response = Tmdb::getSearchApi()->searchMovies($query);\n $num_of_pages = $response['total_pages'];\n\n if ($num_of_pag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END function test_formEmail provide_formEmail() Provides data to use for testing the formEmail method of the Rx_View_Helper_FormEmail class
public function provide_formEmail ( ) { return array( 'simple test' => array( 'expected' => '<input type="email" name="test_name" id="test_name" value="test-value" class=" input email" />', 'name' => 'test_name', 'value' => 'test-value', ), 'disabled attribute test' => array( 'expected' => '<input type="email" name="test_name" id="test_name" value="test-value" disabled="disabled" class=" input email" />', 'name' => 'test_name', 'value' => 'test-value', array( 'disable' => true, ) ), ); }
[ "public function validEmailValidDataProvider() {}", "function testEmailFieldPopulation() {\n\n\t\t$this->get('EmailFieldTest_Controller');\n\t\t$this->submitForm('Form_Form', null, array(\n\t\t\t'Email' => 'test@test.com'\n\t\t));\n\n\t\t$this->assertPartialMatchBySelector('p.good',array(\n\t\t\t'Test save was su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the metricType property value. The user experience analytics metric type.
public function setMetricType(?string $value): void { $this->getBackingStore()->set('metricType', $value); }
[ "public function setMetricClass($type, $class)\n {\n $this->metricClasses[$type] = $class;\n }", "public function setAnomalyType(?UserExperienceAnalyticsAnomalyType $value): void {\n $this->getBackingStore()->set('anomalyType', $value);\n }", "public function getMetricsType()\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets query for [[MstStatus]].
public function getMstStatus() { return $this->hasOne(MstStatus::className(), ['id' => 'mst_status_id']); }
[ "public function getStatus()\n {\n return $this->queryStatus;\n }", "public function get_mms_status()\n {\n if ($this->_mms_status && is_array($this->_mms_status)) {\n return $this->_mms_status;\n } else {\n return FALSE;\n }\n }", "public function getStatus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the native translation of greaterThan token.
public function greaterThan(TokenConditionGreaterThan $token, TokenBase $previous = null) { return "`{$token->property}` > '{$token->value}'"; }
[ "public static function greater() { return self::$gt; }", "function gt($value)\n{\n return new Expr\\Expression('%s > ?', [$value]);\n}", "public function greaterThanOrEquals(TokenConditionGreaterThanOrEquals $token, TokenBase $previous = null) {\n\t\treturn \"\\t{$token->property} >= {$token->value}\";\n\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the value of segni_taglio
public function getSegni_taglio() { return $this->segni_taglio; }
[ "public function get_tag();", "public function setSegni_taglio($segni_taglio)\n {\n $this->segni_taglio = $segni_taglio;\n\n return $this;\n }", "function tag()\n {\n return di()->get('tag');\n }", "public function getTag()\n {\n return $this-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Links tag to the note
public function linkTag($tag) { if (empty($tag)) return false; $tagInstance = Tag::findByName($tag); if (is_null($tagInstance)) $tagInstance = Tag::createNew($tag); $connection = \Yii::$app->db; $connection->createCommand()->insert('note_tag', array( 'note_id' => $this->id, 'tag_id' => $tagInstance->id ))->execute(); }
[ "function get_tag_link($tag)\n {\n }", "function dbt_the_LinkTag($text=\"Bookmark on del.icio.us\",$attr=\"\") {\r\n\t\tglobal $post;\r\n\t\tif($post && is_object($post) && $post->ID>0) {\r\n\t\t\tdbt_addJavaScript();\r\n\t\t\techo \"<a href=\\\"#\\\" onclick=\\\"return dbt_bookmark('\" . get_permalink($pos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler: _copyMultiple If multiple arrays are passed as arguments mulitple will be returned. Otherwise _copy is used.
private static function _copyMultiple($function, $args) { $function(...$args); $arrays = []; foreach ($args as $arg) { if (is_array($arg)) { $arrays[] = $arg; } } if (count($arrays) === 1) { return $arrays[0]; } return $arrays; }
[ "public static function batchCopy() {\n $result = array();\n $copied = lC_Products_Admin::batchCopy($_GET['batch'], $_GET['new_category_id'], $_GET['copy_as']);\n if ($copied) {\n $result['rpcStatus'] = RPC_STATUS_SUCCESS;\n }\n\n echo json_encode($result);\n }", "public function copy($ids);"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test for new lines removal.
public function testNewLines() { $this->assertEquals('testnewlines', $this->getSlugger()->slugify("test\nnew\rlines\n\r")); }
[ "function line_endings_cleanup() {\n\tglobal $fcontents;\n\n\t$ct = preg_match(\"/\\r\\n(\\r\\n)+/\", $fcontents);\n\t$ct += preg_match(\"/\\r\\r+/\", $fcontents);\n\t$ct += preg_match(\"/\\n\\n+/\", $fcontents);\n\tif ($ct>0) {\n\t\t$fcontents = preg_replace(array(\"/(\\r\\n)+/\", \"/\\r+/\", \"/\\n+/\"), array(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve home_enabled in json format
public function get_home() { $obj = new View(); if (! $this->authorized()) { $obj->view('json', array('msg' => 'Not authorized')); return; } $queryobj = new Icloud_model(); $sql = "SELECT COUNT(1) as total, COUNT(CASE WHEN `home_enabled` = 1 THEN 1 END) AS 'yes', COUNT(CASE WHEN `home_enabled` = 0 THEN 1 END) AS 'no' from icloud LEFT JOIN reportdata USING (serial_number) WHERE ".get_machine_group_filter(''); $obj->view('json', array('msg' => current($queryobj->query($sql)))); }
[ "function getEnabled() {\n\t\treturn $this->getData('enabled');\n\t}", "public function get_vnc_enabled()\n {\n $obj = new View();\n if (! $this->authorized()) {\n $obj->view('json', array('msg' => 'Not authorized'));\n return;\n }\n \n $queryobj = new Ard_mod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if bcmath extension is loaded
public function checkBcMath() { return extension_loaded('bcmath') ? 2 : 1; }
[ "public static function isBcMathAvailable()\n {\n return extension_loaded(static::EXTENSION_BCMATH);\n }", "static protected function _useBCMath()\n {\n if (!function_exists('bccomp')) {\n throw new \\LogicException('BC Math extension currently is required', 1405066207);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Category widget for unresolved / resolved posts
function jl_unresolved_posts_cat_register_widget() { register_widget( 'jl_unresolved_posts_cat_widget' ); }
[ "private function getPostCategory()\n\t{\n\t\t$default_category=$this->pluginOptions['default_category'];\n\n\t\t$this->categoriesStringToArray();\n\n\t\t$categories=$this->feed_item->categories;\n\n\t\t$this->feed_item->category=$default_category;\n\n\t\tif(count($categories)==0&&count($this->feed->categories_arra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get specific employee data by his Desktime email.
public function getEmployeeByEmail($email) { $result = new \stdClass(); $result->pass = FALSE; $all_employees = $this->all(); if (($all_employees->pass) && isset($all_employees->body->employees)) { $employees = reset($all_employees->body->employees); if (count($employees) > 0) { foreach ($employees as $employee) { if ($email == $employee->email) { $result->pass = TRUE; $result->data = $employee; break; } } } } return $result; }
[ "public function getEmployeeByEmail(Request $request) \n {\n $employee = Employees::getEmployeeByEmail($request->input('email'));\n $employee = $this->generateEmployeeData($employee); \n\n return $employee;\n }", "public function getEmployeeByEmail($email){\n\t\t\n\t\t$this-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the [podtdesc2] column value.
public function getPodtdesc2() { return $this->podtdesc2; }
[ "public function getDesc2()\n {\n return $this->desc2;\n }", "public function getOedtdesc2()\n {\n return $this->oedtdesc2;\n }", "public function getPodtdesc1()\n {\n return $this->podtdesc1;\n }", "public function getOedhdesc2()\n {\n return $this->oedhdesc2;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renders a closing option group tag
public static function renderOptionGroupClose(){ self::out( self::closeTag('optgroup') ); }
[ "protected function endOptgroup()\n {\n $this->html .= $this->indent(1, \"</optgroup>\");\n $this->optlevel -= 1;\n }", "public function end_el(&$output, $item, $depth){\n $output .= \"</option>\\n\";\n }", "public function end_el(&$output, $item, $depth = 0, $args = array()){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter for deleted files.
public function getDeletedFiles(): Collection { return $this->files->filter(function (File $file) { return $file->getStatus() === File::FILE_DELETED; }); }
[ "public function _get_deleted() {\n\t\treturn $this->_deleted;\n\t}", "public function get_deleted()\n {\n return $this->deleted;\n }", "public function getDeleted()\n {\n return $this->deleted;\n }", "public function getdeleted()\n {\n return $this->deleted;\n }", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get country by ip
function get_country_by_ip($user_ip='') { if ($user_ip) { // Запрос на получение страны по IP $url = "http://ip-to-country.webhosting.info/node/view/36"; $ch = @curl_init(); curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, "ip_address=$user_ip&submit=Find+Country"); // add POST fields $result = curl_exec($ch); // run the whole process curl_close($ch); preg_match("/IP Address(.*?)belongs to(.*?)\./i", $result, $matches); if (strlen($matches[2])>0) { $matches[2]=strip_tags($matches[2]); if (!ereg('Dont', $matches[2])) $country=$matches[2]; else $country="Unknown"; } else $country="Unknown"; return trim($country); } else return; }
[ "public function getCountryForIp(string $ip) : IpInfo;", "function skyGetCountry($ip=''){\n\tglobal $getCountryByIpClass;\n\tif(!$ip)\n\t\t$ip=$_SERVER['REMOTE_ADDR'];\n\t$getCountryByIpClass->set_ip($ip);\n\t$getCountryByIpClass->dist_ip();\n\t$getCountryByIpClass->count_ip();\n\t$info = $getCountryByIpClass->se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests the setCpteCollectifFrn() method.
public function testSetCpteCollectifFrn() { $obj = new Constantes(); $obj->setCpteCollectifFrn("cpteCollectifFrn"); $this->assertEquals("cpteCollectifFrn", $obj->getCpteCollectifFrn()); }
[ "public function testSetCollectif() {\n\n $obj = new Clients();\n\n $obj->setCollectif(\"collectif\");\n $this->assertEquals(\"collectif\", $obj->getCollectif());\n }", "public function testSetNumCptCollectif() {\n\n $obj = new Clients();\n\n $obj->setNumCptCollectif(\"numCpt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the list of KYC documents for the contractor record.
public function kycDocuments() { return $this->hasMany(KycDocument::class); }
[ "public function documents()\n {\n return $this->hasMany(KycDocuments::class, 'kyc_verification_id');\n }", "function getdocuments($ClientID){\n $table = TableRegistry::get(\"documents\");\n return $table->find('all', array('conditions' => array('client_id'=>$ClientID)));\n }", "pu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sanitize the value by replacing special chars with their html unicode equivalent
protected function sanitizeHtmlencode($value) { return filter_var($value, FILTER_SANITIZE_SPECIAL_CHARS); }
[ "function replace_special_characters($value)\n {\n // Detecta a codificação da string.\n $originalEncode = mb_detect_encoding($value);\n\n // Resgata os caracteres que serão substituídos.\n $toSearch = config('constant.specialCharacter.search');\n $toReplace = config('constant....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for chatbotChatbotIDExpressionsGet Returns all training Expression.
public function testChatbotChatbotIDExpressionsGet() { }
[ "public function getExpression();", "public function testChatbotChatbotIDExpressionsExpressionIDDelete()\n {\n }", "public function getExpressions()\n {\n return $this->expressions;\n }", "public function getExpressionList()\n {\n return $this->expressions;\n }", "public func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get MAC addresses of the gateway
public function getMacAddresses() { $addresses = []; $lsInterfaces = $this->commandManager->send('ls /sys/class/net | awk \'{ print $0 }\'', true); $interfaces = explode(PHP_EOL, $lsInterfaces); foreach ($interfaces as $interface) { if ($interface === 'lo') { continue; } $cmd = 'cat /sys/class/net/' . $interface . '/address'; $addresses[$interface] = $this->commandManager->send($cmd, true); } return $addresses; }
[ "public function macAddresses(){\n\t\treturn $this->macAddresses;\n\t}", "public function getMacAddresses() {\n return $this->callSyncStrip('get_macs', array($this->vmName));\n }", "public function getMaclist()\n {\n $result = $this->client->GetMaclist();\n if ($this->errorHandling($r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
concatenate name and welcome message
function concatenate_name($fname, $welcome_message) { if (empty($fname)) { return false; } else { return $welcome_message. $fname; } }
[ "public function welcomeMessage(){\n\n // TODO: change message string concatenation\n $current_user = \\Drupal::currentuser();\n\n // Generate customized welcome message with username and current date.\n $welcome_message = 'Hello ' . $current_user->getDisplayName() . '</br>';\n $welcome_message .= 'T...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getMarkerName:Fixes marker names with prepended and appended hash marks
function getMarkerName( $markerName ) { // Fix subpart name if TYPO tags were not inserted return $markerName = strrpos( $markerName, '###') ? strtoupper( $markerName ) : '###'.strtoupper( $markerName ).'###'; }
[ "private function createMarkerNameWithoutHashes($markerName, $prefix = '') {\n\t\t// If a prefix is provided, uppercases it and separates it with an\n\t\t// underscore.\n\t\tif (!empty($prefix)) {\n\t\t\t$prefix .= '_';\n\t\t}\n\n\t\treturn strtoupper($prefix . trim($markerName));\n\t}", "public function getMarke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the user can delete the time.
public function delete(User $user, Time $time) { return $user->id === $time->checkPoint->run->creator_id; }
[ "public function allowDeletion() {\n return !$this->getReservedHoursCount();\n }", "function canDelete($user) {\n if($this->getIsDefault()) {\n return false; // Default time report cannot be deleted\n } // if\n \treturn $user->isAdministrator() || ($user->getSystemPermission('use_tim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter the query on the engagement_rating_stars column Example usage: $query>filterByEngagementRatingStars(1234); // WHERE engagement_rating_stars = 1234 $query>filterByEngagementRatingStars(array(12, 34)); // WHERE engagement_rating_stars IN (12, 34) $query>filterByEngagementRatingStars(array('min' => 12)); // WHERE engagement_rating_stars >= 12 $query>filterByEngagementRatingStars(array('max' => 12)); // WHERE engagement_rating_stars
public function filterByEngagementRatingStars($engagementRatingStars = null, $comparison = null) { if (is_array($engagementRatingStars)) { $useMinMax = false; if (isset($engagementRatingStars['min'])) { $this->addUsingAlias(PressContactPeer::ENGAGEMENT_RATING_STARS, $engagementRatingStars['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($engagementRatingStars['max'])) { $this->addUsingAlias(PressContactPeer::ENGAGEMENT_RATING_STARS, $engagementRatingStars['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(PressContactPeer::ENGAGEMENT_RATING_STARS, $engagementRatingStars, $comparison); }
[ "public function rating_filter_meta_query() {\n\t\treturn array();\n\t}", "public function filterByStarred($starred = null, $comparison = null)\n\t{\n\t\tif (is_array($starred)) {\n\t\t\t$useMinMax = false;\n\t\t\tif (isset($starred['min'])) {\n\t\t\t\t$this->addUsingAlias(StuffPeer::STARRED, $starred['min'], Cri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return hash with all users of a Region with a role
public function getRegionRoleList($prmRegionId) { $myData = array(); $sQuery = ' SELECT RegionAuth.UserId, RegionAuth.AuthAuxValue AS UserRole, User.UserFullName AS UserName, User.UserEMail FROM RegionAuth INNER JOIN User ON RegionAuth.UserId=User.UserId AND User.UserActive>0 WHERE RegionAuth.AuthKey="ROLE" AND RegionAuth.AuthAuxValue != "NONE" AND RegionAuth.RegionId=:RegionId ORDER BY User.UserFullName '; $sth = $this->q->core->prepare($sQuery); $sth->bindParam(':RegionId', $prmRegionId, PDO::PARAM_STR); try { $sth->execute(); while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $sKey = $row['UserId']; $myData[$sKey] = $row; } $sth->closeCursor(); } catch (Exception $e) { showErrorMsg(debug_backtrace(), $e, ''); } return $myData; }
[ "protected function getUserRoleList()\n {\n $myData = array();\n $sQuery = \"SELECT RegionAuth.*,Region.RegionLabel FROM RegionAuth,Region WHERE \" .\n \" (RegionAuth.RegionId = Region.RegionId) \" .\n \" AND (UserId='\" . $this->UserId . \"') \" .\n \" AND AuthKey=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates hyperlink from text.
public function hyperlink(&$text) { // match protocol://address/path/file.extension?some=variable&another=asf% $text = preg_replace('/\s(([a-zA-Z]+:\/\/)([a-z][a-z0-9_\..-]*[a-z]{2,6})([a-zA-Z0-9\/*-?&%]*))\s/i', ' <a href="$1">$3</a> ', $text); // match www.something.domain/path/file.extension?some=variable&another=asf% $text = preg_replace('/\s(www\.([a-z][a-z0-9_\..-]*[a-z]{2,6})([a-zA-Z0-9\/*-?&%]*))\s/i', ' <a href="http://$1">$2</a> ', $text); return $text; }
[ "public static function makeClickable($text) {\n return preg_replace_callback(\n '#\\bhttps?://[^\\s()<>]+(?:\\([\\w\\d]+\\)|([^[:punct:]\\s]|/))#', \n create_function(\n '$matches',\n 'return \"<a href=\\'{$matches[0]}\\'>{$matches[0]}</a>\";'\n ),\n $text\n );\n}", "public static functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cette fonction va afficher l'article dans la page
function afficherArticle() { }
[ "public function articleAcceuilAction() {\n \n $rArticle = $this->getDoctrine()\n ->getManager()\n ->getRepository('SoleilSiteEftBundle:Articles')\n ->findOneBy(array('categorie' => 1));\n \n //je balance cette rubri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Download all the maps from the modified countries
function downloadAndResizeMaps(){ //There are 216 countries so we need a offset of 200 the second time $modifiedCountries = $this->getModifiedCountries(0); if(count($modifiedCountries) == 200){ $modifiedCountries = array_merge($modifiedCountries, $this->getModifiedCountries(200)); } $countryMapsUrls = $this->getCountryMapsUrls($modifiedCountries); foreach ($countryMapsUrls as $key => $countryMapsUrl) { echo 'Download:'.$key.PHP_EOL; $this->saveImage($this->resize($countryMapsUrl), $key.".png"); } }
[ "protected function set_countries_map() {\n $this->partial(\"Importing country-to-continent map ...\");\n $this->countries = json_decode(file_get_contents($this->get_continents_url()), true);\n ksort($this->countries);\n $this->success(\"OK\");\n }", "function download_maps($locatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setOehdstctry() Set the value of [oehdstcity] column.
public function setOehdstcity($v) { if ($v !== null) { $v = (string) $v; } if ($this->oehdstcity !== $v) { $this->oehdstcity = $v; $this->modifiedColumns[SalesOrderTableMap::COL_OEHDSTCITY] = true; } return $this; }
[ "function setCity($s)\n\t{\n\t\t$this->Info['City'] = $s;\n\t\tupdateTableByClient('ClientContact', 'City', $s, $this->Clientname);\n\t}", "public function setCity( $city );", "function setCity($city)\n {\n $this->__city = $city ;\n }", "public function setCity($city) { $this->city = $city ; }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Descripcion: funcion getEstados, asigna un array con datos de estados de Mexico, los guarda en la variable $this>estados
public function getEstados(){ $this->estados = array( array('id' => 'MEX-AGS','value' => 'AGS', 'label' => 'Aguascalientes'), array('id' => 'MEX-BCN','value' => 'BCN', 'label' => 'Baja California Norte'), array('id' => 'MEX-BCS','value' => 'BCS', 'label' => 'Baja California Sur'), array('id' => 'MEX-CAM','value' => 'CAM', 'label' => 'Campeche'), array('id' => 'MEX-CHIS','value' => 'CHIS', 'label' => 'Chiapas'), array('id' => 'MEX-CHIH','value' => 'CHIH', 'label' => 'Chihuahua'), array('id' => 'MEX-COAH','value' => 'COAH', 'label' => 'Coahuila'), array('id' => 'MEX-COL','value' => 'COL', 'label' => 'Colima'), array('id' => 'MEX-DF','value' => 'DF', 'label' => 'Distrito Federal'), array('id' => 'MEX-DGO','value' => 'DGO', 'label' => 'Durango'), array('id' => 'MEX-GTO','value' => 'GTO', 'label' => 'Guanajuato'), array('id' => 'MEX-GRO','value' => 'GRO', 'label' => 'Guerrero'), array('id' => 'MEX-HGO','value' => 'HGO', 'label' => 'Hidalgo'), array('id' => 'MEX-JAL','value' => 'JAL', 'label' => 'Jalisco'), array('id' => 'MEX-EDM','value' => 'EDM', 'label' => 'México - Estado de'), array('id' => 'MEX-MICH','value' => 'MICH', 'label' => 'Michoacán'), array('id' => 'MEX-MOR','value' => 'MOR', 'label' => 'Morelos'), array('id' => 'MEX-NAY','value' => 'NAY', 'label' => 'Nayarit'), array('id' => 'MEX-NL','value' => 'NL', 'label' => 'Nuevo León'), array('id' => 'MEX-OAX','value' => 'OAX', 'label' => 'Oaxaca'), array('id' => 'MEX-PUE','value' => 'PUE', 'label' => 'Puebla'), array('id' => 'MEX-QRO','value' => 'QRO', 'label' => 'Querétaro'), array('id' => 'MEX-QROO','value' => 'QROO', 'label' => 'Quintana Roo'), array('id' => 'MEX-SLP','value' => 'SLP', 'label' => 'San Luis Potosí'), array('id' => 'MEX-SIN','value' => 'SIN', 'label' => 'Sinaloa'), array('id' => 'MEX-SON','value' => 'SON', 'label' => 'Sonora'), array('id' => 'MEX-TAB','value' => 'TAB', 'label' => 'Tabasco'), array('id' => 'MEX-TAMPS','value' => 'TAMPS', 'label' => 'Tamaulipas'), array('id' => 'MEX-TLAX','value' => 'TLAX', 'label' => 'Tlaxcala'), array('id' => 'MEX-VER','value' => 'VER', 'label' => 'Veracruz'), array('id' => 'MEX-YUC','value' => 'YUC', 'label' => 'Yucatán'), array('id' => 'MEX-ZAC','value' => 'ZAC', 'label' => 'Zacatecas'), ); }
[ "private function getEstados(){\n\n\t\t//Solicita os dados dos idiomas\n\t\t$recordset = $this->Delegator('ConcreteCadastro', 'getEstados');\n\t\t\n\t\t//Associa os dados na view\n\t\t$this->View()->assign('estados',$recordset);\n\t}", "public function getEstados()\n {\n //Retorna os dados dos Contatoss...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all of the customers that are assigned this tag.
public function customers() { return $this->morphedByMany(App\Customer::class, 'taggable'); }
[ "protected function getAllCustomers()\n {\n return Mage::getModel('customer/customer')\n ->getCollection()\n ->addAttributeToSelect('*');\n }", "public function getCustomers()\n {\n if (array_key_exists(\"customers\", $this->_propDict)) {\n return $this->_pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var_dump(div_11("3948601239", 1)); Division by 11 rule
function div_11($string, $debug = false) { $result = null; $plus = true; $sum = 0; $chars = str_split($string); foreach($chars as $char) { if($plus) { $sum += (int)$char; print_r($sum); $plus = false; } else { $sum -= (int)$char; $plus= true; } if($debug) { var_dump("Starting: ".$string); var_dump("Char: ".$char); var_dump("Sum: ".$sum); var_dump("Plus: ".$plus); } } if($sum == 0) { $result = true; } else { if(strlen(abs($sum)) > 2) { $result = div_11($sum, $debug); } else { $result = mod($sum, 11); } } return $result; }
[ "function div_13($string, $debug = false) {\n\t\n\t$result = null;\n\t\n\t$last = last_x($string, 1);\n\t$four_last = last_x_times($string, 1, 9);\n\t\n\t$front_chunk = substr($string, 0, strlen($string)-1);\n\t\n\t$result_sub = $front_chunk - $four_last;\n\t\n\tif($debug) {\n\t\tvar_dump(\"Starting: \".$string);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Devuelve los id_sorteos activos
public function getSorteos(){ //Preparacion del query $sql = "SELECT id_sorteo FROM `sorteos` WHERE status=1 AND zodiacal = 0"; // echo $sql; return $this->vConexion->ExecuteQuery($sql); }
[ "public function getSorteoId()\r\n {\r\n return $this->sorteo_id;\r\n }", "public function sortIdejaAktuelno() {\n $data['kor_ime']=$this->session->get('kor_tip');\n $idejaModel=new IdejaModel();\n $ideje=$idejaModel->dohvati_najaktuelnije_ideje(); \n $data['ideje']=$ideje;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test cases for ::testNodeStatusActions.
public function nodeStatusActionsTestCases() { return [ 'Moderated bundle shows warning (publish action)' => [ 'node_publish_action', 'moderated_bundle', TRUE, // If the node starts out unpublished, the action should not work. FALSE, FALSE, ], 'Moderated bundle shows warning (unpublish action)' => [ 'node_unpublish_action', 'moderated_bundle', TRUE, // If the node starts out published, the action should not work. TRUE, TRUE, ], 'Normal bundle works (publish action)' => [ 'node_publish_action', 'standard_bundle', FALSE, // If the node starts out unpublished, the action should work. FALSE, TRUE, ], 'Normal bundle works (unpublish action)' => [ 'node_unpublish_action', 'standard_bundle', FALSE, // If the node starts out published, the action should work. TRUE, FALSE, ], ]; }
[ "public function testNodeStatus() {\n $this->assertCount(2, $this->items, '2 nodes in the index.');\n $this->processor->preprocessIndexItems($this->items);\n $this->assertCount(1, $this->items, 'An item was removed from the items list.');\n $published_nid = 'entity:node' . IndexInterface::DATASOURCE_ID_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Testing of RequestParser interceptor
public function testParserOnPreParse() { $provider = new RequestProvider('{"jsonrpc": "2.0", "method": "User.getOne", "params": {"id": 999}, "id": 10}'); $server = new Server(); $server->setRequestProvider($provider); // Add custom mapper $mapper = new Mapper(); $server->setMapper($mapper); $server->getRequestParser()->onPreParse() ->add(Interceptor::createWith(function (ParserContainer $container) { $parser = $container->getParser(); $request = $container->getValue(); $request['params']['id'] = 777; return new ParserContainer($parser, $request); })); // Create instance of handlers $repository = new UserRepository(); $response = $server->addHandler($repository)->execute(); $this->assertEquals('{"jsonrpc":"2.0","result":{"id":777,"email":"unknown@empire.com","name":"unknown"},"id":10}', $response); }
[ "public function testJsonRequestParser()\n {\n $request = Request::create(\n '/test',\n 'POST',\n [],\n [],\n [],\n ['CONTENT_TYPE' => 'application/json'],\n '{\"key1\":\"value1\",\"key2\":\"value2\"}'\n );\n\n $app...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set $_FBLoginUrl to $inFBLoginUrl
function setFBLoginUrl($inFBLoginUrl) { if ( $inFBLoginUrl !== $this->_FBLoginUrl ) { $this->_FBLoginUrl = $inFBLoginUrl; $this->setModified(); } return $this; }
[ "public function executeFb($request){\n//$this->loginUrl = $this->helper->getLoginUrl();\n}", "protected function setLoginUrl()\n {\n $userModule = Yii::$app->getModule('user');\n if ($userModule->enableRememberLoginPage) {\n $cookieName = $userModule->originCookieName;\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches all the pending invites related to a particular child hash.
public function get_pending_invites(Request $request, $hash) { try { if ($hash) { $child = Child::where('hash', $hash) ->whereIn('id', Child::accessibleChildren()) ->first(); if (!$child) { return response('The child data does not exist.', 404); } return \App\CaretakerInvite::where('child_id', $child->id) ->where('has_accepted', 0) ->get(); } } catch (\Exception $e) { return response($e->getMessage(), 400); } }
[ "public function get_all_invited(Request $request){\n \t$id = $request->input(\"id\");\n if(!isset($id) || $id === ''){\n $ret = array(\n \"success\"=>false,\n \"msg\"=>'The id was not recieved.'\n );\n die(json_encode($ret));\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all importable address formats.
public function getImportableAddressFormats();
[ "function getAddressFormatList() {\n\t\t$query = \"SELECT `address_summary` FROM `'.BIT_DB_PREFIX.'address_format`\n\t\t\t\t ORDER BY `address_summary`\";\n\t\t$result = $this->mDb->query($query);\n\t\t$ret = array();\n\n\t\twhile ($res = $result->fetchRow()) {\n\t\t\t$ret[] = trim($res[\"address_summary\"]);\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the CSV for graphs
public function generateCSV($graph) { $pretty = array( '_total' => 'All Sources', 'null' => 'Unknown', 'category' => 'Category Browse', 'search' => 'Search Results', 'collection' => 'Collections', 'recommended' => 'Featured Page', 'homepagebrowse' => 'Homepage (Browse)', 'homepagepromo' => 'Homepage (Promo)', 'api' => 'API / Add-ons Manager', 'sharingapi' => 'Add-on Collector', 'addondetail' => 'Add-on Details', 'external' => 'External Sources', 'developers' => 'Meet the Developers', 'installservice' => 'Install Service', 'fxcustomization' => 'Firefox Customization Page', 'oftenusedwith' => 'Often Used With', 'similarcollections' => 'Similar Collections', 'userprofile' => 'User Profile', 'email' => 'Email Sharing', 'rockyourfirefox' => 'Rock Your Firefox', 'mostshared' => 'Most Shared Box', 'fxfirstrun' => 'Firefox Firstrun', 'fxwhatsnew' => 'Firefox Updated', 'creatured' => 'Category Features', 'version-history' => 'Version History', 'addon-detail-version' => 'Add-on Details (Version Area)', 'discovery-pane' => '(Old) Discovery Pane', 'discovery-pane-details' => '(Old) Discovery Pane Details', 'discovery-details' => 'Discovery Pane Details', 'discovery-learnmore' => 'Discovery Pane Learn More' ); if ($graph == 'current') { echo "Label,Count\n"; $_values = $this->db->query_stats("SELECT sources FROM {$this->table} ORDER BY date DESC LIMIT 1"); $values = mysql_fetch_array($_values, MYSQL_ASSOC); $values = json_decode($values['sources'], true); foreach ($values as $column => $value) { if (in_array($column, array('total'))) continue; if (!empty($pretty[$column])) echo "{$pretty[$column]},{$value}\n"; else echo "{$column},{$value}\n"; } } elseif ($graph == 'history') { $headers = array(); $sources = array(); $dates = $this->db->query_stats("SELECT date, total, sources FROM {$this->table} ORDER BY date"); while ($date = mysql_fetch_array($dates, MYSQL_ASSOC)) { $sources[$date['date']] = json_decode($date['sources'], true); $sources[$date['date']]['_total'] = $date['total']; $headers = array_merge($headers, array_keys($sources[$date['date']])); } $headers = array_unique($headers); sort($headers); echo "Date"; foreach ($headers as $header) { if (!empty($pretty[$header])) echo ",{$pretty[$header]}"; else echo ",{$header}"; } echo "\n"; foreach ($sources as $date => $source) { echo $date; foreach ($headers as $header) { if (empty($source[$header])) echo ",0"; else echo ",{$source[$header]}"; } echo "\n"; } } }
[ "public function generateCSV($graph) {\n $columns = array(\n 'total' => 'All Methods',\n 'featured' => 'Featured',\n 'addon' => 'Add-on Details',\n 'search' => 'Search',\n 'guidsearch' => 'GUID Search'\n );\n \n if ($graph == 'curren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts the code which failed as denoted by $startCursor and $endCursor and display the exact column were it happened. The cursor $markCursor is used to mark where the error occured, it will displayed using a ^ character.
private function getAstNodeFailure( $startCursor, $endCursor, $markCursor ) { $code = substr( $startCursor->text, $startCursor->position - $startCursor->column, $endCursor->position - $startCursor->position + $startCursor->column ); // Include some code which appears after the failure points, max 10 characters $extraAstNode = substr( $startCursor->text, $endCursor->position, $markCursor->position - $endCursor->position + 10 ); $eolPos = strpos( $extraAstNode, "\n" ); if ( $eolPos !== false ) { $extraAstNode = substr( $extraAstNode, 0, $eolPos ); } $code .= $extraAstNode; $code .= "\n"; if ( $markCursor->column > 0 ) { $code .= str_repeat( " ", $markCursor->column ); } $code .= "^"; return $code; }
[ "private function getErrorPosition(): string\n {\n if ($this->displayErrorLine) {\n $pieces = preg_split('/\\\\r\\\\n|\\\\n\\\\r|\\\\n|\\\\r/', substr($this->data, 0, $this->position));\n $line = count($pieces);\n $column = strlen(end($pieces));\n\n return \" at...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get CreditCardType value An additional test has been added (isset) before returning the property value as this property may have been unset before, due to the fact that this property is removable from the request (nillable=true+minOccurs=0)
public function getCreditCardType() { return isset($this->CreditCardType) ? $this->CreditCardType : null; }
[ "public function getCreditcardType();", "public function getCardType(): string|null\n {\n if (!$this->hasCardType()) {\n $this->setCardType($this->getDefaultCardType());\n }\n return $this->cardType;\n }", "public function getCardType() {\n return $this->cardType;\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the timeBegan property value. Time when this job run began. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z.
public function setTimeBegan(?DateTime $value): void { $this->getBackingStore()->set('timeBegan', $value); }
[ "public function setStartTime(&$var)\n {\n GPBUtil::checkMessage($var, \\Google\\Protobuf\\Timestamp::class);\n $this->start_time = $var;\n }", "public function setStartedTime($var)\n {\n GPBUtil::checkMessage($var, \\Google\\Protobuf\\Timestamp::class);\n $this->started_time ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a valid csv row from a post id
protected static function make_csv_row_from_feedback( $post_id, $fields ) { $content_fields = self::parse_fields_from_content( $post_id ); $all_fields = array(); if ( isset( $content_fields['_feedback_all_fields'] ) ) $all_fields = $content_fields['_feedback_all_fields']; // Overwrite the parsed content with the content we stored in post_meta in a better format. $extra_fields = get_post_meta( $post_id, '_feedback_extra_fields', true ); foreach ( $extra_fields as $extra_field => $extra_value ) { $all_fields[$extra_field] = $extra_value; } // The first element in all of the exports will be the subject $row_items[] = $content_fields['_feedback_subject']; // Loop the fields array in order to fill the $row_items array correctly foreach ( $fields as $field ) { if ( $field === __( 'Contact Form', 'jetpack' ) ) // the first field will ever be the contact form, so we can continue continue; elseif ( array_key_exists( $field, $all_fields ) ) $row_items[] = $all_fields[$field]; else $row_items[] = ''; } return $row_items; }
[ "public function export_by_id($post_id=0){\r\n $this->check_if_active(\"export_by_id\"); \r\n\r\n check_ajax_referer( 'tmexport_form_nonce_'.$post_id, 'security' );\r\n\r\n $tm_meta= get_post_meta( $post_id , 'tm_meta' , true );\r\n \r\n if ( !empty($tm_meta) \r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve disable order references config.
public function getShowOrderReferences() { return (bool) (!Mage::getStoreConfig('qquoteadv/layout/layout_disable_all_order_references', $this->getStoreId())); }
[ "public function getConfig()\n {\n return $this->_orderConfig;\n }", "public function getDisabledLinks()\n {\n\t\t$disabled = explode(',', Mage::getStoreConfig('faonni_accountnavigation/general/disabled_link'));\n\t\t$links = $this->getLinks();\n\t\t\n\t\tforeach($links as $key => $name){\n\t\t\ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether the total auth vehicles has dropped below the number of discs added
protected function hasTotAuthVehiclesDroppedBelowDiscsCount($data) { $totAuthVehicles = $this->getTotAuthVehicles($data); $totDiscs = count($data['licence']['psvDiscs']); return $totAuthVehicles < $totDiscs; }
[ "protected function hasTotAuthVehiclesDroppedBelowDiscsCount()\n {\n $totAuthVehicles = $this->getTotAuthVehicles($this->application);\n $totDiscs = $this->licence->getPsvDiscsNotCeasedCount();\n\n return $totAuthVehicles < $totDiscs;\n }", "protected function hasTotAuthVehiclesDroppedB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ToDo: make method editRoom()
public function editRoom(){ }
[ "public function updateRoom()\n {\n $data = $this->validate();\n\n $room = Room::find($this->roomId);\n\n if ($room) {\n\n $room->update($data);\n\n $this->reset(['label', 'description', 'cost', 'roomId']);\n \n $this->emit('hideUpsertRoomModal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return error message for pattern checks
function needErr($pat, $v) { if (preg_match("/^$pat$/",$v)) return ''; if ($v == '') return "missing"; return "invalid"; }
[ "public function getPatternMsg(){\n return $this->data['patternMsg'] ? $this->data['patternMsg']: 'Option -'.$this->data['arg'].' must match pattern: '. $this->data['pattern'].\"\\n\";\n }", "public function assertErrorRegExp($pattern, $message = '')\n {\n $output = implode(PHP_EOL, $this->_er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a referrer from a CalendarReferencesInterface.
public function addCalendarReferrer(CalendarReferencesInterface $node);
[ "public function addLocationReferrer(LocationReferencesInterface $node);", "public function addEmailReferrer(EmailReferencesInterface $node);", "public function addReference() {\n\t\t$this->_refCount ++;\n\t}", "public function addReference()\n {\n $this->_refCount++;\n }", "public function add...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the given route has name which belongs to the TwoFactor Authentication component.
protected function routeBelongsToComponent(Route $route) { return strpos($route->getName(), 'two_factor_auth') !== false; }
[ "public function hasRouteName(): bool;", "public function hasNamedRoute($name);", "private function isRegister()\n {\n return Str::contains(Route::currentRouteName(), 'auth.');\n }", "public function isRouteAllowed($route);", "public function isFromRoute(): bool\n {\n return (bool) re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Optional. Max configurable executors. If max_executors_count > executors_count, then autoscaling is enabled. Max Executor Count should be between 2 and 1000. [Default=1000] Generated from protobuf field int32 max_executors_count = 2 [(.google.api.field_behavior) = OPTIONAL];
public function getMaxExecutorsCount() { return $this->max_executors_count; }
[ "public function setExecutorsCount($var)\n {\n GPBUtil::checkInt32($var);\n $this->executors_count = $var;\n\n return $this;\n }", "public function getMaxNumWorkers()\n {\n return $this->max_num_workers;\n }", "public function setMaxInstanceCount($var)\n {\n GPB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove Null from data values. trim extra spaces. remove extra zeros format floats
public function sanitizeData(&$data) { $not_include = ['winning_numbers', 'powerball', 'megaball', 'cash_ball', 'bonus', 'power_play']; foreach ($data as $delta => &$row) { if (!in_array($delta, $not_include)) { $data->{$delta} = trim($row); if ($row == 'NULL') { $data->{$delta} = ''; } if (is_numeric($row)) { $data->{$delta} = floatval($row); if (strpos($row, '000') > -1) { $data->{$delta} = intval($row); } } } } }
[ "private function hhCleanRows($rows) {\n foreach ($rows as &$row) {\n foreach ($row as &$v) {\n if (empty($v)) {\n $v = '';\n }\n elseif (is_numeric($v)) {\n $v = (float) $v;\n }\n };\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the [admintecnico] column value.
public function getAdmintecnico() { return $this->admintecnico; }
[ "public function getClogAdminid()\n {\n return $this->clog_adminid;\n }", "public function getIdccusto()\n {\n return $this->idccusto;\n }", "public function getCategEmploiAutre() {\n return $this->categEmploiAutre;\n }", "public function getClogAdminname()\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Requests the Zabbix API and returns the response of the method "application.tablename". The $params Array can be used, to pass parameters to the Zabbix API. For more information about these parameters, check the Zabbix API documentation at The $arrayKeyProperty can be used to get an associative instead of an indexed array as response. A valid value for the $arrayKeyProperty is is any property of the returned JSON objects (e.g. "name", "host", "hostid", "graphid", "screenitemid").
public function applicationTableName($params = [], $arrayKeyProperty = null, $assoc = true) { return $this->request('application.tablename', $this->getRequestParamsArray($params), $arrayKeyProperty, $assoc, true); }
[ "public function apiTableName($params = array(), $arrayKeyProperty = '')\n {\n return $this->request('api.tableName', $this->getRequestParamsArray($params), $arrayKeyProperty, true);\n }", "public function hostTableName($params = array(), $arrayKeyProperty = '')\n {\n return $this->request(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get All Photos of Thread
public function get_photos_all($thread_id,$post_id){ return $this->where(array('post_id' => $post_id, 'thread_id' => $thread_id))->get(); }
[ "public function get_photos_all($thread_id,$post_id){\nreturn $this->where(array('post_id' => $post_id, 'thread_id' => $thread_id))->get();\n}", "public function getPhotos()\n {\n return $this->buildall(\"FacebookPhoto\",$this->api->api(\"/{$this->id}/photos\")); \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test theBlockShouldBeOpened method with element not found.
public function testTheBlockShouldBeOpenedNotFound(): void { $trait = $this->getSonataPageAdminTraitMock(); $this->page->expects($this->once()) ->method('find') ->with($this->equalTo('css'), $this->equalTo('li:contains(\'Foo\')')) ->willReturn(null) ; $this->session->expects($this->once())->method('getDriver')->willReturn($this->driver); $this->session->expects($this->once())->method('getPage')->willReturn($this->page); $trait->expects($this->exactly(2))->method('getSession')->willReturn($this->session); $this->expectExceptionMessage("Tag not found."); $this->expectException(ElementNotFoundException::class); $trait->theBlockShouldBeOpened("Foo"); // @phpstan-ignore-line }
[ "public function testIOpenTheBlockNotFound(): void\n {\n $trait = $this->getSonataPageAdminTraitMock();\n\n $this->page->expects($this->once())->method('find')\n ->with($this->equalTo('css'), $this->equalTo('li.page-composer__container__child:contains(\\'Foo\\') > a.page-composer__contai...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store a newly created Pengiriman in storage.
public function store(CreatePengirimanRequest $request) { $input = $request->all(); $pengiriman = $this->pengirimanRepository->create($input); Flash::success('Pengiriman saved successfully.'); return redirect(route('pengirimen.index')); }
[ "public function store(CreatePengirimanAPIRequest $request)\n {\n $input = $request->all();\n\n $pengirimen = $this->pengirimanRepository->create($input);\n\n return $this->sendResponse($pengirimen->toArray(), 'Pengiriman saved successfully');\n }", "protected function persist()\n\t{\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the glyph width of a string
function GetStringWidth($string) { $string = (string)$string; $str_width = 0; $str_len = strlen($string); for ($i = 0; $i < $str_len; $i++) { $str_width += $this->m_glyph_widths[$string[$i]]; } return $str_width * $this->m_font_size / 1000; }
[ "function GetStringWidth($string)\n {\n $string = (string)$string;\n $str_width = 0;\n $codes = self::Utf8ToCodepoints($string);\n\n foreach ($codes as $code) \n {\n if (isset($this->m_glyph_widths[$code])) \n { \n // Big-endian uint_16:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get icu locale from sulu locale.
public function getIcuLocale(string $locale): string { $parts = explode('-', $locale); if (isset($parts[1])) { $parts[1] = mb_strtoupper($parts[1]); } return implode('_', $parts); }
[ "public function getLocale() {\n\t\treturn $this->getClaim(self::CAIM_USER_LOCALE);\n\t}", "public function getLocale() {}", "public function getLocale();", "public function getUiLocaleId()\n {\n return $this->uiLocaleId;\n }", "function getSystemLocale() ;", "public function getUserLocale()\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that we cannot upload a theme without info.xml file
public function testUploadThemeZipWithoutInfoFile(): void { // Generate zip with no info.xml $this->fileName = tempnam(sys_get_temp_dir(), 'Theme'); $filePath = $this->fileName . '.zip'; $archive = new ZipArchive(); $archive->open($filePath, ZipArchive::CREATE); $archive->addEmptyDir($this->fileName); $archive->close(); if (file_exists($archive->filename)) { throw new FileNotFoundException('Could not create zip file with theme'); } $this->submitThemeUploadForm(); // We should get a 200 and show an error. self::assertEquals(200, $this->client->getResponse()->getStatusCode()); self::assertContains('We could not find an info.xml', $this->client->getResponse()->getContent()); }
[ "public function testNoDefaultConfig() {\n $name = 'stark';\n $path = $this->availableThemes[$name]->getPath();\n $this->assertFileDoesNotExist(\"$path/\" . InstallStorage::CONFIG_INSTALL_DIRECTORY . \"/$name.settings.yml\");\n $this->container->get('theme_installer')->install([$name]);\n $this->asse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns effective source state for the Transition. If this is a Wildcard Transition then $currentState is treated as sourceState as such Transition can start from any State.
private function getSourceState(Workflow $workflow, WorkflowTransition $transition, WorkflowState $currentState) { if ($transition->startsFromAnyStateId()) { return $currentState; } else { return $workflow->getStateForStateId($transition->getSourceStateId()); } }
[ "public function currentState() {\n return $this->state;\n }", "public function getCurrentSource()\n {\n return $this->currentSource;\n }", "public function get_previous_source()\n {\n return $this->get_default_property(self::PROPERTY_PREVIOUS_SOURCE);\n }", "private function get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
weighted_random_simple() Pick a random item based on weights.
function weighted_random_simple($values, $weights){ $count = count($values); $i = 0; $n = 0; $num = mt_rand(0, array_sum($weights)); while($i < $count){ $n += $weights[$i]; if($n >= $num){ break; } $i++; } return $values[$i]; }
[ "function weighted_random_simple($values, $weights) {\n $count = count($values);\n $i = 0;\n $n = 0;\n echo array_sum($weights);\n echo \"<br>\";\n $num = mt_rand(0, array_sum($weights));\n echo $num;\n echo \"<br>\";\n while ($i < $count) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get recurrence data (keys 'recur_') to merge into an event
public function rrule2event() { return array( 'recur_type' => $this->type, 'recur_interval' => $this->interval, 'recur_enddate' => $this->enddate ? $this->enddate->format('ts') : null, 'recur_data' => $this->weekdays, 'recur_exception' => $this->exceptions, ); }
[ "function getRecurEvents($event){\n\n $events = array();\n\n $rulestr = $event['rrule'];//\"FREQ=DAILY\";//;COUNT=5;INTERVAL=3\";\n //$rulestr = \"FREQ=DAILY;DURATION=60\";//;COUNT=5;INTERVAL=3\";\n $startdate = new DateTime($event['sd']);\n $enddate = new DateTime($event['ed']);\n\n // Recurring event, par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sets the prpc used in this class
public function setPrpc($prpc) { $this->prpc = $prpc; }
[ "function setC_p($sc_p = '')\n {\n $this->sc_p = $sc_p;\n }", "function set_pantone_pc($pantone_name)\n {\n $this->pantone_pc = $pantone_name;\n $this->cmyk['c'] = $this->pantone_pallete_pc[$pantone_name]['c'];\n $this->cmyk['m'] = $this->pantone_pallete_pc[$pantone_name]['m'];\n $this->...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OneToOne (inverse side) Get fkTcemgTetoRemuneratorioControle
public function getFkTcemgTetoRemuneratorioControle() { return $this->fkTcemgTetoRemuneratorioControle; }
[ "public function getFkTcemgTetoRemuneratorio()\n {\n return $this->fkTcemgTetoRemuneratorio;\n }", "public function getFkPessoalContrato()\n {\n return $this->fkPessoalContrato;\n }", "public function getFkTcemgContratoEmpenho()\n {\n return $this->fkTcemgContratoEmpenho;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endColli() end processing a coli, do everything is needed to conclude the scheduling here we can depending on the configuration parameter remove the pdflabel(s) from the label directory
function endColli() { error_log( "Carr_DHL_Simple.php::Carr_DHL_Simple::endColli(): begin") ; if ( self::$carrConfig->DHL_Simple->removeLbl) { $sysCmd = "rm " . $this->path->Archive . "VeColi/" . $this->veColiNr . "*.pdf" ; error_log( "Carr_DHL_Simple.php::Carr_DHL_Simple::scheduleColli(): sysCmd = '$sysCmd'") ; system( $sysCmd) ; } error_log( "Carr_DHL_Simple.php::Carr_DHL_Simple::endColli(): end") ; return true ; }
[ "public function endCurrentBatch() :void;", "public function endBatch() {\n\t}", "public function endBatch() : void\n {\n // IF batch has started we can end it.\n if ($this->batchStarted) {\n\n // Iterate through the couriers\n foreach ($this->couriers as $courierRef => $c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new Quest model. If creation is successful, the browser will be redirected to the 'view' page.
public function actionCreate() { $model = new Quest(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', [ 'model' => $model, ]); } }
[ "public function actionCreate()\n {\n $model = new Question();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->fr_id]);\n } else {\n return $this->render('create', [\n 'model' => $mod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Contact Info Uses HTML Microformats:
function contact_info_formatted($html=null,$includeSocial=true){ $org_name=get_theme_option('org_name'); $street_address_1=get_theme_option('street_address_1'); $street_address_2=get_theme_option('street_address_2'); $city=get_theme_option('city'); $state=get_theme_option('state'); $zip=get_theme_option('zip'); $country=get_theme_option('country'); $phone=get_theme_option('phone'); $html.= $org_name ? '<strong><span class="p-name">'.strip_tags($org_name).'</span></strong><br>' : null; $html.= $street_address_1 ? '<span class="p-street-address">'.strip_tags($street_address_1).'</span><br>' : null; $html.= $street_address_2 ? '<span class="p-extended-address">'.strip_tags($street_address_2).'</span><br>' : null; $html.= $city ? '<span class="p-locality">'.trim(strip_tags($city)).'</span>' : null; $html.= $state ? ', <span class="p-region">'.trim(strip_tags($state)).'</span>' : null; $html.= $zip ? ' <span class="p-postal-code">'.trim(strip_tags($zip)).'</span>' : null; $html.= $country ? ' <span class="p-country-name">'.trim(strip_tags($country)).'</span>' : null; $html.= $phone ? '<br><span class="p-tel">'.trim(strip_tags($phone)).'</span>' : null; $html.= $includeSocial ? '<br>'.social_links_formatted() : null; return $html ? '<div class="h-card">'.$html.'</div>' : 'Please enter your contact information in theme settings.'; }
[ "function parse_contact_content($content) {\r\n $content = str_replace('Email:', '<span class=\"email\">Email:</span>', $content);\r\n return $content;\r\n}", "public function formatContactInfo() {\n $allContactObjectsInfo = $this -> getAllContactEntries();\n $formattedContactInfo = \"\";\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds an element to the array passed in
function addToArray($array,$element){ $array[count($array)]=$element; return $array; }
[ "function intarray_add(&$intarray, $value) {}", "public function addElement(ArrayElementNode $element) : void\n {\n $this->elements[] = $element;\n }", "public function addItem(Array $item);", "public function add($element);", "function array_add($array, $key, $value)\n\t{\n\t\treturn Arr::add(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For specifically checking the user's global level. (For purposes of display only) (Yes that Auth::check() is necessary since is public route)
public function checkGlobal() { $result = json_encode(['level' => 0]); if (Auth::check()) { $userID = Auth::user()->userID; $result = $this->user->getGlobal($userID)->first()->toJson(); } return $result; }
[ "function page_require_level($required_level) \n{\n global $session;\n $current_user = current_user();\n\n /* caution */\n /* === added by Yoel.- 2019.05.23 === */\n if ( !$current_user ) {\n redirect(SITE_URL.'/home.php', FALSE);\n return FALSE;\n }\n\n $login_group = find_by_groupLevel($current_user[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the last four digits of the card number used for this transaction
public function get_last_four() { return ! empty( $this->response->getPaddedCardNo()) ? substr($this->response->getPaddedCardNo(),-4): null; }
[ "public function cardLastFour()\n {\n return (string) ($this->paddleInfo()['payment_information']['last_four_digits'] ?? '');\n }", "public function getCardNumberLast4() {\n if ($this->getData('card_number_last4') === null) {\n if ($this->getCardNumber()) {\n $this->s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether this is the posts page, regardless of whether it's the frontpage or not.
private function is_posts_page(): bool { return ( is_home() && ! is_front_page() ); }
[ "public static function is_posts_page() {\n\t\treturn ( \\is_home() && 'page' === get_option( 'show_on_front' ) );\n\t}", "public function isStaticPostsPage() {\n\t\treturn is_home() && ( 0 !== (int) get_option( 'page_for_posts' ) );\n\t}", "public function is_home_posts_page() {\n\t\treturn ( is_home() && get_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The setter for the field streetName
public function setStreetName($streetName) { $this->_streetName = $streetName; }
[ "public function setStreetName($streetName) {\n\t\t$this->streetName = $streetName;\n\t}", "public function setStreet_name($street_name = null)\n {\n // validation for constraint: string\n if (!is_null($street_name) && !is_string($street_name)) {\n throw new \\InvalidArgumentException(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test fetching user IDs for a given context.
public function test_get_users_in_context() { $component = 'search_simpledb'; // Ensure both users are found for both contexts. $expected = [$this->u1->id, $this->u2->id]; sort($expected); // User 1. $userlist = new \core_privacy\local\request\userlist($this->c1context, $component); provider::get_users_in_context($userlist); $this->assertCount(2, $userlist); $actual = $userlist->get_userids(); sort($actual); $this->assertEquals($expected, $actual); // User 2. $userlist = new \core_privacy\local\request\userlist($this->c2context, $component); provider::get_users_in_context($userlist); $this->assertCount(2, $userlist); $actual = $userlist->get_userids(); sort($actual); $this->assertEquals($expected, $actual); }
[ "public function test_get_users_in_context() {\n $this->resetAfterTest(true);\n $this->setAdminUser();\n $this->scorm_setup_test_scenario_data();\n $component = 'mod_scorm';\n\n $userlist = new \\core_privacy\\local\\request\\userlist($this->context, $component);\n provider...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retorna a data de vencimento
public function getDataVencimento() { return $this->dataVencimento; }
[ "public function getDataVencimento () {\n return $this->oDataVencimento; \n }", "function getDataVencimentoRecibo()\n {\n return $this->dtVencRecibo;\n }", "public function GetVolRetardataire()\n {\n $req = $this->select()->setIntegrityCheck(false)\n ->from(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
__construct Initializes geo image maps
public function __construct() { $this->geoImageMaps = new ArrayCollection(); }
[ "public function __construct() {\r\n $this->geoJson = array(\r\n 'type' => 'FeatureCollection',\r\n 'features' => array()\r\n );\r\n }", "public function _construct()\n {\n $this->_init('signifymap/signifymap', 'signifymap_id');\n }", "public function __constr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
User can't create a project without providing a `name` field
public function a_project_require_a_name() { $project = factory(Project::class)->raw(['name' => '']); $this->post('/api/projects', $project)->assertStatus(422)->assertJsonStructure([ 'errors' => [ 'name', ], ]); }
[ "public function testProjectSaveForbiddenNames(): void\n {\n $this->expectException(\\Exception::class);\n /** @var User $user */\n $user = User::factory()->create();\n $this->be($user);\n $project = new Project();\n $project->name = 'ESP32';\n $project->save();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for api with bad request params
public function cestBadParams(\FunctionalTester $I) { /** * @todo IMPLEMENT THIS */ $I->amOnPage([ 'base/api', 'users' => [ ], 'platforms' => [ ] ]); $I->seeResponseCodeIs(400); }
[ "public function test_invalid_api_response() {\n\t\t$this->setExpectedException('Exception', \\Paddle\\Api::ERR_202, 202);\n\t\t$this->set_private_field($this->api, 'base_url', '');\n\t\t$this->set_private_field($this->api, 'api_version', '');\n\t\t$this->call_private_method($this->api, 'http_call', array('http://e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set isExpected attribute of the aswer
public function setIsExpected($isExpected) { $this->isExpected = $isExpected; }
[ "public function setFailed()\n {\n $this->passed = false;\n }", "public function testSetAssurance() {\n\n $obj = new Clients();\n\n $obj->setAssurance(true);\n $this->assertEquals(true, $obj->getAssurance());\n }", "public function setFlag() {\n $this->attributes['test_fl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a qualification is attached to this course
public function isQualificationOnCourse($qualID){ $this->getCourseQualifications(false, true); return (array_key_exists($qualID, $this->quals)); }
[ "public function has_project_for_student($qualID)\n\t{\n\t\t//TODO THIS DOES NOT TAKE INTO CONSIDERATION GROUPS!!!\n\t\tglobal $CFG;\n\t\t$studentID = $this->studentID;\n\t\t//find the quals that the student has access to \n\t\t//is one of them this qual?\n\t\t//if so, does it have a project for this unit?\n\t\t\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
testMerchantEqBrandIsMerchant Starting from an empty db import one fixtured feed item This is an approved brand that with same values from brand and merchant whitelisted as a merchant
public function testMerchantEqBrandIsMerchant() { $fid = 'fixionalprovider-levi-502'; $this->step1->testProcessItem($fid); $this->command->testProcessItem($fid); $item = $this->repos['item']->findOneBy(array('feedId' => $fid)); $brand = $this->repos['brand']->findOneBy(array()); $this->assertNull($brand); $merchant = $this->repos['merchant']->findOneBy(array()); $this->assertSame('Levi.com', $merchant->getName()); $board = $this->repos['board']->findOneBy(array( 'createdBy.$id' => new \MongoId($merchant->getId()), 'name' => 'Bottoms' )); $this->assertNotNull($board); $this->assertSame('Bottoms', $board->getCategory()->getName()); $post = $this->repos['post']->createQueryBuilder() ->field('board')->references($board) ->field('createdBy')->references($merchant) ->field('target')->references($item) ->getQuery()->execute()->getSingleResult(); $this->assertNotNull($post); $this->assertSame('Bottoms', $post->getCategory()->getName()); $this->assertSame($fid, $post->getTarget()->getFeedId()); $this->assertSame('merchant', $post->getUserType()); //test rootPost for Item $this->assertNotNull($item->getRootPost()); $this->assertSame($item->getRootPost()->getId(), $post->getId()); }
[ "public function testMerchantEqBrand()\n {\n $this->command->testProcessItem('fixionalprovider-levi-502');\n\n $this->assertSame(1, $this->repos['item']->findBy(array())->count());\n $this->assertNotNull($this->repos['item']->findOneBy(array('feedId' => 'fixionalprovider-levi-502')));\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
test one() with association data.
public function testOneAssociationsMany(): void { $data = [ 'title' => 'My title', 'body' => 'My content', 'author_id' => 1, 'comments' => [ ['comment' => 'First post', 'user_id' => 2], ['comment' => 'Second post', 'user_id' => 2], ], 'user' => [ 'username' => 'mark', 'password' => 'secret', ], ]; $marshall = new Marshaller($this->articles); $result = $marshall->one($data, ['associated' => ['Comments']]); $this->assertSame($data['title'], $result->title); $this->assertSame($data['body'], $result->body); $this->assertSame($data['author_id'], $result->author_id); $this->assertIsArray($result->comments); $this->assertCount(2, $result->comments); $this->assertInstanceOf('Cake\ORM\Entity', $result->comments[0]); $this->assertInstanceOf('Cake\ORM\Entity', $result->comments[1]); $this->assertSame($data['comments'][0]['comment'], $result->comments[0]->comment); $this->assertIsArray($result->user); $this->assertEquals($data['user'], $result->user); }
[ "public function testOneAssociationsSingle(): void\n {\n $data = [\n 'title' => 'My title',\n 'body' => 'My content',\n 'author_id' => 1,\n 'comments' => [\n ['comment' => 'First post', 'user_id' => 2],\n ['comment' => 'Second post'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return tripIDs of trip with duration greater than specified duration
public function searchTripsByGreaterDuration($duration) { $db = new Db(); $query = "SELECT tripID FROM trip t, trip_duration d WHERE t.startDate = d.startDate AND t.endDate = d.endDate AND duration > " . ModelsUtils::mysqlString($duration); return $this->returnResult( $this->submitQuery($query)); }
[ "public function filterByDuration($duration = null, $comparison = null);", "public function getRecipeByDuration($duration)\n {\n $db = getAdapter(); \n $statement = $db->createStatement(\"SELECT * FROM Recipe WHERE duration <=\".$duration);\n $result = $statement->execute();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the currentToken index exists Used by the Iterator interface
public function valid() { return isset($this->tokens[$this->currentToken]); }
[ "public function has_current() {\n\t\treturn ( $this->current_position < strlen( $this->input ) );\n\t}", "public function hasToken();", "public function valid()\n\t{\n\t\treturn isset($this->tokens[$this->position]);\n\t}", "protected function hasTokenAtIndex(int $index): bool\n {\n return isset($t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the remaining number of seconds before the module restarts, or zero when no reboot has been scheduled.
public function get_rebootCountdown() { $json_val = $this->_getAttr("rebootCountdown"); return (is_null($json_val) ? Y_REBOOTCOUNTDOWN_INVALID : intval($json_val)); }
[ "public function get_rebootCountdown(): int\n {\n // $res is a int;\n if ($this->_cacheExpiration <= YAPI::GetTickCount()) {\n if ($this->load(YAPI::$_yapiContext->GetCacheValidity()) != YAPI::SUCCESS) {\n return self::REBOOTCOUNTDOWN_INVALID;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks for url query parameter.
public function url_get_param( $url ) { $urldata = parse_url( $url ); if ( isset( $urldata['query'] ) ) { return false; } else { return true; } }
[ "public static function checkUrlParam($param=null){\n\n $instance=new self;\n if($param==null){\n return false;\n }\n if(array_key_exists($param,$instance->request->getQueryString())){\n return true;\n }\n return false;\n }", "private function val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the next trainer's Auto Increment number
public function getNextTrainersAI() { $this->connect(); $query = $this->connection->prepare("SHOW TABLE STATUS LIKE 'trainers'"); $query->execute(); $size = $query->fetch(PDO::FETCH_ASSOC); $this->disconnect(); return $size['Auto_increment']; }
[ "public function getAutoIncrement()\r\n {\r\n $connection = Yii::app()->db;\r\n $command = $connection->createCommand(\"SHOW TABLE STATUS LIKE '\" . get_called_class() . \"'\");\r\n $row = $command->queryRow();\r\n $nextId = 'PAM' . $row['Auto_increment'];\r\n\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load data page tagihan konfirmasi $order = menentukan order database, desc / asc / random $offset = halaman $limit = Batas pengambilan data $search = Keyword / kata kunci
public function load_data_page_draff($order, $offset, $limit, $search) { $this->db->select('*'); $this->db->from('bb_invoice'); $this->db->where('status_inv', '9'); // kondisi jika kata kunci tidak ada if($search != NULL) { $this->db->group_start(); $this->db->like('name_inv', $search); $this->db->or_like('code_inv', $search); $this->db->group_end(); } $this->db->order_by('id_inv', $order); // kondisi jika pembatasan dan offset tidak ada if($limit != NULL && $offset!=NULL) { $this->db->limit($limit,$offset); } elseif($offset == NULL) { $this->db->limit($limit); } $query = $this->db->get(); return $query->result(); }
[ "public function load_dataPage($order, $offset, $limit, $search)\n\t{\n\n\t\t$this->db->select('*');\n\t\t$this->db->from('tbl_aksesoris');\n\n\t\t// kondisi jika kata kunci tidak ada\n\t\tif($search != NULL)\n\t\t{\n\t\t\t$this->db->like('name_acc', $search);\n\t\t}\n\n \t$this->db->order_by('id_acc', $order...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ / View de Incidencias
public function incidencia() { return view('Front.incidencia'); }
[ "public static function ver_todas_incidencias(){\n\n\t\tsession_start();\n\n\t\t$user = $_SESSION['logged_user'];\n\n\t\tView::set(\"user\", $user);\n\n\t\t/* */\n\t\t$incidenciasDeManager = Incidencias::getIncidenciasDeUsuario($user->id);\n\n\t\tif ( $incidenciasDeManager != null ){\n\n\t\t\t/* incidencias Del Ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getAccessString If the accesskey is found in the specified string, underlines it
public function getAccessString($str) { $access = $this->getAccessKey(); if (!empty($access) && (false !== ($pos = strpos($str, $access)))) { return htmlspecialchars(substr($str, 0, $pos), ENT_QUOTES) . '<span style="text-decoration: underline;">' . htmlspecialchars(substr($str, $pos, 1), ENT_QUOTES) . '</span>' . htmlspecialchars(substr($str, $pos + 1), ENT_QUOTES); } return htmlspecialchars($str, ENT_QUOTES); }
[ "function getAccessString( $str )\r\n {\r\n $access = $this->getAccessKey();\r\n if ( !empty($access) && ( false !== ($pos = strpos($str, $access)) ) ) {\r\n return htmlspecialchars(substr($str, 0, $pos), ENT_QUOTES) . '<span style=\"text-decoration: underline;\">' . htmlspecialchars(sub...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return information about given class import.
public function getImport(string $class): ImportInfo { if ($this->hasImport($class)) { return $this->imports[$class]; } throw new RuntimeException("$class is not imported into current namespace."); }
[ "public function get_import_info(): import_info {\n return $this->importinfo;\n }", "function include_import_class($import_class) {\n\tif (file_exists(ABSPATH . '/includes/import-classes/' . $import_class)) {\n\t\trequire_once(ABSPATH . '/includes/import-classes/' . $import_class);\n\t}\n}", "public f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the minimum number of identical tokens (default: 70).
public function setMinTokens($minTokens) { $this->minTokens = $minTokens; }
[ "public function &setMltMaxNumTokens ($value) {}", "public function setMltMaxNumTokens(int $value): \\SolrQuery {}", "public function setMaximumNumberOfTokens(int $maximum): self;", "public function increaseWrongTokenCount()\n {\n ++$this->wrongTokenCount;\n }", "public function getMinimalToken...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }