query
stringlengths
7
5.25k
document
stringlengths
15
1.06M
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Test an object can be added to a message array for the current request
public function testAddMessageFromObjectForCurrentRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $user = new \stdClass(); $user->name = 'Scooby Doo'; $user->emailAddress = 'scooby@mysteryinc.org'; $flash->addMessageNow('user', $user); $messages = $flash->getMessages(); $this->assertInstanceOf(\stdClass::class, $messages['user'][0]); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEmpty($storage['slimFlash']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromObjectForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $user = new \\stdClass();\n $user->name = 'Scooby Doo';\n $user->emailAddress = 'scooby@mysteryinc.org';\n\n $flash->addMessag...
[ "0.6665526", "0.64594567", "0.64529735", "0.6079036", "0.6070254", "0.5973639", "0.5946248", "0.59337026", "0.5880742", "0.58527195", "0.5800147", "0.56900245", "0.5651039", "0.5574166", "0.55355936", "0.5487542", "0.5471896", "0.54697937", "0.5463723", "0.53852826", "0.53809...
0.6725215
0
Test a string can be added to a message array for the next request
public function testAddMessageFromAnIntegerForNextRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $flash->addMessage('key', 46); $flash->addMessage('key', 48); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEquals(['46', '48'], $storage['slimFlash']['key']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromStringForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 'value');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['value'], $storage['slimFlash...
[ "0.67779756", "0.6181242", "0.60967505", "0.59550196", "0.55518717", "0.55506116", "0.55387914", "0.54971635", "0.5314417", "0.5313701", "0.5247339", "0.5245324", "0.5236326", "0.52271664", "0.5214837", "0.51714796", "0.51436853", "0.51412094", "0.51286983", "0.5112833", "0.5...
0.5774627
4
Test a string can be added to a message array for the next request
public function testAddMessageFromStringForNextRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $flash->addMessage('key', 'value'); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEquals(['value'], $storage['slimFlash']['key']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromArrayForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => 'scooby@mysteryinc.org',\n ];\n\n $flash->addMessage...
[ "0.61833304", "0.6096158", "0.5956236", "0.5775606", "0.5553289", "0.554898", "0.55422175", "0.5498558", "0.5316321", "0.5313713", "0.5247073", "0.5246378", "0.5234187", "0.5225374", "0.5214104", "0.5172235", "0.514323", "0.5142921", "0.51311517", "0.5112149", "0.5106109", ...
0.6778396
0
Test an array can be added to a message array for the next request
public function testAddMessageFromArrayForNextRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $formData = [ 'username' => 'Scooby Doo', 'emailAddress' => 'scooby@mysteryinc.org', ]; $flash->addMessage('old', $formData); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEquals($formData, $storage['slimFlash']['old'][0]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromArrayForCurrentRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => 'scooby@mysteryinc.org',\n ];\n\n $flash->addMess...
[ "0.6403168", "0.63492715", "0.58963853", "0.58915865", "0.5839632", "0.57873327", "0.5740914", "0.57213295", "0.5686027", "0.5682223", "0.5512867", "0.54614747", "0.54467547", "0.54236424", "0.541326", "0.5396178", "0.5367872", "0.5359742", "0.5339173", "0.532194", "0.5287669...
0.69801843
0
Test an object can be added to a message array for the next request
public function testAddMessageFromObjectForNextRequest() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $user = new \stdClass(); $user->name = 'Scooby Doo'; $user->emailAddress = 'scooby@mysteryinc.org'; $flash->addMessage('user', $user); $this->assertArrayHasKey('slimFlash', $storage); $this->assertInstanceOf(\stdClass::class, $storage['slimFlash']['user'][0]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testAddMessageFromArrayForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $formData = [\n 'username' => 'Scooby Doo',\n 'emailAddress' => 'scooby@mysteryinc.org',\n ];\n\n $flash->addMessage...
[ "0.67530286", "0.65693074", "0.6433161", "0.63650674", "0.63164556", "0.6200107", "0.59128344", "0.58548766", "0.580537", "0.57742155", "0.57338995", "0.5711898", "0.5595448", "0.55055714", "0.54851294", "0.5481527", "0.54220605", "0.5414259", "0.54062873", "0.5383677", "0.53...
0.69989586
0
Test get empty messages from previous request
public function testGetEmptyMessagesFromPrevRequest() { $storage = []; $flash = new Messages($storage); $this->assertEquals([], $flash->getMessages()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetMessagesFromPrevRequest()\n {\n $storage = ['slimFlash' => ['Test']];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test'], $flash->getMessages());\n }", "public function testGetWebhookQueueTemplateMessageEmpty()\n {\n $container = [];\n ...
[ "0.6869914", "0.6421036", "0.6279734", "0.6275319", "0.6217242", "0.6190312", "0.61655146", "0.61655146", "0.6144499", "0.6110451", "0.61057013", "0.6095381", "0.609537", "0.59745735", "0.59645414", "0.59409404", "0.59265304", "0.59264684", "0.59016716", "0.58902115", "0.5883...
0.76954585
0
Test set messages for current request
public function testSetMessagesForCurrentRequest() { $storage = ['slimFlash' => [ 'error' => ['An error']]]; $flash = new Messages($storage); $flash->addMessageNow('error', 'Another error'); $flash->addMessageNow('success', 'A success'); $flash->addMessageNow('info', 'An info'); $messages = $flash->getMessages(); $this->assertEquals(['An error', 'Another error'], $messages['error']); $this->assertEquals(['A success'], $messages['success']); $this->assertEquals(['An info'], $messages['info']); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEmpty([], $storage['slimFlash']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testSetMessagesForNextRequest()\n {\n $storage = [];\n \n $flash = new Messages($storage);\n $flash->addMessage('Test', 'Test');\n $flash->addMessage('Test', 'Test2');\n\n $this->assertArrayHasKey('slimFlash', $storage);\n $this->assertEquals(['Te...
[ "0.68090874", "0.64293087", "0.62194574", "0.6216122", "0.61718696", "0.6116908", "0.60891205", "0.5985521", "0.5919066", "0.5918706", "0.5909979", "0.5904052", "0.58962536", "0.58763707", "0.5839283", "0.5825164", "0.57972217", "0.57724", "0.57596606", "0.57596606", "0.57596...
0.7029479
0
Test set messages for next request
public function testSetMessagesForNextRequest() { $storage = []; $flash = new Messages($storage); $flash->addMessage('Test', 'Test'); $flash->addMessage('Test', 'Test2'); $this->assertArrayHasKey('slimFlash', $storage); $this->assertEquals(['Test', 'Test2'], $storage['slimFlash']['Test']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getNextMessage(){\r\n }", "public function testAddMessageFromAnIntegerForNextRequest()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $flash->addMessage('key', 46);\n $flash->addMessage('key', 48);\n\n $this->assertArrayHasK...
[ "0.62519413", "0.61591566", "0.61474276", "0.60851175", "0.607869", "0.6024805", "0.6023967", "0.58872044", "0.58124787", "0.5809612", "0.58067995", "0.57403266", "0.57360333", "0.5706457", "0.5687764", "0.5684246", "0.5680642", "0.5617745", "0.5605141", "0.5577496", "0.55737...
0.73202366
0
Test getting the message from the key
public function testGetMessageFromKey() { $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]]; $flash = new Messages($storage); $this->assertEquals(['Test', 'Test2'], $flash->getMessage('Test')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetFirstMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals('Test', $flash->getFirstMessage('Test'));\n }", "public function testGetMessageFromKeyIncludingCurrent()\n {\n ...
[ "0.74023134", "0.73835194", "0.6972725", "0.69450796", "0.69185096", "0.6911737", "0.6717153", "0.6451006", "0.639705", "0.63416713", "0.6319928", "0.622334", "0.6215651", "0.6082025", "0.607969", "0.6066614", "0.6066289", "0.60417175", "0.60350317", "0.5990788", "0.59269774"...
0.77857244
0
Test getting the first message from the key
public function testGetFirstMessageFromKey() { $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]]; $flash = new Messages($storage); $this->assertEquals('Test', $flash->getFirstMessage('Test')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testDefaultFromGetFirstMessageFromKeyIfKeyDoesntExist()\n {\n $storage = ['slimFlash' => []];\n $flash = new Messages($storage);\n\n $this->assertEquals('This', $flash->getFirstMessage('Test', 'This'));\n }", "public function testGetMessageFromKey()\n {\n $sto...
[ "0.7507137", "0.69184434", "0.6886332", "0.64328176", "0.6408872", "0.6302087", "0.6230232", "0.6221132", "0.6141961", "0.61303663", "0.6051193", "0.5973054", "0.59687555", "0.5947246", "0.58659756", "0.5840703", "0.57835543", "0.57457983", "0.57017016", "0.5682362", "0.56712...
0.81680954
0
Test getting the default message if the key doesn't exist
public function testDefaultFromGetFirstMessageFromKeyIfKeyDoesntExist() { $storage = ['slimFlash' => []]; $flash = new Messages($storage); $this->assertEquals('This', $flash->getFirstMessage('Test', 'This')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetDefaultMessageIfNoMatchingValueFoundInMessagesList()\n {\n $this->translator->load();\n $this->assertEquals('default_value', $this->translator->get('invalid_message_key', 'default_value'));\n }", "public static function getDefaultMessage(): string;", "public function ...
[ "0.7424013", "0.7027813", "0.6519302", "0.6421024", "0.63071084", "0.6300398", "0.6262814", "0.62199277", "0.62195075", "0.62076044", "0.6201398", "0.6134098", "0.6125542", "0.60229933", "0.6016036", "0.59516007", "0.5947008", "0.59423625", "0.59402615", "0.5927038", "0.58530...
0.7725253
0
Test getting the message from the key
public function testGetMessageFromKeyIncludingCurrent() { $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]]; $flash = new Messages($storage); $flash->addMessageNow('Test', 'Test3'); $messages = $flash->getMessages(); $this->assertEquals(['Test', 'Test2','Test3'], $flash->getMessage('Test')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetMessageFromKey()\n {\n $storage = ['slimFlash' => [ 'Test' => ['Test', 'Test2']]];\n $flash = new Messages($storage);\n\n $this->assertEquals(['Test', 'Test2'], $flash->getMessage('Test'));\n }", "public function testGetFirstMessageFromKey()\n {\n $stor...
[ "0.77864105", "0.74032694", "0.69719326", "0.6945242", "0.69185305", "0.6912389", "0.6718969", "0.64488673", "0.63963664", "0.63402426", "0.632061", "0.6224188", "0.62159353", "0.6081999", "0.60797566", "0.6066287", "0.60654104", "0.60415053", "0.6034778", "0.5991311", "0.592...
0.73845595
2
Adds an event handler.
public function on($event, $callable) { if (!is_array($this->events)) { $this->events = []; } if (is_callable($callable)) { $this->events[$event] = $callable; } return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function add_event_handler($event, $callback);", "public function addHandler(Handler $handler);", "function AddHandler(&$handler)\r\n\t{\r\n\t\t$this->handlers[] = $handler;\r\n\t}", "public function addHandler(EventHandlerInterface $handler)\n {\n $this->handlers[] = $handler;\n }", "p...
[ "0.753823", "0.7375281", "0.71615744", "0.6746188", "0.6623115", "0.6564252", "0.6524019", "0.6452527", "0.6312969", "0.6260705", "0.61921364", "0.61099666", "0.6050911", "0.6046066", "0.6036312", "0.5955765", "0.59408945", "0.5920697", "0.5910216", "0.5910216", "0.59096754",...
0.0
-1
Executes CURL call. Returns API response.
public function call($endpoint, LicenseRequest $license, $method = 'POST') { $microtime = microtime(true); $this->trigger('start', [$microtime]); // Begin $this->setCurl(preg_match('/https\:/', $license->url)); $this->resolveEndpoint($endpoint, $license); // Make call $url = $license->url . $endpoint; $this->trigger('endpoint', [$endpoint, $url]); curl_setopt($this->curl, CURLOPT_URL, $url); // Set method $this->trigger('request', [$license->request]); switch ($method) { case 'GET': curl_setopt($this->curl, CURLOPT_POST, 0); break; case 'POST': curl_setopt($this->curl, CURLOPT_POST, 1); if ($license->request && count($license->request) > 0) { curl_setopt($this->curl, CURLOPT_POSTFIELDS, http_build_query($license->request)); } break; case 'JPOST': case 'JPUT': case 'JGET': case 'JDELETE': $json = json_encode($license->request); curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, preg_replace('/J/', '', $method, -1)); curl_setopt($this->curl, CURLOPT_POSTFIELDS, $json); // Rewrite headers curl_setopt($this->curl, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'Content-Length: ' . strlen($json), ]); break; } // Get response $this->response = curl_exec($this->curl); if (curl_errno($this->curl)) { $error = curl_error($this->curl); curl_close($this->curl); if (!empty($error)) { throw new Exception($error); } } else { curl_close($this->curl); } $this->trigger('response', [$this->response]); $this->trigger('finish', [microtime(true), $microtime]); return empty($this->response) ? null : json_decode($this->response); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function sendCurl() {\n\t\t$this->curlResponse = $this->curl->exec();\n\t}", "protected function _exec() {\r\n $response = curl_exec($this->_curl);\r\n $httpStatusCode = $this->getOption(CURLINFO_HTTP_CODE);\r\n $httpError = in_array(floor($httpStatusCode / 100), array(4, 5));\r\n ...
[ "0.72677535", "0.723068", "0.7193403", "0.7193403", "0.7096205", "0.70845675", "0.7052806", "0.687872", "0.68333244", "0.6783016", "0.67781395", "0.6773794", "0.675209", "0.67475617", "0.67200893", "0.67084616", "0.6686995", "0.6652942", "0.66395193", "0.66252357", "0.6564008...
0.0
-1
Sets curl property and its settings.
private function setCurl($is_https = false) { // Init $this->curl = curl_init(); // Sets basic parameters curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($this->curl, CURLOPT_TIMEOUT, isset($this->request->settings['timeout']) ? $this->request->settings['timeout'] : 100); // Set parameters to maintain cookies across sessions curl_setopt($this->curl, CURLOPT_COOKIESESSION, true); curl_setopt($this->curl, CURLOPT_COOKIEFILE, sys_get_temp_dir() . '/cookies_file'); curl_setopt($this->curl, CURLOPT_COOKIEJAR, sys_get_temp_dir() . '/cookies_file'); curl_setopt($this->curl, CURLOPT_USERAGENT, 'OLEGNAX-PURCHASE-VERIFY'); if ($is_https) { $this->setSSL(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function configureCurl ()\n {\n curl_setopt_array($this->cURL, [\n CURLOPT_URL => $this->url,\n CURLOPT_RETURNTRANSFER => true\n ]);\n }", "protected function _setCurlOpts() {\n $this->_setCurlOptArray($this->_getCurlOpts());\n }", "private...
[ "0.7115164", "0.6903635", "0.67886484", "0.66602075", "0.6625037", "0.6577221", "0.65577656", "0.6510868", "0.6476004", "0.64215595", "0.6400426", "0.6364996", "0.6319862", "0.631053", "0.6304868", "0.62921137", "0.62331855", "0.62123114", "0.6159156", "0.61526424", "0.613107...
0.61168706
21
Sets SSL curl properties when requesting an https url.
private function setSSL() { curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function setCurl($is_https = false)\n {\n // Init\n $this->curl = curl_init();\n // Sets basic parameters\n curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($this->curl, CURLOPT_TIMEOUT, isset($this->request->settings['timeout']) ? $this->request->set...
[ "0.67573386", "0.66084594", "0.6411469", "0.6334074", "0.62385255", "0.62204045", "0.621059", "0.621059", "0.61937183", "0.61431164", "0.6126274", "0.6072844", "0.60616535", "0.60616535", "0.6024835", "0.6024835", "0.5980887", "0.5961165", "0.59462595", "0.5920146", "0.591629...
0.79271114
0
Resolve endpoint based on handler setup.
private function resolveEndpoint(&$endpoint, LicenseRequest $license) { switch ($license->handler) { case 'wp_rest': $endpoint = '/wp-json/woo-license-keys/v1/' . str_replace('license_key_', '', $endpoint); break; default: $endpoint = '?action=' . $endpoint; break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function resolve(): void\n {\n $path = $this->request->path();\n $method = $this->request->method();\n $handler = $this->routes[$method][$path] ?? false;\n\n if (!$handler) {\n $this->response->showNotFoundPage();\n return;\n }\n\n [$control...
[ "0.62028146", "0.62020904", "0.581338", "0.5774712", "0.5774712", "0.5774712", "0.5741109", "0.56810147", "0.56753063", "0.55393904", "0.5363542", "0.53080195", "0.5270615", "0.5248363", "0.5228355", "0.52201134", "0.5203067", "0.51983386", "0.5197025", "0.5186267", "0.518240...
0.57913405
3
Gets the station ID from name
public function getStationID(string $station_name) { if (substr($station_name, 0, 11) === "TRADE HUB: ") { $station_name = substr($station_name, 11); } $this->db->select('eve_idstation'); $this->db->where('name', $station_name); $query = $this->db->get('station'); if ($query->num_rows() != 0) { $result = $query->row(); } else { $result = false; } return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getIdForName($name, $dbh=null) {\r\n if (is_null($dbh)) $dbh = connect_to_database();\r\n $sql = \"SELECT id FROM stock WHERE LOWER(name) = LOWER('$name')\";\r\n $sth = make_query($dbh, $sql);\r\n $results = get_all_rows($sth);\r\n if ($results) {\r\n return $results[0]['id'];\r\n }...
[ "0.64477944", "0.64183456", "0.6276595", "0.62217396", "0.61974126", "0.5980914", "0.59624326", "0.59511644", "0.5909803", "0.59054863", "0.5901047", "0.5900353", "0.5878598", "0.5853307", "0.58530253", "0.5844175", "0.5843036", "0.5837389", "0.5837389", "0.5837389", "0.58373...
0.7542614
0
Initialize the price lookup for a stocklist
public function init(string $origin, string $destination, int $buyer, int $seller, string $buy_method, string $sell_method, int $stocklist, int $user_id) { $this->stationFromName = (string) $origin; $this->stationToName = (string) $destination; $this->stationFromID = (int) $this->getStationID($origin)->eve_idstation; $this->stationToID = (int) $this->getStationID($destination)->eve_idstation; $this->characterFrom = (string) $buyer; $this->characterTo = (string) $seller; $this->characterFromName = (string) $this->getCharacterName($buyer); $this->characterToName = (string) $this->getCharacterName($seller); $this->characterFromMethod = (string) $buy_method; $this->characterToMethod = (string) $sell_method; $this->stocklistID = (int) $stocklist; $this->stockListName = (string) $this->getStockListName($stocklist)->name; $CI = &get_instance(); $CI->load->model('Tax_Model'); $this->settings = $this->User->getUserProfitSettings($user_id); $CI->Tax_Model->tax($this->stationFromID, $this->stationToID, $buyer, $seller, $this->settings); $this->transTaxFrom = $CI->Tax_Model->calculateTax('from'); $this->brokerFeeFrom = $CI->Tax_Model->calculateBroker('from'); $this->transTaxTo = $CI->Tax_Model->calculateTax('to'); $this->brokerFeeTo = $CI->Tax_Model->calculateBroker('to'); return $this->generateResults(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _construct()\r\n {\r\n $this->_init('ss_price', 'price_id');\r\n }", "public function __construct(PriceList $price_list = null)\n {\n $this->price_list = $price_list;\n }", "public function __construct(StockPrice $stockPrice)\n {\n //\n $this->stockPric...
[ "0.67749494", "0.6619689", "0.6213537", "0.6108304", "0.60767144", "0.5828017", "0.578052", "0.5702991", "0.5642617", "0.5642617", "0.56220454", "0.5607911", "0.55695087", "0.5542295", "0.5537879", "0.55313766", "0.549851", "0.54833096", "0.54716736", "0.54691976", "0.5468911...
0.0
-1
Generates the result array with prices
private function generateResults(): array { $contents = $this->getStockListContents(); $results = []; $buy_broker_per = ($this->brokerFeeFrom - 1) * 100; $buy_tax_per = ($this->transTaxFrom - 1) * 100; $sell_broker_per = (1 - $this->brokerFeeTo) * 100; $sell_tax_per = (1 - $this->transTaxTo) * 100; $taxes = [ "list" => $this->stockListName, "buy_character" => $this->characterFromName, "sell_character" => $this->characterToName, "buy_station" => $this->stationFromName, "sell_station" => $this->stationToName, "buy_method" => $this->characterFromMethod, "sell_method" => $this->characterToMethod, "buy_broker" => $buy_broker_per, "buy_tax" => $buy_tax_per, "sell_broker" => $sell_broker_per, "sell_tax" => $sell_tax_per, ]; foreach ($contents as $row) { $this->RateLimiter->rateLimit(); $item_id = (int) $row->id; $item_name = $row->name; $row->vol == 0 ? $item_vol = 1 : $item_vol = $row->vol; $best_buy_price = $this->getCrestData($item_id, $this->stationFromID, $this->characterFromMethod); $buy_broker_fee = $best_buy_price * ($this->brokerFeeFrom - 1); $best_sell_price = $this->getCrestData($item_id, $this->stationToID, $this->characterToMethod); $sell_broker_fee = $best_sell_price * (1 - $this->brokerFeeTo); $sell_trans_tax = $best_sell_price * (1 - $this->transTaxTo); $best_buy_price_taxed = $best_buy_price * $this->brokerFeeFrom; $best_sell_price_taxed = $best_sell_price * $this->brokerFeeTo * $this->transTaxTo; $profit_raw = $best_sell_price_taxed - $best_buy_price_taxed; $profit_m3 = $profit_raw / $item_vol; $best_buy_price_taxed != 0 ? $profit_margin = ($profit_raw / $best_buy_price_taxed) * 100 : $profit_margin = 0; $item_res = array("id" => $item_id, "name" => $item_name, "vol" => $item_vol, "buy_price" => $best_buy_price, "buy_broker" => $buy_broker_fee, "sell_price" => $best_sell_price, "sell_broker" => $sell_broker_fee, "sell_tax" => $sell_trans_tax, "profit_raw" => $profit_raw, "profit_m3" => $profit_m3, "profit_margin" => $profit_margin); array_push($results, $item_res); } return array("results" => $results, "req" => $taxes); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function getPrices () {\n\t\tlibxml_use_internal_errors(true);\n\t\n\t\t$dom = new DOMDocument();\n\n\t\t@$dom->loadHTML( $this->result );\n\t\t$xpath = new DOMXPath( $dom );\n\t\t\n\t\t$this->prices[] = array(\n\t\t\t'station.from' => $this->getPostField('from.searchTerm'),\n\t\t\t'station.to' => $this->g...
[ "0.7853604", "0.7341315", "0.6972715", "0.6847626", "0.6838348", "0.68021685", "0.67966944", "0.6779894", "0.67739385", "0.67273486", "0.67111254", "0.66631174", "0.6647399", "0.66168714", "0.65676874", "0.65658265", "0.6527574", "0.64007694", "0.63462967", "0.63235766", "0.6...
0.7117997
2
Returns the list of all stock list contents
private function getStockListContents(): array { $list = $this->stocklistID; $this->db->select('i.eve_iditem as id, i.name as name, i.volume as vol'); $this->db->from('itemlist il'); $this->db->join('itemcontents ic', 'ic.itemlist_iditemlist = il.iditemlist'); $this->db->join('item i', 'i.eve_iditem = ic.item_eve_iditem'); $this->db->where('il.iditemlist', $list); $query = $this->db->get(); $result = $query->result(); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function read_stocks() {\n return $this->yahooStock->getQuotes();\n }", "public function view_list(){\n\t\treturn view(mProvider::$view_prefix.mProvider::$view_prefix_priv.'stock');\n\t}", "public function all() {\n $stmt = $this->pdo->query('SELECT id, symbol, company '\n ...
[ "0.735539", "0.7155176", "0.7109039", "0.6581265", "0.6550308", "0.64300275", "0.64300275", "0.64100283", "0.64042234", "0.6404084", "0.6393538", "0.63809395", "0.63797426", "0.63797426", "0.63797426", "0.63650626", "0.6364002", "0.6364002", "0.63457245", "0.63457245", "0.634...
0.7995536
0
Fetches price data from CREST for an item
private function getCrestData(int $item_id, int $station_id, string $order_type): float { $regionID = $this->getRegionID($station_id)->id; $url = "https://crest-tq.eveonline.com/market/" . $regionID . "/orders/" . $order_type . "/?type=https://crest-tq.eveonline.com/inventory/types/" . $item_id . "/"; //$context = stream_context_create(array('http' => array('header'=>'Connection: close\r\n'))); /*$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch), true);*/ $result = json_decode(file_get_contents($url), true); $array_prices = []; for ($i = 0; $i < count($result['items']); $i++) { // only fetch orders FROM the designated stationID if ($result['items'][$i]['location']['id_str'] == $station_id) { array_push($array_prices, $result['items'][$i]['price']); } } if ($order_type == 'buy') { if (!empty($array_prices)) { $price = max($array_prices); } else { $price = 0; } } else if ($order_type == 'sell') { if (!empty($array_prices)) { $price = min($array_prices); } else { $price = 0; } } return $price; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function getPrice();", "public function getPriceFromDatabase()\n {\n }", "public function getPrices()\n {\n }", "public function getPrice();", "public function getPrice();", "public function getPrice();", "public function getPrice();", "private function fetchIt($item) {\n ...
[ "0.6550962", "0.64609826", "0.62417775", "0.62176245", "0.62176245", "0.62176245", "0.62176245", "0.6149448", "0.60590553", "0.5986089", "0.59851027", "0.5950699", "0.5928766", "0.59156924", "0.59156924", "0.58955336", "0.58878803", "0.5870106", "0.5859944", "0.58471614", "0....
0.6338504
2
Returns the region ID from the provided station
public function getRegionID(int $station_id): stdClass { $this->db->select('r.eve_idregion as id'); $this->db->from('region r'); $this->db->join('system sys', 'sys.region_eve_idregion = r.eve_idregion'); $this->db->join('station st', 'st.system_eve_idsystem = sys.eve_idsystem'); $this->db->where('st.eve_idstation', $station_id); $query = $this->db->get(); $result = $query->row(); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getId_region()\n {\n if (!isset($this->iid_region) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->iid_region;\n }", "public function getRegionId()\n {\n return $this->getShippingAddress()->getRegionId();\n }", "public function getSta...
[ "0.6629912", "0.64900887", "0.61547905", "0.6060793", "0.59956", "0.59956", "0.585744", "0.5765551", "0.57334065", "0.5697013", "0.5693873", "0.56701523", "0.56606203", "0.56243885", "0.54742205", "0.54742205", "0.54712766", "0.5457892", "0.5449097", "0.5449097", "0.5449097",...
0.74810696
0
Gets the stock list name from an id
private function getStockListName(int $stocklist): stdClass { $this->db->select('name'); $this->db->where('iditemlist', $stocklist); $query = $this->db->get('itemlist'); $result = $query->row(); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getItemNameByStockId($id,$d = 1){\n\t\t$sql = \"SELECT * FROM `item` WHERE `id` = $id\";\n\t \t$result = $this->conn->query($sql);\n\t \twhile($row = mysqli_fetch_assoc($result)){\n\t\t\t\n\t\t\t$sqlItemType = \"SELECT * FROM `item_type` WHERE `id` = \".$row['itemTypeId'].\"\";\n\t\t\t$resultItemType = ...
[ "0.76825345", "0.695547", "0.6925249", "0.69032276", "0.6808097", "0.64262277", "0.6421025", "0.63527554", "0.6321052", "0.6314064", "0.63008636", "0.62511563", "0.61229604", "0.61223763", "0.6080972", "0.60486585", "0.603643", "0.60333353", "0.6031105", "0.6027406", "0.60169...
0.65905905
5
Returns the character name from an id
private function getCharacterName(int $id_character): string { $this->db->select('name'); $this->db->where('eve_idcharacter', $id_character); $query = $this->db->get('characters'); $result = $query->row()->name; return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static function get_name($id) {\r\n\t\t\tif (trim($id)=='') {\r\n\t\t\t\treturn '';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$all = self::get_all();\r\n\t\t\treturn $all[$id][0];\r\n\t\t}", "function getCharacter($id) {\n try {\n $item = $this->perform_query_one_param(\"SELECT name from characters WHERE i...
[ "0.7704027", "0.74475336", "0.7283829", "0.7243234", "0.7015801", "0.69534355", "0.69315755", "0.6859769", "0.6760725", "0.6686248", "0.66808677", "0.65932286", "0.6590633", "0.65726006", "0.65688515", "0.6528733", "0.65205944", "0.6519239", "0.65012133", "0.6500837", "0.6487...
0.79088765
0
/ done hhh by
public function updateCategorie($categorie) { return Categorie::whereId($categorie->id)->update($categorie->all()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function process() ;", "private function _i() {\n }", "function handle() ;", "function processData() ;", "private function j() {\n }", "final function velcom(){\n }", "function complete();", "abstract protected function _process();", "abstract protected function _process();", "public fu...
[ "0.6063656", "0.56434315", "0.562995", "0.55353796", "0.55331266", "0.55166864", "0.5393416", "0.5362532", "0.5362532", "0.53378415", "0.53342456", "0.53342456", "0.5323301", "0.5292983", "0.5290777", "0.528153", "0.5267139", "0.5267139", "0.52497953", "0.52299744", "0.522844...
0.0
-1
Return the credential that are mandatory.
private function getCredentials(AuthenticateRequest $request) { return [ 'email' => $request->input('email'), 'password' => $request->input('password'), ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCredential ()\n\t{\n\t\t$retVal = null;\n\t\tif ($this->isConsole()) {\n\t\t\t$retVal = MO_CONSOLE_CREDENTIAL;\n\t\t} elseif(!defined('MO_IS_CONSOLE')) {\n\t\t\t$retVal = parent::getCredential();\n\t\t}\n\t\treturn $retVal;\n\t}", "public function getCredential();", "public function credenti...
[ "0.67553794", "0.6733583", "0.65361834", "0.6522885", "0.6404021", "0.63979226", "0.6375345", "0.6369883", "0.6301049", "0.62015104", "0.6109007", "0.60724336", "0.6036436", "0.6004592", "0.59602237", "0.59460306", "0.59386134", "0.59190834", "0.59130734", "0.58905697", "0.58...
0.0
-1
For internal only. DO NOT USE IT.
public function deserialize($param) { if ($param === null) { return; } if (array_key_exists("Id",$param) and $param["Id"] !== null) { $this->Id = $param["Id"]; } if (array_key_exists("ComponentName",$param) and $param["ComponentName"] !== null) { $this->ComponentName = $param["ComponentName"]; } if (array_key_exists("ComponentType",$param) and $param["ComponentType"] !== null) { $this->ComponentType = $param["ComponentType"]; } if (array_key_exists("Homepage",$param) and $param["Homepage"] !== null) { $this->Homepage = $param["Homepage"]; } if (array_key_exists("Description",$param) and $param["Description"] !== null) { $this->Description = $param["Description"]; } if (array_key_exists("RequestId",$param) and $param["RequestId"] !== null) { $this->RequestId = $param["RequestId"]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function __init__() { }", "private function __() {\n }", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}", "protected function init() {}...
[ "0.6265989", "0.61516386", "0.5989965", "0.5989965", "0.5989965", "0.5989965", "0.5989498", "0.5989498", "0.5989498", "0.5989498", "0.5989498", "0.5989498", "0.5988486", "0.5988486", "0.5949007", "0.5939891", "0.59164286", "0.59164286", "0.5870319", "0.5867028", "0.5855363", ...
0.0
-1
Change the collation of all tables in the database, even those with a different prefix than your Joomla installation.
public function changeCollation($newCollation = 'utf8_general_ci') { // Make sure we have at least MySQL 4.1.2 $db = $this->container->db; $old_collation = $db->getCollation(); if ($old_collation == 'N/A (mySQL < 4.1.2)') { // We can't change the collation on MySQL versions earlier than 4.1.2 return false; } // Change the collation of the database itself $this->changeDatabaseCollation($newCollation); // Change the collation of each table $tables = $db->getTableList(); // No tables to convert...? if (empty($tables)) { return true; } foreach ($tables as $tableName) { $this->changeTableCollation($tableName, $newCollation); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myPear_set_collation(){\n $needed = False;\n if (!$needed) return;\n $c_set = 'utf8';\n $d_col = 'utf8_unicode_ci';\n myPear_db()->qquery(\"ALTER SCHEMA \".myPear_db()->Database.\" DEFAULT CHARACTER SET $c_set DEFAULT COLLATE $d_col\",True);\n foreach(myPear_db()->getTables() as $table){\n b_debu...
[ "0.7594291", "0.7247959", "0.64067477", "0.63050836", "0.622661", "0.6192063", "0.6031515", "0.5881048", "0.58473426", "0.5770517", "0.5729425", "0.5726387", "0.5668958", "0.5657266", "0.5586653", "0.5548276", "0.55429673", "0.55290055", "0.55247784", "0.55203795", "0.5486877...
0.5535829
17
Execute a query against the site's database
private function query($query, $silentFail = true) { $db = $this->container->db; try { $db->setQuery($query)->execute(); } catch (RuntimeException $e) { if (!$silentFail) { throw $e; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function executeQuery($query);", "public function query();", "public function query();", "public function query();", "protected function execute_single_query(){\n\t\t$this -> open_connection();\n\t\t$this -> conn -> query($this -> query);\n\t\t$this -> close_connection();\n\t}", "public static function ...
[ "0.7103206", "0.6991545", "0.6991545", "0.6991545", "0.6889922", "0.68378663", "0.6793511", "0.67933494", "0.6786577", "0.6665675", "0.6648634", "0.6634909", "0.66291296", "0.66282505", "0.6572907", "0.65600806", "0.6555398", "0.6515222", "0.65101844", "0.6495862", "0.6484282...
0.0
-1
Change the database collation. This tries to change the collation of the entire database, setting the default for newly created tables and columns. We have the reasonable expectation that this will fail on most live hosts.
private function changeDatabaseCollation($newCollation) { $db = $this->container->db; $collationParts = explode('_', $newCollation); $charset = $collationParts[0]; $dbName = $this->container->platform->getConfig()->get('db'); $this->query(sprintf( "ALTER DATABASE %s CHARACTER SET = %s COLLATE = %s", $db->qn($dbName), $charset, $newCollation )); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myPear_set_collation(){\n $needed = False;\n if (!$needed) return;\n $c_set = 'utf8';\n $d_col = 'utf8_unicode_ci';\n myPear_db()->qquery(\"ALTER SCHEMA \".myPear_db()->Database.\" DEFAULT CHARACTER SET $c_set DEFAULT COLLATE $d_col\",True);\n foreach(myPear_db()->getTables() as $table){\n b_debu...
[ "0.7151892", "0.650667", "0.6472632", "0.6377463", "0.62235487", "0.6222845", "0.6212017", "0.61897814", "0.61086476", "0.6026438", "0.5995577", "0.59861034", "0.5937779", "0.56593704", "0.5590652", "0.5557284", "0.55048525", "0.5492732", "0.5492732", "0.54765594", "0.5465356...
0.713068
1
Changes the collation of a table and its text columns
private function changeTableCollation($tableName, $newCollation, $changeColumns = true) { $db = $this->container->db; $collationParts = explode('_', $newCollation); $charset = $collationParts[0]; // Change the collation of the table itself. $this->query(sprintf( "ALTER TABLE %s CONVERT TO CHARACTER SET %s COLLATE %s", $db->qn($tableName), $charset, $newCollation )); // Are we told not to bother with text columns? if (!$changeColumns) { return; } // Convert each text column try { $columns = $db->getTableColumns($tableName, false); } catch (RuntimeException $e) { $columns = []; } // The table is broken or MySQL cannot report any columns for it. Early return. if (!is_array($columns) || empty($columns)) { return; } $modifyColumns = []; foreach ($columns as $col) { // Make sure we are redefining only columns which do support a collation if (empty($col->Collation)) { continue; } $modifyColumns[] = sprintf("MODIFY COLUMN %s %s %s %s COLLATE %s", $db->qn($col->Field), $col->Type, (strtoupper($col->Null) == 'YES') ? 'NULL' : 'NOT NULL', is_null($col->Default) ? '' : sprintf('DEFAULT %s', $db->q($col->Default)), $newCollation ); } // No text columns to modify? Return immediately. if (empty($modifyColumns)) { return; } // Issue an ALTER TABLE statement which modifies all text columns. $this->query(sprintf( 'ALTER TABLE %s %s', $db->qn($tableName), implode(', ', $modifyColumns ))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myPear_set_collation(){\n $needed = False;\n if (!$needed) return;\n $c_set = 'utf8';\n $d_col = 'utf8_unicode_ci';\n myPear_db()->qquery(\"ALTER SCHEMA \".myPear_db()->Database.\" DEFAULT CHARACTER SET $c_set DEFAULT COLLATE $d_col\",True);\n foreach(myPear_db()->getTables() as $table){\n b_debu...
[ "0.7225204", "0.64697546", "0.63308394", "0.62432265", "0.611616", "0.59739697", "0.59668046", "0.58810216", "0.5865719", "0.5856473", "0.58330935", "0.5819369", "0.5788201", "0.57836914", "0.56409466", "0.56126976", "0.5595682", "0.55862087", "0.557636", "0.55612856", "0.553...
0.6970929
1
Here we we can map our mockup to our hotels mapper class
protected function setUp() { $this->hotelMapperService = new HotelMapperService(); $this->jsonHotels = json_encode($this->getHotelsRequestExample()); $this->mappedHotels = $this->hotelMapperService->mapJsonToHotels($this->jsonHotels); $this->sort = new Sort($this->mappedHotels); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testFormatHotelData(){\n $reflection = new \\ReflectionClass(get_class($this->advertiserA));\n $data = $this->mockResponseA();\n $method = $reflection->getMethod('formatHotelData');\n $method->setAccessible(true);\n $result = $method->invokeArgs($this->advertiserA...
[ "0.5979853", "0.57950884", "0.5720932", "0.56167114", "0.5592526", "0.5438802", "0.52496123", "0.52102596", "0.5202684", "0.51782334", "0.5174611", "0.5173758", "0.5150398", "0.5135128", "0.5122902", "0.5122902", "0.51078624", "0.5074306", "0.505704", "0.50191903", "0.5006102...
0.6036583
0
Here we we test our response's structure and type when we sort by name
public function testSortByName() { $result=$this->sort->sortByName(); $result = $this->hotelMapperService->serialize($result); $this->assertInternalType('array',$result); foreach ($result as $i => $hotel) { $this->assertGreaterThan($result[$i+1]['name'],$hotel['name']); $this->assertArrayHasKey('name', $hotel); $this->assertArrayHasKey('price', $hotel); $this->assertArrayHasKey('city', $hotel); $this->assertArrayHasKey('availability', $hotel); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function sort_response($response_data)\n\t{\n\t\tasort($response_data);\n\t\treturn $response_data;\n\t}", "public function testOrderBy(): void\n {\n $request = new Request([\n 'orderBy' => 'status',\n ]);\n\n $this->assertEquals(['status', 'asc'], $request->orderBy());\...
[ "0.5780222", "0.5760177", "0.5757209", "0.57431144", "0.5592697", "0.55461377", "0.55292994", "0.5500212", "0.54605204", "0.5422834", "0.5372241", "0.5362019", "0.5351873", "0.5344494", "0.53215086", "0.53190184", "0.5294356", "0.5271464", "0.5239272", "0.523155", "0.5207087"...
0.6412094
0
Here we we test our response's structure and type when we sort by price
public function testSortByPrice() { $result=$this->sort->sortByPrice(); $result = $this->hotelMapperService->serialize($result); $this->assertInternalType('array',$result); foreach ($result as $i => $hotel) { var_dump($hotel['price']);die; $this->assertGreaterThan($result[$i+1]['price'],$hotel['price']); $this->assertArrayHasKey('name', $hotel); $this->assertArrayHasKey('price', $hotel); $this->assertArrayHasKey('city', $hotel); $this->assertArrayHasKey('availability', $hotel); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testSortByPrice()\n {\n $item1 = new \\Saitow\\Model\\Tire('sql', 1);\n $item1->setPrice(1.1);\n\n $item2 = new Saitow\\Model\\Tire('xml', 50);\n $item2->setPrice(2.2);\n\n $item3 = new \\Saitow\\Model\\Tire('other', 22);\n $item3->setPrice(0.1);\n\n ...
[ "0.6775954", "0.590531", "0.585309", "0.5791465", "0.56464386", "0.56445473", "0.56119233", "0.5596878", "0.5569873", "0.5545255", "0.55211115", "0.5482619", "0.54670006", "0.5464328", "0.54582024", "0.54364574", "0.54232496", "0.54016703", "0.5363386", "0.53609765", "0.53426...
0.7147369
0
Show a list of all available Threads
public function index() { $threads_1 = DB::table('threads') ->join('users','users.id', '=', 'threads.user_id') ->select('threads.*', 'users.name') ->where('threads.category', '=', '1') ->orderBy('updated_at', 'desc') ->get(); $threads_2 = DB::table('threads') ->join('users','users.id', '=', 'threads.user_id') ->select('threads.*', 'users.name') ->where('category', '=', '2') ->orderBy('updated_at', 'desc') ->get(); $threads_3 = DB::table('threads') ->join('users','users.id', '=', 'threads.user_id') ->select('threads.*', 'users.name') ->where('category', '=', '3') ->orderBy('updated_at', 'desc') ->get(); $threads_4 = DB::table('threads') ->join('users','users.id', '=', 'threads.user_id') ->select('threads.*', 'users.name') ->where('category', '=', '4') ->orderBy('updated_at', 'desc') ->get(); return view('thread', ['threads_1' => $threads_1, 'threads_2' => $threads_2, 'threads_3' => $threads_3, 'threads_4' => $threads_4]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_threads() {\n\n\t\t//return $query->result();\n\t}", "public function threads()\n\t{\n\n\t\t// get sort type\n\n\n\t\t$query = Thread::where('parent_id', null)->with('user')->with('topic')->limit(20);\n\n\t\t$sort = get_string('sort', 'newest');\n\n\t\t$topic = get_int('topic', false);\n\n\t\...
[ "0.64835525", "0.6027719", "0.6026949", "0.5942333", "0.5875374", "0.5848816", "0.584709", "0.579849", "0.5772946", "0.5770617", "0.57400596", "0.5722606", "0.5690784", "0.56481206", "0.55997443", "0.559453", "0.55693346", "0.55655766", "0.5536028", "0.5490036", "0.5478312", ...
0.4954538
50
Store a new thread.
public function store(ThreadRequest $request) { $thread = new Thread; $thread->title = $request->input('title'); $thread->category = $request->input('category'); $thread->user_id = Auth::user()->id; $thread->save(); $post = new Post; $post->title = $request->input('title'); $post->message = $request->input('message'); $post->user_id = Auth::user()->id; $post->thread_id = $thread->id; $post->save(); return redirect('threads/'.$thread->id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store(Thread $thread)\n {\n $thread->update(['locked' => true]);\n }", "public function store($channel, Thread $thread)\n {\n $thread->subscribe();\n }", "public function store(StoreThread $request, Thread $thread)\n {\n if ($thread->store()) {\n r...
[ "0.67814606", "0.60974586", "0.6010781", "0.6008035", "0.5955583", "0.5876444", "0.5820617", "0.5720615", "0.57027435", "0.569007", "0.5673161", "0.56156516", "0.555691", "0.5545452", "0.55090624", "0.53459036", "0.5336149", "0.5322128", "0.5304469", "0.52239645", "0.5203441"...
0.5722436
7
$tripList>printList(); test inList() $tripList>inList('stop_name', 'HOHOKUS'); helper functions// function takes a train station and returns the next $num trains
function nextTrains($database, $stop_id, $time, $num) { //get next $num of trains leaving after $time from $stop_id $query = array("stop_id" => $stop_id, "departure_time" => array('$gt' => $time)); $cursor = $database->stop_times->find( $query )->sort(array("departure_time" => 1))->limit($num); //print("\nnextTrains\n"); //print_debug($cursor); return ($cursor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTrains($station) {\n\n\t\t$retval = array();\n\t\t$redis_key = \"station/getTrains-${station}\";\n\t\t//$redis_key .= time(); // Debugging\n\n\t\tif ($retval = $this->redisGet($redis_key)) {\n\t\t\treturn($retval);\n\n\t\t} else {\n\n\t\t\t$query = 'search index=\"septa_analytics\" '\n\t\t\t\t. 'earlie...
[ "0.5781081", "0.54503745", "0.5128231", "0.5019329", "0.50053805", "0.4991708", "0.4963868", "0.49330297", "0.4860214", "0.48550525", "0.4843406", "0.48130915", "0.47894514", "0.47403437", "0.47088164", "0.47008035", "0.4679761", "0.46698704", "0.4655264", "0.46517396", "0.46...
0.62130743
0
function takes a trip id and returns an array of the remaining stops
function nextTrip($database, $trip_id, $stop_seq) { //gets the trip $query = array("trip_id" => $trip_id, "stop_sequence" => array('$gte' => $stop_seq)); $cursor = $database->stop_times->find( $query )->sort(array("stop_sequence" => 1)); //print_debug($cursor); //print_r($cursor); return ($cursor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getScheduleByIdGroupedByTrip($id){\n $schedule = self::getScheduleById($id);\n if (empty($schedule->data)) {\n //should really return the same error here\n return false;\n }\n $trips = [];\n foreach($schedule->data as $stop){\n $tripid = $stop->r...
[ "0.62264055", "0.6187026", "0.6047254", "0.60381603", "0.6017687", "0.5994894", "0.5771069", "0.56499535", "0.55783504", "0.55626345", "0.5516591", "0.54681015", "0.54279566", "0.53501785", "0.53155154", "0.5205559", "0.5177524", "0.5137254", "0.51315176", "0.5131162", "0.507...
0.48870522
29
get name of a stop
function getStop($db, $stop_id) { //get the stop info $query = array("stop_id" => $stop_id); $cursor = $db->stops->find( $query ); //print_debug($cursor); return ($cursor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getStopName($id){\n return self::getStop($id)->data->attributes->name;\n }", "private function getStopReadableName($stop_id): string\n {\n $url = 'https://api-v3.mbta.com/stops/' . $stop_id;\n\n $client = \\Drupal::httpClient();\n $request = $client->get($url)->getBody()-...
[ "0.81311196", "0.71966153", "0.65919685", "0.65143657", "0.61098754", "0.6005389", "0.58205366", "0.5813099", "0.58087814", "0.58087814", "0.57916105", "0.5770967", "0.5769359", "0.57645065", "0.576272", "0.5746036", "0.5697314", "0.5691237", "0.5681408", "0.56703115", "0.566...
0.56056356
27
helper to print variables
function print_debug($var) { //display if null if ($var == NULL) print("$var is NULL"); //iterate through results and display foreach($var as $obj) { print_r($obj);; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dump() {\n\t\t$vars = get_object_vars( $this );\n\t\techo '<pre style=\"text-align:left\">';\n\t\tforeach( $vars as $name => $value ) {\n\t\t\techo $name.': '.$value.\"\\n\";\n\t\t}\n\t\techo '</pre>';\n\t}", "public function dump($variable) {}", "function dump($variable)\n {\n ...
[ "0.75960344", "0.7443416", "0.7346558", "0.73166335", "0.7314223", "0.7255716", "0.713064", "0.7119965", "0.7048607", "0.70357805", "0.70110255", "0.7007484", "0.6995851", "0.69943684", "0.6970716", "0.6892181", "0.68519855", "0.68465567", "0.6838294", "0.683062", "0.68197864...
0.6830112
20
Finds an existing Agent or creates a new DB Record
public function findOrCreate(Array $attributes): Agent { if (empty($attributes['name'])) { $attributes['name'] = 'unknown'; } return Agent::firstOrCreate($attributes); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function saveAgent() {\r\n // Consider wrapping the lines of code so its more\r\n // readable. Preferrably within 80-90 character length\r\n // - @vishal\r\n $sqlQuery = \"INSERT INTO users ( lname, fname, image_name, password, email, phone, enable, creation_date, address1, addre...
[ "0.58493173", "0.57976437", "0.5786995", "0.5661915", "0.55334413", "0.5380711", "0.5331223", "0.5209913", "0.52086544", "0.5181502", "0.5143289", "0.5044231", "0.5035857", "0.50067836", "0.49665117", "0.493827", "0.4887388", "0.48414704", "0.48296", "0.48202884", "0.47921005...
0.56598294
4
Finds / creats the record for a not detected Agent
public function findOrCreateNotDetected(): Agent { return Agent::firstOrCreate([ 'name' => 'unknown', 'browser' => NULL, 'browser_version' => NULL ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function record(){\n //store deadbody object first\n $this->create();\n\n //stores new deadbody in compartment\n $sql = \"SELECT * FROM compartment WHERE status='free' LIMIT 1\";\n $this->compartment = array_shift(Compartment::find_by_sql($sql));\n $this->compartment->status = \"occupied\"...
[ "0.51552266", "0.4772641", "0.47175062", "0.46376115", "0.46119517", "0.46100888", "0.45843157", "0.45701784", "0.45586094", "0.45474917", "0.4532829", "0.45082062", "0.44557235", "0.44137526", "0.4402685", "0.439246", "0.4387997", "0.43790662", "0.43784818", "0.43778485", "0...
0.638491
0
affichage produits non valides dans back office
public function affichageAction() { $em=$this->getDoctrine()->getManager(); $products=$em->getRepository('HologramBundle:Product')->findBy(array('etat'=>'en attente')); return $this->render('HologramBundle:Back:produitsNonValides.html.twig',array('prod'=>$products)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function produits()\n {\n $data[\"list\"]= $this->produit->list();\n $this->template_admin->displayad('liste_Produits');\n }", "function afficherProduits(){\n\t\t$sql=\"SElECT * From paniers \";\n\t\t$db = config::getConnexion();\n\t\ttry{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\...
[ "0.63145834", "0.6286612", "0.61418337", "0.6130937", "0.61284554", "0.59976745", "0.5950395", "0.5935296", "0.59213513", "0.5897326", "0.58645564", "0.58216345", "0.5799415", "0.5782876", "0.5776759", "0.57624215", "0.57621", "0.5729964", "0.5728574", "0.57277954", "0.572677...
0.62678397
2
afficher un produit pour le valider dans BackOffice
public function viewOneProductAction($id) { $em=$this->getDoctrine()->getManager(); $product=$em->getRepository('HologramBundle:Product')->find($id); $videoPath = ('../web/Uploads/'.$product->getVideo()); $imgPath = ('../web/Uploads/'.$product->getProductPhoto()); $date=$product->getProductDate(); $form=$this->createForm(new ValidateProductForm(),$product); $requete=$this->get('request'); $form->handleRequest($requete); return $this->render('HologramBundle:Back:oneProductNotValidated.hml.twig', array('f'=>$form->createView(),'p'=>$product,'video'=>$videoPath,'img'=>$imgPath,"d"=>$date)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wtsProPaiement($ar){\n $p = new XParam($ar, array());\n $orderoid = $p->get('orderoid');\n // verification du client de la commande et du compte connecte\n list($okPaiement, $mess) = $this->paiementEnCompte($orderoid);\n if (!$okPaiement){\n XLogs::critical(get_class($this), 'paiement ...
[ "0.6371605", "0.6307951", "0.6303901", "0.61269045", "0.6061136", "0.59381", "0.5922541", "0.5882537", "0.5882537", "0.5874604", "0.58630663", "0.58295786", "0.58049875", "0.57859856", "0.576723", "0.57538044", "0.57390887", "0.56993663", "0.56442267", "0.5634447", "0.563319"...
0.0
-1
refuser un produit backoffice
public function refuseProductAction($id){ $em=$this->getDoctrine()->getManager(); $product=$em->getRepository('HologramBundle:Product')->find($id); $em->remove($product); $em->flush(); return $this->redirectToRoute('esprit_hologram'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hookDisplayBackOfficeTop()\n {\n $objectifCoach = array();\n $this->context->controller->addCSS($this->_path . 'views/css/compteur.css', 'all');\n $this->context->controller->addJS($this->_path . 'views/js/compteur.js');\n $objectifCoach[] = CaTools::getObjectifCoach(...
[ "0.63431937", "0.6277276", "0.6133261", "0.611524", "0.61041826", "0.60911864", "0.60598433", "0.60385096", "0.6027927", "0.5992345", "0.5971936", "0.5966847", "0.5953288", "0.593235", "0.59230894", "0.5916671", "0.5915536", "0.5915418", "0.5912843", "0.5906971", "0.5878741",...
0.0
-1
affichage de listes de produit d'un client front office
public function viewProductsAction() { $id = $this->getUser()->getId(); $em=$this->getDoctrine()->getManager(); $products=$em->getRepository('HologramBundle:Product')->findBy(array('idUser'=>$id,'etat'=>array('en attente','valider'))); return $this->render('HologramBundle:Front:allProducts.html.twig', array('prod'=>$products)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Listar_Clientes()\n\t {\n\t\tlog_message('INFO','#TRAZA| CLIENTES | Listar_Clientes() >> ');\n\t\t$data['list'] = $this->Clientes->Listar_Clientes();\n return $data;\n\t }", "public function List_client_Physique(){\n $req = self::list(\"SELECT * FROM client_physique\");\n return $req;\n }...
[ "0.70304775", "0.6843026", "0.6828918", "0.6734751", "0.6669923", "0.666392", "0.6590058", "0.65383863", "0.6536704", "0.6535793", "0.6535216", "0.6533364", "0.6528679", "0.6527088", "0.6519497", "0.6511529", "0.6487047", "0.64403516", "0.64034045", "0.64018", "0.6391739", ...
0.0
-1
add new product front office
public function addProductAction() { $em = $this->getDoctrine()->getManager(); $product=new Product(); $form=$this->createForm(new ProductForm(),$product); $request=$this->get('request'); $form->handleRequest($request); if($form->isValid()) { $em=$this->getDoctrine()->getManager(); $upload = new Upload("", "../web/Uploads/", 0, 0); $productVideo=$form->get('video')->getData(); $file = array("tmp_name" => $productVideo->getPathname(), "type" => $productVideo->getMimeType() ); $productPhoto=$form->get('productPhoto')->getData(); $file1 = array("tmp_name" => $productPhoto->getPathname(), "type" => $productPhoto->getMimeType() ); $product->setVideo($upload->uploadFile($file)); $product->setProductPhoto($upload->uploadFile($file1)); $product->setProductDate(new \DateTime('now')); $product->setIdUser($this->getUser()); $em->persist($product); $em->flush(); return $this->redirectToRoute('esprit_hologram_front_products'); } return $this->render('HologramBundle:Front:newProduct.html.twig',array('f'=>$form->createView())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add() {\n\t\tif (True) {\n\n\t\t\t// create an empty product.\n\t\t\t$o =& new ufo_product(0);\n\t\t\t$this->addedObject =& $o;\n\t\t\n\t\t\t// create an entry in the db.\n\t\t\t$o->initialize();\n\t\t\t$o->create();\n\t\t\t$o->edit();\n\n\t\t\t// add it to the product array.\n\t\t\t$this->product[] = $o;...
[ "0.6695121", "0.66545445", "0.66199064", "0.65959644", "0.65817106", "0.64879215", "0.6458583", "0.64477724", "0.6418282", "0.6405825", "0.6373641", "0.6353848", "0.6344343", "0.6327545", "0.6315267", "0.63021165", "0.62904793", "0.62865704", "0.62749267", "0.6272722", "0.626...
0.0
-1
affichage d'un produit front office
public function viewProductAction($id) { $em=$this->getDoctrine()->getManager(); $product=$em->getRepository('HologramBundle:Product')->find($id); return $this->render('HologramBundle:Front:oneProduct.html.twig',array('p'=>$product)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hookDisplayBackOfficeTop()\n {\n $objectifCoach = array();\n $this->context->controller->addCSS($this->_path . 'views/css/compteur.css', 'all');\n $this->context->controller->addJS($this->_path . 'views/js/compteur.js');\n $objectifCoach[] = CaTools::getObjectifCoach(...
[ "0.6683356", "0.64476615", "0.62574404", "0.6222986", "0.62200797", "0.61618686", "0.6105604", "0.6039797", "0.60173196", "0.60048485", "0.5986522", "0.5942242", "0.59391785", "0.59286934", "0.59247583", "0.5918956", "0.5905682", "0.58997756", "0.5898244", "0.58957744", "0.58...
0.0
-1
modifier un produit front offcie
public function editProductAction($id){ $em=$this->getDoctrine()->getManager(); $product=$em->getRepository('HologramBundle:Product')->find($id); $p=$product->getProductPhoto(); $v=$product->getVideo(); /*$form = $this->createFormBuilder($product) ->add('video','file', array('data_class' => null, 'required' => false,'attr' =>array('class'=>' form-control custom-file-input'),'label'=>'Update your video ')) ->add('productPhoto','file', array('data_class' => null, 'required' => false,'attr' =>array('class'=>' form-control custom-file-input'),'label'=>'Update your logo ')) ->getForm(); */ $request = $this->get('request'); if($request->getMethod()=='POST') { $upload = new Upload("", "../web/Uploads/", 0, 0); $video=$this->getRequest()->files->get('file'); $productPhoto = $this->getRequest()->files->get('upload2'); if($productPhoto != null) { $file1 = array("tmp_name" => $productPhoto->getPathname(), "type" => $productPhoto->getMimeType() ); $product->setProductPhoto($upload->uploadFile($file1)); }else{ $product->setProductPhoto($p); } //video if($video != null) { $file2 = array("tmp_name" => $video->getPathname(), "type" => $video->getMimeType() ); $product->setVideo($upload->uploadFile($file2)); }else{ $product->setVideo($v); } $n=$request->get('nomp'); $c=$request->get('contenup'); if ($product->getEtat() == "valider"){ $product->setEtat("en attente"); } $product->setProductName($n); $product->setProductContent($c); $em->persist($product); $em->flush(); return $this->redirectToRoute('esprit_hologram_front_products'); } return $this->render('HologramBundle:Front:oneProduct.html.twig', array('p'=>$product,'id'=>$id)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wtsProPaiement($ar){\n $p = new XParam($ar, array());\n $orderoid = $p->get('orderoid');\n // verification du client de la commande et du compte connecte\n list($okPaiement, $mess) = $this->paiementEnCompte($orderoid);\n if (!$okPaiement){\n XLogs::critical(get_class($this), 'paiement ...
[ "0.6408087", "0.63547933", "0.6327955", "0.61076504", "0.585736", "0.58299625", "0.5789285", "0.5789124", "0.5747148", "0.56809586", "0.56410384", "0.56113577", "0.55801743", "0.55415815", "0.5501369", "0.5492027", "0.5483786", "0.54769427", "0.547046", "0.54492134", "0.54451...
0.0
-1
! Desc : Logout, destroy sessions !
public function logOut(){ // Starting sessions session_start(); // Emptying sessions $_SESSION['userID'] = ''; $_SESSION['logged_in'] = false; // Destroying sessions session_destroy(); header("Location: ?controller=home"); exit(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function logOut()\n {\n self::startSession();\n session_destroy();\n }", "public function logOut(){\n $_SESSION=[];\n session_destroy();\n }", "public function logOut () : void {\n $this->destroySession();\n }", "public function logoutxxx()\n {\n ...
[ "0.8461088", "0.8432945", "0.8294516", "0.8278152", "0.8255903", "0.8214023", "0.8193799", "0.8167511", "0.8162846", "0.81415933", "0.8119535", "0.810422", "0.8101961", "0.8059031", "0.8033537", "0.8021982", "0.80158484", "0.8007926", "0.800115", "0.7993659", "0.7991455", "...
0.8087645
13
! Checks if password match !
public function matchPassword($userPassword, $saltAndHash) { $hashValues = preg_split('/\./', $saltAndHash); $salt = $hashValues[0]; $hash = $hashValues[1]; $salt2 = $hashValues[2]; if((hash("sha512", md5($salt.$userPassword.$salt2))) == $hash){ return true; } else{ return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pwdMatch($password, $passwordRepeat){\n $result = true;\n if ($password !== $passwordRepeat){\n $result = true;\n }\n else{\n $result = false;\n }\n return $result;\n}", "function testPasswordsAreEqual($password, $password_one) {\n ...
[ "0.78580385", "0.7837851", "0.783264", "0.78004414", "0.7780186", "0.773594", "0.7728959", "0.7726949", "0.76972276", "0.76952744", "0.76879126", "0.76872337", "0.765373", "0.7651266", "0.7647589", "0.7579951", "0.75546163", "0.75169224", "0.7511214", "0.74990636", "0.7497002...
0.0
-1
! Takes a password then generates a salt and creates a hash. Returns salt+hash !
public function generateHash($userPassword) { $salt = $this->generateSalt(); $salt2 = $this->generateSalt(); $result = $salt.".".hash("sha512", md5($salt.$userPassword.$salt2)).".".$salt2; return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getHashedPass($password, $salt)\n{\n $saltedPass = $password . $salt;\n return hash('sha256', $saltedPass);\n}", "function makeHash($password) {\r\n return crypt($password, makeSalt());\r\n}", "function getHash( $password, $salt = '' )\r\n{\r\n\treturn hash( 'sha256', $password . $salt );\r\n...
[ "0.81962234", "0.8118475", "0.80853033", "0.8036892", "0.80246073", "0.7980485", "0.7866376", "0.7863567", "0.7770568", "0.77702844", "0.77616733", "0.77567774", "0.7748468", "0.7735436", "0.76788276", "0.7665582", "0.76616496", "0.7659466", "0.76543933", "0.7629388", "0.7602...
0.0
-1
! Generate 10 character salt !
private function generateSalt() { $possibleValues = '0123456789abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ'; $salt = ''; for($i = 0; $i < 10; $i++) { $salt .= $possibleValues[mt_rand(0, strlen($possibleValues)-1)]; } return $salt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function GenSalt()\n {\n $chars = array_merge(range('a','z'), range('A','Z'), range(0, 9));\n $max = count($chars) - 1;\n $str = \"\";\n $length = 22;\n \n while($length--) {\n shuffle($chars);\n $rand = mt_rand(0, $max);\n $str ...
[ "0.8620291", "0.86027485", "0.8424969", "0.83353364", "0.8298978", "0.8280773", "0.8258466", "0.82321376", "0.82104486", "0.8195782", "0.81943995", "0.8189444", "0.8149346", "0.81050533", "0.8100473", "0.80642945", "0.80625105", "0.80612385", "0.8059442", "0.8059442", "0.8057...
0.863523
0
/ Validate a member login from data in a MySQL Database.
public function verifyLogin($username, $password) { if(empty($username) || empty($password)) { throw new Exception("One or more fields are empty"); } else { $dbModel = $GLOBALS['db']; $result = $dbModel->select('*','user'," WHERE username='".$username."'"); if($row = mysql_fetch_array($result)){ if ($password == $this->matchPassword($password, $row['password'])) { $admin = false; $adminresult = $dbModel->select('*','admin'," WHERE userid='".$row['id']."'"); if(mysql_num_rows($adminresult)){ $admin = true; } $this->setSessions($row['id'],$admin); return $row['id']; } else { throw new Exception("Wrong password or username, please try again"); } } } mysql_free_result($result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function memberLoginHandler() {\n global $inputs;\n\n $username = $inputs['username'];\n $password = $inputs['password'];\n $sql = 'select * from `member` where name = ? and password = ?';\n $res = getOne($sql, [$username, $password]);\n\n if (!$res) {\n formatOutput(false, 'username or pa...
[ "0.7231226", "0.7041633", "0.7014983", "0.68430173", "0.6828197", "0.6775398", "0.6757982", "0.67304873", "0.67249095", "0.6717574", "0.66858965", "0.6642699", "0.66053647", "0.65985817", "0.6589373", "0.6585631", "0.6584989", "0.6579783", "0.6573199", "0.65726525", "0.651484...
0.61546534
79
! Start sessions if login succeed!
public function setSessions($id,$admin) { session_start(); $_SESSION['userID'] = $id; $_SESSION['logged_in'] = true; if($admin == true){ $_SESSION['admin'] = true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function startSession();", "public function startSession() {}", "public function startSessions()\r\n {\r\n Zend_Session::start();\r\n }", "private function checkLogin()\n {\n if ($this->verifySession()) {\n $this->userId = $this->session['id'];\n }\n ...
[ "0.7561102", "0.75259376", "0.71529657", "0.71182793", "0.70637345", "0.7057598", "0.70119023", "0.7008619", "0.6976411", "0.69640106", "0.6935279", "0.69021565", "0.68785596", "0.6863336", "0.6852832", "0.6851214", "0.6850439", "0.68329704", "0.6830511", "0.6820222", "0.6769...
0.0
-1
! Checks if user is inlogged !
public function isLoggedIn(){ if(!isset($_SESSION)){ session_start(); } if(isset($_SESSION['logged_in']) && isset($_SESSION['userID']) && $_SESSION['logged_in'] == true){ return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function isUserLoggedIn() {}", "protected function isUserLoggedIn() {}", "public function is_logged_in() {\n\n\t}", "function wv_is_user_loggedin() {\n $output = 0;\n if (is_user_logged_in()) {\n $output = 1;\n } else {\n $output = 0;\n }\n r...
[ "0.86785835", "0.86785835", "0.8527274", "0.8484006", "0.84455794", "0.83750176", "0.832903", "0.83128744", "0.83128744", "0.8297051", "0.82759917", "0.82686114", "0.82685137", "0.82585824", "0.8247186", "0.8244983", "0.82405144", "0.8227985", "0.82104576", "0.81937027", "0.8...
0.0
-1
! Checks if user is admin !
public function isAdmin(){ if(!isset($_SESSION)){ session_start(); } if(isset($_SESSION['admin']) && $_SESSION['admin'] == true){ return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function isAdminUser() {}", "function is_user_admin()\n {\n }", "function is_admin()\n {\n //is a user logged in?\n\n //if so, check admin status\n\n //returns true/false\n\n }", "private function isAdmin() {\n\t\tif (Auth::user()->user == 1) {\n\t\t\treturn true;\n...
[ "0.8912773", "0.8882788", "0.8800633", "0.8598705", "0.85671127", "0.8563944", "0.8539474", "0.8499135", "0.8496032", "0.84778184", "0.8456616", "0.84487116", "0.8418807", "0.83447415", "0.83288795", "0.8324892", "0.8313899", "0.8303283", "0.8303283", "0.8298254", "0.82917976...
0.78878164
99
why not make this easier to use? some more parameters?
protected function parse_dim($dimensions) { $fix = false; $crop = false; $vh = false; switch (substr($dimensions, -1)) { case '#': $crop = true; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case '!': $fix = true; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case '<': $vh = "h"; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case '>': $vh = "v"; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case '(': $crop = true; $vh = "h"; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; case ')': $crop = true; $vh = "v"; $dimensions = substr($dimensions, 0, (strlen($dimensions)-1)); break; } $dim = explode("x", $dimensions); $width = (isset($dim[0]) && $dim[0] != '') ? $dim[0] : 0; $height = (isset($dim[1]) && $dim[1] != '') ? $dim[1] : 0; return array($width, $height, $fix, $crop, $vh); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function helper()\n\t{\n\t\n\t}", "private function _i() {\n }", "public function temporality();", "abstract protected function external();", "abstract protected function get_args();", "abstract protected function _process();", "abstract protected function _process();", "function process() ;"...
[ "0.5729864", "0.5333882", "0.52060205", "0.51564467", "0.51421", "0.5127276", "0.5127276", "0.5118297", "0.5102545", "0.5042685", "0.501365", "0.501365", "0.50058377", "0.49930936", "0.49890062", "0.49890062", "0.49881274", "0.49831456", "0.49779263", "0.49712408", "0.4966537...
0.0
-1
Loads information about the image. Will throw an exception if the image does not exist or is not an image.
public function __construct($file) { try { // Get the real path to the file $file = realpath($file); // Get the image information $info = getimagesize($file); } catch (Exception $e) { // Ignore all errors while reading the image } if (empty($file) OR empty($info)) { // throw new Exception('Not an image or invalid image: :file', // array(':file' => Kohana::debug_path($file))); return ''; } // Store the image information $this->file = $file; $this->width = $info[0]; $this->height = $info[1]; $this->type = $info[2]; $this->mime = image_type_to_mime_type($this->type); // Set the image creation function name switch ($this->type) { case IMAGETYPE_JPEG: $create = 'imagecreatefromjpeg'; break; case IMAGETYPE_GIF: $create = 'imagecreatefromgif'; break; case IMAGETYPE_PNG: $create = 'imagecreatefrompng'; break; } if ( ! isset($create) OR ! function_exists($create)) { // throw new Exception('Installed GD does not support :type images', // array(':type' => image_type_to_extension($this->type, FALSE))); } // Save function for future use $this->_create_function = $create; // Save filename for lazy loading $this->_image = $this->file; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagec...
[ "0.6800805", "0.6526379", "0.64549524", "0.6412039", "0.6254222", "0.61136574", "0.6025113", "0.5963989", "0.5930068", "0.5860133", "0.5857649", "0.5854881", "0.5831103", "0.57905465", "0.5789969", "0.57879233", "0.57879233", "0.57879233", "0.57879233", "0.5785168", "0.576087...
0.0
-1
Checks if GD is enabled and bundled. Bundled GD is required for some methods to work. Exceptions will be thrown from those methods when GD is not bundled.
public static function check() { if ( ! function_exists('gd_info')) { //throw new Exception('GD is either not installed or not enabled, check your configuration'); } if (defined('GD_BUNDLED')) { // Get the version via a constant, available in PHP 5. Image_GD::$_bundled = GD_BUNDLED; } else { // Get the version information $info = gd_info(); // Extract the bundled status Image_GD::$_bundled = (bool) preg_match('/\bbundled\b/i', $info['GD Version']); } if (defined('GD_VERSION')) { // Get the version via a constant, available in PHP 5.2.4+ $version = GD_VERSION; } else { // Get the version information $info = gd_info(); // Extract the version number preg_match('/\d+\.\d+(?:\.\d+)?/', $info['GD Version'], $matches); // Get the major version $version = $matches[0]; } if ( ! version_compare($version, '2.0.1', '>=')) { // throw new Exception('Image_GD requires GD version :required or greater, you have :version', // array('required' => '2.0.1', ':version' => $version)); } return Image_GD::$_checked = TRUE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function checkGDLibrary(){\n\t//Check for GD support\n\t\treturn extension_loaded('gd');\n\t}", "protected function check() {\n\n // check for a valid GD lib installation \n if(!function_exists('gd_info')) raise('GD Lib is not installed');\n\n }", "function gdInstalled() {\r\n return funct...
[ "0.7879122", "0.7671165", "0.73218316", "0.72018665", "0.71957904", "0.71631336", "0.71623176", "0.7110737", "0.7083069", "0.7068809", "0.6922137", "0.69061035", "0.6852401", "0.6835664", "0.6720914", "0.6707009", "0.66613716", "0.6656281", "0.656959", "0.6543717", "0.6363496...
0.7528866
2
Destroys the loaded image to free up resources.
public function __destruct() { if (is_resource($this->_image)) { // Free all resources imagedestroy($this->_image); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __destruct()\n {\n imagedestroy($this->image);\n }", "public function __destruct()\n {\n if ($this->image) {\n imagedestroy($this->image);\n }\n }", "public function destroy()\n {\n $this->_info = new stdClass();\n if( is_resource($this->_resou...
[ "0.8348592", "0.8333889", "0.83176297", "0.82952803", "0.8217895", "0.8199644", "0.8177189", "0.8166292", "0.81604576", "0.8083442", "0.807078", "0.79993165", "0.7846122", "0.7843388", "0.77906746", "0.7614439", "0.75315934", "0.749144", "0.7468518", "0.7460305", "0.7009431",...
0.82734156
4
Resize the image to the given size. Either the width or the height can be omitted and the image will be resized proportionally. // Resize to 200 pixels on the shortest side $image>resize(200, 200); // Resize to 200x200 pixels, keeping aspect ratio $image>resize(200, 200, Image::INVERSE); // Resize to 500 pixel width, keeping aspect ratio $image>resize(500, NULL); // Resize to 500 pixel height, keeping aspect ratio $image>resize(NULL, 500); // Resize to 200x500 pixels, ignoring aspect ratio $image>resize(200, 500, Image::NONE);
public function resize($width = NULL, $height = NULL, $master = NULL) { if ($master === NULL) { // Choose the master dimension automatically $master = Image::AUTO; } // Image::WIDTH and Image::HEIGHT depricated. You can use it in old projects, // but in new you must pass empty value for non-master dimension elseif ($master == Image::WIDTH AND ! empty($width)) { $master = Image::AUTO; // Set empty height for backvard compatibility $height = NULL; } elseif ($master == Image::HEIGHT AND ! empty($height)) { $master = Image::AUTO; // Set empty width for backvard compatibility $width = NULL; } if (empty($width)) { if ($master === Image::NONE) { // Use the current width $width = $this->width; } else { // If width not set, master will be height $master = Image::HEIGHT; } } if (empty($height)) { if ($master === Image::NONE) { // Use the current height $height = $this->height; } else { // If height not set, master will be width $master = Image::WIDTH; } } switch ($master) { case Image::AUTO: // Choose direction with the greatest reduction ratio $master = ($this->width / $width) > ($this->height / $height) ? Image::WIDTH : Image::HEIGHT; break; case Image::INVERSE: // Choose direction with the minimum reduction ratio $master = ($this->width / $width) > ($this->height / $height) ? Image::HEIGHT : Image::WIDTH; break; } switch ($master) { case Image::WIDTH: // Recalculate the height based on the width proportions $height = $this->height * $width / $this->width; break; case Image::HEIGHT: // Recalculate the width based on the height proportions $width = $this->width * $height / $this->height; break; } // Convert the width and height to integers $width = round($width); $height = round($height); $this->_do_resize($width, $height); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function resize($width, $height = null);", "public function resizeTo($width, $height, $resizeOption = 'default') {\n switch (strtolower($resizeOption)) {\n case 'exact':\n $this->resizeWidth = $width;\n $this->resizeHeight = $height;\n break;\...
[ "0.7357126", "0.72096777", "0.7058268", "0.69174933", "0.68890214", "0.67627215", "0.66837996", "0.66826135", "0.66611576", "0.65837675", "0.65561384", "0.65299714", "0.6529286", "0.65278107", "0.6523671", "0.6502308", "0.6456611", "0.64532137", "0.6434276", "0.64276624", "0....
0.6749627
6
Crop an image to the given size. Either the width or the height can be omitted and the current width or height will be used. If no offset is specified, the center of the axis will be used. If an offset of TRUE is specified, the bottom of the axis will be used. // Crop the image to 200x200 pixels, from the center $image>crop(200, 200);
public function crop($width, $height, $offset_x = NULL, $offset_y = NULL) { if ($width > $this->width) { // Use the current width $width = $this->width; } if ($height > $this->height) { // Use the current height $height = $this->height; } if ($offset_x === NULL) { // Center the X offset $offset_x = round(($this->width - $width) / 2); } elseif ($offset_x === TRUE) { // Bottom the X offset $offset_x = $this->width - $width; } elseif ($offset_x < 0) { // Set the X offset from the right $offset_x = $this->width - $width + $offset_x; } if ($offset_y === NULL) { // Center the Y offset $offset_y = round(($this->height - $height) / 2); } elseif ($offset_y === TRUE) { // Bottom the Y offset $offset_y = $this->height - $height; } elseif ($offset_y < 0) { // Set the Y offset from the bottom $offset_y = $this->height - $height + $offset_y; } // Determine the maximum possible width and height $max_width = $this->width - $offset_x; $max_height = $this->height - $offset_y; if ($width > $max_width) { // Use the maximum available width $width = $max_width; } if ($height > $max_height) { // Use the maximum available height $height = $max_height; } $this->_do_crop($width, $height, $offset_x, $offset_y); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function crop($width, $height, $offset_x=null, $offset_y=null);", "protected function _do_crop($width, $height, $offset_x, $offset_y)\n {\n $image = $this->_create($width, $height);\n\n // Loads image if not yet loaded\n $this->_load_image();\n\n // Execute the crop\n if (imagecopyresample...
[ "0.78189194", "0.66439575", "0.64920396", "0.6277231", "0.62416786", "0.6236862", "0.6133884", "0.6116691", "0.6055783", "0.6050034", "0.6044341", "0.60259306", "0.6005839", "0.59723556", "0.59148073", "0.588516", "0.58260214", "0.5798846", "0.5798543", "0.57856876", "0.57582...
0.6647961
1
Rotate the image by a given amount. // Rotate 45 degrees clockwise $image>rotate(45); // Rotate 90% counterclockwise $image>rotate(90);
public function rotate($degrees) { // Make the degrees an integer $degrees = (int) $degrees; if ($degrees > 180) { do { // Keep subtracting full circles until the degrees have normalized $degrees -= 360; } while($degrees > 180); } if ($degrees < -180) { do { // Keep adding full circles until the degrees have normalized $degrees += 360; } while($degrees < -180); } $this->_do_rotate($degrees); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function RotatedImage($file,$x,$y,$w,$h,$angle)\n{\n $this->Rotate($angle,$x,$y);\n $this->Image($file,$x,$y,$w,$h);\n $this->Rotate(0);\n}", "function rotate($img_name,$rotated_image,$direction){\n\t\t$image = $img_name;\n\t\t$extParts=explode(\".\",$image);\n\t\t$ext=end($extParts);\n\t\t$filename=$ro...
[ "0.7718361", "0.7675992", "0.7526446", "0.7262501", "0.7246608", "0.7246608", "0.7188207", "0.7151774", "0.7146723", "0.7057935", "0.7020458", "0.70078576", "0.69567716", "0.69564265", "0.6948983", "0.69157284", "0.686234", "0.68500435", "0.68397003", "0.6777366", "0.6740516"...
0.5473446
74
Flip the image along the horizontal or vertical axis. // Flip the image from top to bottom $image>flip(Image::HORIZONTAL); // Flip the image from left to right $image>flip(Image::VERTICAL);
public function flip($direction) { if ($direction !== Image::HORIZONTAL) { // Flip vertically $direction = Image::VERTICAL; } $this->_do_flip($direction); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function imageflip(&$image, $x = 0, $y = 0, $width = null, $height = null) {\n\tif ($width < 1)\n\t\t$width = imagesx($image);\n\tif ($height < 1)\n\t\t$height = imagesy($image);\n\t// Truecolor provides better results, if possible.\n\tif (function_exists('imageistruecolor') && imageistruecolor($image)) {\n\t\t$tm...
[ "0.74767643", "0.74740124", "0.7435241", "0.74295914", "0.73990226", "0.73853934", "0.73138785", "0.69941926", "0.69708556", "0.6954947", "0.68692875", "0.6749272", "0.67014897", "0.6616811", "0.6534605", "0.65026665", "0.641083", "0.63535464", "0.6193806", "0.6083866", "0.60...
0.6438851
16
Sharpen the image by a given amount. // Sharpen the image by 20% $image>sharpen(20);
public function sharpen($amount) { // The amount must be in the range of 1 to 100 $amount = min(max($amount, 1), 100); $this->_do_sharpen($amount); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function sharpenImage()\n\t{\n\t\t$this->checkImage();\n\n\t\tif (!$this->saveState && $this->sharpen == true) {\n\t\t\t$sharpness = $this->findSharp($this->width, $this->optimalWidth);\n\t\t\t$sharpenMatrix = array(\n\t\t\t\tarray(-1, -2, -1),\n\t\t\t\tarray(-2, $sharpness + 12, -2),\n\t\t\t\tarray(-1, -2...
[ "0.780681", "0.7317228", "0.7188619", "0.708618", "0.69203883", "0.6801079", "0.6792776", "0.5747679", "0.57320493", "0.57206446", "0.5687695", "0.55936396", "0.5477889", "0.5205381", "0.51199985", "0.5086683", "0.5029578", "0.49629986", "0.47916767", "0.4741838", "0.4726139"...
0.6656477
7
Add a reflection to an image. The most opaque part of the reflection will be equal to the opacity setting and fade out to full transparent. Alpha transparency is preserved. // Create a 50 pixel reflection that fades from 0100% opacity $image>reflection(50); // Create a 50 pixel reflection that fades from 1000% opacity $image>reflection(50, 100, TRUE); // Create a 50 pixel reflection that fades from 060% opacity $image>reflection(50, 60, TRUE); [!!] By default, the reflection will be go from transparent at the top to opaque at the bottom.
public function reflection($height = NULL, $opacity = 100, $fade_in = FALSE) { if ($height === NULL OR $height > $this->height) { // Use the current height $height = $this->height; } // The opacity must be in the range of 0 to 100 $opacity = min(max($opacity, 0), 100); $this->_do_reflection($height, $opacity, $fade_in); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function reflection($height=null, $opacity=null, $fade_in=null);", "public function transform(sfImage $image)\r\n {\r\n\r\n // Get the actual image resource\r\n $resource = $image->getAdapter()->getHolder();\r\n\r\n //get the resource dimentions\r\n $width = $image->getWidth();\r\n $height...
[ "0.68388355", "0.58590525", "0.55752647", "0.5130943", "0.49125236", "0.48945642", "0.47592044", "0.47167438", "0.46296737", "0.45433605", "0.4489357", "0.44642133", "0.44349244", "0.44130448", "0.44097447", "0.4372867", "0.43535054", "0.43534693", "0.43534693", "0.43534693", ...
0.56454366
2
Add a watermark to an image with a specified opacity. Alpha transparency will be preserved. If no offset is specified, the center of the axis will be used. If an offset of TRUE is specified, the bottom of the axis will be used. // Add a watermark to the bottom right of the image $mark = Image::factory('upload/watermark.png'); $image>watermark($mark, TRUE, TRUE);
public function watermark(Image $watermark, $offset_x = NULL, $offset_y = NULL, $opacity = 100) { if ($offset_x === NULL) { // Center the X offset $offset_x = round(($this->width - $watermark->width) / 2); } elseif ($offset_x === TRUE) { // Bottom the X offset $offset_x = $this->width - $watermark->width; } elseif ($offset_x < 0) { // Set the X offset from the right $offset_x = $this->width - $watermark->width + $offset_x; } if ($offset_y === NULL) { // Center the Y offset $offset_y = round(($this->height - $watermark->height) / 2); } elseif ($offset_y === TRUE) { // Bottom the Y offset $offset_y = $this->height - $watermark->height; } elseif ($offset_y < 0) { // Set the Y offset from the bottom $offset_y = $this->height - $watermark->height + $offset_y; } // The opacity must be in the range of 1 to 100 $opacity = min(max($opacity, 1), 100); $this->_do_watermark($watermark, $offset_x, $offset_y, $opacity); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function watermark($watermark, $offset_x=null, $offset_y=null, $opacity=null);", "public function add_watermark_to_( $image ) {\n\n\t\t// TODO Select graphics library from plugin settings (this is GD, add Imagick)\n\n\t\t$watermark_file = get_attached_file( $this->settings['watermark']['image'] );\n\n\t\t...
[ "0.8594125", "0.775226", "0.7401763", "0.73029447", "0.73026496", "0.7153652", "0.7117748", "0.69545376", "0.6895416", "0.6851341", "0.68019307", "0.6738347", "0.67224705", "0.66621417", "0.6597992", "0.65832454", "0.6577887", "0.6549959", "0.652484", "0.64720017", "0.6461848...
0.8034334
1
Set the background color of an image. This is only useful for images with alpha transparency. // Make the image background black $image>background('000'); // Make the image background black with 50% opacity $image>background('000', 50);
public function background($color, $opacity = 100) { if ($color[0] === '#') { // Remove the pound $color = substr($color, 1); } if (strlen($color) === 3) { // Convert shorthand into longhand hex notation $color = preg_replace('/./', '$0$0', $color); } // Convert the hex into RGB values list ($r, $g, $b) = array_map('hexdec', str_split($color, 2)); // The opacity must be in the range of 0 to 100 $opacity = min(max($opacity, 0), 100); $this->_do_background($r, $g, $b, $opacity); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function set_background_color()\n {\n imagecolorallocate(\n $this->img,\n L_BACKGROUND_COLOR_R,\n L_BACKGROUND_COLOR_G,\n L_BACKGROUND_COLOR_B\n );\n }", "public static function background($value)\n {\n self::$background = Color::t...
[ "0.79896325", "0.7035235", "0.663013", "0.6621289", "0.6621289", "0.6621289", "0.6621289", "0.6566006", "0.65092456", "0.6485428", "0.641499", "0.63589096", "0.6237104", "0.62353545", "0.61726856", "0.61726856", "0.60831445", "0.6063705", "0.605798", "0.59767365", "0.5962902"...
0.5427761
44
Save the image. If the filename is omitted, the original image will be overwritten. // Save the image as a PNG $image>save('saved/cool.png'); // Overwrite the original image $image>save(); [!!] If the file exists, but is not writable, an exception will be thrown. [!!] If the file does not exist, and the directory is not writable, an exception will be thrown.
public function save($file = NULL, $quality = 100) { if ($file === NULL) { // Overwrite the file $file = $this->file; } if (is_file($file)) { if ( ! is_writable($file)) { throw new Exception('File must be writable'); } } else { // Get the directory of the file $directory = realpath(pathinfo($file, PATHINFO_DIRNAME)); if ( ! is_dir($directory) OR ! is_writable($directory)) { throw new Exception('Directory must be writable'); } } // The quality must be in the range of 1 to 100 $quality = min(max($quality, 1), 100); return $this->_do_save($file, $quality); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function save($img, $filename);", "protected function save()\n {\n switch ($this->image_info['mime']) {\n \n case 'image/gif':\n imagegif($this->image, $this->getPath(true));\n break;\n \n case 'image/jpeg':\n imagejpeg($this-...
[ "0.7662879", "0.69788116", "0.6926806", "0.68358123", "0.6674351", "0.6625614", "0.6565919", "0.6548842", "0.6491323", "0.6469623", "0.6458421", "0.6442479", "0.64292246", "0.6367738", "0.63242394", "0.6324052", "0.62599343", "0.6175783", "0.61396295", "0.60573727", "0.604209...
0.0
-1
Render the image and return the binary string. // Render the image at 50% quality $data = $image>render(NULL, 50); // Render the image as a PNG $data = $image>render('png');
public function render($type = NULL, $quality = 100) { if ($type === NULL) { // Use the current image type $type = image_type_to_extension($this->type, FALSE); } return $this->_do_render($type, $quality); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function image_render()\r\n {\r\n // Send the correct HTTP header\r\n \\header(\"Cache-Control:no-cache,must-revalidate\");\r\n \\header(\"Pragma:no-cache\");\r\n \\header('Content-Type: image/'.static::$image_type);\r\n \\header(\"Connection:close\");\r\n\r\n ...
[ "0.6845505", "0.6737439", "0.66208655", "0.66094285", "0.6591611", "0.65501165", "0.6513753", "0.64308685", "0.641859", "0.641859", "0.6394242", "0.63301736", "0.6313328", "0.6285644", "0.62258816", "0.61851156", "0.61792576", "0.61117417", "0.61000764", "0.60812074", "0.6080...
0.6014523
24
Loads an image into GD.
protected function _load_image() { if ( ! is_resource($this->_image)) { // Gets create function $create = $this->_create_function; // Open the temporary image $this->_image = $create($this->file); // Preserve transparency when saving imagesavealpha($this->_image, TRUE); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagec...
[ "0.7279598", "0.6560022", "0.6535591", "0.65068156", "0.6391081", "0.6183456", "0.6068901", "0.60112375", "0.59473675", "0.59314656", "0.5929995", "0.5923906", "0.591783", "0.5917558", "0.5894933", "0.58916134", "0.58810747", "0.58702743", "0.5832721", "0.57782984", "0.577829...
0.68958074
1
Presize width and height
protected function _do_resize($width, $height) { $pre_width = $this->width; $pre_height = $this->height; // Loads image if not yet loaded $this->_load_image(); // Test if we can do a resize without resampling to speed up the final resize if ($width > ($this->width / 2) AND $height > ($this->height / 2)) { // The maximum reduction is 10% greater than the final size $reduction_width = round($width * 1.1); $reduction_height = round($height * 1.1); while ($pre_width / 2 > $reduction_width AND $pre_height / 2 > $reduction_height) { // Reduce the size using an O(2n) algorithm, until it reaches the maximum reduction $pre_width /= 2; $pre_height /= 2; } // Create the temporary image to copy to $image = $this->_create($pre_width, $pre_height); if (imagecopyresized($image, $this->_image, 0, 0, 0, 0, $pre_width, $pre_height, $this->width, $this->height)) { // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $image; } } // Create the temporary image to copy to $image = $this->_create($width, $height); // Execute the resize if (imagecopyresampled($image, $this->_image, 0, 0, 0, 0, $width, $height, $pre_width, $pre_height)) { // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $image; // Reset the width and height $this->width = imagesx($image); $this->height = imagesy($image); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function resize(){\n\n}", "abstract public function resize($properties);", "public function resize($width, $height = null);", "public function resizePx($width,$height) {\n\t\t$this->_width = $width;\n\t\t$this->_height = $height;\n\t\treturn $this;\n\t}", "function resize($width,$height)\n ...
[ "0.70774007", "0.68458486", "0.6583758", "0.65757143", "0.6547624", "0.6477724", "0.645179", "0.6446837", "0.6428243", "0.6398771", "0.635543", "0.6324176", "0.6318995", "0.63087445", "0.62907344", "0.6288065", "0.6260297", "0.6246836", "0.6209749", "0.6191392", "0.617371", ...
0.57362384
67
Create the temporary image to copy to
protected function _do_crop($width, $height, $offset_x, $offset_y) { $image = $this->_create($width, $height); // Loads image if not yet loaded $this->_load_image(); // Execute the crop if (imagecopyresampled($image, $this->_image, 0, 0, $offset_x, $offset_y, $width, $height, $width, $height)) { // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $image; // Reset the width and height $this->width = imagesx($image); $this->height = imagesy($image); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createTemporaryImage()\n {\n $tmpDir = sys_get_temp_dir();\n $fileName = $tmpDir . DIRECTORY_SEPARATOR . 'image_project_unit_test_' . time() . rand() . '.jpg';\n $gd = imagecreatetruecolor(400, 300);\n imagefill($gd, 50, 50, 1);\n\n imagejpeg($gd, $fileName, 10...
[ "0.7554619", "0.66591173", "0.64988375", "0.64308274", "0.6373878", "0.6361806", "0.6343417", "0.6313749", "0.6147725", "0.6134345", "0.6097174", "0.6091913", "0.5964198", "0.5941242", "0.59222245", "0.58710253", "0.58621943", "0.5841999", "0.58217776", "0.5809876", "0.580952...
0.0
-1
Create the flipped image
protected function _do_flip($direction) { $flipped = $this->_create($this->width, $this->height); // Loads image if not yet loaded $this->_load_image(); if ($direction === Image::HORIZONTAL) { for ($x = 0; $x < $this->width; $x++) { // Flip each row from top to bottom imagecopy($flipped, $this->_image, $x, 0, $this->width - $x - 1, 0, 1, $this->height); } } else { for ($y = 0; $y < $this->height; $y++) { // Flip each column from left to right imagecopy($flipped, $this->_image, 0, $y, 0, $this->height - $y - 1, $this->width, 1); } } // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $flipped; // Reset the width and height $this->width = imagesx($flipped); $this->height = imagesy($flipped); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function flipVertical() {\n\t\tif(!$this->image) {\n\t\t\ttrigger_error('The image does not exist or is not readable.', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\n\t\t$working_image = imagecreatetruecolor($this->width, $this->height);\n\t\tif(imagecopyresampled($working_image, $this->image, 0, 0, 0, $t...
[ "0.7195381", "0.6903706", "0.6870645", "0.6819707", "0.6819531", "0.6662779", "0.64357245", "0.6301936", "0.61989546", "0.6156402", "0.6132216", "0.5997638", "0.5989538", "0.59817857", "0.5978206", "0.592543", "0.5844693", "0.57515925", "0.5711293", "0.5709704", "0.57010496",...
0.66774774
5
Loads image if not yet loaded
protected function _do_background($r, $g, $b, $opacity) { $this->_load_image(); // Convert an opacity range of 0-100 to 127-0 $opacity = round(abs(($opacity * 127 / 100) - 127)); // Create a new background $background = $this->_create($this->width, $this->height); // Allocate the color $color = imagecolorallocatealpha($background, $r, $g, $b, $opacity); // Fill the image with white imagefilledrectangle($background, 0, 0, $this->width, $this->height, $color); // Alpha blending must be enabled on the background! imagealphablending($background, TRUE); // Copy the image onto a white background to remove all transparency if (imagecopy($background, $this->_image, 0, 0, 0, 0, $this->width, $this->height)) { // Swap the new image for the old one imagedestroy($this->_image); $this->_image = $background; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagec...
[ "0.7510242", "0.7247902", "0.72165185", "0.7079294", "0.7043849", "0.700722", "0.66745865", "0.6577331", "0.6419409", "0.6392677", "0.63886935", "0.6376109", "0.6263727", "0.6214442", "0.6175348", "0.60436434", "0.6040354", "0.6004984", "0.59886205", "0.5982271", "0.5954268",...
0.0
-1
Loads image if not yet loaded
protected function _do_save($file, $quality) { $this->_load_image(); // Get the extension of the file $extension = pathinfo($file, PATHINFO_EXTENSION); // Get the save function and IMAGETYPE list($save, $type) = $this->_save_function($extension, $quality); // Save the image to a file $status = isset($quality) ? $save($this->_image, $file, $quality) : $save($this->_image, $file); if ($status === TRUE AND $type !== $this->type) { // Reset the image type and mime type $this->type = $type; $this->mime = image_type_to_mime_type($type); } return TRUE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagec...
[ "0.7510242", "0.7247902", "0.72165185", "0.7079294", "0.7043849", "0.700722", "0.66745865", "0.6577331", "0.6419409", "0.6392677", "0.63886935", "0.6376109", "0.6263727", "0.6214442", "0.6175348", "0.60436434", "0.6040354", "0.6004984", "0.59886205", "0.5982271", "0.5954268",...
0.0
-1
Loads image if not yet loaded
protected function _do_render($type, $quality) { $this->_load_image(); // Get the save function and IMAGETYPE list($save, $type) = $this->_save_function($type, $quality); // Capture the output ob_start(); // Render the image $status = isset($quality) ? $save($this->_image, NULL, $quality) : $save($this->_image, NULL); if ($status === TRUE AND $type !== $this->type) { // Reset the image type and mime type $this->type = $type; $this->mime = image_type_to_mime_type($type); } return ob_get_clean(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImage()\n\t{\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t$this->ImageStream = @imagecreatefromgif($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$this->ImageStream = @imagecreatefromjpeg($this->sFileLocation);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$this->ImageStream = @imagec...
[ "0.7510242", "0.7247902", "0.72165185", "0.7079294", "0.7043849", "0.700722", "0.66745865", "0.6577331", "0.6419409", "0.6392677", "0.63886935", "0.6376109", "0.6263727", "0.6214442", "0.6175348", "0.60436434", "0.6040354", "0.6004984", "0.59886205", "0.5982271", "0.5954268",...
0.0
-1
Get the GD saving function and image type for this extension. Also normalizes the quality setting
protected function _save_function($extension, & $quality) { switch (strtolower($extension)) { case 'jpg': case 'jpeg': // Save a JPG file $save = 'imagejpeg'; $type = IMAGETYPE_JPEG; break; case 'gif': // Save a GIF file $save = 'imagegif'; $type = IMAGETYPE_GIF; // GIFs do not a quality setting $quality = NULL; break; case 'png': // Save a PNG file $save = 'imagepng'; $type = IMAGETYPE_PNG; // Use a compression level of 9 (does not affect quality!) $quality = 9; break; default: throw new Exception('Installed GD does not support :type images', array(':type' => $extension)); break; } return array($save, $type); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getGDType(){\n \t\treturn isset($GLOBALS[\"GDIMAGE_TYPE\"][strtolower($this->Extension)]) ? $GLOBALS[\"GDIMAGE_TYPE\"][strtolower($this->Extension)] : \"jpg\";\n\t}", "function getGDType(){\n\t\treturn isset(we_base_imageEdit::$GDIMAGE_TYPE[strtolower($this->Extension)]) ? we_base_imageEdit::$GDIMAGE_T...
[ "0.73923534", "0.71739316", "0.66663194", "0.60201335", "0.5980345", "0.59768635", "0.5898809", "0.5890547", "0.58843863", "0.5835049", "0.5814651", "0.5807202", "0.5803945", "0.57777286", "0.57446337", "0.5733839", "0.571005", "0.56993294", "0.56830055", "0.56557226", "0.565...
0.6354834
3
Create an empty image with the given width and height.
protected function _create($width, $height) { // Create an empty image $image = imagecreatetruecolor($width, $height); // Do not apply alpha blending imagealphablending($image, FALSE); // Save alpha levels imagesavealpha($image, TRUE); return $image; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function create_blank_image() {\r\n\t\t$image = imagecreatetruecolor( $this->diameter,$this->diameter );\r\n\r\n\t\t/* we also need a transparent background ... */\r\n\t\timagesavealpha($image, true);\r\n\r\n\t\t/* create a transparent color ... */\r\n\t\t$color = imagecolorallocatealpha($image, 0, 0, 0, 1...
[ "0.7229427", "0.6914227", "0.68399566", "0.6764752", "0.6508632", "0.63181525", "0.62752", "0.61417097", "0.6137881", "0.61121744", "0.5987968", "0.5931884", "0.5836678", "0.58366257", "0.582283", "0.5764109", "0.5719337", "0.5707742", "0.5653852", "0.56410766", "0.5611552", ...
0.6868188
2
Create a custom Monolog instance.
public function __invoke(array $config) { $logger = new Logger('slack_deduplicated'); $slackHandler = new SlackWebhookHandler( $config['url'], $config['channel'] ?? null, $config['username'] ?? 'Laravel', $config['attachment'] ?? true, $config['emoji'] ?? ':boom:', $config['short'] ?? false, $config['context'] ?? true, Logger::DEBUG, $config['bubble'] ?? true, $config['exclude_fields'] ?? [] ); $logger->pushHandler(new DeduplicationHandler( $slackHandler, storage_path('logs/duplicates.log'), Logger::DEBUG, $config['time'] ?? 3600, true )); return $logger; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __construct()\n {\n $this->log = new Monolog('');\n $this->log->pushProcessor(new PsrLogMessageProcessor);\n\n $config = array_merge([\n 'type' => 'daily',\n 'level' => 'debug',\n 'max_files' => 5,\n 'app_file' => 'ap...
[ "0.7079103", "0.669472", "0.6669259", "0.6624679", "0.66114056", "0.6527272", "0.6469319", "0.6383948", "0.63522387", "0.6308052", "0.6270581", "0.6255487", "0.6176386", "0.61563534", "0.6154256", "0.61280835", "0.61105025", "0.61007816", "0.6093689", "0.6065181", "0.60369456...
0.5293467
97
filter Returns FALSE to accept the message, TRUE to block it.
public function filter(Record $record);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public static function shouldReceive()\n {\n }", "public function accept()\n {\n return tru...
[ "0.6195605", "0.6195605", "0.6195605", "0.6195605", "0.59890264", "0.57204306", "0.56514686", "0.56514686", "0.56456274", "0.5576791", "0.54758006", "0.5474054", "0.5439187", "0.5437542", "0.54011244", "0.5356302", "0.5345653", "0.53178", "0.53154445", "0.53024834", "0.529065...
0.0
-1
Gets the supplied form submission data mapped to a dto.
public function mapFormSubmissionToDto(array $submission) { $formData = $this->getStagedForm()->process($submission); return new ObjectActionParameter( $formData[IObjectAction::OBJECT_FIELD_NAME], new ArrayDataObject($formData) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getSubmissionData($submission_id, $form_id) {\n \n }", "public function getSubmissionData()\n {\n return $this->data;\n }", "public function getSubmissionData()\n {\n return $this->data;\n }", "public function getSubmissionData()\n {\n return $thi...
[ "0.6403062", "0.6137485", "0.6137485", "0.6137485", "0.6137485", "0.6114024", "0.6100388", "0.60034484", "0.5717522", "0.56829906", "0.56637377", "0.5591791", "0.55847156", "0.5516104", "0.5516104", "0.5483597", "0.5465517", "0.5428606", "0.54221725", "0.5412459", "0.5406923"...
0.62813884
1
Get all the inputs.
public function postRegisterUser() { $userdata = array( 'fullname' => Input::get('fullname'), 'email' => Input::get('email'), 'password' => Input::get('password') ); // Declare the rules for the form validation. $rules = array( 'fullname' => 'Required', 'email' => 'Required', 'password' => 'Required' ); // Validate the inputs. $validator = Validator::make($userdata, $rules); // Check if the form validates with success. if ($validator->passes()) { $user = User::where('email' , '=', $userdata['email'])->first(); if($user == null) { $user = new User; $user->fullname = $userdata['fullname']; $user->email = $userdata['email']; $user->password = Hash::make($userdata['password']); $user->save(); if ( Auth::attempt($userdata ) ) { return Redirect::to(''); } } else { return Redirect::to('register')->withErrors(array('email' => 'Email already has an account'))->withInput(Input::except('password')); } } //something went wrong return Redirect::to('register')->withErrors($validator)->withInput(Input::except('password')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getInputs()\n {\n return $this->inputs;\n }", "public function getInputs()\n {\n return array();\n }", "protected function inputs()\n {\n return [];\n }", "public function inputs()\n {\n return $this->inputs;\n }", "public function getInpu...
[ "0.7965205", "0.79228604", "0.782545", "0.7811779", "0.77420044", "0.75788087", "0.7366298", "0.695331", "0.6941443", "0.6918222", "0.6666754", "0.66185474", "0.6595184", "0.6554888", "0.64162755", "0.6367297", "0.63620645", "0.6359621", "0.62736595", "0.6265544", "0.624815",...
0.0
-1
Get URL from internal cache if exists.
protected function getUrlFromCache($cacheKey, $route, $params) { if (!empty($this->_ruleCache[$cacheKey])) { foreach ($this->_ruleCache[$cacheKey] as $rule) { /* @var $rule UrlRule */ if (($url = $rule->createUrl($this, $route, $params)) !== false) { return $url; } } } else { $this->_ruleCache[$cacheKey] = []; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function getURLcache($url){\n\n\t\t$urlContent = false;\n\t\t$cacheFile = PATH_site.'typo3temp/t3m_'.md5($_SERVER['HTTP_HOST'] . $url);\n\t\tif( !file_exists($cacheFile) || filemtime($cacheFile) < (time()-(3600*24*3)) ){\n\t\t\t$urlContent = trim(t3lib_div::getURL($url));\n\t\t\tif( !empty($urlContent) )...
[ "0.6388731", "0.6384673", "0.63411176", "0.62882966", "0.62544155", "0.6218115", "0.61667085", "0.61021096", "0.6101198", "0.6083538", "0.60320854", "0.6018289", "0.600961", "0.59426427", "0.59359604", "0.59247637", "0.5896218", "0.5884583", "0.5879206", "0.5811783", "0.57880...
0.61447453
7
Store rule (e.g. [[UrlRule]]) to internal cache.
protected function setRuleToCache($cacheKey, UrlRuleInterface $rule) { $this->_ruleCache[$cacheKey][] = $rule; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function saveCache(): void\n {\n //====================================================================//\n // Safety Check\n if (!isset($this->cacheItem) || !isset($this->cache) || empty($this->cache)) {\n return;\n }\n //===================================...
[ "0.5680179", "0.55724484", "0.55054665", "0.5440866", "0.54273087", "0.538548", "0.5383786", "0.53703", "0.5359271", "0.53575253", "0.53458375", "0.5341233", "0.53408355", "0.53124565", "0.5282261", "0.52774346", "0.52530915", "0.5242294", "0.52031064", "0.5185662", "0.515281...
0.712807
0
Procura no banco todos os clientes retornando um array
public function actionLista() { $model = Cliente::findall(); // Criação do provider para uso no grid view if ($model) { $provider = new ArrayDataProvider([ 'allModels' => $model, 'sort' => [ // 'attributes' => ['cpf_cliente', 'nome', 'telefone'], ], 'pagination' => [ 'pageSize' => 10, ], ]); } else $provider = null; return $this->render('cliente/lista', ['dataProvider' => $provider]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function listarClientes(){\n $this->bd->getConeccion();\n $sql = \"SELECT * FROM CLIENTE\";\n $registros = $this->bd->executeQueryReturnData($sql); \n $this->bd->cerrarConeccion(); \n $clientes = array(); \n \n foreach ($registros as $cliente) {\n $clien...
[ "0.8366002", "0.82650477", "0.81932837", "0.79748905", "0.79659253", "0.7963666", "0.79495156", "0.79322773", "0.79175144", "0.7793616", "0.7793473", "0.7745171", "0.7701065", "0.76985186", "0.7695293", "0.7630131", "0.7537953", "0.7458199", "0.74571985", "0.74463844", "0.741...
0.0
-1
Determine if the user is authorized to make this request.
public function authorize() { return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function authorize()\n {\n if ($this->user() !== null) {\n return true;\n }\n return false;\n }", "public function authorize()\n {\n return $this->user() !== null;\n }", "public function authorize()\n {\n return $this->user() !== null;\n }"...
[ "0.8401071", "0.8377486", "0.8377486", "0.8344406", "0.8253731", "0.824795", "0.8213121", "0.8146598", "0.81115526", "0.8083369", "0.7991986", "0.79907674", "0.79836637", "0.79604936", "0.79516214", "0.79494005", "0.79265946", "0.7915068", "0.79001635", "0.7894822", "0.789145...
0.0
-1
Get The error messages
public function messages() { return [ 'name.required' => 'Sie müssen einen Hotelnamen angeben!', 'description.required' => 'Sie müssen einen Beschreibung angeben!', 'stars.required' => 'Sie müssen die Anzahl Sterne angeben!', 'street.required' => 'Sie müssen eine Strasse angeben!', 'postalcode.required' => 'Sie müssen eine Postleitzahl angeben!', 'area.required' => 'Sie müssen einen Ort angeben!', 'phone.required' => 'Sie müssen eine Telefonnummer angeben!', 'phone.regex' => 'Sie müssen eine gültige Telefonnummer angeben!', 'fax.required' => 'Sie müssen eine Faxnummer angeben!', 'fax.regex' => 'Sie müssen eine gültige Faxnummer angeben!', 'email.required' => 'Sie müssen eine E-Mail Adresse angeben!', 'email.email' => 'Sie müssen eine gültige E-Mail Adresse angeben!', ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getErrorMessages() {}", "public function get_error_messages();", "public function getErrorMessages() {\n\t\t$errorMessages = '';\n\t\tforeach ($this->errorMessages as $index => $error) {\n\t\t\t$errorMessages .= \"[Error:\" . $index . '] ' . $error . \"\\n<br />\";\n\t\t}\n\t\treturn $errorMess...
[ "0.8909136", "0.87320673", "0.8414456", "0.8338383", "0.8225785", "0.81918263", "0.8106275", "0.8084946", "0.8044304", "0.79884386", "0.796195", "0.7904297", "0.7883454", "0.7883454", "0.7883454", "0.7883454", "0.7879226", "0.78183746", "0.78084075", "0.77935994", "0.7774201"...
0.0
-1
Get the validation rules that apply to the request.
public function rules() { return [ 'name' => 'required', 'description' => 'required', 'stars' => 'required|integer|between:1,5', 'street' => 'required', 'postalcode' => 'required', 'area' => 'required', 'phone' => ['required', 'regex:/^(?=.*[0-9])[ +()0-9]+$/' ], 'fax' => ['required', 'regex:/^(?=.*[0-9])[ +()0-9]+$/' ], 'email' => 'required|email', 'managers' => '' ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function rules()\n {\n $commons = [\n\n ];\n return get_request_rules($this, $commons);\n }", "public function getRules()\n {\n return $this->validator->getRules();\n }", "public function getValidationRules()\n {\n $rules = [];\n\n // Get the sche...
[ "0.83426684", "0.8012867", "0.79357", "0.7925642", "0.7922824", "0.79036003", "0.785905", "0.77895427", "0.77832615", "0.7762324", "0.77367616", "0.7732319", "0.7709478", "0.7691477", "0.76847756", "0.7682022", "0.7682022", "0.7682022", "0.7682022", "0.7682022", "0.7682022", ...
0.0
-1
fnoction qui supprime un visiteur de la bdd
function suppMembre($id) { $this->db->where('id', $id); $this->db->delete('membres'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function hidupkan();", "function eliminar($bd);", "public function nadar()\n {\n }", "function chnodesp($numero){\n\t\t$dbnumero = $this->db->escape($numero);\n\t\t$fdespacha= $this->datasis->dameval(\"SELECT fdespacha FROM sfac WHERE numero=${dbnumero}\");\n\t\tif(empty($fdespacha)){\n...
[ "0.6476358", "0.5901739", "0.57376826", "0.572087", "0.5710846", "0.5703916", "0.5699055", "0.5666657", "0.56664395", "0.56632733", "0.5647472", "0.56401664", "0.56400067", "0.5625963", "0.56224066", "0.56222665", "0.5608378", "0.5593632", "0.55833405", "0.55806863", "0.55806...
0.0
-1
fn generate the win number in list
public function generateWinNumber($numbers = array()) { // Shuffle an array shuffle($numbers); // If array has only one number. if (count($numbers) === 0) { return false; } // Random number secure, start from 0 to length of list // Generates cryptographically secure pseudo-random integers (position) $positionNumber = random_int(0, count($numbers) - 1); // Retrieve random number $result = $numbers[$positionNumber]; return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function whoWins(){\n $winners = array();\n $n = 100;\n for($i=0;$i<=$n;$i++){\n $winner = playTournament();\n if(!isset($winners[$winner])){\n $winners[$winner] = 1;\n } else {\n $winners[$winner] += 1;\n }\n }\n arsort($winners);\n foreach($winn...
[ "0.66740984", "0.6458077", "0.5894908", "0.5891992", "0.57814527", "0.57438004", "0.55830646", "0.55447805", "0.548594", "0.54627687", "0.5455086", "0.5410818", "0.5391878", "0.5391666", "0.5367776", "0.53535694", "0.53379446", "0.532294", "0.5312466", "0.5283265", "0.5272764...
0.6060513
2
fn object win number in list
public function findTicketNumber($winNumber = -1, $ticketNumbers = array()){ foreach ($ticketNumbers as $index => $ticketNumber) { if ((int)$ticketNumber->number === (int)$winNumber) { return $ticketNumber; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function whoWins(){\n $winners = array();\n $n = 100;\n for($i=0;$i<=$n;$i++){\n $winner = playTournament();\n if(!isset($winners[$winner])){\n $winners[$winner] = 1;\n } else {\n $winners[$winner] += 1;\n }\n }\n arsort($winners);\n foreach($winn...
[ "0.5548006", "0.51379645", "0.5085659", "0.5050009", "0.49657753", "0.4912264", "0.48874834", "0.4880526", "0.48799905", "0.47983626", "0.47726303", "0.47624794", "0.4709304", "0.46888727", "0.4687722", "0.46688807", "0.46565464", "0.4650841", "0.4644073", "0.4625243", "0.461...
0.49177742
5
Attempt to authenticate a user using the given credentials.
public function attempt(array $credentials = [], $remember = false) { try { $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); //Check if the user exists in local data store if (! ($user instanceof Authenticatable)) { throw new NoLocalUserException(); } if ($this->hasValidCredentials($user, $credentials)) { return $this->login($user); } return false; } catch (NoLocalUserException $e) { Log::error('CognitoTokenGuard:attempt:NoLocalUserException:'); throw $e; } catch (CognitoIdentityProviderException $e) { Log::error('CognitoTokenGuard:attempt:CognitoIdentityProviderException:' . $e->getAwsErrorCode()); //Set proper route if (! empty($e->getAwsErrorCode())) { $errorCode = 'CognitoIdentityProviderException'; switch ($e->getAwsErrorCode()) { case 'PasswordResetRequiredException': $errorCode = 'cognito.validation.auth.reset_password'; break; case 'NotAuthorizedException': $errorCode = 'cognito.validation.auth.user_unauthorized'; break; default: $errorCode = $e->getAwsErrorCode(); break; } return response()->json(['error' => $errorCode, 'message' => $e->getAwsErrorCode()], 400); } return $e->getAwsErrorCode(); } catch (AwsCognitoException $e) { Log::error('CognitoTokenGuard:attempt:AwsCognitoException:' . $e->getMessage()); throw $e; } catch (Exception $e) { Log::error('CognitoTokenGuard:attempt:Exception:' . $e->getMessage()); throw $e; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function authenticate(array $credentials)\n {\n foreach ($this->backends as $backend) {\n try {\n // trust the user, and just call the authenticate method.\n $user = $backend->authenticate($credentials);\n } catch (Exceptions\\NotSupportedCredent...
[ "0.7254412", "0.70172423", "0.6965639", "0.6842092", "0.6836163", "0.67025554", "0.66943187", "0.6681742", "0.66738963", "0.6564419", "0.6559786", "0.65471256", "0.6471956", "0.64608675", "0.64457256", "0.64186496", "0.64145", "0.6414472", "0.6410185", "0.6409826", "0.6408646...
0.0
-1
Create a token for a user.
private function login($user) { if (! empty($this->claim)) { //Save the claim if it matches the Cognito Claim if ($this->claim instanceof AwsCognitoClaim) { //Set Token $this->setToken(); } //Set user $this->setUser($user); } return $this->claim; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createToken();", "public function createToken(\\Navis\\UserBundle\\Entity\\User $user)\n {\n $token = sha1(time().$user->getSecretToken());\n\n $user->setAccessToken($token);\n $user->setExpiresAt(time()+300);//añado 5 minutos al tiempo de expiracion del token\n\n $...
[ "0.7698893", "0.7391423", "0.7370758", "0.734142", "0.7303722", "0.71713793", "0.7087433", "0.70764303", "0.7051596", "0.70074874", "0.700475", "0.69972116", "0.69050264", "0.68760985", "0.68501157", "0.6830758", "0.6820572", "0.67820513", "0.6754841", "0.67490524", "0.674905...
0.0
-1
Fucntion ends Set the token.
public function setToken() { $this->cognito->setClaim($this->claim)->storeToken(); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function set($token);", "public function setToken(string $token): void;", "public function setToken($token);", "function setToken($token)\n {\n $this->token = $token;\n }", "public function setToken($token){\n $this->token = $token;\n }", "public function setToke...
[ "0.79208195", "0.785612", "0.7737798", "0.74588406", "0.73750573", "0.71573913", "0.7115457", "0.70927954", "0.7083504", "0.7083504", "0.70310116", "0.6872293", "0.68073165", "0.6719096", "0.6700787", "0.66472566", "0.6645294", "0.65537167", "0.6522115", "0.64822143", "0.6480...
0.5687528
95
Logout the user, thus invalidating the token.
public function logout($forceForever = false) { $this->invalidate($forceForever); $this->user = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function logout() {\n\t$new_token = sha1(TOKEN_SALT.$this->user->email.Utils::generate_random_string());\n\t\n\t# Create the data array we'll use with the update method\n\t# In this case, we're only updating one field, so our array only has one entry\n\t$data = Array(\"token\" => $new_token);\n\t\n\t# Do th...
[ "0.8408453", "0.83963764", "0.83770245", "0.83718973", "0.8323235", "0.82815313", "0.82600856", "0.8218627", "0.82179165", "0.8188585", "0.81540143", "0.8150022", "0.8135342", "0.81231207", "0.8114682", "0.8054704", "0.8028382", "0.7945337", "0.79325557", "0.79283434", "0.791...
0.0
-1
Get the authenticated user.
public function user() { //Check if the user exists if (! is_null($this->user)) { return $this->user; } //Retrieve token from request and authenticate return $this->getTokenForRequest(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAuthenticatedUser()\n {\n // get the web-user\n $user = Auth::guard()->user();\n\n // get the api-user\n if(!isset($user) && $user == null) {\n $user = Auth::guard('api')->user();\n }\n return $user;\n }", "private function getAuthenticatedUser()\...
[ "0.8636257", "0.85953075", "0.85953075", "0.85888106", "0.8318398", "0.8286792", "0.8278905", "0.81200147", "0.8008301", "0.7995013", "0.7995013", "0.7988806", "0.797304", "0.7970671", "0.7966893", "0.7926469", "0.79074126", "0.7891598", "0.78681654", "0.7861022", "0.785861",...
0.7956038
15
Get the token for the current request.
public function getTokenForRequest() { //Check for request having token if (! $this->cognito->parser()->setRequest($this->request)->hasToken()) { return null; } if (! $this->cognito->parseToken()->authenticate()) { throw new NoLocalUserException(); } //Get claim $claim = $this->cognito->getClaim(); if (empty($claim)) { return null; } //Get user and return return $this->user = $this->provider->retrieveById($claim['sub']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_request_token()\n {\n $sess_id = $_COOKIE[ini_get('session.name')];\n if (!$sess_id) $sess_id = session_id();\n $plugin = $this->plugins->exec_hook('request_token', array('value' => md5('RT' . $this->get_user_id() . $this->config->get('des_key') . $sess_id)));\n return $plugin['val...
[ "0.7793079", "0.76922476", "0.7682764", "0.7675397", "0.7638158", "0.7598385", "0.7591153", "0.7576759", "0.7566031", "0.7564487", "0.75496787", "0.7549625", "0.751833", "0.75096416", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089765", "0.75089...
0.0
-1