query stringlengths 10 8.11k | document stringlengths 17 398k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Determine if the passed token has a condition of one of the passed types. | public function hasCondition($stackPtr, $types)
{
return $this->__call(__FUNCTION__, func_get_args());
} | [
"public function hasConditionType(string $type): bool;",
"private function foundOneOf($tokentypes) {\n\t\tforeach ( $tokentypes as $tokentype ) {\n\t\t\tif ($this->token->getType () == $tokentype)\n\t\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"public function hasCondition();",
"function isApplicableF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy datas from $_POST to object | public function copyFromPost()
{
/* Classical fields */
foreach ($this->fields AS $key => $more) {
if (array_key_exists($key, $_POST))
{
/* Do not take care of password field if empty */
if ($key == 'passwd' AND empty($_POST[$key])) {
continue;
}
/* Automatically encrypt password in MD5 */
if ($key == 'passwd' AND !empty($_POST[$key])) {
$this->{$key} = Tools::encrypt($_POST[$key]);
} else {
$this->{$key} = $_POST[$key];
}
} elseif (isset($this->{$key}) && !empty($this->{$key}) && $this->{$key} != null){
continue;
} else {
$this->{$key} = '';
}
}
} | [
"protected function copyFromPost(&$object) {\r\n\t\t/* Classical fields */\r\n\t\tforeach ( $_POST as $key => $value ) {\r\n\t\t\tif ($key == 'active_column' || $key == 'active_menu' || $key == 'active_element') {\r\n\t\t\t\t$key = 'active';\r\n\t\t\t}\r\n\t\t\tif (key_exists($key, $object)) {\r\n\t\t\t\t$object->{... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select Specific details of lead specified in arguments | function selectLeadDetails($leadId, $select = array('salutation_name', 'first_name', 'last_name'))
{
global $db;
$strSelect = implode(', ', $select);
try {
$stmt = $db->prepare("SELECT $strSelect
FROM leads l
WHERE l.id = :leadid");
$stmt->bindParam(":leadid", $leadId);
$stmt->execute();
$rows = $stmt->columnCount();
if ($rows > 0) {
$details = $stmt->fetch(PDO::FETCH_ASSOC);
}
return ($details)? $details : NULL;
} catch (Exception $exc) {
throw new Exception($exc->getMessage());
}
} | [
"public function lead_details($lead_id){\n\n $this->db->select('Ld.id,Ld.lead_identification,Ld.lead_ticket_range,Ld.opened_account_no,Ld.created_by_branch_id,Ld.customer_name,Ld.contact_no,Ld.remark,La.employee_name,La.status,La.is_deleted,La.is_updated,La.followup_date,db_master_products.title,rs.reminder_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Is version order creation time? | public function isVersionOrderCreationTime(); | [
"public function isVersionOrderCreationTime()\n {\n $versionOrder = $this->getVersionOrder();\n\n return $versionOrder == self::VERSION_ORDER_CREATION_TIME;\n }",
"public function shouldCreateVersion() {\n\t\treturn $this->createVersion;\n\t}",
"public function hasVersions(): bool;",
"publ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inject the current media storage | public function setMediaStorage(MediaStorageInterface $mediaStorage); | [
"public function upload_media_in_storage() {\n \n // Upload the media's files\n (new MidrubBaseAdminComponentsCollectionSettingsHelpers\\Settings)->upload_media_in_storage();\n \n }",
"protected abstract function getMediaObjectPersistence();",
"public function getMediaStorage()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function scrape_between This function returns all data between two HTML tags to reduce search space. | function scrape_between($data, $start, $end){
$data = stristr($data, $start); // Stripping all data from before $start
$data = substr($data, strlen($start)); // Stripping $start
$stop = stripos($data, $end); // Getting the position of the $end of the data to scrape
$data = substr($data, 0, $stop); // Stripping all data from after and including the $end of the data to scrape
return $data; // Returning the scraped data from the function
} | [
"public static function getBetweenText( $html, $tag_before, $tag_after ) { \n\t\t$tag_before = preg_quote($tag_before);\n\t\t$tag_after = preg_quote($tag_after);\n\t\t$match = '';\n\t\tpreg_match_all(\"/$tag_before(.*?)$tag_after/uis\", $html, $match);\n\t\treturn $match[1];\n\t}",
"function getTextBetweenHTML($... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtains lead routing rules. | public function getRoutingRules($data) {
$admin = &Yii::app()->settings;
$online = $admin->onlineOnly;
Session::cleanUpSessions();
$sessions = Session::getOnlineUsers();
$criteria = new CDbCriteria;
$criteria->order = "priority ASC";
$rules = X2Model::model('LeadRouting')->findAll($criteria);
foreach ($rules as $rule) {
$arr = LeadRouting::parseCriteria($rule->criteria);
$flagArr = array();
foreach ($arr as $criteria) {
if (isset($data[$criteria['field']])) {
$val = $data[$criteria['field']];
$operator = $criteria['comparison'];
$target = $criteria['value'];
if ($operator != 'contains') {
switch ($operator) {
case '>':
$flag = ($val >= $target);
break;
case '<':
$flag = ($val <= $target);
break;
case '=':
$flag = ($val == $target);
break;
case '!=':
$flag = ($val != $target);
break;
default:
$flag = false;
}
} else {
$flag = preg_match("/$target/i", $val) != 0;
}
$flagArr[] = $flag;
}
}
if (!in_array(false, $flagArr) && count($flagArr) > 0) {
$users = $rule->users;
$users = explode(", ", $users);
if (is_null($rule->groupType)) {
if ($online == 1)
$users = array_intersect($users, $sessions);
}else {
$groups = $rule->users;
$groups = explode(", ", $groups);
$users = array();
foreach ($groups as $group) {
if ($rule->groupType == self::WITHIN_GROUPS) {
$links = GroupToUser::model()->findAllByAttributes(
array('groupId' => $group));
foreach ($links as $link) {
$usernames[] = User::model()->findByPk($link->userId)->username;
}
} else { // $rule->groupType == self::BETWEEN_GROUPS
$users[] = $group;
}
}
if ($online == 1 && $rule->groupType == self::WITHIN_GROUPS) {
foreach ($usernames as $user) {
if (in_array($user, $sessions)) $users[] = $user;
}
}elseif ($rule->groupType == self::WITHIN_GROUPS) {
$users = $usernames;
}
}
if ($rule->groupType == self::WITHIN_GROUPS) {
$users = array_values(
array_intersect(
Profile::model()->getUsernamesOfAvailableUsers(),
$users));
}
$users[] = $rule->rrId;
$rule->rrId++;
$rule->save();
return $users;
}
}
} | [
"protected function rewrite_rules() {\n $rules = array();\n foreach ( $this->routes as $route ) {\n /** @var Route $route */\n $rules = array_merge($rules, $route->rewrite_rules());\n }\n return $rules;\n }",
"public function getRoutingRules($data) {\n\t\t$admi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unset relevent keys before stats object is inserted into db | public function unsetKeysBeforeCreate($stats)
{
foreach ($this->keysOnlyUsedDuringCreation() as $key) {
unset($stats[$key]);
}
return $stats;
} | [
"public static function reset_draw_stats_entries()\r\n {\r\n db::sql(\"DELETE FROM `tl_users_stats_draw`;\", DB_NAME);\r\n }",
"public function clearData()\n {\n $this->save();\n $this->_data = array();\n $this->_indexes = array();\n $this->_preloaded = false;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to check if archive is a flex loop. This doesn't check if viewing an actual archive, but this layout should not be an option if ! is_archive() | function mai_is_flex_loop() {
// Bail if not a content archive.
if ( ! mai_is_content_archive() ) {
return false;
}
// Get columns.
$columns = mai_get_columns();
// If we have more than 1 column or if we are using featured image as bg image, it's a flex loop.
if ( ( $columns > 1 ) || ( 'background' === mai_get_archive_setting( 'image_location', true, genesis_get_option( 'image_location' ) ) ) ) {
return true;
}
// Not a flex loop.
return false;
} | [
"function mai_is_content_archive() {\n\n\tglobal $wp_query;\n\n\tif ( ! $wp_query->is_main_query() ) {\n\t\treturn false;\n\t}\n\n\t$is_archive = false;\n\n\t// Blog\n\tif ( is_home() ) {\n\t\t$is_archive = true;\n\t}\n\t// Term archive\n\telseif ( is_category() || is_tag() || is_tax() ) {\n\t\t$is_archive = true;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store a newly created Community in storage. | public function store(CreateCommunityRequest $request)
{
$input = $request->all();
$community = $this->communityRepository->create($input);
$community->users()->attach(Auth::id());
Flash::success(trans('flash.store', ['model' => trans_choice('functionalities.communities', 1)]));
return redirect(route('communities.index'));
} | [
"public function store(CreateCommunityRequest $request)\n {\n $input = $request->all();\n\n $community = $this->communityRepository->create($input);\n\n Flash::success('Community saved successfully.');\n\n return redirect(route('communities.index'));\n }",
"public function newCom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all tweets with mentioned hashtag since id. | function campaign_tweetcounter_get_tweets($oauth, $hashtag, $since_id = FALSE) {
$statuses = array();
$hashtag = preg_replace('/^\#/', '', $hashtag);
$params = array(
'q' => '#' . $hashtag,
'count' => '100',
'result_type' => 'recent',
'include_entities' => 'true',
);
if ($since_id) {
$params['since_id'] = $since_id;
}
$query = http_build_query($params);
$response = campaign_tweetcounter_request('tweets', $oauth, '?' . $query);
if (!empty($response->statuses)) {
$statuses = $response->statuses;
}
return $statuses;
} | [
"protected function generateTweetsByHashtag()\n {\n $this->setTweets($this->twitter->getSearch(array(\n 'q' => '#'.$this->value,\n 'count' => 100,\n 'result_type' => 'recent'\n ))->statuses);\n }",
"public function getTwitterHashtags()\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses $smNavigationData looking for the block pertaining to the current SMTool or SMFolder. Returns it. | protected function getNavigationDataForThisObject($navigationData = null) {
global $smSiteNavigationData;
if (!$navigationData) { $navigationData = $smSiteNavigationData; }
$returnVal = null;
// $this is an SMFolder: $this.id should equal $navigationData['site_instance_id']
if (get_class($this) == 'SMFolder') {
foreach ((array)$navigationData['pages'] as $page) {
// matching folder
if ($page['app_name'] == 'folder' && $page['site_instance_id'] == $this->getID()) {
$returnVal = $page;
}
// non-matching folder
else if ($page['app_name'] == 'folder') {
$returnVal = $this->getNavigationDataForThisObject($page);
}
}
}
// $this is an SMTool: $this.id should eqla $navigationData['id']
else if (get_class($this) == 'SMTool') {
foreach ((array)$navigationData['pages'] as $page) {
// matching tool
if ($page['id'] == $this->getID()) {
$returnVal = $page;
}
// folder: examine contents
else if ($page['app_name'] == 'folder') {
$returnVal = $this->getNavigationDataForThisObject($page);
}
}
}
return $returnVal;
} | [
"private function navigationDataForCurrentFolder($incomingData = null) {\n\t\t\tglobal $smSiteNavigationData;\n\t\t\t$returnData = null;\n\t\t\t\n\t\t\t// choose navData based on what we got (since this is a recursive method)\n\t\t\tif ($incomingData) {\n\t\t\t\tif (smDebugToolStructure) { echo 'navigationDataForCu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Injecting dependencies. This time we have typehinted our TwitterFeedReader to ensure that we can't pass strange dependencies into our constructor. THAT guy is foiled! | public function __construct(TwitterFeedReader $twitterFeedReader)
{
$this->twitterFeedReader = $twitterFeedReader;
} | [
"public function testFeedReaderCanBeInstantiated()\n {\n $s = new TwitterFeedReader;\n }",
"public function __construct()\n {\n $this->twitter = new TwitterRepo();\n }",
"function __construct()\n {\n $this->twitter = new TwitterOAuth($this->consumer, $this->consumersecret, $t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all the validation rule builders. | public function getBuilders(): array
{
return collect($this->rules)->map(function ($rules, string $actionMethod) {
return $this->resolveRulesFor($actionMethod);
})->all();
} | [
"public static function builders()\n {\n return self::$builders;\n }",
"function getBuilders(): array\n {\n return $this->builders;\n }",
"public function getBuilders()\r\n {\r\n foreach ($this->_builders as &$builder) {\r\n if (is_string($builder)) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation gETCarrierAccountsAsync List all carrier accounts | public function gETCarrierAccountsAsync()
{
return $this->gETCarrierAccountsAsyncWithHttpInfo()
->then(
function ($response) {
return $response[0];
}
);
} | [
"public function gETCarrierAccounts()\n {\n $this->gETCarrierAccountsWithHttpInfo();\n }",
"public function listAccounts()\n {\n return $this->apiRequest('system.listaccounts');\n }",
"public function listAllAccounts(){\r\n return $this->identityGateway->listAllAccounts();\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
two uses to this script: 1. load cities into cities table (done only once). (will be done when loadToDB==1) 2. (primary usage) search venues data using the API. (when requestData==1). returns something og the form array(boolean, "error message") | function addNewCity($foursquare,$cityName, // cityName - no underscore
$jsonsDir,$venuesDir,$splitNum,$categotyId,$loadToDB,$requestData,$conn){
// google API part
$googleApiKey = "AIzaSyDutGO-yGZstF2N3IjGOUv8kWYWi9aGGGk";
$boundingBox = $foursquare->getBoundingBox($cityName,$googleApiKey);
// null when we have problem in requesting google api
if($boundingBox === null){
return array(false,"Something went wrong... Please try again."); // error
}
if($boundingBox === 0){
return array(false,"City wasn't found. Try a different city."); // error
}
if(!inUSA($boundingBox)){
return array(false,"This city is not in the USA"); // error
}
if(cityAlreadyInTableBB($conn,$boundingBox)){
return array(false,"We already have this city"); // error (kind of)
}
$titleToIndex = array('cityId'=>0,'cityName'=>1,'north_lat'=>2,'south_lat'=>3, 'east_lon'=>4,'west_lon'=>5);
$cityArr = array_fill(0,sizeof($titleToIndex),'');
$cityArr[$titleToIndex['cityName']] = $cityName;
$cityArr[$titleToIndex['north_lat']] = $boundingBox['north_lat'];
$cityArr[$titleToIndex['south_lat']] = $boundingBox['south_lat'];
$cityArr[$titleToIndex['east_lon']] = $boundingBox['east_lon'];
$cityArr[$titleToIndex['west_lon']] = $boundingBox['west_lon'];
// put city in DB: cityId,cityName,boundingBox-details
//(only one time - controlled by flag $loadToDB)
if ($loadToDB){
addEntryToCityTable($conn, $cityArr, $titleToIndex);
}
if(!$requestData)
return array(true,''); // when already have the data
//assume city already exists in db
//now do the api requsts
$requestType = "venues/search";
$cityNameDir = str_replace(' ','_',$cityName).'/';
$outputDir = $jsonsDir.$venuesDir.$cityNameDir;
if(!in_array(str_replace('/','',$cityNameDir),scanDir($jsonsDir.$venuesDir)))
mkdir($outputDir);
$requestsNum = requestCityFunc($foursquare,$cityName,$boundingBox,$requestType,$categotyId,$outputDir,$splitNum);
// not enough results for the city
if($requestsNum<=$splitNum)
return array(false,"Requesting restaurants has failed. Please try again."); // error
return array(true,'');
} | [
"function discoverWorldcitiesAvailable()\n{\n global $dbConn;\n $params = array();\n $query = \"SELECT C.id as cityid,C.country_code, C.state_code, C.name, C.latitude, C.longitude, CO.name AS country_name, ST.state_name FROM webgeocities AS C INNER JOIN cms_countries AS CO ON C.country_code=CO.code LEFT J... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Doctors data API accepts four parameters doctor_id : doctor id which user will select API will return following parameters doctors details all doctors related details address address from previously booked camps for which same doctor was assigned message message relevant to api response status SUCCESS / FALSE $user_id = '116'; | public function doctor_data(){
$response_data = '';
$address = '';
$user_id = $this->input->post('doctor_id');
$doctors_data = $this->db->query("SELECT * FROM doctors WHERE doctors.id = '".$user_id."'");
if ($doctors_data->num_rows() > 0) {
$address_data = $this->db->query("SELECT * FROM camp_clinic_booking WHERE id = '".$doctors_data->result()[0]->id."' ORDER BY id LIMIT 1");
if ($address_data->num_rows() > 0) {
$address = $address_data->result()[0]->address;
}
$response_data = array('message' => 'SUCCESS', 'status' => 'SUCCESS', 'doctors_data' => $doctors_data->result(), 'address' => $address);
} else {
$response_data = array('message' => 'Doctor Selection Invalid', 'status' => 'failed');
}
$this->response($response_data);
} | [
"public function get_doctor_detail($doctor_id) {\n $doctor_query = \"\n SELECT\n user_id,\n user_first_name,\n user_last_name,\n user_photo,\n user_photo_filepath,\n user_status,\n user_phone_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function returns the default value of a parameter. | protected function getDefaultValue($param)
{
return self::$param_info[$param]['default'];
} | [
"abstract protected function getDefaultValue($param);",
"function default_value(&$var, $def = null) {\n return isset($var)?$var:$def;\n}",
"public function defaultValue($default = NULL);",
"public function getDefaultValue() { return $this->default_value; }",
"private static function parse_policy_paramete... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Redirect to new URL. Used as a fallback function for the old URL structure of Elementor page edit URL. Fired by `template_redirect` action. | public function redirect_to_new_url() {
if ( ! isset( $_GET['elementor'] ) ) {
return;
}
$document = Plugin::$instance->documents->get( get_the_ID() );
if ( ! $document ) {
wp_die( __( 'Document not found.', 'elementor' ) );
}
if ( ! $document->is_editable_by_current_user() || ! $document->is_built_with_elementor() ) {
return;
}
wp_safe_redirect( $document->get_edit_url() );
die;
} | [
"function _template_redirect() {\n\n\t\t}",
"public function template_redirect() {\n\t\t// If there is no path, nothing to do.\n\t\tif ( empty( $_SERVER['REQUEST_URI'] ) ) {\n\t\t\treturn;\n\t\t}\n\t\t$path = \\sanitize_text_field( \\wp_unslash( $_SERVER['REQUEST_URI'] ) );\n\n\t\t// If it's not a wp-sitemap requ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets as shippingCarrierUsed This field is deprecated. | public function getShippingCarrierUsed()
{
return $this->shippingCarrierUsed;
} | [
"public function getShippingServiceUsed()\n {\n return $this->shippingServiceUsed;\n }",
"public function getFreightShipping()\n {\n return $this->freightShipping;\n }",
"public function getListedShippingServiceCost()\n {\n return $this->listedShippingServiceCost;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a die to dieArray | public function add_die($die) {
$this->dieArray[] = $die;
} | [
"public function add_die(BMDie $die) {\n // need to search with strict on to avoid identical-valued\n // objects matching\n if (!in_array($die, $this->validDice, TRUE)) {\n if (is_array($die->skillList)) {\n foreach ($die->skillList as $skill) {\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Dim in an OpenXML Drawing (pictures in an XLSX) | function TbsPicGetDim_Drawings($Txt, $Pos, $FieldPos, $FieldLen, $Offset, $dim_inner) {
// The <a:ext> coordinates must have been found previously.
if ($dim_inner===false) return false;
// The current file must be an XLSX drawing sub-file.
if (strpos($this->TBS->OtbsCurrFile, 'xl/drawings/')!==0) return false;
if ($Pos==0) {
// The parent element has already been found
$PosEl = 0;
} else {
// Found parent element
$loc = clsTbsXmlLoc::FindStartTag($Txt, 'xdr:twoCellAnchor', $Pos, false);
if ($loc===false) return false;
$PosEl = $loc->PosBeg;
}
$loc = clsTbsXmlLoc::FindStartTag($Txt, 'xdr:to', $PosEl, true);
if ($loc===false) return false;
$p = $loc->PosBeg;
$res = array();
$el_lst = array('w'=>'xdr:colOff', 'h'=>'xdr:rowOff');
foreach ($el_lst as $i=>$el) {
$loc = clsTbsXmlLoc::FindElement($Txt, $el, $p, true);
if ($loc===false) return false;
$beg = $Offset + $loc->GetInnerStart();
if ($beg>$FieldPos) $beg = $beg - $FieldLen;
$val = $dim_inner[$i.'v'];
$tval = $loc->GetInnerSrc();
$res[$i.'b'] = $beg;
$res[$i.'l'] = $loc->GetInnerLen();
$res[$i.'u'] = '';
$res[$i.'v'] = $val;
$res[$i.'t'] = $tval;
$res[$i.'o'] = intval($tval) - $val;
}
$res['r'] = ($res['hv']==0) ? 0.0 : $res['wv']/$res['hv']; // ratio W/H;
$res['dec'] = 0;
$res['cpt'] = 12700;
return $res;
} | [
"function TbsPicGetDim_Drawings($Txt, $Pos, $FieldPos, $FieldLen, $Offset, $dim_inner) {\n\n\t\t// The <a:ext> coordinates must have been found previously.\n\t\tif ($dim_inner===false) return false;\n\t\t// The current file must be an XLSX drawing sub-file.\n\t\tif (strpos($this->TBS->OtbsCurrFile, 'xl/drawings/')!... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the model class. | public function getModelClass(): string
{
return $this->model_class;
} | [
"public function getModelClass()\n\t{\n\t\treturn $this->model_class;\n\t}",
"final public function modelClass()\r\n {\r\n $parts = explode('\\\\', get_class($this));\r\n return $parts[count($parts) - 1];\r\n }",
"protected function _getClassModel()\r\n {\r\n return $this->getModel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all articles with a technical name like the string given. | public function getWithTechnicalNameLike($technicalName)
{
return $this->model
->newQuery()
->with(['media', 'translations' => function ($query) {
$query->where('locale', content_locale());
}])
->where('technical_name', 'like', "{$technicalName}.%")
->orderBy('order_column')
->get();
} | [
"function searchArticlesByName($article_name, $ignore_offlines = false, $clang = false, $category = false) {\r\n\t\tglobal $REX;\r\n\t\tif($clang === false) $clang = $REX[CUR_CLANG];\r\n\t\t$offline = $ignore_offlines ? \" and status = 1 \" : \"\";\r\n\t\t$oocat = $category ? \" and startpage = 1 \" : \"\";\r\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load all initialized actions/filter, models and external files | public function load() {
$this->includes();
$this->inits();
} | [
"public function _loadFilters()\n {\n //include_once XOOPS_ROOT_PATH.'/class/filters/filter.php';\n //foreach ($this->_filters as $f) {\n //\t include_once XOOPS_ROOT_PATH.'/class/filters/'.strtolower($f).'php';\n //}\n }",
"public static function init() {\n\t\tcore::loadClass(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds the url of the video that can be inserted in an iframe | public function buildVideoUrl($params)
{
$videoId = $this->_getVideoId($params);
if (!empty($videoId)) {
$videoUrl = '//vk.com/video_ext.php' . $videoId;
if ($iframeUrlParams) {
$videoUrl = $this->_addParamsToUrl($videoUrl, $iframeUrlParams);
}
return $videoUrl;
}
} | [
"private function createVideoUrl() {\n\t\t$arguments = array();\n\t\t$arguments['tx_jwplayer_pi1'] = array();\n\t\t$arguments['tx_jwplayer_pi1']['action'] = 'showVideo';\n\t\t$arguments['tx_jwplayer_pi1']['controller'] = 'Player';\n\t\t$settings = $this->settings;\n\t\t$settings['autostart']= TRUE;\n\t\t$settings['... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds the Organisation model based on its primary key value. If the model is not found, a 404 HTTP exception will be thrown. | protected function findModel($id)
{
if (($model = Organisation::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
} | [
"protected function findModel($id)\n {\n if (($model = Organization::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException(Yii::t('error', 'backend.controllers.organization_page_error', ['ru' => 'The requested page does not exist.']));\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return true if the linked list is empty | public function isEmpty()
{
//return false if linked list has nodes
} | [
"public function is_empty()\r\n\t{\r\n\t\treturn empty( $this->list );\r\n\t}",
"public function isEmpty() {\n return 0 === sizeof($this->list);\n }",
"function isEmpty() {\n return empty($this->head) && empty($this->tail);\n }",
"public function isEmpty()\n {\n return $this->list->... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the value of fv_economic_activity. | public function getEconomic_activity()
{
return $this->fv_economic_activity;
} | [
"public function getActivity()\n {\n if (!isset($this->data['fields']['activity'])) {\n if ($this->isNew()) {\n $this->data['fields']['activity'] = null;\n } elseif (!isset($this->data['fields']) || !array_key_exists('activity', $this->data['fields'])) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Plugin Name: Dashboard Google Page Rank Plugin URI: Description: Shows your google pagerank in the wordpress dashboard Author: Weston Deboer Version: 1.1 Author URI: | function gpr_wp_dashboard_test() {
include('pagerank.php');
$url = get_bloginfo('url');
echo $url.' has a Page Rank of '.$pr_rank;
echo getpagerank($url );
} | [
"function PN_Referer_Default()\n{\n\tglobal $pluginMenuURL, $pluginSelfParam;\n\tif (($_SERVER['REQUEST_METHOD'] == 'POST') && isset($_POST['page']))\n\t\t$_GET['page'] = $_POST['page'];\n\t\n\t$page = Setting::getBlogSetting('RowsPerPageReferer',20);\n\tif (empty($_POST['perPage'])) { \n\t\t$perPage = $page; \n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a gallery based on slug. | public function get_gallery_by_slug( $slug ) {
return envira_get_gallery_by_slug( $slug );
} | [
"public static function findBySlug($slug)\n {\n return self::where(['slug' => $slug])->with('photos')->first();\n }",
"function ap_get_galleries()\r\n{\r\n return get_posts([\r\n 'post_type' => 'rl_gallery',\r\n ]);\r\n}",
"protected function listGalleries()\n {\n $galleries ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Will register a webhook url for the invitee.canceled event | public function registerInviteeCanceled($url){
return $this->register(['url'=>$url,'events'=>['invitee.canceled']]);
} | [
"public function removeWebhook();",
"public function get_cancel_endpoint()\n {\n }",
"abstract public function onCancel(Request $request);",
"public function getCanceledUrl()\n {\n return $this->getVal('canceled_url');\n }",
"function set_cancel_url($cancel_url){\n $this->canc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve the version number of the plugin. | public function get_plugin_version() {
return $this->version;
} | [
"public static function get_version() {\n\t\t$plugin = self::get_instance();\n\t\treturn $plugin->version;\n\t}",
"public static function get_plugin_version() {\n\t\t\t$self = self::get_instance();\n\n\t\t\tif ( ! isset( $self->version ) ) {\n\t\t\t\t$data = get_file_data( $self->plugin_file, array(\n\t\t\t\t\t'V... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test report with empty constants | public function test_report_with_empty_constants()
{
$this->constants = new TestConstants();
$sut = $this->make_instance();
$run = $sut->run();
codecept_debug($run);
$this->assertMatchesJsonSnapshot(json_encode($run, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
} | [
"public function testNoOptions()\n {\n $this->executeReport($this->getResults(), array());\n }",
"public function testCommandWithReportConfigurationUnknown(): void\n {\n $process = $this->phpbench(\n 'run --report=\\'{\"generator\": \"foo_table\"}\\' benchmarks/set4/NothingBench.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process export remaining carts | function processExportRemainingCarts($idShop, $module)
{
$data = $module->cronExport('carts', $idShop, true, 'start');
for ($i = 0; $i < (int) $data['totalChunks']; $i++) {
MailChimp::resetGuzzle();
$module->cronExport('carts', $idShop, true, 'next');
}
die('ok');
} | [
"function processExportRemainingCarts($idShop, $module)\n{\n $data = $module->cronExportCarts($idShop, true, 'start');\n for ($i = 0; $i < (int) $data['totalChunks']; $i++) {\n $module->cronExportCarts($idShop, true, 'next');\n }\n\n die('ok');\n}",
"function exportCart ( ) {\n\t\t$export = ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct a personReference object (array). | private function constructPersonReference(Request $request)
{
$personReference = [
"tenant_id" => $this->requester->getTenantId(),
"person_id" => $request->personId,
"name" => $request->name,
"relationship" => $request->relationship,
"description" => $request->description,
"phone" => $request->phone
];
return $personReference;
} | [
"public static function createFromArray($fields) \n\t{\n\t\t$person = new Person();\n\t\tself::populate($person,$fields);\n\t\treturn $person;\n\t}",
"public function getReferences(): array;",
"protected function makeReferenceForm()\n {\n $faker = \\Faker\\Factory::create();\n $projects = [];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set/Create template compile directory | public function setCompileDirectory()
{
$compilePath = $this->getTemplatesDirectory() . DIRECTORY_SEPARATOR . $this->compileDirectoryName . DIRECTORY_SEPARATOR;
if (!file_exists($compilePath))
{
static::mkdir($compilePath);
}
$this->compilePath = $compilePath;
} | [
"private function setTemplateFolderPath(){\n $this->TemplateFolderPath = dirname(__DIR__) . DIRECTORY_SEPARATOR . \"frontend\" . DIRECTORY_SEPARATOR . \"templates\" . DIRECTORY_SEPARATOR;\n }",
"function set_template_dir($dir)\n {\n $this->smarty->addTemplateDir($dir);\n\n if (!isset($this->smart... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a file name from a path. i.e. 'path/to/a/name.less' > 'name' | private function getFilenameFromPath($path)
{
$pathBits = explode('/', $path);
$file = end($pathBits);
$fileBits = explode('.', $file);
$filename = $fileBits[0];
return $filename;
} | [
"public function filename($path)\n {\n return $this->pathInfo($path, PATHINFO_FILENAME);\n }",
"function filename_from_path($path)\n{\n $data = explode( '/', $path );\n return $data[ count( $data ) -1 ];\n}",
"function getFilename($path) {\r\n\t$splitPath = spliti('[/\\]', $path);\r\n\t\r\n\tretu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return true if the repository has a composer file for a given identifier, false otherwise. | function hasComposerFile($identifier); | [
"public function hasComposerFile(string $identifier): bool;",
"public function hasComposerFile(): bool\n {\n return file_exists(sprintf('%s/composer.json', $this->baseDirectory));\n }",
"public function usesComposer()\n\t{\n\t\t$path = $this->app['path.base'].DIRECTORY_SEPARATOR.'composer.json';\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return GraphQL query string by categoryId | private function getQuery(int $categoryId): string
{
return <<<QUERY
{
categoryList(filters: {ids: {in: ["$categoryId"]}}) {
id
name
children_count
children {
id
name
children_count
}
}
}
QUERY;
} | [
"public function getCategory(): string\n {\n return 'graphql';\n }",
"public function transferCategoriesQuery(): string;",
"private function buildCategoryCountQuery(): string\n {\n $language = $this->requestInputService->getInputValue(QueryConstants::LANGUAGE_KEY);\n\n $query =\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getAddToProjectsUrl Return send welcome message URL | function getSendWelcomeMessageUrl() {
return assemble_url('people_company_user_send_welcome_message', array(
'company_id' => $this->getCompanyId(),
'user_id' => $this->getId(),
));
} | [
"public function getProjectUrl()\n {\n return Mage::getUrl('xcentia_projects/project/view', array('id'=>$this->getId()));\n }",
"public function project_url(){\n\t\treturn $this->the_url;\n\t}",
"function getSendReminderUrl() {\n \treturn assemble_url('reminders_add', array('parent_id' => $this-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find active document signature by source id and type. | public function findActiveDocumentSignatureBySourceIdAndType($accountId, $type)
{
return $this->findOneDocumentSignatureBySourceIdAndType($accountId, $type, true);
} | [
"public function findActiveDocumentSignature($id)\n {\n return $this->findOneDocumentSignatureBy(['id' => $id, 'active' => true]);\n }",
"public function getDocumentSignatureType();",
"public function get_audit_signature_id($id, &$document) {\n\n $invitations = $this->invite->getInvitations(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set testcases to run | public function setSelectedTestcases(array $testcases = array()) {
$this->selectedTestcases = $testcases;
} | [
"public function setTestcases($testcases) {\n $this->testcases = $testcases;\n }",
"public function runTests() {\n\t}",
"public function runSelectedTests(){\n\t\tself::getAvailableTests(); // just to include all files\n\n\t\tif (array_key_exists('runtest', $_REQUEST)) {\n\n\t\t\t// logging\n\t\t\trequ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return's the body content stored in body stream | public function getBodyContent(); | [
"public static function bodyStream() {\n\t\treturn fopen(self::REQUEST_BODY_STREAM, 'r');\n\t}",
"public function getRawBody()\n {\n if ($this->stream) {\n $this->readStream();\n }\n return $this->content;\n }",
"public function getFullBodyContents() {\n\t\t$offset = $this-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Forces the API key to regenerate and saves the record | public function regenerateApiKey() {
$this->apiKey = false;
return $this->save(false, ['apiKey']);
} | [
"public function updateApikey();",
"public function save( ApiKey $api_key ): ApiKey;",
"public function reset_key()\n {\n $response = $this->check_request('Changing web key');\n if (!$response) {\n $wpid = \\get_current_user_id();\n $person = TableMembers::findByWordpressI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store a new flavor | public function store()
{
// Slug Validation for Translations
if ( Input::get('language') ){
$slug = Str::slug(Input::get('flavor_title') . '-' . Input::get('language'));
} else {
$slug = Str::slug(Input::get('flavor_title'));
}
$validation = Validator::make([
'title' => Input::get('flavor_title'),
'slug' => $slug
], [
'title' => 'required',
'slug' => 'unique:flavors,slug'
]);
if ( $validation->fails() ) return Redirect::back()->withErrors($validation);
$this->product_factory->createProduct(Input::all());
return Redirect::route('edit_products')
->with('success', 'Product successfully added.');
} | [
"function set_flavor($flavor){\n $this->flavor = $flavor ;\n return $this->flavor ;\n }",
"public function setFlavor($flavor) {\n\t\tif ($this->configurationCheck) {\n\t\t\t$this->configurationCheck->setFlavor($flavor);\n\t\t}\n\t}",
"protected function setFlavor($flavor = null)\n {\n if (is_ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets a new lUFTWP | public function setLUFTWP($lUFTWP)
{
$this->lUFTWP = $lUFTWP;
return $this;
} | [
"public function setPlu($plu)\n {\n $this->plu = $plu;\n\n return $this;\n }",
"public function set_lp(string $_lp) {\n $this->_lp = $_lp;\n return $this;\n}",
"public function setLUPUS($LUPUS)\n {\n $this->LUPUS = $LUPUS;\n\n return $this;\n }",
"public function setNPW... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for replaceNamespacedDaemonSetStatus . | public function testReplaceNamespacedDaemonSetStatus()
{
} | [
"public function testPatchNamespacedDaemonSetStatus()\n {\n }",
"public function testReplaceExtensionsV1beta1NamespacedDaemonSetStatus()\n {\n\n }",
"public function testPatchExtensionsV1beta1NamespacedDaemonSetStatus()\n {\n\n }",
"public function testReadNamespacedDaemonSetStatus()\n {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the 'test.client.history' service. | protected function getTest_Client_HistoryService()
{
return new \Symfony\Component\BrowserKit\History();
} | [
"public function historySubscriber()\n {\n $history = new History();\n\n // Place new adapter on client class\n $this->testClass->setClientSubscriber($history);\n\n return $history;\n }",
"public function getHistory(): History\n {\n return $this->history;\n }",
"pu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the accumulated score. Returns the result of the accumulated score. The score that can be lost if the result of the roll is one. | public function getAccumulatedScore()
{
return $this->score;
} | [
"public function totalScore()\n {\n return $this->score + $this->roundScore;\n }",
"public function getTotalScore()\n\t{\n\t\treturn $this->totalScore;\n\t}",
"public function getTotalScore()\n {\n return $this->total_score;\n }",
"public function getScore()\n {\n return Ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parse description only if description block is present | function _parseDescription() {
if ($this->checkTemplateBlockExists('description')) {
$this->tpl->parse('description');
return $this->tpl->text('description');
} else {
return false;
}
} | [
"public function parse_description_field($description)\n {\n }",
"function parseDescription($descriptionLine){\r\n\t\tif(strpos($descriptionLine,\"*\")<=2) $descriptionLine=substr($descriptionLine,(strpos($descriptionLine,\"*\")+1));\r\n\r\n\t \t//geen lege comment regel indien al in grote omschrijv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a whereGeoShape condition. | public function whereGeoShape(
string $field,
array $shape,
string $relation = 'INTERSECTS',
string $boolean = 'must'
): self {
$this->wheres[$boolean][] = [
'geo_shape' => [
$field => [
'shape' => $shape,
'relation' => $relation,
],
],
];
return $this;
} | [
"public function whereGeoShape($field, array $shape, $relation = 'INTERSECTS', $boolean = 'must')\n {\n $this->wheres[$boolean][] = [\n 'geo_shape' => [\n $field => [\n 'shape' => $shape,\n 'relation' => $relation,\n ],\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the delegated roles if any. | public function getDelegatedRoles(): array
{
return $this->getSigned()['delegations']['roles'] ?? [];
} | [
"public static function get_roles()\n {\n }",
"public function getUserRoles() {\n return $this->roles;\n }",
"public function getRoles()\r\n {\r\n return $this->roles;\r\n }",
"public function getRoles()\n {\n return isset($this->Roles) ? $this->Roles : null;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Affichage d'un message pour mot de passe non identique | function mdpPasIdentique() {
return '<div class="alert alert-warning" role="alert">
Les mots de passe ne sont pas identiques.
</div>';
} | [
"function mdpPasIdentique() {\n\t\treturn '<div class=\"alert alert-warning\" role=\"alert\">\n\t\t\t\tLes mots de passe ne sont pas identiques.\n\t\t\t</div>';\n\t}",
"private function getPassword(): string\n {\n return json_decode($this->getSender()->messenger_settings)->sms->password;\n }",
"pub... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for comDayCqDamS7damCommonServletsS7damProductInfoServlet . | public function testComDayCqDamS7damCommonServletsS7damProductInfoServlet()
{
$client = static::createClient();
$path = '/system/console/configMgr/com.day.cq.dam.s7dam.common.servlets.S7damProductInfoServlet';
$crawler = $client->request('POST', $path);
} | [
"public function testComDayCqDamS7damCommonServletsS7damProductInfoServlet() {\n\n }",
"public function testComAdobeGraniteAcpPlatformPlatformServlet() {\n\n }",
"public function testComDayCqDamCoreImplServletMetadataGetServlet() {\n\n }",
"public function testComDayCqDamCoreImplServletMultipleLicens... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that reflection() returns the ReflectionClass object. | public function testReflection() {
$this->assertInstanceOf('ReflectionClass', $this->object->reflection());
} | [
"public function getClassReflection(): ReflectionClass;",
"public function testLoadClassReflectionFromObject()\n {\n $object = new ReflectionClassTested();\n $reflection = Reflection::loadClassReflection($object);\n\n $this->assertInstanceOf('ReflectionClass', $reflection);\n $this-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns active search parameter | public function getActSearchParam()
{
return oxRegistry::getConfig()->getRequestParameter('searchparam');
} | [
"public function _get_search_param()\r\n\t{\r\n\t}",
"public function getSearchParam(){\r\n return $this->_searchParam;\r\n }",
"public function getSearchParam()\r\n {\r\n return $this->searchParam;\r\n }",
"public function getSearchQueryParameter()\n {\n return $this->search_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register CSS and Javascript Register CSS and Javascript Register custom CSS and Javascript for this plugin. Multiple code blocks can be implemented to enable multiple stylesheets or javascript files. | function register_css_and_js() {
// Access the global data structure
global $trj_golem_data;
/*
* Register a css stylesheet
*/
// Stylesheet name
$stylesheet = 'styles.css';
// Register the stylesheet
wp_register_style('trj_golem', $trj_golem_data['paths']['css_url'] . $stylesheet);
// Enqueue the stylesheet
wp_enqueue_style('trj_golem');
/*
* Register a javascript file
*/
// Javascript filename
$js_file = "script.js";
// Register the file
wp_register_script( 'trj_golem', $trj_golem_data['paths']['js_url'] . $js_file);
// Enqueue the script
wp_enqueue_script('trj_golem');
} | [
"public function addCustomCSSandJS(){\n \n $this->addCss('/plugins/brunomagconcept/whitelabel/assets/css/admin-overrides.css', 'core');\n $this->addJs('/plugins/brunomagconcept/whitelabel/assets/js/custom-javascript.js', 'core');\n echo $this->makeAssets();\n \n }",
"public ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method returns a list of hyphenation patterns, that are available. | public static function getAvailableHyphenatePatterns() {
if (self::$hyphenatePatterns != NULL) {
return self::$hyphenatePatterns;
}
self::$hyphenatePatterns = array();
$files = file_scan_directory(libraries_get_path('tcpdf') . '/hyphenate_patterns', '/.tex$/', array('nomask' => '/(\.\.?|CVS)$/'), 1);
foreach ($files as $file) {
self::$hyphenatePatterns[basename($file->uri)] = str_replace('hyph-', '', $file->name);
}
return self::$hyphenatePatterns;
} | [
"private function getPatterns()\n\t{\n\t\t$rtrn = '';\n\t\treset($this->patterns);\n\t\tforeach ($this->patterns as $pattern)\n\t\t{\n\t\t\t$rtrn .= '('.$pattern['expression'].')|';\n\t\t}\n\t\t$rtrn = substr($rtrn, 0, -1);\n\t\treturn '~'.$rtrn.'~'.($this->ignoreCase ? 'i' : '');\n\t}",
"public static function p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the target for the React to mount to. | public function render_target()
{
} | [
"public function render($target)\n {\n print($this->buildGraphImgTag($target));\n }",
"public function renderSelf();",
"function render($target_or_options, array $additional_options = []): string\n{\n return get_renderer()->render($target_or_options, $additional_options);\n}",
"public function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init area editing form. | public function initAreaEditingForm($a_edit_property)
{
global $lng, $ilCtrl;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$form = new ilPropertyFormGUI();
$form->setOpenTag(false);
$form->setCloseTag(false);
// name
if ($a_edit_property != "link" && $a_edit_property != "shape")
{
$ti = new ilTextInputGUI($lng->txt("cont_name"), "area_name");
$ti->setMaxLength(200);
$ti->setSize(20);
$ti->setRequired(true);
$form->addItem($ti);
}
// save and cancel commands
if ($a_edit_property == "")
{
$form->setTitle($lng->txt("cont_new_trigger_area"));
$form->addCommandButton("saveArea", $lng->txt("save"));
}
else
{
$form->setTitle($lng->txt("cont_new_area"));
$form->addCommandButton("saveArea", $lng->txt("save"));
}
return $form;
} | [
"public function editarea() {\n\t\tif ($this->secureCheck ()) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$id = \"\";\n\t\tif ($this->request->isParameterNotEmpty ( 'actionid' )) {\n\t\t\t$id = $this->request->getParameter ( \"actionid\" );\n\t\t}\n\t\t\n\t\t$model = new SyArea ();\n\t\t$area = $model->getArea ( $id );\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
$sql = "INSERT INTO delivery VALUES('','" . $data['id_delivery'] . "','" . $data['type_deliv'] . "','" . $data['sub_type'] . "','" . $data['no_resi'] . "','" . $data['nik'] . "','" . $data['jmlh_barang'] . "','" . $data['jenis_barang'] . "','" . $data['front_desk'] . "','" . $data['deliv_status'] . "','" . $data['date_time'] . "','" . $data['id_barang'] . "')"; | public function insertd($data_deliv) {
// $sql = "INSERT INTO `delivery` (`id_delivery`, `type_deliv`, `sub_type`, `no_resi`, `nik`, `jmlh_barang`, `jenis_barang`, `front_desk`, `deliv_status`, `date_time`, `id_barang`) VALUES (NULL, 'E-commerce', 'Shopee', '12345', '09876', '4', 'pakaian', 'mega', 'Belum Diambil', '2019-07-01 09:38:23', '33');"
// $this->db->query($sql);
return $this->db->insert('delivery', $data_deliv);
} | [
"function insertKelas($data){\n //VALUES ('$start', '$end', '$durasi', '$nama_kegiatan', '$ruang', '$hari','$tgl_kegiatan',1)\";\n //$result = mysql_query($sql) or die (mysql_error());\n $this->db->insert('jadwal', $data);\n }",
"public function insert_delivery($arr_data){\n\n\t\tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the scopeType property value. The type of the scope where the policy is created. One of Directory, DirectoryRole, Group. Required. | public function setScopeType(?string $value): void {
$this->getBackingStore()->set('scopeType', $value);
} | [
"public function setScopeType($val)\n {\n $this->_propDict[\"scopeType\"] = $val;\n return $this;\n }",
"public function validateScopeType($scopeType);",
"public function getScopeType()\n {\n return $this->scopeType;\n }",
"protected function addType($type, $id, $scopeType = S... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a form to edit a Newsletter entity. | private function createEditForm(Newsletter $entity)
{
$form = $this->createForm(new NewsletterType(), $entity, array(
'action' => $this->generateUrl('newsletters_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
//$form->add('submit', 'submit', array('label' => 'Update'));
return $form;
} | [
"public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('ExtranetBundle:Newsletters')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Newsletter entity.');\n }\n\n $editF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert UCS4 strin into UCS4 garray | function _ucs4_string_to_ucs4($input)
{
$output = array();
$inp_len = strlen($input);
// Input length must be dividable by 4
if ($inp_len % 4) {
$this->_error('Input UCS4 string is broken');
return false;
}
// Empty input - return empty output
if (!$inp_len) return $output;
for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) {
// Increment output position every 4 input bytes
if (!($i % 4)) {
$out_len++;
$output[$out_len] = 0;
}
$output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) );
}
return $output;
} | [
"protected function _ucs4_string_to_ucs4($input)\n {\n $output = array();\n $inp_len = strlen($input);\n // Input length must be dividable by 4\n if ($inp_len % 4) {\n $this->_error('Input UCS4 string is broken');\n return false;\n }\n // Empty inpu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an order from the ACP Order Screen | function createFromOrderScreen() {
global $_POST, $dbConn;
$basket = new Cart();
//This iterates over each item in the order items row until a row is not defined, which marks the end of the table
for ($i=1; isset($_POST['item'.$i.'ID']); $i++) {
//This order item row exists, create an item in the cart based on this
//Skip this row if the item's quantity is 0
if ($_POST['item'.$i.'Qty'] == 0) continue;
//Skip Final ID
if ($_POST['item'.$i.'ID'] == '') continue;
//Pull the price from the post form in case the user has set a custom price
$basket->addItem($_POST['item'.$i.'ID'], $_POST['item'.$i.'Qty'], floatval(str_replace('£','',$_POST['item'.$i.'Price'])));
}
//Iterate through coupons and create a reference to each one
//TODO: The system does not currently apply the actions on the server
for ($i=1; isset($_POST['coupon'.$i.'Key']); $i++) {
$result = $dbConn->query('SELECT id FROM keys WHERE `key` = "'.$_POST['coupon'.$i.'Key'].'" LIMIT 1');
$result = $dbConn->fetch($result);
$keyID = $result['id'];
unset($result);
$basket->addKey($keyID);
}
//Set whether VAT has been applied to this order
$basket->applyVAT(!isset($_POST['vatExempt']));
//Set up the customer for the billing address
if ($_POST['billingID'] != "New") {
//The customer already exists. Just use that
$billing = new Customer($_POST['billingID']);
} else {
//The customer is new, create an ID for them now
$billing = new Customer();
$billing->populate($_POST['customerBillingName'],
$_POST['customerBillingAddress1'],
$_POST['customerBillingAddress2'],
$_POST['customerBillingAddress3'],
$_POST['customerBillingPostcode'],
$_POST['customerBillingCountry'],
NULL, //TODO: Add Email support
NULL,
1 //TODO: Contact Opt-out
);
}
//Check if the shipping address is configured
if (isset($_POST['noShipping'])) {
//The shipping address is the same as billing. Just take from there
$shipping = @$billing; //@ Saves memory by using an alias
} else {
//The shipping address is different. Load it the same as before
if ($_POST['shippingID'] != "New") {
//The customer already exists. Just use that
$shipping = new Customer($_POST['shippingID']);
} else {
//The customer is new, create an ID for them now
$shipping = new Customer();
$shipping->populate($_POST['customerShippingName'],
$_POST['customerShippingAddress1'],
$_POST['customerShippingAddress2'],
$_POST['customerShippingAddress3'],
$_POST['customerShippingPostcode'],
$_POST['customerShippingCountry'],
NULL, //TODO: Add Email support
NULL,
1 //TODO: Contact Opt-out
);
}
}
//That's all the data passed. Create the Order.
$basketID = $basket->getID();
$orderStatus = $_POST['orderStatus'];
$basket->__destruct(); //Force call for PHP4
unset($basket);
$billingID = $billing->getID();
$shippingID = $shipping->getID();
$billing->__destruct();
$shipping->__destruct();
unset($billing,$shipping); //Unset after due to potential alias
$dbConn->query('INSERT INTO orders (basket,status,billing,shipping,assignedTo)
VALUES ('.$basketID.',"'.$orderStatus.'",'.$billingID.','.$shippingID.','.$GLOBALS['acp_uid'].')');
return new Order($dbConn->insert_id());
} | [
"public function createOrderAction(){\n\t\tif (!$this->_loadValidSubscription()) {\n\t\t\treturn;\n\t\t}\n\t\t$subscription = Mage::registry('current_subscription');\n\n\t\t$this->createOrder($subscription);\n\t}",
"public function createOrder()\n {\n\n $cart = $this->options['user']->getCart();\n // Fill ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a tbody object with "form.calculation_act.row.html" rows | public function html_act_tbody($i, $records, $valid_rules, $model_article, $model_calculation) {
$rows = array();
$ii= 1;
foreach($records as $record){
$rows[] = $this->html_act_row($i, $ii, $record, $valid_rules, $model_article, $model_calculation);
$ii++;
}
return $this->wrapTag('tbody',$rows);
} | [
"private function generateRows()\n {\n $this->rows = array();\n\n // empty row for cloneable js\n $this->addRow();\n\n $values = $this->getForm()->getValue($this->getName());\n\n if (is_array($values) && count($values)) {\n foreach ($values As $key => $rowValues) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======================= END ADD/ REMOVE/ UPDATE/ GET BLOGPOST DATA IN journal2_blog_post ============================ ======================= START ADD/ REMOVE/ UPDATE/ GET POST DETAILS IN journal2_blog_post ============================ | public function addPostDetails($post_data)
{
$this->db->query(
"INSERT INTO " . DB_PREFIX . "journal2_blog_post_description (`post_id`,`language_id`,`name`, `description`, `meta_title`, `meta_keywords` , `meta_description`, `keyword`, `tags`)
VALUES (" . (int)($post_data['post_id']) . "," . (int)($post_data['language_id']). ",'" . $this->db->escape($post_data['name']) . "','" . $this->db->escape($post_data['description']) . "','" . $this->db->escape($post_data['meta_title']) . "','" . $this->db->escape($post_data['meta_keywords'])
. "','" . $this->db->escape($post_data['meta_description']) . "','" . $this->db->escape($post_data['keyword']) . "','" . $this->db->escape($post_data['tags']) . "')" );
} | [
"public function saveBlogPost() {\r\n\t\t\r\n\t\t//$this->verifyID($toid);\r\n\t\t$html_tags = '<b><p><br></br><u><ul><li><table><tr><th><td><i>';\r\n\r\n\t\t// controleer of submit gepost is\r\n\t\tif (isset($_POST['admblogsubmit'])) {\r\n\t\t\t\r\n\t\t\t// check: velden voor titel en content zijn niet leeg\r\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ based on the latt/long passed in, get a list of venues and their city_region and intersection fucntion returns distance in Km Used when adding new venue to guess the nearest intersection / city_region / neighbourhood | function getNearbyVenueIntersection( $lat, $lng, $venueId = null) {
$distance = 10; // 1 = 1000 metres, 10 = 10km
$limit = 10;
$venueLat = floatval($lat);
$venueLng = floatval($lng);
$result = $this->find('all',
array('fields' => array(
'Venue.id', 'Venue.name', 'Venue.slug',
'Venue.address', 'Venue.geo_lat',
'Venue.geo_lng',
'(6371 * acos( cos( radians(' . $venueLat . ') ) * cos( radians( geo_lat ) ) *
cos( radians( geo_lng ) - radians('. $venueLng .') ) + sin( radians(' . $venueLat . ') ) *
sin( radians( geo_lat ) ) ) ) AS distance'
),
'conditions' => array(
'Venue.publish_state_id' => Configure::read('Venue.published'),
'Venue.id !=' => $venueId
),
'group' => array( "Venue.id HAVING distance <= $distance"),
'order' => 'distance',
'limit' => $limit,
'contain' => array('City.name', 'CityRegion.name', 'CityNeighbourhood.name', 'Intersection.name' )
) );
//debug($result); exit;
if ($result) {
return($result);
} else {
return false;
}
} | [
"function _getNearByVenues( $venueLatt, $venueLong ) {\r\n\t\t$distance = 1; // 1000 metres\r\n\r\n\t\t$venueLatt = floatval($venueLatt);\r\n\t\t$venueLong = floatval($venueLong);\r\n\r\n\t\t$result1 = $this->Venue->query( \"SELECT Venue.name, Venue.subname, Venue.slug, Venue.address, Venue.geo_latt, Venue.geo_long... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns tenant scope for this model. | public static function getTenantScope()
{
return TenantScopeFacade::getFacadeRoot();
} | [
"public function get_scope()\n {\n return $this->scope;\n }",
"public function getScope()\n {\n return $this->fields['scope'];\n }",
"public function getTenantObject()\n {\n return $this->tenant;\n }",
"public function getTenant()\n {\n return $this->hasOne(Ten... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the byte counter of a chain. | public function getChainByteCounter($table, $chain)
{
if (isset($this->fileTree[$table][$chain]['byte-counter']))
return $this->fileTree[$table][$chain]['byte-counter'];
return NULL;
} | [
"public function count_bytes() : int {\n $bytes = 0;\n foreach ($this->lines as $line) { $bytes += strlen($line); }\n return $bytes;\n }",
"function getDownloadCount() {\n\t\t\t$cache = $this->readCache();\n\t\t\treturn $cache[12];\n\t\t}",
"public function getReceivedBytes(): int;",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delivery servers usage logs | public function actionDelivery_servers_usage_logs()
{
$request = Yii::app()->request;
$log = new DeliveryServerUsageLog('search');
$log->unsetAttributes();
$log->attributes = (array)$request->getQuery($log->modelName, array());
$this->setData(array(
'pageMetaTitle' => $this->data->pageMetaTitle . ' | '. Yii::t('misc', 'View delivery servers usage logs'),
'pageHeading' => Yii::t('misc', 'View delivery servers usage logs'),
'pageBreadcrumbs' => array(
Yii::t('misc', 'Delivery servers usage logs'),
)
));
$this->render('delivery-servers-usage-logs', compact('log'));
} | [
"public function get_delivery_stats() {\n\t\t\t\treturn $this->build_request()->fetch( '/deliverystats' );\n\t\t}",
"public function get_delivery_logs()\n {\n }",
"public function do_server_side_stats() {\n\t\t$urls = $this->get_stats_urls();\n\t\tforeach ( $urls as $url ) {\n\t\t\t$this->do_serve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move entry points in place. | function moveEntryPHPpoints()
{
$rootDir = __DIR__ . '/../tmp_uploaded_update/phplist/public_html/lists';
$downloadedFiles = scandir($rootDir);
foreach ($downloadedFiles as $filename) {
$oldFile = $rootDir . '/' . $filename;
$newFile = __DIR__ . '/../' . $filename;
if (in_array($filename, $this->excludedFiles)) {
rename($oldFile, $newFile);
}
}
} | [
"public function escortPositions(): void;",
"public function moveScriptsToFooter()\n {\n global $wp_scripts;\n $notInFooter = array_diff($wp_scripts->queue, $wp_scripts->in_footer);\n $wp_scripts->in_footer = array_merge($wp_scripts->in_footer, $notInFooter);\n }",
"private function m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test constructor exception wrong 1st parameter. | public function testConstructorException1st2(): void
{
$this->expectException(Exception::class);
$this->e(false);
} | [
"public function test___construct_calledWithBadValue_throw()\n {\n $this->setExpectedException($this->getExceptionToArgument('InvalidNativeArgumentException'));\n $this->getSut($this->getBadNativeValue());\n }",
"public function test_not_valid_data_excention_is_thrown_in_constructor_method()\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the unpublish extension to the builder. | protected function addUnpublish(Builder $builder)
{
$builder->macro('unpublish', function (Builder $builder) {
$builder->withPublished();
$column = $this->getPublishedAtColumn($builder);
return $builder->update([
$column => null,
]);
});
} | [
"protected function addWithoutUnpublished(Builder $builder)\n {\n $builder->macro('withoutUnpublished', function (Builder $builder) {\n $model = $builder->getModel();\n\n $builder->withoutGlobalScope($this)->where($model->getQualifiedPublishAtColumn(), '<=', $model->freshTimestamp())... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Push a details item fields to the data array | public function pushDetailsItem($fields)
{
$defaults = array(
'id' => '',
'name' => ''
);
$this->data['ecommerce']['detail']['products'][] = $this->getDefaults($fields, $defaults);
} | [
"public function pushItemField(array $data);",
"public function AddCustomerDetails(){\n // this is a valuable piece of code\n // here we are iterating over the items array and decorating the items in the array with the customer name property\n // since array are object references, we dont pus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a customer check debit request for the given $order | public function create_echeck_debit( WC_Order $order ) {
$this->create_transaction( self::AUTH_CAPTURE, $order );
} | [
"public function check_debit( \\WC_Order $order ) {\n\n\t\t$request = $this->get_new_echeck_request( $order );\n\n\t\t$request->set_echeck_data();\n\n\t\treturn $this->perform_request( $request );\n\t}",
"public function createPaymentRequest($order);",
"public function debit() \n {\n $sOxid = $this->_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Implement getPackedSize() method. | public function getPackedSize()
{
} | [
"public function getUnpackedSize() {}",
"public function getPackSize() : int\n {\n return $this->packSize;\n }",
"public function extractSize();",
"function GetSize(){}",
"public function packedLen(): int\n {\n return vscf_message_info_editor_packed_len_php($this->ctx);\n }",
"pu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the value of user_id_user. | public function getUserIdUser(): int
{
return $this->user_id_user;
} | [
"public function getId_user()\r\n {\r\n return $this->id_user;\r\n }",
"public function getUserID()\n\t{\n\t\treturn $this->user_id;\n\t}",
"public function getUserId()\n\t{\n\t\t$column = self::COL_USER_ID;\n\t\t$v = $this->$column;\n\n\t\tif ($v !== null) {\n\t\t\t$v = (string)$v;\n\t\t}\n\n\t\tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the 'form.type.country' service. This service is shared. This method always returns the same instance of the service. | protected function getForm_Type_CountryService()
{
return $this->services['form.type.country'] = new \Symfony\Component\Form\Extension\Core\Type\CountryType();
} | [
"protected function getOroLocale_Form_Type_CountryService()\n {\n return $this->services['oro_locale.form.type.country'] = new \\Oro\\Bundle\\LocaleBundle\\Form\\Type\\CountryType();\n }",
"protected function getSylius_Form_Type_CountryChoiceService()\n {\n return $this->services['sylius.fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Should every piece of every order entered be logged as it comes in? This helps solve problems when people think they submitted correct orders but may not have, but it can use up lots of disk space and waste resources every time orders are submitted. Every complaint about incorrect orders have been found via the order logs to be correctly received, so it's probably not worth enabling this unless you get many complaints. If this is set to false orders will not be logged, if it returns a writable directory orders will be logged there. Must not be accessible to the web server, as sensitive info is stored in this folder. | public static function orderlogDirectory()
{
return false;
return '../orderlogs';
} | [
"private static function checkPaths() {\n\t\tif(!is_dir (self::$logpath)) mkdir(self::$logpath, 0777);\n\t\tif(!is_file(self::$logfile)) file_put_contents(self::$logfile, \"<?\\n/**\\n#\\n# Tools FTP Log file\\n#\\n*/\\n\\n\");\n\t}",
"public function isLoggingForced() {\n return Mage::getStoreConfigFlag(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if an action exists in a given module. | public function actionExists($module, $action)
{
if (isset($this->modules[$module]['commands'][$action]['cmd'][$this->hostOS])) {
return true;
}
return false;
} | [
"public function module_has_action($action)\n\t{\n\t\tif (empty($this->CI->item_actions)) return FALSE;\n\t\treturn (isset($this->CI->item_actions[$action]) OR in_array($action, $this->CI->item_actions));\n\t}",
"public function actionExists($action){\n return method_exists($this, $action);\n }",
"pub... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Added meta to a collection. The $mediaId is actually the WordPress Post/Attachment ID. | function add_media_to_collection( $mediaId, $collectionId, $isRemove = false ) {
$id = $this->get_id_for_collection( $collectionId );
$str = get_post_meta( $id, '_post_image_gallery', TRUE );
$ids = !empty( $str ) ? explode( ',', $str ) : array();
$index = array_search( $mediaId, $ids, false );
if ( $isRemove ) {
if ( $index !== FALSE )
unset( $ids[$index] );
}
else {
// If mediaId already there then exit.
if ( $index !== FALSE )
return;
array_push( $ids, $mediaId );
}
// Update _post_image_gallery
update_post_meta( $id, '_post_image_gallery', implode( ',', $ids ) );
// Add a default featured image if none
add_post_meta( $id, '_thumbnail_id', $mediaId, true );
} | [
"function add_media_to_collection( $mediaId, $collectionId ) {\n global $wplr;\n\n // Upload the file to the gallery\n $gallery_id = $wplr->get_meta( 'nextgen_gallery_id', $collectionId );\n $abspath = get_attached_file( $mediaId );\n $file_data = file_get_contents( $abspath );\n $file_name = M_I1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the minlength attribute value.MDN: Defines the minimum number of characters allowed in the element. Parent tags allowed: , | public function get_minlength()
{
return $this->get_attr('minlength');
} | [
"public function getMinLength()\r\r\n {\r\r\n return $this->minLength;\r\r\n }",
"public function getMinLength()\n {\n return $this->min_length;\n }",
"public function getMinLength()\n {\n return $this->minLength;\n }",
"public function getMinLength()\r\n {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds sanitization callback function: text align | function skyre_sanitize_text_align( $input ) {
$talign = skyre_get_text_aligns();
if ( array_key_exists( $input, $talign ) ) {
return $input;
} else {
return '';
}
} | [
"function getTextAlignment(){}",
"function setTextAlignment($alignment){}",
"function do_bbcode_align($action, $attr, $content, $params, $node_object) {\n\treturn '<div style=\"text-align:'. $attr['default'] .'\">'. $content .'</div>';\n}",
"function aligner($letexte, $justif='') {\n\t$letexte = trim($letexte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allows the user to add another privilege in the application | public function addAction(){
$this->title = 'Add a new privilege.';
$form = new PrivilegeForm();
$privilegeModel = new Privilege();
if($this->getRequest()->isPost()){
if($form->isValid($this->getRequest()->getPost())){
$privilegeModel->save($form->getValues());
$this->_helper->FlashMessenger(
array(
'msg-success' => 'The privilege was successfully added.',
)
);
//Regenerate Flag and Flippers
App_FlagFlippers_Manager::save();
$this->_redirect('/privileges/');
}
}
$this->view->form = $form;
} | [
"public function addPrivilegeAction() {\n\n }",
"public function addSitePrivileges()\n {\n\n }",
"public function testUpdatePrivilege()\n {\n }",
"protected function privilegeAction()\n {\n $userRoleID = $this->flattenArray($this->userRole->getRepo()->findBy(['role_id'], ['user_id' =>... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enable a stringmatch type as supported. | protected function addStringMatchType (osid_type_Type $type) {
$this->stringMatchTypes[] = $type;
} | [
"public function supports(string $string): bool;",
"public function setRegExMatch() {\r\n $this->db->sqliteCreateFunction('REGEX_MATCH',array($this,'RegExMatch'),2);\r\n }",
"public function setStringToMatch($string) : void\n {\n $this->setString('stringToMatch', $string);\n \n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modify Multimedia Objects status. | private function modifyMultimediaObjectsStatus($values)
{
$dm = $this->get('doctrine_mongodb.odm.document_manager');
$repo = $dm->getRepository('PumukitSchemaBundle:MultimediaObject');
$repoTags = $dm->getRepository('PumukitSchemaBundle:Tag');
$tagService = $this->get('pumukitschema.tag');
$executeFlush = false;
foreach ($values as $id => $value) {
$mm = $repo->find($id);
if ($mm) {
if ($this->isGranted(Permission::CHANGE_MMOBJECT_PUBCHANNEL)) {
foreach ($value['channels'] as $channelId => $mustContainsTag) {
$mustContainsTag = ('true' == $mustContainsTag);
$tag = $repoTags->find($channelId);
if (!$this->isGranted(Permission::getRoleTagDisableForPubChannel($tag->getCod()))) {
if ($mustContainsTag && (!($mm->containsTag($tag)))) {
$tagAdded = $tagService->addTag($mm, $tag, false);
$executeFlush = true;
} elseif ((!($mustContainsTag)) && $mm->containsTag($tag)) {
$tagAdded = $tagService->removeTag($mm, $tag, false);
$executeFlush = true;
}
}
}
}
if ($this->isGranted(Permission::CHANGE_MMOBJECT_STATUS) && $value['status'] != $mm->getStatus()) {
$mm->setStatus($value['status']);
$executeFlush = true;
}
}
}
if ($executeFlush) {
$dm->flush();
}
} | [
"function ctools_export_set_object_status($object, $new_status = TRUE) {\r\n $table = $object->table;\r\n $schema = ctools_export_get_schema($table);\r\n $export = $schema['export'];\r\n $status = variable_get($export['status'], array());\r\n\r\n // Compare\r\n if (!$new_status && $object->export_type & EXPOR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds and displays a Tecnico entity. | public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OsBundle:Tecnico')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Tecnico entity.');
}
$deleteForm = $this->createDeleteForm($id);
return $this->render('OsBundle:Tecnico:show.html.twig', array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(), ));
} | [
"public function showAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('ColegioAdminBundle:TipoColegio')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find TipoColegio entity.');\n }\n\n $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Evaluates the spectrum based on the annotation array. The more annotations fit to the spectrum, the higher the score | public function getSpectrumScore($annotations, $massprop, $intensityprop, $annotationprop, $threshold, $thresholdtype)
{
$arrReturn = array();
$dblFactor = 0;
$dblInt = 0;
$dblMass = 0;
$dblMassMax = 0;
$dblMassMin = 0;
$k = 0;
$l = count($annotations);
$varEntry = null;
$aFound = 0;
if ($thresholdtype === 'da') {
$dblFactor = $threshold;
}
for ($i=0,$j= count($this->spectrum); $i<$j; $i++) {
$dblMass = $this->spectrum[$i]['mass'];
$dblInt = $this->spectrum[$i]['intensity'];
if ($thresholdtype === 'ppm') {
$dblFactor = 0.000001 * $threshold * $dblMass;
}
if ($thresholdtype === 'percent') {
$dblFactor = 0.01 * $threshold * $dblMass;
}
$dblMassMin = $dblMass - $dblFactor;
$dblMassMax = $dblMass + $dblFactor;
$strAnnot = '';
for ($k=0; $k<$l; $k++) {
$varEntry = $annotations[$k];
if ($varEntry[$massprop] >= $dblMassMin && $varEntry[$massprop] <= $dblMassMax) {
$aFound++;
}
}
}
if ($aFound === 0) {
return 0;
}
return $aFound / count($annotations);
} | [
"public function get_array_scores();",
"public function annotateSpectrum($annotations, $massprop, $intensityprop, $annotationprop, $threshold, $thresholdtype)\r\n\t{\r\n\t\t$arrReturn = array();\r\n\t\t$dblFactor = 0;\r\n\t\t$dblInt = 0;\r\n\t\t$dblMass = 0;\r\n\t\t$dblMassMax = 0;\r\n\t\t$dblMassMin = 0;\r\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set number of pages. | private function setNumberOfPages(): void
{
$this->number_of_pages = (int)ceil($this->number_of_records / $this->per_page);
} | [
"private function setPages()\n {\n $this->pages_count = (int) ceil( $this->records_count / $this->per_page );\n }",
"protected function updateNumPages(): void\n {\n $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int)ceil($this->totalItems / $this->itemsPerPage));\n }",
"public func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read all logfiles (if existent) | public static function getLogfiles()
{
try {
$texte = file_get_contents(Path::path_logs() . 'texte_errors.log');
} catch (\Exception $exception) {
$texte = '[Not found]';
}
try {
$morph = file_get_contents(Path::path_logs() . 'morph_errors.log');
} catch (\Exception $exception) {
$morph = '[Not found]';
}
try {
$general = file_get_contents(Path::path_logs() . 'general_errors.log');
} catch (\Exception $exception) {
$general = '[Not found]';
}
return [
'texte' => $texte,
'morph' => $morph,
'general' => $general,
'laravel' => Helper::getLaravelLog(true)
];
} | [
"public static function get_log_files()\n {\n }",
"private function checkLogFiles()\n {\n foreach ($this->filesystem->all() as $path) {\n $this->checkLogFile($path);\n }\n }",
"protected function read_working_logs_dir() {\n $working_logs = [];\n $working_dir = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/================= / Admin Campaigns /================= / List Campaigns. Displays the first 15 entries by default. | function admin_campaigns_list( $page = 1, $perpage = 15 )
{
$request['page'] = $page;
$request['perpage'] = $perpage;
return $this->hook( "/campaigns.json", "campaign", $request, 'GET', 'admin' );
} | [
"public function listCampaign(){\n\n $token = generateAccessToken();\n $campaigns = listCampaign($token);\n return $campaigns['data'];\n\n }",
"public function getCampaigns()\n {\n }",
"public function listCampaigns()\n\t{\n\t\t$url = $this->getBetaAPIURL() . 'campaigns';\n\t\t$hea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
4.5.12 deleteDriverGroup This action deletes a driver group and the assignments of all drivers to that group. The drivers detached through this action are not being deleted. | public function deleteDriverGroup($params); | [
"function deleteGroup($group) {}",
"public function delete_group() {\n\n // Deletes Groups\n (new MidrubBaseUserAppsCollectionChatbotHelpers\\Groups)->delete_group();\n\n }",
"public function deleteGroup()\n {\n $this->showDeleteConfirm = false;\n DB::transaction(function () {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register settings on admin page, called if is_admin() && pageId = YoPressBase::instance()>getAdminPageId match | public function registerAdminSettings(); | [
"public function admin_init() {\n\t\t\tdo_action( 'learndash_settings_page_init', $this->settings_page_id );\n\t\t}",
"public function on_hook_admin_menu_setup(){\n\t\t$menu_slug = BTM_Plugin_Options::get_instance()->get_admin_menu_slug();\n\n\t\t// Admin Settings submenu page init\n\t\tadd_submenu_page(\n\t\t\t$... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether to show the Category field on form | function snax_link_show_category_field() {
return 'disabled' !== snax_link_category_field();
} | [
"function snax_text_show_category_field() {\n\treturn 'disabled' !== snax_text_category_field();\n}",
"public function category_filter() {\n\n\t\t$categories = get_terms( 'form_category' );\n\t\tif ( $categories && ! is_wp_error( $categories ) ) {\n\t\t\techo Give()->html->category_dropdown( 'category', $this->ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read file and return an array of words in the file | public function readFileByWord() {
if ($this->exists) {
$filecontents = file_get_contents ( $this->filename );
$words = preg_split ( '/[\s]+/', $filecontents, - 1, PREG_SPLIT_NO_EMPTY );
return $words;
} else {
return false;
}
} | [
"private function wordArray()\n {\n $wordArray = array(file('wordlist.txt'));\n return $wordArray[0];\n }",
"function get_file_words($file, $exclude) {\n\t$result = array();\n\n\t$content = file_get_contents($file);\n\tif (!empty($content)) {\n\t\t$words = explode(' ', $content);\n\n\t\tforeac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the value of date_birth | public function getDateBirth()
{
return $this->date_birth;
} | [
"public function getDateOfBirth() {\n\t\treturn $this->getAsInteger('date_of_birth');\n\t}",
"public function get_birth_date(){\n\t\treturn $this->v_birth_date->sec;\n\t}",
"public function getBirthDate();",
"public function getDate_Birth()\r\n\t{\r\n\t\treturn $this->date_birth;\r\n\t}",
"public function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify cURL timeouts are appropriately reported. | public function testWithCurlTimeout() {
$handle = curl_init();
curl_setopt($handle, CURLOPT_TIMEOUT_MS, 1);
$safeCurl = new SafeCurl($handle);
$safeCurl->execute("https://httpstat.us/200?sleep=100");
} | [
"public function testCurlTimeout()\n {\n $expected = env('GOOGLE_CURL_TIMEOUT');\n $actual = Config::curlTimeout();\n\n $this->assertEquals($expected, $actual);\n }",
"public function testConnectTimeoutExceeded()\n {\n $this->connection = new DefaultConnection(1, -1);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests that proper method calls are made in ItemManager's setExpired() method | public function testSetItemExpired()
{
putenv('DB_CONNECTION=sqlite_testing');
Log::shouldReceive('info');
Mail::shouldReceive('to');
$item = factory(\App\item::class)->make([
'End_Date' => Carbon::today()
]);
$item->save();
$this->assertDatabaseHas('items', [
'id' => $item->id,
'Status' => 'pending'
]);
$userRepoMock = Mockery::mock('App\Repositories\UserRepository');
$itemRepoMock = Mockery::mock('App\Repositories\ItemRepository');
$transactionRepoMock = Mockery::mock('App\Repositories\TransactionRepository');
$paymentManager = Mockery::mock('App\Domain\PaymentManager');
$itemRepoMock->shouldReceive('getExpiredItems')->with()->once();
$itemRepoMock->shouldReceive('find');
$transactionRepoMock->shouldReceive('getAllByItemId');
$itemManager = new ItemManager($itemRepoMock, $transactionRepoMock, $userRepoMock, $paymentManager);
$itemManager->setExpired();
} | [
"public function testItemExpiration()\n {\n $this->assertTrue(true);\n }",
"public function Cache_And_Get_Expired() {\n\t\t// Arrange\n\t\t$cache = $this->GetCache();\n\t\t$date = new DateTime();\n\t\t$date = $date->sub(new DateInterval(\"P1Y\"));\n\t\t$cacheItem = new \\EggCup\\CacheItem(\"key\", $d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |