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
/ Load configuration data
private function _load($session) { if (isset($session['configuration']) && is_array($session['configuration'])) { $this->_configuration = $session['configuration']; } else { $this->_configuration = include 'config.php'; $this->_check(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function loadConfig($data);", "abstract protected function loadConfig();", "function load_config() {\n\t\t$conf_file = @file_get_contents( LDAP_LOGIN_PATH.'data.dat' );\n\t\tif ($conf_file!==false)\n\t\t{\n\t\t\t$this->config = unserialize($conf_file);\n\t\t}\n\t}", "public static function load()\n ...
[ "0.84316874", "0.8128195", "0.7795825", "0.7561144", "0.75552887", "0.75482875", "0.75088036", "0.73999274", "0.7296254", "0.72635525", "0.7245357", "0.72373927", "0.7215795", "0.7177752", "0.71097696", "0.7104384", "0.7100882", "0.7094294", "0.70674855", "0.70559895", "0.705...
0.0
-1
/ Return configuration data
public function get() { return $this->_configuration; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getConfigData()\n {\n return [\n 'alias' => $this->getAlias(),\n 'dbName' => $this->getName(),\n 'dbHost' => $this->getHost(),\n 'dbType' => $this->getType(),\n 'dbUser' => $this->getUserName(),\n 'dbPass' => $this->getPass...
[ "0.79169494", "0.7797594", "0.77622676", "0.77231556", "0.76405793", "0.76405793", "0.76405793", "0.76405793", "0.76405793", "0.76405793", "0.76405793", "0.76405793", "0.7612983", "0.7576414", "0.75605094", "0.75511986", "0.7532274", "0.7505278", "0.75039536", "0.7486115", "0...
0.0
-1
/ Check configuration data
private function _check() { $cfgStrKey = array('nkVersion', 'nkMinimumVersion', 'minimalPhpVersion', 'partnersKey'); $cfgArrayKey = array('phpExtension', 'uploadDir', 'changelog', 'infoList', 'deprecatedFiles'); $i18n = i18n::getInstance(); foreach (array_merge($cfgStrKey, $cfgArrayKey) as $cfgKey) { if (! array_key_exists($cfgKey, $this->_configuration)) throw new Exception(sprintf($i18n['MISSING_CONFIG_KEY'], $cfgKey)); if (in_array($cfgKey, $cfgStrKey) && (! is_string($this->_configuration[$cfgKey]) || empty($this->_configuration[$cfgKey]))) throw new Exception(sprintf($i18n['CONFIG_KEY_MUST_BE_STRING'], $cfgKey)); elseif (in_array($cfgKey, $cfgArrayKey) && (! is_array($this->_configuration[$cfgKey]) || empty($this->_configuration[$cfgKey]))) throw new Exception(sprintf($i18n['CONFIG_KEY_MUST_BE_ARRAY'], $cfgKey)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function checkConfig();", "private function check_conf() {\n ConfigChecker::check();\n }", "public function hasConfig();", "public function checkConfiguration() {\n\t\tif(empty($this->configuration['appKey'])) {\n\t\t\t$this->error = '<div>You have to set App key first and save the record.</...
[ "0.8522281", "0.7721374", "0.7414345", "0.7411104", "0.7384851", "0.7359051", "0.7359051", "0.7248139", "0.7194977", "0.71415055", "0.7057584", "0.69108814", "0.6890064", "0.6869496", "0.6743789", "0.6737687", "0.6712126", "0.6706744", "0.66644657", "0.66509163", "0.6637919",...
0.71149665
10
Create a new controller instance.
public function __construct() { $this->middleware('auth')->except(['show', 'members']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function createController()\n {\n $this->createClass('controller');\n }", "protected function createController()\n {\n $controller = Str::studly(class_basename($this->getNameInput()));\n\n $modelName = $this->qualifyClass('Models/'.$this->getNameInput());\n\n $this-...
[ "0.82668066", "0.8173394", "0.78115296", "0.77052677", "0.7681875", "0.7659338", "0.74860525", "0.74064577", "0.7297601", "0.7252339", "0.7195181", "0.7174191", "0.70150065", "0.6989306", "0.69835985", "0.69732994", "0.6963521", "0.6935819", "0.68973273", "0.68920785", "0.687...
0.0
-1
Display a listing of the resource.
public function index() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->re...
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.683052...
0.0
-1
Show the form for creating a new resource.
public function create() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view(...
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.717428...
0.0
-1
Store a newly created resource in storage.
public function store(Request $request) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations...
[ "0.7286258", "0.71454436", "0.7132821", "0.6640289", "0.6621105", "0.6566493", "0.65255576", "0.65087926", "0.6448317", "0.63752604", "0.63736314", "0.6365631", "0.6365631", "0.6365631", "0.634229", "0.634229", "0.634229", "0.634229", "0.634229", "0.634229", "0.634229", "0....
0.0
-1
Display the specified resource.
public function show(User $user, Topic $topic) { $topic_counter = Topic::where('user_id', $user->id)->count(); $reply_counter = Reply::where('user_id', $user->id)->count(); return view('users.show', compact('user', 'reply_counter', 'topic_counter')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id...
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245...
0.0
-1
Show the form for editing the specified resource.
public function edit(User $user) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n ...
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.6833...
0.0
-1
Update the specified resource in storage.
public function update(Request $request, User $user) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ...
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890...
0.0
-1
Remove the specified resource from storage.
public function destroy(User $user) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n ...
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897...
0.0
-1
se elimina un profesional.
public function execute() { $id = FormatUtils::getParam('id'); //se inicia una transacción. DbManager::begin_tran(); try { $manager = new ProfesionalManager(); $manager->eliminarProfesional($id); $forward = 'eliminar_profesional_success'; //commit de la transacción. DbManager::save(); } catch (GenericException $ex) { $forward = 'eliminar_profesional_error'; $this->setDs_forward_params('er=1' . '&msg=' . $ex->getMessage() . '&code=' . $ex->getCode()); //rollback de la transacción. DbManager::undo(); } return $forward; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function opcion__eliminar()\n\t{\n\t\t$id_proyecto = $this->get_id_proyecto_actual();\n\t\tif ( $id_proyecto == 'toba' ) {\n\t\t\tthrow new toba_error(\"No es posible eliminar el proyecto 'toba'\");\n\t\t}\n\t\ttry {\n\t\t\t$p = $this->get_proyecto();\n\t\t\tif ( $this->consola->dialogo_simple(\"Desea ELIMINAR los...
[ "0.6317899", "0.62474984", "0.6086223", "0.6080738", "0.6080181", "0.60276467", "0.60126454", "0.6006299", "0.59553045", "0.59521186", "0.5892324", "0.58873576", "0.5886923", "0.58514565", "0.58043236", "0.5790806", "0.57646465", "0.5762933", "0.570856", "0.57061356", "0.5697...
0.5551863
36
Run the database seeds.
public function run() { Model::unguard(); $this->call(ClubTableSeeder::class); $this->command->info('Clubs table seeded!'); $this->call(DistanceTableSeeder::class); $this->command->info('Distances table seeded!'); $this->call(GenderTableSeeder::class); $this->command->info('Genders table seeded!'); $this->call(RecordTableSeeder::class); $this->command->info('Records table seeded!'); $this->call(RoleTableSeeder::class); $this->command->info('Roles table seeded!'); $this->call(StateTableSeeder::class); $this->command->info('States table seeded!'); $this->call(UserTableSeeder::class); $this->command->info('Users table seeded!'); Model::reguard(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run()\n {\n // $this->call(UserTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(TagTableSeeder::class);\n // $this->call(PostTagTableSeeder::class);\n\n /*AB - use faker to populate table see file ModelFactory.php */\n fact...
[ "0.8013876", "0.79804534", "0.7976992", "0.79542726", "0.79511505", "0.7949612", "0.794459", "0.7942486", "0.7938189", "0.79368967", "0.79337025", "0.78924936", "0.78811055", "0.78790957", "0.78787595", "0.787547", "0.7871811", "0.78701615", "0.7851422", "0.7850352", "0.78414...
0.0
-1
add index/indexes in specific table columns
function add_index($index, $table, $column) { global $langIndexAdded, $langIndexExists, $langToTable; $num_of_args = func_num_args(); if ($num_of_args <= 3) { $ind_sql = Database::get()->queryArray("SHOW INDEX FROM $table"); foreach ($ind_sql as $i) { if ($i->Key_name == $index) { $retString = "<p>$langIndexExists $table</p>"; return $retString; } } Database::get()->query("ALTER TABLE $table ADD INDEX `$index` ($column)"); } else { $arguments = func_get_args(); // cut the first and second argument array_shift($arguments); array_shift($arguments); $st = ''; for ($j = 0; $j < count($arguments); $j++) { $st .= $arguments[$j] . ','; } $ind_sql = Database::get()->queryArray("SHOW INDEXES FROM `$table`"); foreach ($ind_sql as $i) { if ($i->Key_name == $index) { $retString = "<p>$langIndexExists $table</p>"; return $retString; } } $sql = "ALTER TABLE $table ADD INDEX `$index` ($st)"; $sql = str_replace(',)', ')', $sql); Database::get()->query($sql); } $retString = "<p>$langIndexAdded $langToTable $table</p>"; return $retString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function add_additional_index() {\n\t\t$table_name = $this->db->prefix . self::BASE_TABLE;\n\n\t\t$sql = 'ALTER TABLE ' . $table_name . ' ADD `index_8` VARCHAR(127)';\n\n\t\t$this->db->query( $sql );\n\t}", "public function addIndex( $table, $name, $fieldlist, $isPrimary=false );", "function add_clean_i...
[ "0.7181902", "0.7013335", "0.67576694", "0.6672179", "0.66462904", "0.65270966", "0.6461437", "0.64391017", "0.6427341", "0.6282906", "0.6196372", "0.6153922", "0.6110154", "0.6059058", "0.6037748", "0.60365874", "0.6021988", "0.60199684", "0.60148954", "0.6013287", "0.600050...
0.6986675
2
We need some messages from all languages to upgrade course accueil table
function load_global_messages() { global $global_messages, $session, $webDir, $language_codes; // these may seem unused, but they are needed when including messages.inc.php global $siteName, $InstitutionUrl, $Institution; foreach ($session->native_language_names as $code => $name) { // include_messages include "$webDir/lang/$code/common.inc.php"; $extra_messages = "config/{$language_codes[$code]}.inc.php"; if (file_exists($extra_messages)) { include $extra_messages; } else { $extra_messages = false; } include "$webDir/lang/$code/messages.inc.php"; if ($extra_messages) { include $extra_messages; } $global_messages['langCourseDescription'][$code] = $langCourseDescription; $global_messages['langCourseUnits'][$code] = $langCourseUnits; $global_messages['langGlossary'][$code] = $langGlossary; $global_messages['langEBook'][$code] = $langEBook; $global_messages['langVideo'][$code] = $langVideo; $global_messages['langDropBox'][$code] = $langDropBox; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function install_translations() {\n $db = DB::getInstance();\n if(!$db->query(file_get_contents(CORE_INSTALLER_FILES_PATH.'/db/translation.sql'))->error()) {\n return true;\n }\n else {\n System::addMessage('error', rt('An error occurred during the installation of your chosen language'));...
[ "0.6307929", "0.6279423", "0.6018871", "0.5987484", "0.5985052", "0.5924254", "0.58560616", "0.5830143", "0.5816742", "0.5757681", "0.5741451", "0.572128", "0.5715325", "0.5713798", "0.5693484", "0.5685896", "0.56601316", "0.5642704", "0.56161267", "0.5614208", "0.5584372", ...
0.5639213
18
Quote string for output in config.php file
function quote($s) { return "'" . addslashes(canonicalize_whitespace($s)) . "'"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function escaped()\n {\n return preg_quote('='.env($this->key()), '/');\n }", "function add_quote($value) {\n\t\treturn '\"' . addslashes($value) . '\"';\n\t}", "protected function declareConfig(){\n\n $output = '';\n \n foreach( $this->getConfig() as $key => $value ...
[ "0.6332523", "0.62850296", "0.6124192", "0.6039647", "0.5989027", "0.5978696", "0.5957611", "0.583147", "0.58181745", "0.58175284", "0.5789202", "0.57187307", "0.56831586", "0.56153107", "0.55616164", "0.55193055", "0.5510798", "0.54999834", "0.54973906", "0.548826", "0.54634...
0.0
-1
install ready to use badge icons
function installBadgeIcons($root_dir) { $cert_default_dir = $root_dir . "/template/default/img/game"; foreach (glob("$cert_default_dir/*.png") as $icon) { $iconname = preg_replace('|.*/(.*)\.png|', '$1', $icon); $filename = $iconname . '.png'; if (!copy($icon, $root_dir . BADGE_TEMPLATE_PATH . $filename)) { die("Error copying badge icon!"); } Database::get()->query("INSERT INTO badge_icon (name, description, filename) VALUES (?s, '', ?s)", $iconname, $filename); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function buildCssAndRegisterIcons() {}", "function load_icons() {\n themify_get_icon( 'ti-import' );\n themify_get_icon( 'ti-export' );\n Themify_Enqueue_Assets::loadIcons();\n }", "public function get_icon() {\n return 'eicon-heading apr-badge';\n }"...
[ "0.59537673", "0.5934781", "0.5850528", "0.5798251", "0.5620138", "0.55884886", "0.55464894", "0.55138355", "0.54676574", "0.5447577", "0.54452413", "0.54320395", "0.5414563", "0.53973204", "0.53926295", "0.5387264", "0.53872377", "0.53843254", "0.53718793", "0.536857", "0.53...
0.659823
0
Should validate and set the native value.
abstract public function __construct($value);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function setValue($value);", "public function postHydrate(): void\n {\n if ('invalid' === $this->value) {\n $this->value = 'valid';\n }\n }", "final function set($value){\n if(is_object($value) and get_class($value)===get_class($this)){\n $this->value = $v...
[ "0.61316335", "0.60464203", "0.60060006", "0.59664774", "0.59657025", "0.5936885", "0.5926443", "0.5909467", "0.5909467", "0.5909467", "0.5909467", "0.5909467", "0.5909467", "0.5909467", "0.5909467", "0.5909467", "0.5909467", "0.5909467", "0.59090185", "0.59090185", "0.587689...
0.0
-1
Returns the native value.
public function get() { return $this->value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toNative()\n {\n return $this->value;\n }", "public function toNative()\n {\n $value = parent::toNative();\n\n return \\intval($value);\n }", "public function getRawValue();", "public function valueOf() {\n return $this->_value;\n }", "publ...
[ "0.86892104", "0.74695796", "0.7159563", "0.69486225", "0.6873021", "0.6754618", "0.6746944", "0.66919297", "0.6686641", "0.6686641", "0.66821915", "0.6675868", "0.66049504", "0.65902686", "0.6551914", "0.6545979", "0.65363455", "0.6526987", "0.6526987", "0.65065074", "0.6494...
0.0
-1
Returns true if the value resolves to true.
public function isTrue() { return !!$this->value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isTrue()\n {\n return $this->value === true;\n }", "public function isTrue();", "function isTrue($value) {\r\n\treturn is_bool($value) ? $value : (bool)preg_match('/^(1|y|yes|true|on)$/i',(string)$value);\r\n}", "function bool ($value)\r\n{\r\n\tif ($value === true || $value === ...
[ "0.83746284", "0.7327865", "0.7255598", "0.7237692", "0.7135793", "0.7099107", "0.7009759", "0.69991183", "0.6963154", "0.69327813", "0.689397", "0.68891025", "0.6885377", "0.6842323", "0.68270355", "0.6826442", "0.68248254", "0.68046576", "0.67733765", "0.67328924", "0.67099...
0.76715714
1
Returns true if the value resolves to false.
public function isFalse() { return !$this->value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is_false(mixed $value): bool\n\t{\n\t\treturn $value === false;\n\t}", "public function isFalse();", "public static function false(): self\n {\n return self::fromValue(Value::false());\n }", "public function isFalse() {\n return $this->is(new Identical(false));\n }", "protected fu...
[ "0.7759415", "0.7726061", "0.74473184", "0.7393785", "0.73572373", "0.7334865", "0.7206088", "0.7168344", "0.67863894", "0.67777485", "0.67279816", "0.6600152", "0.64929044", "0.64041144", "0.6379429", "0.636509", "0.6354426", "0.6321541", "0.6304143", "0.6290906", "0.6277464...
0.80876946
0
Use Successible to check for the result a hasSomething method.
public function has($methodName) { //Handle arguments. $args = func_get_args(); //Get the method name. $method = 'has'.ucfirst(array_shift($args)); //Call the method and use it to set the success state. $this->is(!!call_user_func_array([$this, $method], $args)); //Enable chaining. return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isSuccess();", "public function isSuccess();", "public function isSuccess();", "public function isSuccess();", "public function isSuccess(): bool;", "public function isSuccess(): bool;", "public function isSuccess(): bool;", "public function isSuccess():bool;", "public function hasR...
[ "0.7452194", "0.7452194", "0.7452194", "0.7452194", "0.72555435", "0.72555435", "0.72555435", "0.71391", "0.712163", "0.712163", "0.712163", "0.7115634", "0.7107377", "0.69647956", "0.6909933", "0.69063133", "0.68905985", "0.67396134", "0.67212903", "0.66634685", "0.65696776"...
0.0
-1
Implements "greater than" to determine the success state of Successible.
public function gt($value) { //Extract the raw value. raw($value); //Return the result of is() with a great than check. return $this->is($this->value > $value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function greaterThan($value);", "public function greaterThan( $value ) {\n return $this->gt( $value );\n }", "public function isGreaterThan($value)\n\t{\n $this->operator = \"is_greater\";\n $this->value = $value;\n\t}", "public function validateGreaterthan($attribute, ...
[ "0.6687838", "0.6459306", "0.63129354", "0.6250508", "0.6078044", "0.59613293", "0.59459543", "0.5856086", "0.5786109", "0.57178134", "0.5656702", "0.5611306", "0.5605285", "0.55582494", "0.55421627", "0.55147177", "0.55147177", "0.5464509", "0.54484236", "0.53810406", "0.533...
0.57969266
8
Implements "less than" to determine the success state of Successible.
public function lt($value) { //Extract the raw value. raw($value); //Return the result of is() with a less than check. return $this->is($this->value < $value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function lessThan($value);", "public function lessThan( $value ) {\n return $this->lt( $value );\n }", "public static function lessThan($value, $value1)\n {\n return ($value < $value1)?:false;\n }", "function o_lt($a, $b) {\n\t\t\treturn Obj::singleton()->lessThan($a, $b...
[ "0.6960609", "0.6534999", "0.63193184", "0.625163", "0.6097814", "0.5979607", "0.5890857", "0.5876831", "0.58491683", "0.58404714", "0.5789346", "0.57031083", "0.56691885", "0.5661443", "0.56422555", "0.5603742", "0.55913955", "0.55644524", "0.5562083", "0.5557042", "0.554159...
0.6270885
3
Implements an equality check to determine the success state of Successible.
public function eq($value) { return $this->is($this->value == unwrap($value)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isSuccessful(): bool\n {\n return $this->status == 'a';\n }", "function isSuccess()\n\t{\n\t\treturn($this->getStatus() == 'SUCCESS');\n\t}", "public function wasSuccessful() : bool\n {\n return $this->status === self::STATUS_SUCCESS;\n }", "abstract public function ...
[ "0.66990393", "0.668153", "0.6635364", "0.6618722", "0.6610755", "0.65767026", "0.65767026", "0.65767026", "0.65767026", "0.65743464", "0.6562795", "0.6562795", "0.6562795", "0.6515839", "0.6492062", "0.6488299", "0.6474746", "0.6466807", "0.6434632", "0.64268464", "0.6424079...
0.0
-1
Posting a message to a room.
public function postMessage(SlackHttpPayloadServicePostMessage $message) { return $this->decodeRequest($this->slackHttpService->requestWithArguments($this->mainApi . '.' . 'postMessage', $message->getPayload())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function sendMessage()\n {\n $userId = auth()->user()->id;\n\n // Save the message\n Message::create([\n 'room_id' => $this->roomId,\n 'user_id' => $userId,\n 'message' => $this->message,\n ]);\n\n // Remove the value of the message afte...
[ "0.6936743", "0.6229358", "0.6199686", "0.61672235", "0.6105381", "0.60206836", "0.59722507", "0.5917717", "0.5782412", "0.5777406", "0.57605094", "0.57292914", "0.570702", "0.5705577", "0.5698321", "0.56772256", "0.56526554", "0.5632762", "0.5632762", "0.5632762", "0.5632762...
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.83993316", "0.8375539", "0.8375539", "0.8342643", "0.8251967", "0.82460433", "0.82116765", "0.8145634", "0.81104577", "0.8082012", "0.7990385", "0.79879874", "0.7982323", "0.79598", "0.7950402", "0.7948058", "0.7924861", "0.791403", "0.7900065", "0.78929263", "0.7889438", ...
0.0
-1
Get the validation rules that apply to the request.
public function rules() { return [ 'modelName' => 'required', 'fields' => 'required', 'commandType' => 'required' ]; }
{ "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.8342703", "0.80143493", "0.7937251", "0.79264987", "0.79233825", "0.79048395", "0.78603816", "0.7790699", "0.77842164", "0.77628785", "0.7737272", "0.7733618", "0.7710535", "0.7691693", "0.76849866", "0.7683038", "0.7683038", "0.7683038", "0.7683038", "0.7683038", "0.76830...
0.0
-1
Get the proper failed validation response for the request.
public function response(array $errors) { $messages = implode(' ', array_flatten($errors)); return Response::json($messages, 400); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getValidationFailed();", "public function getInvalidRequestResponse()\n {\n $result['responseCode'] = self::RESPONSE_INVALID_REQUEST;\n return $result;\n }", "public function validationError($validator)\n {\n $messages = $validator->errors()->getMessages();\n...
[ "0.7578804", "0.7509205", "0.69908965", "0.69491476", "0.69462425", "0.69071645", "0.689199", "0.67955565", "0.67213976", "0.6709172", "0.6681485", "0.6673777", "0.66606957", "0.665817", "0.6642562", "0.66077626", "0.6584377", "0.657845", "0.65736073", "0.65408933", "0.652425...
0.0
-1
Check if a game has started.
public function isStarted() { return $this->started_at > 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isStarted();", "public function isStarted();", "public function isStarted();", "protected function hasStarted()\r\n {\r\n return isset($this->_session[$this->_stepsKey]);\r\n }", "public function isStarted() {}", "public function isStarted()\n\t{\n\t\tif($this->test_status_id...
[ "0.7144569", "0.7144569", "0.7144569", "0.70950603", "0.7045439", "0.6933159", "0.69188476", "0.69073355", "0.683146", "0.6782225", "0.6763463", "0.674255", "0.674255", "0.674255", "0.6715309", "0.6669208", "0.6658073", "0.66069454", "0.6603335", "0.6513421", "0.6458025", "...
0.6844322
8
Check if a game has ended.
public function isEnded() { return $this->ended_at > 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function isGameFinished()\n {\n $isGameFinished = false;\n\n $totalResult = $this->score + $this->savedScore;\n if ($totalResult >= self::POINTS_AT_WIN) {\n $isGameFinished = true;\n }\n\n return $isGameFinished;\n }", "public function hasGameFinished()...
[ "0.81349516", "0.7418887", "0.7415461", "0.7415024", "0.73098147", "0.72700894", "0.711619", "0.7025608", "0.69832295", "0.6870875", "0.67612505", "0.6614386", "0.6593995", "0.65196514", "0.6497341", "0.6468668", "0.6468538", "0.6321781", "0.6313133", "0.62639", "0.6259871", ...
0.7304676
5
declare the specification error codes
static function error( $code, $version = '2.0', $id = null ) { $errors = array ( -32600 => 'Invalid Request', -32601 => 'Method not found', -32602 => 'Invalid params', -32603 => 'Internal error', -32700 => 'Parse error', ); return (object) array( 'id' => $id, 'jsonrpc' => $version, 'error' => (object) array( 'code' => $code, 'message' => $errors[$code], ), ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_error_codes()\n {\n }", "public function errorcode();", "public function get_error_code()\n {\n }", "public function getErrorList()\n {\n return [\n 13 => 1,\n 33 => 1,\n 83 => 1,\n 88 => 1,\n 92 ...
[ "0.7468572", "0.693825", "0.67524445", "0.6376029", "0.63573444", "0.62393326", "0.6223929", "0.6114753", "0.60567147", "0.6052507", "0.6051333", "0.6029569", "0.6007014", "0.5999562", "0.5999562", "0.59896547", "0.5959568", "0.5959568", "0.5947666", "0.59441316", "0.590735",...
0.0
-1
create an instance of the jsonrpc2 class, and map in the allowed method strings
public function __construct( array $method_map ) { $this->method_map = $method_map; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function invoke() {\n global $user;\n $req =& $this->request;\n try {\n\n if ($req) {\n if (isset($req->uri) && preg_match(\"/^([^\\?]*)(\\?(.*))?$/\", $req->uri, $match)) {\n $this->q = $match[1];\n parse_str($match[3], $_GET);\n }\n }\n \n if (...
[ "0.5963103", "0.5894824", "0.58319944", "0.5815827", "0.57778555", "0.5747794", "0.57467216", "0.5701367", "0.5684628", "0.56707174", "0.5604915", "0.55884844", "0.5571685", "0.5566815", "0.5469356", "0.5467061", "0.54263383", "0.54123676", "0.53813124", "0.5373858", "0.53685...
0.5781412
4
per the 2.0 specification
public function isValidRequestObect( $request ) { // a request object must: // be an object if ( !is_object( $request ) ) return false; // contain a jsonrpc member that is a string if ( !isset( $request->jsonrpc ) || $request->jsonrpc !== '2.0' ) return false; // contain a method member that is a string if ( !isset( $request->method ) || !is_string( $request->method ) ) return false; // if it contains a params member // that member must be an array or an object if ( isset( $request->params ) && !is_array( $request->params ) && !is_object( $request->params ) ) return false; // if it contains an id member // that member must be a string, number, or null if ( isset( $request->id ) && !is_string( $request->id ) && !is_numeric( $request->id ) && !is_null( $request->id ) ) return false; // it passes the tests return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _i() {\n }", "private function __construct()\t{}", "function yy_r116(){ \n $this->_retvalue[implode(\" \", $this->yystack[$this->yyidx + -2]->minor)] = $this->yystack[$this->yyidx + 0]->minor->getMember(0); \n }", "function yy_r72(){ $this->_retvalue = $this->yystack[$this->yyidx + -...
[ "0.5591915", "0.53262585", "0.53187877", "0.52529204", "0.5229157", "0.5183208", "0.51828605", "0.5152519", "0.51382923", "0.51088166", "0.51017666", "0.509871", "0.509871", "0.50943506", "0.50791055", "0.507734", "0.5069964", "0.5067583", "0.50578624", "0.50575554", "0.50563...
0.0
-1
process a single request object
public function dispatch_single( $request ) { // check that the object passes some basic protocal shape tests if ( !$this->isValidRequestObect( $request ) ) return jsonrpc2::error( -32600 ); // if the request object does not specify a jsonrpc verison if ( !isset( $request->jsonrpc ) ) $request->jsonrpc = '1.0'; // if the request is 2.0 and and no params were sent // create an empty params entry, // as 2.0 requests do not need to send an empty array // later code can now assume that this field will exist if ( $request->jsonrpc == '2.0' && !isset( $request->params ) ) $request->params = array(); // invoke the request object, and store it in the reponse $response = $this->invoke( $request ); // if the request id is not set, or if it is null if ( !isset ( $request->id ) || is_null( $request->id ) ) return null; // copy the request id into the response object $response->id = $request->id; // if it is a 2.0 request if ( $request->jsonrpc === '2.0' ) { // set the response to 2.0 $response->jsonrpc = $request->jsonrpc; } else { // assume it is a 1.0 requrest // ensure there is a result member in the response if ( !isset( $response->result ) ) $response->result = null; // ensure there is an error member if ( !isset( $response->error ) ) $response->error = null; } // return the response object return $response; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function processRequest();", "abstract public function processRequest();", "abstract protected function process(Request $request);", "public abstract function processRequest();", "public function process_request() {\n if(!empty($this->POST)) {\n return $this->handlePOST();\n ...
[ "0.7912653", "0.78914464", "0.78445697", "0.77872914", "0.70835525", "0.6952924", "0.6910085", "0.6880072", "0.6873851", "0.6864242", "0.6843213", "0.67507696", "0.6673425", "0.6673425", "0.6673425", "0.6590542", "0.6587248", "0.6552768", "0.65375966", "0.65201706", "0.646568...
0.5871973
51
take a more complete request, after processing, and invoke it after checking the parameters align extend this function if you need to provide more automatic actions related to methods in classes/instanes
private function invoke( $request ) { // if the method requested is available if ( isset( $this->method_map[$request->method] ) ) { try { // reflect the global function or method $name = $this->method_map[$request->method]; if ( is_array( $name ) ) { $reflection = new ReflectionMethod ( $name[0], $name[1] ); $object = is_object( $name[0] ) ? $name[0] : null; } elseif ( strpos( $name, '::' ) ) { list( $class, $method ) = explode( '::', $name, 2 ); $reflection = new ReflectionMethod ( $class, $method ); $object = null; } else { $reflection = new ReflectionFunction ( $name ); $object = false; } // check the parameters in the reflection against what was sent in the request $params = $this->checkParams( $reflection->getParameters(), $request->params ); if ( $object === false ) $result = $reflection->invokeArgs( $params ); else $result = $reflection->invokeArgs( $object, $params ); // return the result as an invoked call return (object) array( 'result' => $result ); } catch ( Exception $e ) { // if anything abnormal happened, capture the error code thrown $error = $e->getMessage(); } } // by this point, all we have is errors return jsonrpc2::error( isset($error) ? $error : -32601 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function processRequest() {\n $action = \"\";\n //retrieve action from client.\n if (filter_has_var(INPUT_GET, 'action')) {\n $action = filter_input(INPUT_GET, 'action');\n }\n\n switch ($action) {\n case 'login':\n $this->login(); \n ...
[ "0.6734121", "0.6678177", "0.6627215", "0.6611398", "0.6542564", "0.64404076", "0.63505274", "0.6330978", "0.6307041", "0.6306242", "0.62960786", "0.6293364", "0.6248936", "0.62322736", "0.6220849", "0.6216469", "0.6201871", "0.61932445", "0.61932445", "0.6188286", "0.6185005...
0.0
-1
create the param list we are going to use to invoke the object
private function checkParams( $real, $sent ) { $new = array(); $is_obj = is_object( $sent ); $is_assoc = is_array( $sent ) && jsonrpc2::isAssoc( $sent ); // check every parameter foreach ( $real as $i => $param ) { $name = $param->getName(); if ( $is_obj && isset( $sent->{$name} ) ) { $new[$i] = $sent->{$name}; } elseif ( $is_assoc && $sent[$name] ) { $new[$i] = $sent[$name]; } elseif ( isset( $sent[$i] ) ) { $new[$i] = $sent[$i]; } elseif ( !$param->isOptional() ) { throw new Exception( -32602 ); } } // return the list of matching params return $new; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function setParams()\n\t\t{\n\t\t\t/**\n\t\t\t* Remove do $this->_separetor os dois primeiros valores\n\t\t\t* referentes ao controller e action, deixando os demais valores\n\t\t\t* que serão usados para formarem os parametros, indices e valores\n\t\t\t*/\n\t\t\tunset($this->_separetor[1], $this->_separeto...
[ "0.6612234", "0.64751923", "0.6462426", "0.64622825", "0.64411336", "0.639625", "0.6370964", "0.6364432", "0.63498795", "0.6328017", "0.6328017", "0.6266476", "0.62619615", "0.6233893", "0.6233893", "0.621892", "0.62082124", "0.6174088", "0.61521715", "0.61432344", "0.6143234...
0.0
-1
add the route in validRoute
public static function set($route,$function) { self::$validRoute[] = $route; if ($_GET['url'] == $route) { $function->__invoke(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isValidRoute($route) {\n \n return $route == 'campus' ||\n $route == 'extended' ||\n $route == 'nathanBisk' ||\n $route == 'downtown';\n}", "public function addRoute()\n {\n if (!$this->route->isFulfilled()) {\n return $this->route->dispatch(fu...
[ "0.65088886", "0.64860696", "0.6448493", "0.6342183", "0.63029563", "0.6230435", "0.61523527", "0.61438507", "0.60752565", "0.60367197", "0.60242635", "0.6014128", "0.6003677", "0.59969854", "0.59866077", "0.59743226", "0.5971961", "0.5971961", "0.5971961", "0.5971961", "0.59...
0.0
-1
Find all files having the given extension
public function findFilesWithExtension($directory, $extension) { $this->validateInput($directory, $extension); $this->finder->in($directory) ->name('*.'.$extension) ; $results = $this->getFinderResult(); return $results; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _get_files($ext=false)\n\t{\n\t\t\n\t\t$files = PerchUtil::get_dir_contents(PERCH_RESFILEPATH);\n\n\t\t$returnfiles = array();\n\t\tif(PerchUtil::count($files) > 0) {\n\t\t\tforeach($files as $file) {\n\t\t\t\t// if a file extension has been provided only add files with that extension\n\t\t\t\tif(...
[ "0.7028653", "0.69744825", "0.687496", "0.6759792", "0.67374986", "0.6705261", "0.66419643", "0.66133094", "0.6580828", "0.65307045", "0.64832264", "0.64796317", "0.6468062", "0.64122045", "0.6377963", "0.6375414", "0.6326476", "0.6267518", "0.62437403", "0.624124", "0.620859...
0.6480409
11
Extract filepaths from finder results
private function getFinderResult() { $results = array(); foreach ($this->finder as $result) { $results[] = $result->getRealPath(); } return $results; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function findFiles();", "public function find () {\n\t\t$results = array();\n\n\t\t// Iterate all paths in target\n\t\tforeach ($this->target->get_resolved_paths() as $path) {\n\t\t\t\n\t\t\t// Iterate all files in paths\n\t\t\t$files = directory_contents($path);\n\t\t\tforeach ($files as $file) {\n\t\t\t...
[ "0.6785689", "0.6522868", "0.63721865", "0.61564285", "0.61357844", "0.6121081", "0.6059127", "0.5994545", "0.5969169", "0.5963418", "0.595956", "0.59460074", "0.59460074", "0.59460074", "0.5936259", "0.5908881", "0.5865822", "0.5853286", "0.5838035", "0.5817389", "0.581305",...
0.7564424
0
Filter temporary data based on the given prefix
private function _extractFromTempData(string $prefix, array $tempData): array { $result = []; foreach ($tempData as $key => $value) { if ((new StringOperation)->str_starts_with($key, $prefix)) { $result[str_replace($prefix. "_", "", $key)] = $value; } } return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static function _getFilter() {}", "public function testPrefixedExtraction()\n {\n $queryData = ['prefix_a' => 1, 'b' => 2];\n $requestData = ['a' => 2, 'prefix_b' => 4, 'c' => 8];\n $contentData = ['b' => 3, 'prefix_c' => 6, 'prefix_d' => 9];\n $request = $this->createReque...
[ "0.562868", "0.55831087", "0.55544144", "0.54626733", "0.54585207", "0.5452465", "0.5451222", "0.5437347", "0.54345614", "0.5415852", "0.541133", "0.53958464", "0.53715426", "0.53271586", "0.53140235", "0.5302295", "0.5270148", "0.52336365", "0.52330345", "0.52197593", "0.521...
0.60562235
0
Return a post with associated comments
public function findOneByWithComment(array $where = [], array $orderBy = [], int $limit = null, int $offset = null) { $sql = "SELECT ". $this->_computeField([ 'id' => "post_id", 'created_at' => "post_created_at", 'updated_at' => "post_updated_at", 'slug' => "post_slug", 'title' => "post_title", 'content' => "post_content", 'url_coverage_image' => "post_url_coverage_image", 'alt_coverage_image' => "post_alt_coverage_image", ], "p"). ", ". $this->_computeField([ 'id' => "comment_id", 'post_id' => "comment_post_id", 'created_at' => "comment_created_at", 'updated_at' => "comment_updated_at", 'content' => "comment_content", ], "c"). ", ". $this->_computeField([ 'id' => "admin_id", 'first_name' => "admin_first_name", 'last_name' => "admin_last_name", ], "ua"). ", ". $this->_computeField([ 'id' => "user_id", 'first_name' => "user_first_name", 'last_name' => "user_last_name", ], "u"). " FROM post AS p LEFT JOIN comment AS c ON p.id = c.post_id AND c.status = true JOIN admin AS a ON a.id = p.admin_id JOIN user AS ua ON ua.id = a.user_id LEFT JOIN user AS u on u.id = c.user_id"; $result = $this->_appendIfCorrect($sql, $where, $orderBy, $limit, $offset); $request = $this->pdo->prepare($result[0]); $request->execute($result[1]); $results = $request->fetchAll(); if (!empty($results)) { $post = new Post($this->_extractFromTempData("post", $results[0])); $post->setAdmin(new Admin($this->_extractFromTempData("admin", $results[0]))); foreach ($results as $result) { if (!is_null($result['comment_id'])) { $comment = new Comment($this->_extractFromTempData("comment", $result)); $comment->setUser(new User($this->_extractFromTempData("user", $result))); $post->addComment($comment); } } return $post; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getComments() {\n return $this->hasMany(Comment::class, ['post_id' => 'id']);\n }", "public function getAllPostsWithComments(){\n $entityManager = $this->getEntityManager();\n $queryBuilder = $entityManager->createQueryBuilder();\n $queryBuilder\n ->select('bp'...
[ "0.745956", "0.7362304", "0.72692907", "0.72678757", "0.7241831", "0.7172758", "0.71622163", "0.7148526", "0.7146526", "0.7121626", "0.69933486", "0.6927377", "0.69219166", "0.6855185", "0.67541426", "0.675171", "0.6730031", "0.66797036", "0.6634394", "0.6613966", "0.65694565...
0.0
-1
Delete a post and associated comments
public function delete(Entity $post): void { $sql = "DELETE p, c FROM post p LEFT JOIN comment c ON p.id = c.post_id WHERE p.slug = :slug"; $request = $this->pdo->prepare($sql); $request->execute([ 'slug' => $post->getSlug(), ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleting(Post $post)\n {\n //-------we delete picture and comments before deletd post -----------\n\n $post->picture()->delete();\n $post->comments()->delete();\n // delete picture physicly and comments before delete physic post and after post is deleted logic =>(picture...
[ "0.7724705", "0.754655", "0.74320024", "0.74094635", "0.7362096", "0.72846484", "0.72541213", "0.72241455", "0.7219005", "0.7196771", "0.7193406", "0.7174325", "0.71740746", "0.7158529", "0.7137445", "0.71260583", "0.71260583", "0.71260583", "0.71260583", "0.71260583", "0.712...
0.7503189
2
at this stage only yx of the current figure is updated
public function handleCollision () : bool|string { $y = $this->board->players[$this->board->currentPlayer]->currentFigure->y; $x = $this->board->players[$this->board->currentPlayer]->currentFigure->x; $destination = $this->board->field[$y][$x]; if ($destination[0] == ".." || $destination[0] == "FF") { //just a free tile return false; // false for no collision } else { // consider non-free tile scenarios $enemies = $this->figureService->findEnemies($destination, $this->board->players[$this->board->currentPlayer]->team); //make a list of enemies if (!$enemies) { //non-empty array evaluates to true, otherwise findEnemies will return false //if there were N figures there but all were friendly or fortified return false; // we wont have collision } else { // find enemies returned array of count at least 1 if (count($enemies) === 1) { //if it is just one enemy, no point of triggering choices $this->figureService->removeFigure($this->board, $enemies[0]); //remove it from the enemy players list of figs return $enemies[0]; // return the name of the fig for fieldUpdate() } else { // otherwise there is more than 1 attackable enemy $choice = $this->view->getFigureChoice($enemies); $this->figureService->removeFigure($this->board, $choice); return $choice; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _set_new_y($size)\r\n {\r\n $this->new_y = $size;\r\n }", "public function setY($y) {}", "public function restorePosition()\n {\n if ($this->value['y']==$this->_pdf->getY()) $this->_pdf->setY($this->value['yc'], false);\n }", "public function setY($y);", "function SetXY($...
[ "0.6266833", "0.6213247", "0.6173688", "0.6032653", "0.58453983", "0.57554585", "0.56693137", "0.56053364", "0.54752254", "0.53620136", "0.5292381", "0.525152", "0.5237822", "0.5237822", "0.5216326", "0.5214634", "0.5187367", "0.5181818", "0.5177927", "0.512274", "0.5112567",...
0.0
-1
__construct ini buat apa?
public function __construct(){ parent::__construct(); // parent ini buat apa? $this->load->model('menu_model'); $this->load->model('user_model'); $this->load->model('order_model'); $this->load->model('bayar_model'); $this->load->helper('text'); // ini buat apa? $this->load->helper('url_helper'); // meload helper gunanya untuk apa? if($this->session->has_userdata('username')){ //has_userdata ini apa? buat sendiri kah? if ($_SESSION['status']=='user') { // session itu untuk menampung sementara ketita dia login/yg memerlukan username }else if ($_SESSION['status']='admin'){ redirect('admin'); // 'admin' apa namanya? kapan dibuatnya? }else { echo "<script>alert('maaf status anda tidak jelas')</script>"; redirect('login'); //'login' juga kapan dibuat kok tiba2 uda di direct aja? } }else{ redirect('login'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "private fun...
[ "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.83479255", "0.8243098", "0.82011575", "0.81697345",...
0.0
-1
Save person to database
public function save();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function save() {\n\t\t// Error-checking should already be complete\n\t\tif(person::exists($this->id)) {\n\t\t\t// UPDATE an existing database entry\n\t\t\t$query = \"UPDATE people set \"\n\t\t\t\t\t.\"firstname = \".$this->firstname.\", \"\n\t\t\t\t\t.\"lastname = \".$this->lastname.\", \"\n\t\t\t\t\t.\"address_h...
[ "0.70909876", "0.6967318", "0.6967318", "0.6965577", "0.69654566", "0.69243187", "0.6915628", "0.6883446", "0.6870973", "0.6870973", "0.6870973", "0.6870973", "0.6870973", "0.6864391", "0.68398476", "0.6835868", "0.6804525", "0.67879343", "0.67794484", "0.6696268", "0.6644017...
0.7128582
16
Run the database seeds.
public function run() { factory(Pregunta::class)->create([ 'contenido' => '¿Tengo algún malestar fisico?', 'id_tipo' => '1', 'id_area' => '1', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Tengo algún dolor?', 'id_tipo' => '1', 'id_area' => '1', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Tengo algún sintoma?', 'id_tipo' => '1', 'id_area' => '1', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Representa ese sintoma alguna enfermedad?', 'id_tipo' => '1', 'id_area' => '1', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Me encuentro usando algún medicamento autorecetado?', 'id_tipo' => '1', 'id_area' => '2', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Me encuentro usando algún medicamento recomendado por un amigo?', 'id_tipo' => '1', 'id_area' => '2', ]); factory(Pregunta::class)->create([ 'contenido' => '¿He vuelto a tomar algún medicamento si consultar a un especialista?', 'id_tipo' => '1', 'id_area' => '2', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Me siento bajo presión psicologica?', 'id_tipo' => '1', 'id_area' => '3', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Siento que tengo problemas en mi ambiente laboral?', 'id_tipo' => '1', 'id_area' => '3', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Siento que tengo problemas personales?', 'id_tipo' => '1', 'id_area' => '3', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Estoy cansado?', 'id_tipo' => '1', 'id_area' => '4', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Tengo sueño constantemente?', 'id_tipo' => '1', 'id_area' => '4', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Tengo necesidad constantemente de acostarme o recostarme?', 'id_tipo' => '1', 'id_area' => '4', ]); factory(Pregunta::class)->create([ 'contenido' => '¿Siento que todo me cuesta el doble?', 'id_tipo' => '1', 'id_area' => '4', ]); factory(Pregunta::class)->create([ 'contenido' => '¿He comido en los horarios correspondientes hoy?', 'id_tipo' => '1', 'id_area' => '5', ]); factory(Pregunta::class)->create([ 'contenido' => '¿2 + 2?', 'id_tipo' => '2', 'id_area' => '6', ]); factory(Pregunta::class)->create([ 'contenido' => '¿2 = 5?', 'id_tipo' => '1', 'id_area' => '6', ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run()\n {\n // $this->call(UserTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(TagTableSeeder::class);\n // $this->call(PostTagTableSeeder::class);\n\n /*AB - use faker to populate table see file ModelFactory.php */\n fact...
[ "0.80140394", "0.7980541", "0.79775697", "0.79547316", "0.79514134", "0.79500794", "0.79444957", "0.794259", "0.79382807", "0.7937482", "0.7934376", "0.7892533", "0.7881253", "0.78794724", "0.7879101", "0.7875628", "0.787215", "0.7870168", "0.78515327", "0.7850979", "0.784195...
0.0
-1
Do not enable this until we need to store all the executed queries this may slow down the site.
public function add_query_filter_wptc(){ // add_filter('query', array($this->hooks_handler_obj, 'wtc_record_query'), 10); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function queries_run(){\n\t\tglobal $database_sql_queries;\n\t\treturn($database_sql_queries);\n\t}", "public function init_save_queries()\n {\n }", "public static function enableQueryLog()\n {\n }", "function dq_dump_queries() {\n\tglobal $wpdb;\n\t$hide = true;\n\n\tif ($hide) e...
[ "0.6956049", "0.6832898", "0.66475844", "0.6428341", "0.64094657", "0.6400613", "0.6352814", "0.6351529", "0.6307424", "0.6256685", "0.6188031", "0.6184426", "0.61808294", "0.6164062", "0.60676956", "0.6030711", "0.6027162", "0.6025277", "0.600921", "0.60076326", "0.600492", ...
0.0
-1
/ Methods used for getting the properties of this class.
public function getController() { return $this->controller; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getProperties() {}", "public function getProperties() {}", "public function getProperties() {}", "public function getProperties() {}", "public function getProperties();", "public function getProperties();", "public function getProperties();", "public function getProperties();", "fun...
[ "0.87147427", "0.87145287", "0.87145287", "0.87145287", "0.86497045", "0.86497045", "0.86497045", "0.86497045", "0.8599027", "0.8508741", "0.8414333", "0.8352769", "0.83006334", "0.828508", "0.82735753", "0.82617146", "0.8240456", "0.8232146", "0.8224533", "0.8224533", "0.822...
0.0
-1
It handles the request from chain class
abstract public function handleRequest($request);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _request() {}", "protected abstract function handleRequest();", "abstract public function handle_request();", "public function handleRequest() {}", "protected function forwardToReferringRequest() {}", "private function requestProcessor() {\n try {\n\n if (empty($this-...
[ "0.68424773", "0.66104585", "0.6554545", "0.65527254", "0.6520031", "0.65182334", "0.6514471", "0.64878523", "0.64878523", "0.64878523", "0.6459114", "0.6397065", "0.6350654", "0.6324475", "0.61416435", "0.6090599", "0.6090599", "0.602621", "0.5998086", "0.5995677", "0.599188...
0.58937067
25
It sets the next part of chain
abstract public function setSuccessor($nextService);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setNext($next) {}", "function setFirstNext($next){\r\n\t\t$this->first->next=$next;\r\n\t}", "public function set_next_stage() {\n\t\t$this->debug = [];\n\t\t$stage = $this->get_current_stage();\n\n\t\tif ( $stage ) {\n\t\t\t$stage = $this->get_next_stage( $stage );\n\n\t\t\t// Save next positi...
[ "0.67513233", "0.6632744", "0.6046491", "0.6011356", "0.58915275", "0.58906", "0.58715916", "0.58591807", "0.5848773", "0.5781889", "0.57494503", "0.5738493", "0.5729846", "0.57184297", "0.57123613", "0.57123613", "0.5677963", "0.5654253", "0.5654253", "0.5630385", "0.5629181...
0.0
-1
Show the form for creating a new resource.
public function __construct(){ $this->middleware('auth', ['only'=>['create']]) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view(...
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.717428...
0.0
-1
Remove the specified resource from storage.
public function destroy($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n ...
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897...
0.0
-1
Set basic widget options and call parent class construct
public function __construct() { parent::__construct( 'eltd_weather_widget', // Base ID esc_html__('Elated Weather Widget','newsroom') // Name ); $this->setParams(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function __construct() {\n\n\t\t// Widget Handle\n\t\t$this->ID = 'example-widget';\n\n\t\t// Widget Config\n\t\t$this->options = array(\n\t\t\t'name' => 'Example Widget', // Widget name\n\t\t\t'description' => 'Widget description.', // Widget description\n\t\t\t'classname' => 'projects-cycle-widge...
[ "0.7353356", "0.73253137", "0.72680193", "0.72453433", "0.72325444", "0.71455973", "0.7096777", "0.7073983", "0.7057116", "0.703536", "0.7024676", "0.6992184", "0.6986105", "0.69786686", "0.697371", "0.6948472", "0.69445705", "0.69445705", "0.693425", "0.69292414", "0.6927676...
0.67757815
37
Prevent Magento from generating classes that we use to detect the Smile ES module
public function generateClass($className) { if ($className === 'Smile\ElasticsuiteCore\Search\Request\Query\QueryFactory') { return parent::GENERATION_SKIP; } return parent::generateClass($className); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function beforeToHtml()\n {\n if (!\\class_exists('Mage')) {\n class_alias('\\LCB\\Mage\\Framework\\Mage', 'Mage');\n }\n }", "function provide_import() {\n return false;\n }", "function power_seo_disabled() {\n\n\treturn defined( 'POWER_SEO_DISABLED' ) && POWER_SE...
[ "0.56932163", "0.5546809", "0.54357666", "0.54304254", "0.5380196", "0.5353186", "0.52862483", "0.52564824", "0.5234706", "0.5171732", "0.51434493", "0.51324105", "0.51186174", "0.51173276", "0.5112634", "0.5069098", "0.5053909", "0.5031208", "0.5027362", "0.5026918", "0.5023...
0.4993496
23
create condition value dropdown values
function createRoomDropDown($dbSelected) { $tSQLselect = "SELECT "; $tSQLselect .= "loc_room "; $tSQLselect .= "FROM "; $tSQLselect .= "nhi_locations "; $tSQLselect .= "order by loc_room "; $tSQLselect_Query = mysqli_query($dbSelected, $tSQLselect); $DropDown = ""; $DropDown .= " <option value=\"\">\n"; while ($row = mysqli_fetch_assoc($tSQLselect_Query)) { foreach ($row as $idx => $r) { $DropDown .= " <option value=\"$r\">\n"; } } mysqli_free_result($tSQLselect_Query); return $DropDown; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getNewChildSelectOptions()\n {\n $conditions = [\n ['value' => $this->getType(), 'label' => __('Conditions Combination')],\n $this->_attributeFactory->create()->getNewChildSelectOptions(),\n ];\n\n $conditions = array_merge_recursive(parent::getNewChild...
[ "0.59829366", "0.59741426", "0.5927966", "0.5903364", "0.58982414", "0.58633244", "0.5825789", "0.57977307", "0.5778796", "0.5760906", "0.5747261", "0.57240325", "0.57076496", "0.56745607", "0.56613135", "0.5658931", "0.56042165", "0.55952954", "0.55860245", "0.55698043", "0....
0.0
-1
Leer fichero y generar saltos de linea en parrafo ...
function texto($fichero="") { echo '<div class="row"> <blockquote class="blockquote ml-3 text-justify">'; if ("$fichero" == "") { echo '<br>'; } else { // Leer fichero $texto=file_get_contents($fichero); $texto='<p>' . str_replace("·", "<br>",$texto) . '</p>'; echo $texto; } echo '</blockquote> </div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function lerArquivoLog(){\n $ponteiro = fopen(\"C:\\\\temp\\\\teste2.txt\", \"r\");\n\n //Abre o aruqivo .txt\n while(!feof($ponteiro)) {\n $linha = fgets($ponteiro, 4096);\n //Imprime na tela o resultado\n $this->pulaLinha();\n }\n //Fecha...
[ "0.68096864", "0.60303247", "0.589639", "0.5840538", "0.5830748", "0.57983434", "0.57871723", "0.5782272", "0.5780235", "0.57479316", "0.57354856", "0.5696811", "0.56890535", "0.56374145", "0.56162596", "0.55824184", "0.5523743", "0.5516619", "0.55031353", "0.54789263", "0.54...
0.0
-1
Plugin Name: OMDB Plugin URI: localhost/omdb Description: Searches OMDB by title Version: 1.0 Author: Adam Singh Author URI: localhost Function that retrieve search results from the API [movie title="Good Will Hunting"]
function omdb_search($atts) { //Setting attributes from the short code $a = shortcode_atts(array('title' => "Good Will Hunting"), $atts); $your_key = "a61b2946"; //Key from OMDB $url = "http://www.omdbapi.com/?apikey=".$your_key."&t=".$a['title']; $response = wp_remote_get($url); //Calling OMDB for data //Catching an error if it occurs if(is_wp_error($response)) { die("Error occred when retrieving data."); } //Decoding the json $data = json_decode($response['body'], true); //Creating the begining of the table $table = "<table style=\"width:100%\">"; //for loop that traverses through the data foreach($data as $key => $value) { if($key == "Ratings") //Rating found { //for loop for traversing through the ratings foreach($value as $rating) { $table .= "<tr>"; $table .= "<td>Source</td>"; $table .= "<td>".$rating['Source']."</td>"; $table .= "</tr>"; }//End of foreach($value as $rating) }//End of if($key == "Ratings") else //Ratings not found { $table .= "<tr>"; $table .= "<td>".$key."</td>"; $table .= "<td>".$value."</td>"; $table .= "</tr>"; }//End of else }//End of foreach($data as $key => $value) //End of the table $table .= "</table>"; echo $table; //Printing table }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getMovieInformation($movie)\n{\n if($movie != \"\") {\n $OMDB_API_KEY = '99842c57';\n $omdbUrl = \"http://www.omdbapi.com?s=$movie&apikey=$OMDB_API_KEY&type=movie\";\n $movie = file_get_contents($omdbUrl);\n\n $movieDetails =json_decode($movie, true);\n\n \n if(count($movie...
[ "0.55437243", "0.55127805", "0.53031915", "0.52433", "0.5176246", "0.5174078", "0.51416534", "0.5122727", "0.5116539", "0.51081324", "0.5076951", "0.5042895", "0.500784", "0.50071234", "0.50063574", "0.49717832", "0.49602446", "0.49433488", "0.49287233", "0.49139565", "0.4913...
0.5869707
0
Return whether we're testing Varien_Object, where bug in unsetOldData() is fixed
protected static function _isFixedBugWithOldDataNullKey() { if (!defined('TESTS_MAGENTO_PATH')) { return true; // php_mage extension has non-buggy functionality } $reflectionMethod = new ReflectionMethod('Varien_Object', 'unsetOldData'); $sourceClass = file($reflectionMethod->getFileName()); $sourceMethod = array_slice($sourceClass, $reflectionMethod->getStartLine(), $reflectionMethod->getEndLine() - $reflectionMethod->getStartLine()); $source = implode("\n", $sourceMethod); return strpos($source, '$this->_oldFieldsMap') !== false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function changelog_validate_object () {\n\t\t# set valid objects\n\t\t$objects = array(\n\t\t\t\t\t\t\"ip_addr\",\n\t\t\t\t\t\t\"subnet\",\n\t\t\t\t\t\t\"section\"\n\t\t\t\t\t\t);\n\t\t# check\n\t\treturn in_array($this->object_type, $objects) ? true : false;\n\t}", "protected function isUnchanged() {}",...
[ "0.6035578", "0.595178", "0.59030485", "0.5902927", "0.5800507", "0.5791812", "0.57532674", "0.57275575", "0.5698497", "0.5694829", "0.56756383", "0.56614673", "0.5654564", "0.56535953", "0.5642814", "0.5601161", "0.55899113", "0.55794257", "0.55789065", "0.55774814", "0.5559...
0.72413844
0
Test for a case, when there are numbered old fields. This use case is never used in Magento (moreover it has bugs there), so the test just ensures, that no exceptions or segfaults occur because of such call
public function testUnsetOldDataWithNumbers($initialData, $key) { $object = new Zerkella_PhpMage_Varien_Object_Descendant_OldFieldsMap_DynamicWithNumbers($initialData); $result = $object->unsetOldData($key); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function testFieldsDontRerequestChanges() {\r\n\t\t$db = DB::getConn();\r\n\t\tDB::quiet();\r\n\t\t\r\n\r\n\t\t// Table will have been initially created by the $extraDataObjects setting\r\n\t\t\r\n\t\t\r\n\t\t// Verify that it doesn't need to be recreated\r\n\t\t$db->beginSchemaUpdate();\r\n\t\t$obj = new DataObje...
[ "0.59022564", "0.5888162", "0.58190006", "0.5766772", "0.56933594", "0.5556578", "0.5548521", "0.54868937", "0.5458287", "0.54496735", "0.5410165", "0.53695315", "0.5367168", "0.5319271", "0.5313533", "0.5306452", "0.53057164", "0.5287275", "0.5259805", "0.5255965", "0.525084...
0.5327833
13
Display a listing of the resource.
public function index() { // return view('layouts.registrasi'); // dd(Auth::user()); $pelanggan = Pelanggan::where('id_user', Auth::user()->pelanggan()->first()->id)->first(); return view('index', compact('pelanggan')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->re...
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.683052...
0.0
-1
Show the form for creating a new resource.
public function create() { return view('layouts.registrasi'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view(...
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.717428...
0.0
-1
Store a newly created resource in storage.
public function store(Request $request) { // dd($request); $request->validate([ 'nama' => 'required|String|max:255', 'alamat' => 'required|string|max:255', 'nohp' => 'required|string|max:255', 'email' => 'required|string|email|max:255|unique:users', 'password' => 'required|string|min:6|confirmed', ]); // dd('masuk'); $user=User::create([ 'email' => $request->email, 'password' => Hash::make($request->password), 'role' => 'pembeli', ]); Pelanggan::create([ 'id_user'=> $user->id, 'nama' => $request->nama, 'alamat' => $request->alamat, 'nohp' => $request->nohp, ]); return view('welcome'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations...
[ "0.7286258", "0.71454436", "0.7132821", "0.6640289", "0.6621105", "0.6566493", "0.65255576", "0.65087926", "0.6448317", "0.63752604", "0.63736314", "0.6365631", "0.6365631", "0.6365631", "0.634229", "0.634229", "0.634229", "0.634229", "0.634229", "0.634229", "0.634229", "0....
0.0
-1
Display the specified resource.
public function show(pelanggan $pelanggan) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id...
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245...
0.0
-1
Show the form for editing the specified resource.
public function edit(pelanggan $pelanggan) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n ...
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.6833...
0.0
-1
Update the specified resource in storage.
public function update(Request $request, pelanggan $pelanggan) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ...
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890...
0.0
-1
Remove the specified resource from storage.
public function destroy(pelanggan $pelanggan) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n ...
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897...
0.0
-1
DOES NOT SANITIZE: esc_html for tests without loading WordPress
function esc_html($value) { return $value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function esc_html( $text ) {\n\t$safe_text = wp_check_invalid_utf8( $text );\n\t$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );\n\t/**\n\t * Filter a string cleaned and escaped for output in HTML.\n\t *\n\t * Text passed to esc_html() is stripped of invalid or special characters\n\t * before output.\n\t *...
[ "0.7820635", "0.7720442", "0.76926124", "0.7673675", "0.72213537", "0.70321184", "0.70268965", "0.6888477", "0.6887617", "0.68384695", "0.6829406", "0.68002635", "0.6780979", "0.67260444", "0.6672598", "0.66534454", "0.66375023", "0.66373247", "0.66035885", "0.65975744", "0.6...
0.7517689
4
DOES NOT SANITIZE: esc_attr for tests without loading WordPress
function esc_attr($value) { return $value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function esc_attr( $text ) {\r\n\t$safe_text = wp_check_invalid_utf8( $text );\r\n\t$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );\r\n\t/**\r\n\t * Filters a string cleaned and escaped for output in an HTML attribute.\r\n\t *\r\n\t * Text passed to esc_attr() is stripped of invalid or special characters\...
[ "0.7714346", "0.7655529", "0.7497903", "0.7321529", "0.7312101", "0.69006974", "0.6862679", "0.6846908", "0.6838206", "0.67843723", "0.67037374", "0.66565704", "0.6595387", "0.6562398", "0.6528609", "0.6511456", "0.6489237", "0.64501077", "0.64376867", "0.6415322", "0.6405743...
0.77115417
1
Updates statistics with a games result
public static function update(Game $game) { $stats = self::get(); if (isset($stats[$game->getState()->getId()])) { $stats[$game->getState()->getId()]++; } else { $stats[$game->getState()->getId()] = 1; } if (isset($stats[self::STATISTIC_COMPUTER_DRAW_PREFIX][$game->getComputerDecision()->getId()])) { $stats[self::STATISTIC_COMPUTER_DRAW_PREFIX][$game->getComputerDecision()->getId()]++; } else { $stats[self::STATISTIC_COMPUTER_DRAW_PREFIX][$game->getComputerDecision()->getId()] = 1; } if (isset($stats[self::STATISTIC_OPPONENT_DRAW_PREFIX][$game->getOpponentDecision()->getId()])) { $stats[self::STATISTIC_OPPONENT_DRAW_PREFIX][$game->getOpponentDecision()->getId()]++; } else { $stats[self::STATISTIC_OPPONENT_DRAW_PREFIX][$game->getOpponentDecision()->getId()] = 1; } $cache = new FilesystemCache(); $cache->set(self::STATISTIC_PREFIX, $stats); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function updateTeamStats()\n {\n $conditions = array('stats.needs_update' => true);\n $fields = array('league_id');\n $teams_needing_update = Teams::all(compact('conditions', 'fields'));\n\n $team_id_list = array();\n $team_stats = array();\n foreach ($teams_n...
[ "0.67188734", "0.6527138", "0.634093", "0.6315318", "0.62692946", "0.5935375", "0.5893242", "0.5779762", "0.5761269", "0.5736024", "0.5734782", "0.5700259", "0.5681702", "0.56689024", "0.5665348", "0.56505257", "0.5645573", "0.5644526", "0.56223375", "0.5593789", "0.5589734",...
0.6394207
2
Gets the total number of wins
public static function getWins($includeOpponents = true, $includeComputer = true) { $number = 0; $stats = self::get(); if ($includeOpponents && isset($stats[GameState::OPPONENT_WON])) { $number+= $stats[GameState::OPPONENT_WON]; } if ($includeComputer && isset($stats[GameState::COMPUTER_WON])) { $number+= $stats[GameState::COMPUTER_WON]; } return $number; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function totalPlayerWins()\n {\n $qb = $this->createQueryBuilder('r')\n ->select('COUNT(r)')\n ->where('r.win = true')\n ;\n\n return $qb->getQuery()->getSingleScalarResult();\n }", "public function totalComputerWins()\n {\n $qb = $this->createQueryBu...
[ "0.83989877", "0.816922", "0.7718205", "0.7718205", "0.7449752", "0.71423286", "0.7052044", "0.69959015", "0.6981016", "0.68820983", "0.6860618", "0.67876786", "0.6651585", "0.66450506", "0.66443545", "0.6626646", "0.65992785", "0.655434", "0.65114754", "0.6489861", "0.646547...
0.7413976
5
Gets the total number of throws by types
public static function getDecisions(int $decisionTypeId, $includeOpponents = true, $includeComputer = true) { $number = 0; $stats = self::get(); if ($includeOpponents && isset($stats[self::STATISTIC_OPPONENT_DRAW_PREFIX][$decisionTypeId])) { $number+= $stats[self::STATISTIC_OPPONENT_DRAW_PREFIX][$decisionTypeId]; } if ($includeComputer && isset($stats[self::STATISTIC_COMPUTER_DRAW_PREFIX][$decisionTypeId])) { $number+= $stats[self::STATISTIC_COMPUTER_DRAW_PREFIX][$decisionTypeId]; } return $number; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getErrorCount();", "public function getNumberOfTypes(): int;", "private function get_count( array $stats, $type = 'getCorrectCount' ) {\n\t\t\t$count = 0;\n\n\t\t\tforeach ( $stats as $stat ) {\n\t\t\t\t$count = $count + $stat->$type();\n\t\t\t}\n\n\t\t\treturn $count;\n\t\t}", "public functi...
[ "0.6594597", "0.6349561", "0.6251993", "0.61659163", "0.5998645", "0.59944147", "0.59944147", "0.59918886", "0.5971147", "0.5806768", "0.57627934", "0.57592833", "0.5733434", "0.57288146", "0.56933475", "0.5677652", "0.5663938", "0.5610491", "0.561032", "0.5596796", "0.559067...
0.0
-1
Provides data for testTemplatePreprocessUpdateReport().
public function providerTemplatePreprocessUpdateReport() { return [ '$variables with data not set' => [ [], ], '$variables with data as an interger' => [ ['data' => 4], ], '$variables with data as a string' => [ ['data' => 'I am a string'], ], ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function templateData()\n {\n return $this->templateData;\n }", "public function templateData() {\n return array();\n }", "protected function getTemplateData() {\r\n return $this->templateData;\r\n }", "protected function preprocessData() {}", "function prepareTemplateVars...
[ "0.5940317", "0.5926782", "0.5818001", "0.57136965", "0.56867206", "0.5643051", "0.56323236", "0.56283516", "0.55528146", "0.55338997", "0.54815525", "0.5401672", "0.54012936", "0.5378693", "0.537162", "0.53187644", "0.53041244", "0.5270606", "0.52558017", "0.52430856", "0.52...
0.77148503
0
Add a custom attribute
public function addCustomAttribute($key, $value = null) { $this->CUSTOMATTRIBUTES[$key] = $value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addAttribute($name, $value);", "function addAttribute($name, $value) {\n $this->_attributes[$name] = $value;\n }", "public function addAttribute(string $name, $value): self;", "public function createAttribute()\n\t{\n\n\t\t$this->createCustomAttribute($this->attributeName, $this->argument...
[ "0.79308", "0.7323362", "0.73170894", "0.716069", "0.7054427", "0.7004061", "0.68869555", "0.6751144", "0.662246", "0.6610369", "0.65632683", "0.65312934", "0.6523838", "0.642234", "0.63994384", "0.6396421", "0.63917685", "0.63744026", "0.6360682", "0.6356719", "0.63457364", ...
0.66961396
8
Display a listing of the resource.
public function index() { // $activities = Activity::orderBy('id', 'asc')->get()->all(); $activities = Activity::withCount('activityImages')->orderBy('id', 'desc')->paginate(10); return view('pages.activities.index', ['activities' => $activities]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->re...
[ "0.7447426", "0.73628515", "0.73007894", "0.7249563", "0.7164474", "0.7148467", "0.71320325", "0.7104678", "0.7103152", "0.7100512", "0.7048493", "0.6994995", "0.69899315", "0.6935843", "0.6899995", "0.68999326", "0.6892163", "0.6887924", "0.6867505", "0.6851258", "0.6831236"...
0.0
-1
Show the form for creating a new resource.
public function create() { $activityImages = ActivityImage::all(); return view('pages.activities.create', ['activityImages' => $activityImages]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view(...
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.717428...
0.0
-1
Store a newly created resource in storage.
public function store(Request $request) { $this->validate($request, [ 'title' => 'required', 'description' => 'required', ]); /* CREATING THE activity */ $activity = new Activity(); $activity->title = $request->title; $activity->description = $request->description; $activity->save(); /* CREATING THE image(s) */ if($request->image_url) { $counter = 1; $activityImagesFolderPath = 'app\\tmp\\activityImages\\' . '\\'; foreach ($request->image_url as $image_url) { $activityImage = new activityImage(); $activityImage->activity_id = $activity->id; $activityImage->title = $request->title . '_' . $counter; $activityImage->image_url = $image_url; $activityImage->save(); $counter++; //Deleting the temporary files File::delete(storage_path($activityImagesFolderPath . $image_url)); } } return redirect('/admin/activities')->with('status', 'Book created successfully!'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations...
[ "0.72865677", "0.7145327", "0.71325725", "0.6640912", "0.66209733", "0.65685713", "0.652643", "0.65095705", "0.64490104", "0.637569", "0.63736665", "0.63657933", "0.63657933", "0.63657933", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.63424...
0.0
-1
Display the specified resource.
public function show(Activity $activity) { $nextActivityId = ($activity->id)+1; $nextActivity = Activity::where('id', $nextActivityId)->get()->first(); if($nextActivity != null) $next = $nextActivityId; else $next = 0; $previousActivityId = ($activity->id)-1; $previousActivity = Activity::where('id', $previousActivityId)->get()->first(); if($previousActivity != null) $previous = $previousActivityId; else $previous = 0; return view('pages.activities.show', ['activity' => $activity, 'next'=>$next, 'previous'=> $previous]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id...
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245...
0.0
-1
Show the form for editing the specified resource.
public function edit(Activity $activity) { return view('pages.activities.edit', ['activity' => $activity]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n ...
[ "0.7854417", "0.7692986", "0.72741747", "0.72416574", "0.7173436", "0.706246", "0.70551765", "0.698488", "0.6948513", "0.694731", "0.69425464", "0.6929177", "0.6902573", "0.6899662", "0.6899662", "0.6878983", "0.6865711", "0.6861037", "0.6858774", "0.6847512", "0.6836162", ...
0.0
-1
Update the specified resource in storage.
public function update(Request $request, Activity $activity) { /* UPDATING THE activity */ $activity->title = $request->title; $activity->description = $request->description; $activity->save(); /* UPDATING THE image(s) */ if($request->image_url[0] != null) { //Delete all the images. $oldImages = ActivityImage::where('activity_id', $activity->id)->get()->all(); foreach($oldImages as $oldImage) { $oldImage->delete(); } //Create the new images and delete the temporary files. $counter = 1; $activityImagesFolderPath = 'app\\tmp\\activityImages\\' . '\\'; foreach ($request->image_url as $image_url) { $activityImage = new activityImage(); $activityImage->activity_id = $activity->id; $activityImage->title = $request->title . '_img' . $counter; $activityImage->image_url = $image_url; $activityImage->save(); $counter++; //Deleting the temporary files File::delete(storage_path($activityImagesFolderPath . $image_url)); } } return redirect('/admin/activities')->with('status', 'Book edited successfully!'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ...
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890...
0.0
-1
Remove the specified resource from storage.
public function destroy(Activity $activity) { $activity->delete(); return redirect('/admin/activities')->with('status','Item deleted successfully!'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n ...
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897...
0.0
-1
Helper function to quickly output the results of $books from our various tests For demo purposes we're echoing data out in the controller, but you should not do this in projects or "real world" examples.
private function printBooks($books) { foreach($books as $book) { echo 'id:'.$book->id.' title: '.$book->title.'<br>'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function testFindBooksResults() {\n\n /* test title */\n echo '<h2 style=\"color: black;\">testFindBookResults...</h2>';\n\n /* can't page layout because of the indeterminate nature of\n * results (i.e. we can't guarantee there's a book in the \n * production database, and the page layout depends ...
[ "0.6895703", "0.6831107", "0.68240917", "0.66861844", "0.6685816", "0.66041535", "0.638851", "0.6316246", "0.6250085", "0.6182789", "0.61757237", "0.61446655", "0.61263126", "0.6109041", "0.6099881", "0.6093157", "0.60264635", "0.600652", "0.5992481", "0.5955284", "0.59318084...
0.676513
3
Demonstrate using the Book model without prefixing with \App\Book This works because of the use `App\Book;` statement at the top of this file
public function getEx15() { $books = Book::all(); $this->printBooks($books); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function model()\n {\n return 'App\\QuickBooks';\n }", "public function __construct(Book $book)\n {\n $this->BookModel = $book;\n }", "public function __construct(){\n // make sure you do something like that in your index.php\n require_once('models/book.php');\n ...
[ "0.6795844", "0.65076", "0.6342043", "0.62859106", "0.6202635", "0.61866075", "0.61579686", "0.6147237", "0.6145102", "0.6080602", "0.6078917", "0.5997397", "0.5997323", "0.591618", "0.58688605", "0.5795247", "0.56935096", "0.56911737", "0.5606732", "0.5595873", "0.5573688", ...
0.0
-1
Practice from notes on Models: Find any books by the author Bell Hooks and update the author name to be bell hooks (lowercase).
public function getEx13() { # Approach # 1 # Get all the books that match the criteria $books = \App\Book::where('author','=','Bell Hooks')->get(); # Loop through each book and update them foreach($books as $book) { $book->author = 'bell hooks'; $book->save(); } # Resulting SQL: # Always: # 1) select * from `books` where `author` = 'Bell Hooks' # Only if there's something to update: # 2) update `books` set `updated_at` = '2016-04-12 18:46:04', `author` = 'bell hooks' where `id` = '8' # Approach #2 \App\Book::where('author', '=', 'Bell Hooks')->update(['author' => 'bell hooks']); # Resulting SQL: # Always: # 1) update `books` set `author` = 'bell hooks', `updated_at` = '2016-04-12 18:44:46' where `author` = 'Bell Hooks' return '"Bell Hooks" => "bell hooks"'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getEx6() {\n # First get a book to update\n $book = \\App\\Book::where('author', 'LIKE', '%Scott%')->first();\n # If we found the book, update it\n if($book) {\n # Give it a different title\n $book->title = 'The Really Great Gatsby';\n # ...
[ "0.6002671", "0.587632", "0.5845784", "0.57047755", "0.56890315", "0.561786", "0.56017345", "0.55889004", "0.55870485", "0.5581467", "0.5558776", "0.55468273", "0.5543281", "0.5519324", "0.55115426", "0.55115426", "0.55115426", "0.5510896", "0.5483642", "0.5472748", "0.544256...
0.6625447
0
Practice from notes on Models: Retrieve all the books in descending order according to published date
public function getEx12() { $books = \App\Book::orderBy('published','desc')->get(); $this->printBooks($books); # Underlying SQL: select * from `books` order by `published` desc }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function latest_books()\n {\n //thiet lap rieng\n $this->paginate = array(\n 'fields' => array('id', 'title', 'slug', 'image', 'sale_price'),\n 'order' => array('created' => 'desc'),\n 'limit' => 8,\n 'contain'=> arra...
[ "0.664487", "0.66268075", "0.63996667", "0.6333038", "0.63007253", "0.62964976", "0.6257233", "0.6132179", "0.6080486", "0.5959239", "0.5945087", "0.5939681", "0.59193873", "0.58530307", "0.5847881", "0.5840894", "0.57964605", "0.5785783", "0.5782388", "0.57759106", "0.577208...
0.72998583
0
Practice from notes on Models: Retrieve all the books in alphabetical order by title
public function getEx11() { $books = \App\Book::orderBy('title','asc')->get(); $this->printBooks($books); # Underlying SQL: select * from `books` order by `title` asc }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function allRecordsByTitle(){\n\t $news = collect(DB::table('news')->get());\n\t return $news->sortBy('title');\n }", "public function getAllBooks(){\n $query = \"SELECT * FROM Book;\";\n return $this->getBookDetail($query);\n }", "public static function get_all_books() {\n\t\t...
[ "0.69672763", "0.67620957", "0.66572577", "0.6633597", "0.66289234", "0.65558666", "0.6538621", "0.65146446", "0.65015584", "0.6445272", "0.64435744", "0.6397994", "0.6377456", "0.6371801", "0.6368506", "0.63493663", "0.6328112", "0.6325117", "0.63138676", "0.6281114", "0.624...
0.6956423
1
Practice from notes on Models: Retrieve all the books published after 1950
public function getEx10() { $books = \App\Book::where('published','>',1950)->get(); $this->printBooks($books); # Underlying SQL: select * from `books` where `published` > '1950' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getEx12() {\n $books = \\App\\Book::orderBy('published','desc')->get();\n $this->printBooks($books);\n # Underlying SQL: select * from `books` order by `published` desc\n\t}", "function bm_get_books($all=false) {\n\n $now = time();\n $books = array();\n $data = @getXML(BMB...
[ "0.72562957", "0.69154596", "0.65214384", "0.6507692", "0.6353704", "0.63432425", "0.6179446", "0.61784595", "0.61729115", "0.6163359", "0.61611396", "0.6026118", "0.5979315", "0.5978755", "0.5978443", "0.59604555", "0.5953469", "0.5950752", "0.5942591", "0.59336406", "0.5920...
0.79408365
0
Practice from notes on Models: Show the last 5 books that were added to the books table
public function getEx9() { # Ref: https://laravel.com/docs/5.2/queries#ordering-grouping-limit-and-offset $books = \App\Book::orderBy('id', 'desc')->get()->take(5); $this->printBooks($books); # Underlying SQL: select * from `books` order by `id` desc }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get5book(){\n $db =new DbConnect();\n $con =$db->connect();\n $books5 = array();\n $result_book = mysqli_query($con,\"SELECT * from book order by book_id DESC LIMIT 5\");\n while($book5 = mysqli_fetch_array($result_book,MYSQLI_ASSOC)){\n array_push($boo...
[ "0.66409665", "0.66152143", "0.6365157", "0.62084067", "0.6182886", "0.61390436", "0.6080838", "0.5995565", "0.5781299", "0.5759295", "0.5732717", "0.57060367", "0.57048255", "0.5679602", "0.5646191", "0.56201226", "0.561438", "0.5591857", "0.5582936", "0.5569142", "0.5557235...
0.6980189
0
Comparing get() and all()
public function getEx8() { # Get all the books $books = \App\Book::all(); $this->printBooks($books); # get() without any query constraints is the equivalent of all() $books = \App\Book::get(); $this->printBooks($books); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hasAllOf() {\n return isset($this->field['allOf']);\n }", "public function hasValues(){\n return $this->_has(1);\n }", "public function hasValues() {\n return $this->_has(2);\n }", "abstract public function all();", "public static function all();", "public static...
[ "0.60929894", "0.58653915", "0.57444715", "0.5743021", "0.56015617", "0.56015617", "0.56015617", "0.55878437", "0.55878437", "0.55878437", "0.55878437", "0.55878437", "0.55878437", "0.55878437", "0.55878437", "0.55878437", "0.55878437", "0.55878437", "0.55878437", "0.55878437",...
0.0
-1
Demonstrate deletion with the Book Model
public function getEx7() { # First get a book to delete $book = \App\Book::where('author', 'LIKE', '%Scott%')->first(); # If we found the book, delete it if($book) { # Goodbye! $book->delete(); return "Deletion complete; check the database to see if it worked..."; } else { return "Can't delete - Book not found."; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteFromBook(Book $book);", "public function deleteBook()\n {\n $id = $_POST['id'];\n $time = DELETE_AFTER;\n if (USE_ONE_TABLE) {\n $sql = \"UPDATE `books_authors` SET `deleted` = DATE_ADD(NOW(), interval $time HOUR) WHERE `id` = ?\";\n } else {\n ...
[ "0.8164867", "0.7616667", "0.75166726", "0.7470828", "0.7334113", "0.732572", "0.72823066", "0.72823066", "0.72823066", "0.72823066", "0.72823066", "0.72823066", "0.72823066", "0.72823066", "0.72823066", "0.72823066", "0.72795165", "0.69932836", "0.69479114", "0.6926514", "0....
0.0
-1
Demonstrate updating with the Book Model
public function getEx6() { # First get a book to update $book = \App\Book::where('author', 'LIKE', '%Scott%')->first(); # If we found the book, update it if($book) { # Give it a different title $book->title = 'The Really Great Gatsby'; # Save the changes $book->save(); echo "Update complete; check the database to see if your update worked..."; } else { echo "Book not found, can't update."; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function update(Request $request, book $book)\n {\n \n }", "public function update(Request $request, Book $book)\n {\n //\n }", "public function update(Request $request, Book $book)\n {\n //\n }", "public function update(Request $request, Book $book)\n {\n ...
[ "0.7667645", "0.7538131", "0.7538131", "0.7538131", "0.7538131", "0.7538131", "0.7538131", "0.7538131", "0.7538131", "0.7489761", "0.74205524", "0.72381616", "0.72381616", "0.72381616", "0.72381616", "0.72381616", "0.72381616", "0.72381616", "0.72381616", "0.72381616", "0.719...
0.70226324
24
Demonstrate reading with the Book Model
public function getEx5() { $books = \App\Book::all(); $this->printBooks($books); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_book();", "public function testRead() {\n $this->loadFixtures('Books');\n\n // Single\n $this->assertEquals(new Book([\n 'series_id' => 1,\n 'name' => 'A Game of Thrones',\n 'isbn' => '0-553-10354-7',\n 'released' => '1996-08-02...
[ "0.7531225", "0.6902521", "0.65265435", "0.6510694", "0.65106493", "0.643193", "0.6363639", "0.6341965", "0.6341965", "0.6341965", "0.6341965", "0.6341965", "0.6341965", "0.6341965", "0.6341965", "0.6341965", "0.6341965", "0.6341965", "0.6192898", "0.6128266", "0.61268085", ...
0.0
-1
Demonstrate creation with the Book Model
public function getEx4() { # Instantiate a new Book Model object $book = new \Book(); # Set the parameters # Note how each parameter corresponds to a field in the table $book->title = 'Harry Potter'; $book->author = 'J.K. Rowling'; $book->published = 1997; $book->cover = 'http://prodimage.images-bn.com/pimages/9780590353427_p0_v1_s484x700.jpg'; $book->purchase_link = 'http://www.barnesandnoble.com/w/harry-potter-and-the-sorcerers-stone-j-k-rowling/1100036321?ean=9780590353427'; # Invoke the Eloquent save() method # This will generate a new row in the `books` table, with the above data $book->save(); return 'Added: '.$book->title; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __construct(Book $book)\n {\n $this->BookModel = $book;\n }", "public function testCreateBook()\n {\n $this->post('/book', [\n 'title' => 'Aspernatur eum voluptas distinctio pariatur',\n 'author' => 'Vickie Muller'\n ]);\n\n $this->assert...
[ "0.7429246", "0.7419818", "0.73218113", "0.7242412", "0.7049051", "0.70392555", "0.7027714", "0.702668", "0.697427", "0.697427", "0.6943151", "0.6935824", "0.6855438", "0.680366", "0.68006366", "0.6792888", "0.672066", "0.66828793", "0.66710037", "0.66307193", "0.65985596", ...
0.0
-1
Demonstrate reading with a constraint with the QueryBuilder
public function getEx3() { # Use the QueryBuilder to get all the books where author is like "%Scott%" $books = \DB::table('books')->where('author', 'LIKE', '%Scott%')->get(); # Output the results $this->printBooks($books); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getConstraint($param);", "public function getConstraint() {}", "public function getConstraint() {}", "public function getConstraint();", "public function testLoad_Contraint()\n {\n \t$this->setExpectedException('Q\\DB_Constraint_Exception');\n\t\t$this->conn->lookupValue(\"test\", \"t...
[ "0.59067166", "0.5764477", "0.5764477", "0.57415676", "0.56804496", "0.55978674", "0.55978674", "0.54742604", "0.5468753", "0.5468753", "0.5449575", "0.53639686", "0.53639686", "0.5314218", "0.5289841", "0.5257484", "0.5255467", "0.52079266", "0.51794994", "0.51776475", "0.51...
0.0
-1
Demonstrate insertion with the QueryBuilder
public function getEx2() { // Use the QueryBuilder to insert a new row into the books table // i.e. create a new book \DB::table('books')->insert([ 'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->toDateTimeString(), 'title' => 'The Great Gatsby', 'author' => 'F. Scott Fitzgerald', 'published' => 1925, 'cover' => 'http://img2.imagesbn.com/p/9780743273565_p0_v4_s114x166.JPG', 'purchase_link' => 'http://www.barnesandnoble.com/w/the-great-gatsby-francis-scott-fitzgerald/1116668135?ean=9780743273565', ]); return 'Added book.'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "#[@test]\n public function insertViaQuery() {\n $this->createTable();\n $this->assertTrue($this->db()->query('insert into unittest values (1, \"kiesel\")'));\n }", "public function testInsert()\n {\n $statement = $this->getQueryBuilderConnection()\n ->insert()\n ->...
[ "0.7350047", "0.70593166", "0.66983706", "0.66983706", "0.6692008", "0.66109985", "0.64114356", "0.6372773", "0.63391656", "0.633321", "0.633321", "0.633321", "0.6332099", "0.63264275", "0.6308819", "0.6308819", "0.6260642", "0.6215942", "0.6197891", "0.6171348", "0.6168854",...
0.0
-1
Demonstrate reading with the QueryBuilder
public function getEx1() { # Use the QueryBuilder to get all the books $books = \DB::table('books')->get(); $this->printBooks($books); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function queryBuilder();", "public function queryBuilder();", "public function read()\n {\n $query = $this->queryBuilder->new($this->entityName)\n ->select()\n ->get();\n\n return $this->executeQueryForMultipleResults($query);\n }", "public function read(phpDa...
[ "0.6806512", "0.6806512", "0.6693228", "0.66869026", "0.6617617", "0.6509708", "0.6457566", "0.6446555", "0.6446555", "0.6419076", "0.6419076", "0.6419076", "0.6375953", "0.6352171", "0.63242614", "0.62856424", "0.628453", "0.6251405", "0.6234616", "0.6190713", "0.6138316", ...
0.0
-1
Makes sure that before the user can access the functions below, they'll need to be authorised
public function __construct() { $this->middleware('auth'); $this->middleware('role:admin'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function checkAccess()\n {\n // need to be modified for security\n }", "function require_permission($required)\n{\n require_login();\n\n // owners have full access\n if ($_SESSION['permission'] == OWN) {\n return;\n }\n\n if ($required != $_SESSION['permission']) {\n ...
[ "0.73193437", "0.7211918", "0.7152192", "0.7127176", "0.7127176", "0.7026352", "0.70066243", "0.70066243", "0.70066243", "0.700627", "0.700627", "0.70049953", "0.70049953", "0.70049953", "0.6995187", "0.6983926", "0.6983926", "0.69509435", "0.68916076", "0.6881515", "0.683405...
0.0
-1
Display a listing of the resource.
public function index() { $countries = Country::orderBy('name', 'asc')->paginate(15); return view('admin.countries.index')->with([ 'countries' => $countries ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->re...
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.683052...
0.0
-1
Show the form for editing the specified resource.
public function edit($id) { $country = Country::findOrFail($id); return view('admin.countries.edit')->with([ 'country' => $country ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n ...
[ "0.7854417", "0.7692986", "0.72741747", "0.72416574", "0.7173436", "0.706246", "0.70551765", "0.698488", "0.6948513", "0.694731", "0.69425464", "0.6929177", "0.6902573", "0.6899662", "0.6899662", "0.6878983", "0.6865711", "0.6861037", "0.6858774", "0.6847512", "0.6836162", ...
0.0
-1
Update the specified resource in storage.
public function update(Request $request, $id) { $request->validate([ 'name' => 'required|string|max:255', 'continent' => 'required|string|max:20', ]); $country = Country::findOrFail($id); $country->name = $request->input('name'); $country->continent = $request->input('continent'); // update this country in the countries table $country->save(); $request->session()->flash('info', 'Country updated successfully.'); return redirect()->route('admin.countries.index'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ...
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890...
0.0
-1