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 |
|---|---|---|---|---|---|---|
Remove an item from a store's stock. | public function action_item_remove(Request $request, Response $response)
{
$values = $request->query();
$restock = ORM::factory('Store_Restock', $values['restock_id']);
if(!$restock->loaded())
{
RD::set(RD::ERROR, 'No restock record found.');
}
else
{
$restock->delete();
RD::set(RD::SUCCESS, 'Item successfully removed from the store\'s stock');
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function removeItem(string $sku): Cart;",
"public function remove($item);",
"public function clearStockTransaction() {\n// $stockItemClass = Mage::app()->getConfig()->getModelClassName('cataloginventory/stock_item');\n// $productClass = Mage::app()->getConfig()->getModelClassName('catalog/prod... | [
"0.679734",
"0.6533454",
"0.64882594",
"0.64102197",
"0.63687485",
"0.6210717",
"0.6152507",
"0.61183125",
"0.6115957",
"0.6105898",
"0.6068565",
"0.6046272",
"0.60171795",
"0.6008523",
"0.5975704",
"0.5973731",
"0.59717244",
"0.59713745",
"0.59648895",
"0.59256136",
"0.58610... | 0.6587807 | 1 |
Static, once only constructor | public static function __once() {
try {
self::$environment = \Glue\Component\Environment::getInstance();
self::$path = self::$environment->get('path');
self::$node = '/' . self::$environment->get('node');
} catch(\Exception $exception) {
throw new \RuntimeException(\Glue\Helper\General::replace(array('class' => __CLASS__), GLUE_EXCEPTION_CLASS_INITIALIZE), NULL, $exception);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"final private function __construct() {}",
"final private function __construct() {}",
"private final function __construct() {}",
"final private function __construct() { }",
"final private function __construct() { }",
"final private function __construct() { }",
"public static function __constructStatic()... | [
"0.8213274",
"0.8213274",
"0.81530035",
"0.79852897",
"0.79852897",
"0.79852897",
"0.79839295",
"0.7886951",
"0.78454316",
"0.7714863",
"0.7689553",
"0.7670618",
"0.7625035",
"0.7625035",
"0.7624934",
"0.7624664",
"0.7624664",
"0.7624664",
"0.7624664",
"0.7624664",
"0.7624664... | 0.0 | -1 |
Magic method to allow registry access | public function __call($method, $arguments) {
if(method_exists($this->registry, $method) === true) {
return call_user_func_array(array(&$this->registry, $method), (array) $arguments);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function &get_registry()\n {\n }",
"protected static function register() {}",
"abstract public function register();",
"abstract public function register();",
"abstract public function register();",
"public function loadRegistry();",
"abstract public function register ( );",
"publ... | [
"0.7423067",
"0.73408884",
"0.67322206",
"0.67322206",
"0.67322206",
"0.665471",
"0.6635395",
"0.6568741",
"0.6568741",
"0.6568741",
"0.6568741",
"0.6568741",
"0.6568741",
"0.6568741",
"0.6568741",
"0.6550025",
"0.65472955",
"0.65039146",
"0.6477578",
"0.6339831",
"0.63338214... | 0.0 | -1 |
Method to load tree files | public function load($language, $scope = GLUE_SCOPE_ALL) {
$language = (is_string($language)) ? (array) $language : $language;
if(($result = \Glue\Helper\Validator::batch(array(
'@$language' => array($language, 'isString'),
'$scope' => array($scope, array('matchesBitmask', array(GLUE_SCOPE_ALL)))
))) !== true) {
throw new \InvalidArgumentException(\Glue\Helper\General::replace(array('method' => __METHOD__, 'parameter' => $result), GLUE_EXCEPTION_PARAMETER));
}
try {
$this->dispatcher->notify(new \Glue\Event($this->id . '.load.pre', array($language)));
$dependencies = array();
switch($scope) {
case GLUE_SCOPE_GLOBAL:
foreach($language as $code) {
$dependencies[] = self::$path['global'] . '/.internationalization/tree/' . $code . '.xml';
}
break;
case GLUE_SCOPE_LOCAL:
foreach($language as $code) {
$dependencies[] = self::$path['local'] . '/.internationalization/tree/' . $code . '.xml';
}
break;
case GLUE_SCOPE_ALL:
foreach(self::$path as $scope) {
foreach($language as $code) {
$dependencies[] = $scope . '/.internationalization/tree/' . $code . '.xml';
}
}
break;
}
$id = self::$path['local'] . '/.cache/' . __CLASS__ . '/' . sha1(serialize($language));
if(extension_loaded('apc') === true) {
$cache = \Glue\Entity\Cache\Apc::getInstance($id);
} else {
$cache = \Glue\Entity\Cache\File::getInstance($id);
}
$cache->setDependencies($dependencies);
if(($data = $cache->get()) === false) {
if(($data = \Glue\Helper\General::loadConfiguration($cache->dependencies)) !== false && isset($data['Tree'])) {
$temp = array();
if(!isset($data['Tree'][0])) {
$data['Tree'] = array($data['Tree']);
}
foreach($data['Tree'] as $tree) {
if(!isset($tree['childnodes'][0])) {
$tree['childnodes'] = array($tree['childnodes']);
}
$temp[$tree['@attributes']['id']] = array();
$temp[$tree['@attributes']['id']]['nodelist'] = array();
$temp[$tree['@attributes']['id']]['current'] = NULL;
$temp[$tree['@attributes']['id']]['childnodes'] =& $this->_processTree($tree['childnodes'], $temp[$tree['@attributes']['id']]);
if(isset($tree['@attributes']['breadcrumb']) && $tree['@attributes']['breadcrumb'] == true) {
$temp[$tree['@attributes']['id']]['breadcrumb'] = array();
}
unset($tree['@attributes']);
}
$data = $temp;
$cache->setData($data)->set();
unset($temp, $tree);
}
}
if($data !== false) {
foreach($data as &$tree) {
$this->_processState($tree);
if(isset($tree['breadcrumb'])) {
$this->_processBreadcrumb($tree, $tree['breadcrumb']);
$tree['current'] =& $tree['breadcrumb'][count($tree['breadcrumb']) - 1];
}
}
$this->registry->set(NULL, $data);
}
$this->dispatcher->notify(new \Glue\Event($this->id . '.load.post', array($language, $data)));
unset($language, $scope, $result, $dependencies, $id, $cache, $data);
} catch(\Exception $exception) {
throw new \RuntimeException(\Glue\Helper\General::replace(array('method' => __METHOD__), GLUE_EXCEPTION_METHOD_FAILED), NULL, $exception);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function loadTreeData() {}",
"abstract protected function loadFiletree(DataContainerInterface $objDc);",
"public function load()\n {\n\n /*\n $folder = new LibFilesystemFolder(PATH_GW.'data/bdl/');\n $files = $folder->getPlainFiles();\n\n $this->data = array();\n\n // Load als xmi Fil... | [
"0.8138365",
"0.71508896",
"0.6818853",
"0.67137086",
"0.66420805",
"0.6622824",
"0.6578812",
"0.65448636",
"0.65448636",
"0.65153587",
"0.64494836",
"0.6346299",
"0.6295452",
"0.62606215",
"0.6246496",
"0.6246496",
"0.6246496",
"0.6246496",
"0.62322843",
"0.6222555",
"0.6214... | 0.0 | -1 |
Method to process state for tree | protected function _processState(array &$tree) {
try {
foreach($tree['nodelist'] as &$item) {
$node = '/' . $item['node'];
$state = (preg_match('/^' . preg_quote($node, '/') . '.*/', self::$node . '/')) ? (($node == self::$node) ? 2 : 1) : 0;
if($state !== 0) {
$item['state'] = $state;
if($state === 2) {
$tree['current'] =& $item;
}
}
unset($item, $node, $state);
}
unset($tree);
} catch(\Exception $exception) {
throw new \RuntimeException(\Glue\Helper\General::replace(array('method' => __METHOD__), GLUE_EXCEPTION_METHOD_FAILED), NULL, $exception);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _calculateTree() {\n include_once(\"bitlib/SQL/Tree.php\");\n include_once(\"bitlib/functions/common.php\");\n $db = common::getDB($GLOBALS[\"BX_config\"][\"dsn\"]);\n $t = new SQL_Tree($db);\n $t->FullPath=\"fulluri\";\n $t->Path=\"uri\";\n $t->FullTitlePa... | [
"0.59861684",
"0.59835136",
"0.57236385",
"0.56152904",
"0.5594084",
"0.5570806",
"0.5570806",
"0.5513232",
"0.5508735",
"0.5486823",
"0.54719937",
"0.54672635",
"0.5447323",
"0.54247606",
"0.53693056",
"0.5359117",
"0.533816",
"0.533816",
"0.53379697",
"0.52581286",
"0.52428... | 0.7104994 | 0 |
Method to process breadcrumb for tree | protected function _processBreadcrumb(array &$tree, array &$result) {
try {
if(isset($tree['childnodes'])) {
foreach($tree['childnodes'] as &$item) {
if($item['state'] > 0) {
$result[] =& $item;
if(isset($item['childnodes'])) {
$this->_processBreadcrumb($item, $result);
}
break;
}
}
unset($item, $node, $status);
}
unset($tree, $result);
} catch(\Exception $exception) {
throw new \RuntimeException(\Glue\Helper\General::replace(array('method' => __METHOD__), GLUE_EXCEPTION_METHOD_FAILED), NULL, $exception);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function BreadCrumb(){}",
"function eo_bbpm_get_breadcrumb() {\n}",
"public function trail() {\n\n\t\t$breadcrumb = '';\n\t\t$item_count = count( $this->items );\n\t\t$item_position = 0;\n\n\t\tif ( 0 < $item_count ) {\n\n\t\t\tif ( true === $this->args['show_browse'] )\n\t\t\t\t$breadcrumb .= sprintf( '... | [
"0.7252127",
"0.7116681",
"0.6937708",
"0.69226134",
"0.68615043",
"0.65947783",
"0.65347284",
"0.65316415",
"0.6522476",
"0.6493446",
"0.6475859",
"0.64318067",
"0.6387936",
"0.6372058",
"0.63607204",
"0.634375",
"0.6342324",
"0.63270503",
"0.6301878",
"0.6297311",
"0.629504... | 0.66378415 | 5 |
Method to parse tree | protected function &_processTree(array &$tree, array &$root) {
try {
foreach($tree as $index => $subtree) {
if(isset($tree[$index]['@attributes']) && is_array($tree[$index]['@attributes'])) {
foreach($tree[$index]['@attributes'] as $key => $value) {
$tree[$index][$key] = $value;
}
unset($tree[$index]['@attributes']);
}
$tree[$index]['slug'] = (isset($tree[$index]['slug'])) ? \Glue\Helper\Modifier::sluggify($tree[$index]['slug']) : \Glue\Helper\Modifier::sluggify($tree[$index]['title']);
$pointer =& $tree[$index];
while(isset($pointer['parent'])) {
$pointer = &$pointer['parent'];
$tree[$index]['node'] = $pointer['node'] . '/' . $tree[$index]['node'];
$tree[$index]['slug'] = $pointer['slug'] . '/' . $tree[$index]['slug'];
}
$tree[$index]['alias'] = str_replace('/', '.', $tree[$index]['node']);
$tree[$index]['visible'] = (!isset($subtree['@attributes']['visible']) || !is_bool($subtree['@attributes']['visible'])) ? true : $subtree['@attributes']['visible'];
$tree[$index]['state'] = 0;
$tree[$index]['custom'] = array();
$root['nodelist'][$tree[$index]['slug']] =& $tree[$index];
if(isset($subtree['custom'])) {
if(isset($subtree['custom']['@attributes']) && is_array($subtree['custom']['@attributes'])) {
foreach($subtree['custom']['@attributes'] as $key => $value) {
$subtree['custom'][$key] = $value;
}
unset($subtree['custom']['@attributes']);
}
$tree[$index]['custom'] = $subtree['custom'];
}
if(isset($subtree['childnodes']) && is_array($subtree['childnodes']) && count($subtree['childnodes']) > 0) {
if(!isset($subtree['childnodes'][0])) {
$tree[$index]['childnodes'] = array($tree[$index]['childnodes']);
}
foreach($tree[$index]['childnodes'] as $index2 => $subtree2) {
$tree[$index]['childnodes'][$index2]['parent'] =& $tree[$index];
}
$tree[$index]['childnodes'] =& $this->_processTree($tree[$index]['childnodes'], $root);
}
}
return $tree;
} catch(\Exception $exception) {
throw new \RuntimeException(\Glue\Helper\General::replace(array('method' => __METHOD__), GLUE_EXCEPTION_METHOD_FAILED), NULL, $exception);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function parse()\n {\n $this->parseChildrenNodes($this->_dom, $this->_rootNode);\n }",
"static public function parseTree($tree)\n\t{\n\t\t$rtree=array();\n\t\tforeach ($tree as $node)\n\t\t\t$rtree[$node['id']]=isset($node['children'])? self::parseTree($node['children']) : null;\n\t\treturn ... | [
"0.72084814",
"0.640325",
"0.62920487",
"0.62854624",
"0.6251577",
"0.6251577",
"0.6251577",
"0.62501097",
"0.62501097",
"0.62501097",
"0.62501097",
"0.62397456",
"0.62328255",
"0.61522853",
"0.6111065",
"0.6091115",
"0.600486",
"0.5995211",
"0.5954424",
"0.5950678",
"0.59138... | 0.51529294 | 83 |
/ Upload the file | public function move($modify = 'original',$overwrite = false) {
$path = $this->_destination;
if ($this->_uploaded) {
$field = current($this->_uploaded);
if (is_array($field['name'])) {
foreach ($field['name'] as $number => $filename) {
// process multiple upload
$this->_renamed = false;
$this->processFile($filename, $field['error'][$number], $field['size'][$number], $field['type'][$number], $field['tmp_name'][$number], $path, $modify, $overwrite);
}
}
else {
$this->processFile($field['name'], $field['error'], $field['size'], $field['type'], $field['tmp_name'], $path, $modify, $overwrite);
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function upload();",
"public function upload()\n\t{\n\t}",
"public function uploadFile(){\n\n if (!$this->request->is('post'))\n {\n $this->setErrorMessage('Post method required');\n return;\n }\n\n if (!isset($this->request->data['currentPath']) ||\n ... | [
"0.81664354",
"0.78553593",
"0.7815562",
"0.7783905",
"0.77027696",
"0.7678735",
"0.7663673",
"0.76605576",
"0.76465094",
"0.7564527",
"0.752564",
"0.75110036",
"0.75044006",
"0.74427134",
"0.7436048",
"0.7374126",
"0.7366321",
"0.7362572",
"0.73611075",
"0.73582464",
"0.7341... | 0.0 | -1 |
/ Checks if a file with the same name previously exists in the upload destination and overwrites the previous file if $overwrite is true or renames the uploaded file and keeps both files if $overwrite is false | protected function createFileName($name, $overwrite) {
//get rid of any blank space in the submitted file name
$nospaces = str_replace(' ', '_', $name);
//mark the file as renamed if that changed the name from what was submitted
if ($nospaces != $name) {
$this->_renamed = true;
}
if (!$overwrite) {
$existing = scandir($this->_destination);
//check if an image with that name already exists
if (in_array($nospaces, $existing)) {
//if the filename already exists, we need to rename the file, so let's start by finding the character number of the '.' character
$dot = strrpos($nospaces, '.');
if ($dot) {
//get the name of the file up to but without the dot
$base = substr($nospaces, 0, $dot);
//store the current file extension as well
$extension = substr($nospaces, $dot);
} else {
//else if the file has no extension, store its name too
$base = $nospaces;
$extension = '';
}
//Now proceed to rename the file
//we use a do while loop because we may be renaming multiple files from a multiple file upload, otherwise it will be just the one file being renamed,
// hence the choice of do..while loop which will run at least once
$i = 1;
do {
//we rename the file by adding an underscore and an incremented number (e.g. gus_2) to the basename (before the extension)
//notice how we commence by incrementing the number after the underscore by one ($i++). The initial 1 value of $i is to indicate that we're uploading a second version of that same file
//but the while loop below will also ensure that the renamed file has an incremented number for as long as it finds another file existing in the destination folder
$nospaces = $base . '_' . $i++ . $extension;
} while (in_array($nospaces, $existing));
//mark the file as renamed
$this->_renamed = true;
}
}
//return the new file name
return $nospaces;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function overwrite_file($source_file, $destination_file)\n\t{\n\t\t/**\n\t\t* @todo generally think about overwriting files in another way, by creating a temporary file and then renaming it\n\t\t* @todo check for the destination file existance too\n\t\t*/\n\t\t$this->_delete($destination_file);\n\t\t$result = $thi... | [
"0.65913475",
"0.65009964",
"0.62726325",
"0.6230604",
"0.6198522",
"0.61751753",
"0.6126193",
"0.60714275",
"0.6038394",
"0.60343426",
"0.6023347",
"0.5906463",
"0.5875084",
"0.5840433",
"0.57954687",
"0.5792802",
"0.5788634",
"0.5781003",
"0.5777803",
"0.5717185",
"0.571718... | 0.7114448 | 0 |
/ SELECT l1_class.l1id,l1name,l2id,l2name FROM l1_class LEFT OUTER JOIN l2_class ON (l1_class.l1id=l2_class.l1id) WHERE l1_class.l1id in (4,5) and l2id in (15,30) ORDER BY l1_class.l1id; | function classifyTheCall( $callid, &$arL1, &$arL2)
{
$retval = true;
if(ctype_digit($callid) and $callid > 0) {
$dbConnect = dbconnect();
$sql = "BEGIN;";
/* get rid of all that's there already */
$sql .= "DELETE FROM call_l1_class WHERE callid={$callid};";
$sql .= "DELETE FROM call_l2_class WHERE callid={$callid};";
if(isset($arL1) and is_array($arL1) and sizeof($arL1) > 0) {
foreach( $arL1 as $l1id) {
$sql .= "INSERT INTO call_l1_class (callid,l1id)
VALUES ({$callid}, {$l1id});";
}
}
if(isset($arL2) and is_array($arL2) and sizeof($arL2) > 0) {
foreach( $arL2 as $l2id) {
$sql .= "INSERT INTO call_l2_class (callid,l2id)
VALUES ({$callid}, {$l2id});";
}
}
$sql .= "COMMIT";
$result = pg_query( $dbConnect, $sql);
if (!$result) {
$message = 'Invalid query: ' . pg_result_error( $result) . "\n";
$message .= 'Whole query: ' . $sql;
printErrorMessage($message);
$retval=false;
}
dbclose($dbConnect);
}
else {
$retval = false;
}
return $retval;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sql_leftJoin(){\n\t\t$dbconnection = $this->db_connect();\n\t\tif($dbconnection !=1)\n\t\t{\n\t\t\t$result=\"MySql Connection Error\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//LIST OF SELECTIONS\n\t\t\t//INSTEAD of a listOfFields I need a listOfSelections like \"db.tbl_1.fld_1\"\n\t\t\t// a_selections = array(\"d... | [
"0.6085006",
"0.5322063",
"0.52307904",
"0.5143592",
"0.5038736",
"0.50117224",
"0.4805328",
"0.47367635",
"0.47178206",
"0.47047818",
"0.46971208",
"0.46917227",
"0.46782854",
"0.46751997",
"0.46632978",
"0.46590844",
"0.46262386",
"0.45911092",
"0.45758164",
"0.45639122",
"... | 0.51748663 | 3 |
print_r($hands); //delete after debugging | function showhands($hands, $all=false)
//$all flag determines if dealer's first card is shown or not
{
foreach ($hands as $hand => $cards)
{
echo "{$hand}'s hand is ";//shows 'Computer's hand is...' and 'Player's hand is...'
foreach ($cards as $card=>$value)
{
if ($hand == "Computer") //Computer
{
switch ($card)
{
case 0:
if ($all)
{
echo "({$value})";
}
else
{
echo "(?-?)";
}
break;
default:
echo "({$value})";
break;
}
}
else //Player
{
echo "({$value})";
}
}
echo PHP_EOL;
}
return $hands;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function get_hands() {\n return $this->hands;\n }",
"public function GetHandArray(){\r\n\t \r\n\t\treturn $this -> handArray;\r\n\t }",
"public function GetHands(){\r\n\t \r\n\t\treturn $this -> hands;\r\n\t }",
"public function drawHand(array $hands) {\n\n\t\t$hand = collect($hands)-... | [
"0.7346324",
"0.6978806",
"0.6794774",
"0.63933057",
"0.63307226",
"0.6094427",
"0.6092971",
"0.60794055",
"0.5890431",
"0.5885085",
"0.58527577",
"0.5824898",
"0.5730695",
"0.5697511",
"0.5629474",
"0.5622418",
"0.55275327",
"0.5507061",
"0.54699624",
"0.545067",
"0.5410966"... | 0.6249308 | 5 |
Create the Form definition. | public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder
->add('leftHanded', CheckboxType::class)
->add('headstock', TextType::class)
->add('body', TextType::class)
->add('amplification', TextType::class)
->add('strings', IntegerType::class)
->add('frets', IntegerType::class)
->add('tuning')
;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function initializeForm()\n {\n $this->form = new Form();\n $this->form->add(Element::create(\"FieldSet\",\"Report Format\")->add\n (\n Element::create(\"SelectionList\", \"File Format\", \"report_format\")\n ->addOption(\"Hypertext Markup Lan... | [
"0.785096",
"0.7786465",
"0.7786465",
"0.776722",
"0.776722",
"0.76634437",
"0.76254475",
"0.75540817",
"0.7551564",
"0.7443507",
"0.74177533",
"0.7402114",
"0.7384385",
"0.7375861",
"0.73576987",
"0.73296344",
"0.73074406",
"0.7305967",
"0.7298659",
"0.72959924",
"0.7271806"... | 0.0 | -1 |
Display a listing of the resource. | public function index(Request $request)
{
if ($select = request()->query('list')) {
return $this->accountRepository->listAll($this->formatFields($select));
} else
$data = AccountResource::collection($this->accountRepository->getAllPaginate());
return $this->respondWithData($data);
} | {
"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 |
Run the database seeds. | public function run()
{
$settings = [
'site-on' => '1',
'support-email' => 'admin@hyip.is',
];
foreach ($settings as $settingKey => $settingValue) {
$checkExists = DB::table('settings')->where('s_key', $settingKey)->count();
if ($checkExists > 0) {
echo "Setting '".$settingKey."' already registered.\n";
continue;
}
DB::table('settings')->insert([
's_key' => $settingKey,
's_value' => $settingValue,
'created_at' => now()
]);
echo "Setting '".$settingKey."' registered.\n";
}
} | {
"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 |
/ notify all observers about any change in SunSubject | function notify()
{
foreach ($this->observers as $obKey => $obValue) {
$obValue->update($this);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function notify() {\n\t\tforeach($this->_observers as $key => $val) {\n\t\t\t$val->update($this);\n\t\t}\n\t}",
"public function notify(){\n foreach ($this->observers as $observer){\n $observer->update();\n }\n }",
"public function notifyObservers() {\n\t\tforeach ( $this->ob... | [
"0.721787",
"0.72162306",
"0.7122913",
"0.71227336",
"0.70694596",
"0.70157844",
"0.6984043",
"0.6982503",
"0.6939297",
"0.691533",
"0.68791705",
"0.68739194",
"0.6785612",
"0.6515169",
"0.6510684",
"0.6427568",
"0.64262956",
"0.6423259",
"0.6423259",
"0.6423259",
"0.6423259"... | 0.7238421 | 0 |
Display a listing of the resource. | public function index()
{
$tracings = Tracing::latest()->paginate(10);
return view('Tracing.index', compact('tracings'));
} | {
"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('Tracing.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)
{
request()->validate([
'type'=>'required',
'reason'=>'required',
'observation'=>'required',
'tutor_c_id'=>'required',
]);
Tracing::create($request->all());
return redirect()->route('Tracing.index')->with('success','Registro creado correctamente.');
} | {
"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($id)
{
$tracings = Tracing::find($id);
return view('Tracing.show', compact('tracings'));
} | {
"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($id)
{
$tracings = Tracing::find($id);
return view('Tracing.edit',compact('tracings'));
} | {
"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, $id)
{
request()->validate([
'type'=>'required',
'reason'=>'required',
'observation'=>'required',
'tutor_c_id'=>'required',
]);
//Enterprise::find($id)->update($request->all());
Tracing::where('id', $id)->update($request->except('_token','_method'));
return redirect()->route('Tracing.index')->with('success','Registro creado correctamente.');
} | {
"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($id)
{
$tracing = Tracing::find($id);
$tracing->deleted = true;
$tracing->update();
return redirect()->route('Tracing.index')->with('success','Registro eliminado satisfactoriamente');
} | {
"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 |
Display a listing of the resource. | public function index()
{
return view('Admin.addCenter');
} | {
"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)
{
request()->validate([
'center_name' => 'required|unique:training_centers',
'center_location' => 'required',
'center_image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
]);
$imageName = time().'.'.request()->center_image->getClientOriginalExtension();
request()->center_image->move(public_path('images'), $imageName);
$var = new TrainingCenter();
$var->center_name = $request->input('center_name');
$var->center_location = $request->input('center_location');
$var->center_image = $imageName;
$var->save();
return redirect('admin/viewCenter')->with('success', 'Training center added 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($id)
{
//
} | {
"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($id)
{
$center = TrainingCenter::find($id);
return view('Admin.editCenter', compact('center'));
} | {
"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, $id)
{
$request->validate([
'center_name' => 'required',
'center_location' => 'required',
'center_image' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',
]);
if (!empty(request()->center_image)){
$center = TrainingCenter::find($id);
$imageName= $center-> center_image;
File::delete(public_path('images/'.$imageName));
$imageName = time().'.'.request()->center_image->getClientOriginalExtension();
request()->center_image->move(public_path('images'), $imageName);
}
else {
$center = TrainingCenter::find($id);
$imageName= $center-> center_image;
}
$center = TrainingCenter::find($id);
$center->center_name = $request->get('center_name');
$center->center_location = $request->get('center_location');
$center->center_image = $imageName;
$center->save();
return redirect('admin/viewCenter')->with('success', 'Training center updated!');
} | {
"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($id)
{
$center = TrainingCenter::find($id);
File::delete(public_path('images/'.$center->center_image));
$center->delete();
return back()->with('success', 'Training center deleted!');
} | {
"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 |
Create a new command instance. | public function __construct()
{
parent::__construct();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function newCommand() {\n return newinstance(Command::class, [], '{\n public static $wasRun= false;\n public function __construct() { self::$wasRun= false; }\n public function run() { self::$wasRun= true; }\n public function wasRun() { return self::$wasRun; }\n }');\n }",
"pu... | [
"0.8010746",
"0.7333379",
"0.72606754",
"0.7164165",
"0.716004",
"0.7137585",
"0.6748632",
"0.67234164",
"0.67178184",
"0.6697025",
"0.6677973",
"0.66454077",
"0.65622073",
"0.65437883",
"0.64838654",
"0.64696646",
"0.64292693",
"0.6382209",
"0.6378306",
"0.63773245",
"0.6315... | 0.0 | -1 |
Execute the console command. | public function handle()
{
\Log::info('Starting General Product Update @'.\Carbon\Carbon::now());
// create new sitemap object
$sitemap = App::make('sitemap');
// get all products from db (or wherever you store them)
$products = \DB::table('products')->orderBy('created_at', 'desc')->get();
// counters
$counter = 0;
$sitemapCounter = 0;
$productCounter = 0;
// add every product to multiple sitemaps with one sitemap index
foreach ($products as $product) {
if ($counter == 50000) {
// generate new sitemap file
$sitemap->store('xml', 'sitemap-' . $sitemapCounter);
// add the file to the sitemaps array
$sitemap->addSitemap(secure_url('sitemap-' . $sitemapCounter . '.xml'));
// reset items array (clear memory)
$sitemap->model->resetItems();
// reset the counter
$counter = 0;
// count generated sitemap
$sitemapCounter++;
}
// add product to items array
$product_url = url('/').'/'.$product->slug.'-'.$product->id;
$sitemap->add($product_url, $product->created_at, '1.0', 'daily');
// count number of elements
$counter++;
$productCounter++;
}
// you need to check for unused items
if (!empty($sitemap->model->getItems())) {
// generate sitemap with last items
$sitemap->store('xml', 'sitemap-' . $sitemapCounter);
// add sitemap to sitemaps array
$sitemap->addSitemap(secure_url('sitemap-' . $sitemapCounter . '.xml'));
// reset items array
$sitemap->model->resetItems();
}
$Totalsitemaps = $sitemapCounter+1;
// generate new sitemapindex that will contain all generated sitemaps above
$sitemap->store('sitemapindex', 'sitemap');
\Log::info('Ending General Product Update Now @'.\Carbon\Carbon::now());
$this->info('Successfully Ran Update @ '.\Carbon\Carbon::now());
$this->info("Added $productCounter Products");
$this->info("Successfully Created $Totalsitemaps Sitemap(s)");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function handle()\n {\n\t\t$this->info('league fetching ..');\n $object = new XmlFeed();\n\t\t$object->fetchLeague($this->argument('sports_id'));\n\t\t$this->info('league saved');\n }",
"public function handle()\n {\n //get us the Converter class instance and call the convert() meth... | [
"0.6469962",
"0.6463639",
"0.64271367",
"0.635053",
"0.63190264",
"0.62747604",
"0.6261977",
"0.6261908",
"0.6235821",
"0.62248456",
"0.62217945",
"0.6214421",
"0.6193356",
"0.61916095",
"0.6183878",
"0.6177804",
"0.61763877",
"0.6172579",
"0.61497146",
"0.6148907",
"0.614841... | 0.0 | -1 |
Complete refresh of page, rebuild all content from scratch i.e. index.php | function index($address) {
$main_view = new Template('index');
$main_view->set('title', config('title'))
->set('alert_messages', lang('alert_messages'))
->set('page_address', $address)
->set('tab_view', $this->tabs())
->set('project_header', lang('project_header'))
->set('project_view', $this->projects())
->set('filter_header', lang('filter_header'))
->set('filters', lang('filter_settings'))
->set('tag_header', lang('tag_header'))
->set('tag_view', $this->tags())
->set('task_view', $this->all())
->set('langs', config('lang_list'))
->set('cur_lang', ini('language'));
return $main_view;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function refresh();",
"public function refresh();",
"public function reload() {\n $this->init();\n redirect('./');\n }",
"public function refresh() {\n\t\t$this->redirect( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '/' );\n\t}",
"public function reload();",
"publ... | [
"0.7084916",
"0.7084916",
"0.69342417",
"0.6917513",
"0.6766367",
"0.6766367",
"0.6766367",
"0.6766367",
"0.6688505",
"0.66383743",
"0.66333896",
"0.6499072",
"0.6473127",
"0.629219",
"0.6266816",
"0.6224105",
"0.6194355",
"0.6162706",
"0.6100035",
"0.6099567",
"0.6061168",
... | 0.0 | -1 |
Returns true if file is ready to be moved to its destination. | public function IsValid() {
return $this->Error === UPLOAD_ERR_OK;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function waitingForFile(){\n return !empty($this->check_for_file);\n }",
"protected function isStreamFinished()\n {\n return gzeof($this->file);\n }",
"public function checkConvertionComplete()\r\n\t{\r\n\t\treturn (!file_exists($this->referenceFile) || @filesize($this->referenceF... | [
"0.6652188",
"0.645909",
"0.629462",
"0.6162757",
"0.61210495",
"0.609253",
"0.604874",
"0.6019008",
"0.60096973",
"0.5861673",
"0.58372337",
"0.5811249",
"0.58068085",
"0.5803838",
"0.5789078",
"0.57687795",
"0.575028",
"0.5744553",
"0.57295096",
"0.57157075",
"0.5711332",
... | 0.53437054 | 64 |
Returns true if there is some error in transfer. Missing file is not an error. | public function HasError() {
return !in_array($this->Error, array(UPLOAD_ERR_OK, UPLOAD_ERR_NO_FILE));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function validUpload() {\t\n\t\tif($this->file['error'] == 0) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"public function hasError()\n {\n if ( curl_errno($this->handler) ) {\n return true;\n }\n return false;\n }",
"private function wasFileSent() : bool... | [
"0.7150491",
"0.67486334",
"0.67280847",
"0.66065997",
"0.6597482",
"0.6593579",
"0.6536562",
"0.64926267",
"0.6476616",
"0.64389634",
"0.6431632",
"0.6398148",
"0.6387687",
"0.63710886",
"0.6360043",
"0.63526165",
"0.63526165",
"0.63526165",
"0.63526165",
"0.6322414",
"0.629... | 0.67948246 | 1 |
Check is uploaded file image. By default it will use file extension for detection but with $CheckMimeType parameter it will check real mimetype too. | public function IsImage($CheckMimeType=false) {
$ImageExtensions= array('jpg', 'jpe', 'jpeg', 'gif', 'png');
if (!in_array(strtolower($this->GetExtension()), $ImageExtensions)) {
return false;
}
if ($CheckMimeType) {
$MimeTypes= array('image/jpeg', 'image/gif', 'image/png');
if (!in_array($this->GetMimeType(), $MimeTypes)) {
return false;
}
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function checkImageType()\n {\n if (empty($this->checkImageType)) {\n return true;\n }\n\n if (('image' == substr($this->mediaType, 0, strpos($this->mediaType, '/')))\n || (!empty($this->mediaRealType)\n && 'image' == substr($this->mediaRealType, 0, s... | [
"0.77192074",
"0.73598015",
"0.721893",
"0.7062584",
"0.703361",
"0.6990562",
"0.6962246",
"0.6919374",
"0.6883376",
"0.68633825",
"0.681623",
"0.68129003",
"0.6800077",
"0.67959714",
"0.67446524",
"0.6720619",
"0.6717326",
"0.66452265",
"0.6624768",
"0.66176295",
"0.66157204... | 0.69422 | 7 |
Returns array with width and height of uploaded image or false on missing or nonimage file. | public function GetImageSize() {
return $this->IsValid()
? @getimagesize($this->TmpName) // @ - prevent warning on reading non-images
: false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_image_dimensions($file_path)\n\t{\n\n\t\tif( ! file_exists($file_path)) {\n\n\t\t\treturn FALSE;\n\n\t\t}\n\n\t\t// PHP7.4 does not come with GD JPEG processing by default\n\t\t// So, we need to run this check.\n\t\tif (function_exists('getimagesize'))\n\t\t{\n\t\t\t$imageSize = @getimagesize($file_pa... | [
"0.7213394",
"0.7162518",
"0.71464676",
"0.71033216",
"0.68905336",
"0.68886024",
"0.6876985",
"0.6869756",
"0.679584",
"0.67584443",
"0.67538893",
"0.67511433",
"0.6708959",
"0.66778356",
"0.6675638",
"0.66334563",
"0.66254205",
"0.66207093",
"0.6612658",
"0.6583274",
"0.654... | 0.72267246 | 0 |
Returns mimetype of uploaded file or null if hosting does not support checking. This is real mimetype detection, not via file extension. | public function GetMimeType() {
if ($this->IsValid() && $this->MimeType === null) {
if (function_exists('mime_content_type')) {
$this->MimeType= mime_content_type($this->TmpName);
} elseif (function_exists('finfo_open')) {
$fInfo= finfo_open(FILEINFO_MIME);
$this->MimeType= finfo_file($fInfo, $this->TmpName);
finfo_close($fInfo);
}
}
return $this->MimeType;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function type() {\n\t\treturn $this->_cache(__FUNCTION__, function($file) {\n\t\t\t$type = null;\n\n\t\t\t// We can't use the file command on windows\n\t\t\tif (!defined('PHP_WINDOWS_VERSION_MAJOR')) {\n\t\t\t\t$type = shell_exec(sprintf(\"file -b --mime %s\", escapeshellarg($file->path())));\n\n\t\t\t\tif ... | [
"0.7940607",
"0.76699597",
"0.7559069",
"0.74096936",
"0.7395556",
"0.73367757",
"0.72435385",
"0.72203726",
"0.71776974",
"0.7175969",
"0.71661997",
"0.7162659",
"0.71540016",
"0.71534836",
"0.7137104",
"0.70945907",
"0.70916563",
"0.70895606",
"0.708719",
"0.7058984",
"0.70... | 0.7337965 | 5 |
Change name of file before moving it to target location. | public function Rename($NewName) {
$this->Name= $this->SanitizeFilename($NewName);
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function set_file_name($new_name = '') {\r\n\t\tif ($this->rename_file) {\r\n\t\t\tif ($this->the_file == '') return;\r\n\t\t\t$name = ($new_name == '') ? strtotime('now') : $new_name;\r\n\t\t\tsleep(3);\r\n\t\t\t$name = $name.$this->get_extension($this->the_file);\r\n\t\t} else {\r\n\t\t\t$name = str_replace(' ',... | [
"0.7137183",
"0.7072955",
"0.69715595",
"0.6959627",
"0.69268346",
"0.68998754",
"0.67529595",
"0.6702538",
"0.6695465",
"0.657887",
"0.65189224",
"0.64992607",
"0.6460489",
"0.64575166",
"0.64473134",
"0.6421975",
"0.64060795",
"0.6402514",
"0.6339466",
"0.63290626",
"0.6328... | 0.0 | -1 |
Change name of file (but preserve extension) before moving it to target location. | public function RenameBasename($NewName) {
$Ext= $this->GetExtension();
$this->Name= $this->SanitizeFilename($NewName).'.'.$Ext;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function set_file_name($new_name = '') {\r\n\t\tif ($this->rename_file) {\r\n\t\t\tif ($this->the_file == '') return;\r\n\t\t\t$name = ($new_name == '') ? strtotime('now') : $new_name;\r\n\t\t\tsleep(3);\r\n\t\t\t$name = $name.$this->get_extension($this->the_file);\r\n\t\t} else {\r\n\t\t\t$name = str_replace(' ',... | [
"0.7242488",
"0.70655084",
"0.69141597",
"0.68410635",
"0.68395835",
"0.6656185",
"0.6651485",
"0.66479355",
"0.6625968",
"0.66041684",
"0.65480375",
"0.6391009",
"0.63858485",
"0.6368672",
"0.6360018",
"0.6318708",
"0.6316524",
"0.627362",
"0.6186027",
"0.61848426",
"0.61679... | 0.0 | -1 |
Move uploaded file to target location. | public function Move($ToDir) {
// if there is no file return null
if ($this->Error === UPLOAD_ERR_NO_FILE) {
return null;
}
// if any error occured return false
if ($this->Error !== UPLOAD_ERR_OK) {
return false;
}
// create target directory
if (!$ToDir) {
$this->Error= $this->MsgDef('Target directory must be specified.', 'Request.FileErr.NoDir', null, null, array($ToDir));
return false;
}
if (!is_dir($ToDir)) {
if (!mkdir($ToDir, 0777, true)) {
$this->Error= $this->MsgDef('Unable to create directory %s.', 'Request.FileErr.CreateDir', null, null, array($ToDir));
return false;
}
}
// remove existing file (overwrite)
$ToPath= rtrim($this->ResolvePath($ToDir), '\\/').'/'.$this->Name;
if (is_file($ToPath)) {
@unlink($ToPath); // @ - possible file permition protection
}
// move file to target location
if (!move_uploaded_file($this->TmpName, $ToPath)) {
$this->Error= error_get_last();
return false;
}
// success
@chmod($ToPath, 0666); // @ - maybe no permition to use chmod
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function upload_move($file, $local_file);",
"public function moveToTmpDir()\n\t{\n\t\tif($this->source instanceof UploadedFile) {\n\t\t\t$this->source->move($this->getTmpDir()->getRootPath());\n\t\t} else if(is_string($this->source)) {\n\t\t\tcopy($this->params['path'], $this->getTmpDir()->getRootPath() .... | [
"0.7310539",
"0.7150951",
"0.6864969",
"0.6847037",
"0.67785996",
"0.6771532",
"0.67586404",
"0.6738262",
"0.6728246",
"0.6677467",
"0.66573966",
"0.6655904",
"0.6587532",
"0.6564605",
"0.6550274",
"0.6543432",
"0.6523433",
"0.65194196",
"0.65148646",
"0.6512135",
"0.6501361"... | 0.6260347 | 43 |
Cleaning filename from nonstandard chars. | protected function SanitizeFilename($Name) {
$Name= preg_replace('/[^A-Za-z0-9~_!\|\.\-\+]/', '', $Name);
return $Name;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sa_sanitize_chars($filename) {\n return strtolower(preg_replace('/[^a-zA-Z0-9-_\\.]/', '', $filename));\n}",
"function cleanFileName($filename) {\n\t\t//$name = preg_replace('/[^a-zA-Z0-9.]/', '', $name);\n\t\t//$name = substr($name,0,9);\n\t\t$filename_raw = $filename;\n\t\t$special_chars = array(\"... | [
"0.8468803",
"0.83387846",
"0.8022858",
"0.79106545",
"0.78771764",
"0.78552",
"0.7843385",
"0.78226185",
"0.7776485",
"0.7641304",
"0.76388294",
"0.7598594",
"0.75843364",
"0.7564258",
"0.7492413",
"0.74915516",
"0.7477909",
"0.7468763",
"0.7343337",
"0.73060143",
"0.7283174... | 0.7156327 | 31 |
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 |
Store a newly created resource in storage. | public function store(Request $request)
{
$inputs = [
'event_id'
];
//
DB::beginTransaction();
try{
//
foreach($inputs as $key){
if($request->filled($key)){
$this->aff->$key = $request->input($key);
}else{
throw new Exception(sprintf('【%s】LINE:%s %s, Null Not Allowed', __METHOD__, __LINE__, $key).PHP_EOL);
}
}
if(!$this->aff->main()){ throw new Exception("Something Wrong"); }
DB::commit();
$result = true;
}catch(Exception $e){
echo $e->getMessage().PHP_EOL;
DB::rollback();
$result = false;
}
return $result ? 'success' : 'failed';
} | {
"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($id)
{
//
} | {
"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 |
Update the specified resource in storage. | public function update(Request $request, $id)
{
//
} | {
"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($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 |
Get the listings of the owner. | public function listings()
{
return $this->hasMany(Listing::class, 'owner_id');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function _getListingsByLoggedInUser()\n\t{\n\t\t$user_id = $this->_getUserId();\n\t\tif ($user_id == 0 || $user_id == null){\n\t\t\treturn array('error' => 'USER_NOT_LOGGED_IN', 'code' => 3);\n\t\t}\n\t\t\n\t\t$listings = $this->Listing->GetListingsByUserId($user_id);\n\t\tif ($listings == null)\n\t\t\tret... | [
"0.7160915",
"0.6681862",
"0.6355202",
"0.6309376",
"0.62984455",
"0.62033033",
"0.6140931",
"0.60837483",
"0.60051763",
"0.5975873",
"0.59716",
"0.5963204",
"0.5962228",
"0.593347",
"0.5855118",
"0.5818661",
"0.5810291",
"0.58078724",
"0.5766747",
"0.5759229",
"0.57576823",
... | 0.7713336 | 0 |
Display a listing of the resource. | public function index()
{
$institutes = $this->instituteRepository->index();
return view('Admin.Institute.institute_list', compact('institutes'));
} | {
"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()
{
$countries = $this->instituteRepository->countries();
return view('Admin.Institute.institute',compact('countries'));
} | {
"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)
{
$result = $this->instituteRepository->store($request);
return $this->instituteRepository->returnBack($result);
} | {
"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(Institute $institute)
{
return $this->instituteRepository->show($institute);
} | {
"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(Institute $institute)
{
//
} | {
"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, Institute $institute)
{
//
} | {
"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(Institute $institute)
{
$this->instituteRepository->delete($institute);
} | {
"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 |
/ Run the migrations. | public function up()
{
Schema::create('fruits', function (Blueprint $table) {
$table->increments('id');
$table->string('type');
$table->string('taste');
$table->string('texture');
$table->string('season');
$table->timestamps();
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function runAction():void{\n $currentVersion = Migration::getCurrentVersion();\n $migrations = glob($this->config->application->migrationsDir.'*.php');\n $version = count($migrations);\n if((int)$version === $currentVersion){\n Cli::error('Nothing to migrate');\n ... | [
"0.75275457",
"0.7504146",
"0.741662",
"0.74043643",
"0.731344",
"0.7170822",
"0.716727",
"0.7116556",
"0.71116215",
"0.70874274",
"0.7013769",
"0.69981027",
"0.699646",
"0.69708437",
"0.6958594",
"0.6922959",
"0.6914705",
"0.688172",
"0.6867588",
"0.68307316",
"0.6829838",
... | 0.0 | -1 |
/ Reverse the migrations. | public function down()
{
Schema::dropIfExists('fruits');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function down()\n {\n //add your migration here \n }",
"public function down()\n {\n //add your migration here\n }",
"public function down()\n {\n Schema::dropIfExists('reunion');\n }",
"public function down()\n {\n //Schema::dropIfExists... | [
"0.7547356",
"0.74523526",
"0.73072034",
"0.7082641",
"0.7067668",
"0.7064703",
"0.7047196",
"0.69690806",
"0.69575274",
"0.6953028",
"0.6943268",
"0.6940584",
"0.69317234",
"0.6919529",
"0.6882202",
"0.68721837",
"0.6862158",
"0.6825824",
"0.6824019",
"0.68235826",
"0.681442... | 0.6877479 | 15 |
By default it will use our APP_ENV | public function testResolveEnvironment()
{
$this->assertEquals('testing', EnvSecurity::resolveEnvironment());
EnvSecurity::resolveEnvironmentUsing(function() {
return "heya";
});
$this->assertEquals('heya', EnvSecurity::resolveEnvironment());
EnvSecurity::setEnvironment("override");
$this->assertEquals('override', EnvSecurity::resolveEnvironment());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function initEnvironment() {\n\t\t$env = getenv('APP_ENV');\n\n\t\t$this->_env = ($env !== FALSE) ? $env : 'development';\n\t}",
"function get_environment(): string {\n return getenv('APP_ENV') ?\n getenv('APP_ENV') : 'default';\n}",
"public static function environment(){\n ret... | [
"0.791438",
"0.77103543",
"0.72682166",
"0.7253278",
"0.71557975",
"0.70835245",
"0.7077431",
"0.70227665",
"0.7013368",
"0.6996586",
"0.6993136",
"0.6955319",
"0.6909131",
"0.6834243",
"0.68088853",
"0.67953044",
"0.6791777",
"0.6754335",
"0.6726715",
"0.6726715",
"0.6726715... | 0.0 | -1 |
By default it will be null | public function testResolveKey()
{
$this->assertNull(EnvSecurity::resolveKey());
EnvSecurity::resolveKeyUsing(function($environment) {
return "alias/myapp-$environment";
});
$this->assertEquals("alias/myapp-testing", EnvSecurity::resolveKey());
$this->assertEquals("alias/myapp-newenv", EnvSecurity::setEnvironment('newenv')->resolveKey());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function __return_null()\n {\n }",
"public function __default()\n\t{\n\n\t}",
"protected function __init__() { }",
"public function __init(){}",
"public function __construct() {\n\t\t// Intentionally left empty.\n\t}",
"public function __construct()\n\t{\n\t\t// nothing to do\t\n\t}",
"public fun... | [
"0.67244875",
"0.6646183",
"0.6552279",
"0.64766324",
"0.63672394",
"0.63626754",
"0.6340255",
"0.63153034",
"0.63153034",
"0.63153034",
"0.63153034",
"0.63153034",
"0.62998855",
"0.62978727",
"0.629776",
"0.6292766",
"0.6292766",
"0.6289175",
"0.6279521",
"0.6271484",
"0.627... | 0.0 | -1 |
Create a new message instance. | public function __construct(Contact $contact)
{
$this->contact = $contact;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function createMessage()\n {\n $message = new Message(new Swift_Message);\n\n\n // If a global from address has been specified we will set it on every message\n // instances so the developer does not have to repeat themselves every time\n // they create a new message. We wi... | [
"0.81376195",
"0.7959614",
"0.77619994",
"0.7713793",
"0.76559645",
"0.7553059",
"0.7458076",
"0.71510184",
"0.6852663",
"0.68347865",
"0.67154217",
"0.6689976",
"0.6683088",
"0.6644564",
"0.6628052",
"0.6549025",
"0.6514292",
"0.6501647",
"0.645071",
"0.645071",
"0.645071",
... | 0.0 | -1 |
Display a listing of the Specification_type. | public function index(Request $request)
{
$specificationTypes = $this->specificationTypeRepository->all();
return view('specification_types.index')
->with('specificationTypes', $specificationTypes);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function index() {\n $specs = Specification::paginate(config('globalSettings.entries-per-page'));\n return view('admin.specs.specs',\n [\n 'specs' => $specs\n ]\n );\n }",
"public function specializations_list()\n {\n $data['specializa... | [
"0.6765748",
"0.6698905",
"0.6547096",
"0.6336483",
"0.6201059",
"0.61452466",
"0.6143353",
"0.60474277",
"0.5985045",
"0.58537257",
"0.5822156",
"0.57925844",
"0.5783664",
"0.5768481",
"0.5750227",
"0.5664008",
"0.5661484",
"0.56545395",
"0.5644269",
"0.5644269",
"0.5644269"... | 0.61868995 | 5 |
Show the form for creating a new Specification_type. | public function create()
{
$specification = Specification::all();
return view('specification_types.create')->with(compact('specification'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function store(CreateSpecification_typeRequest $request)\n {\n $input = $request->all();\n\n $specificationType = $this->specificationTypeRepository->create($input);\n\n Flash::success('Specification Type saved successfully.');\n\n return redirect(route('specificationTypes.ind... | [
"0.6891645",
"0.6832236",
"0.6832236",
"0.67393976",
"0.6649213",
"0.6638073",
"0.6626142",
"0.6617111",
"0.6614032",
"0.6567561",
"0.6533818",
"0.65306485",
"0.65222585",
"0.65126884",
"0.65025246",
"0.6494007",
"0.6493881",
"0.6490555",
"0.64793557",
"0.64711577",
"0.646978... | 0.78522754 | 0 |
Store a newly created Specification_type in storage. | public function store(CreateSpecification_typeRequest $request)
{
$input = $request->all();
$specificationType = $this->specificationTypeRepository->create($input);
Flash::success('Specification Type saved successfully.');
return redirect(route('specificationTypes.index'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function saveType()\n {\n }",
"public function save(Type $type) {\n $typeData = array(\n 'name_ET' => $type->getName()\n );\n\n if ($type->getNum()) {\n // The type has already been saved : update it\n $this->getDb()->update('event... | [
"0.59298974",
"0.5857471",
"0.5816396",
"0.5762593",
"0.5721604",
"0.569306",
"0.5689876",
"0.565144",
"0.56136304",
"0.55326897",
"0.55313015",
"0.55204844",
"0.54565305",
"0.54481673",
"0.5446711",
"0.53715074",
"0.5341286",
"0.52945787",
"0.5279172",
"0.52786213",
"0.52690... | 0.70928854 | 0 |
Display the specified Specification_type. | public function show($id)
{
$specificationType = $this->specificationTypeRepository->find($id);
if (empty($specificationType)) {
Flash::error('Specification Type not found');
return redirect(route('specificationTypes.index'));
}
return view('specification_types.show')->with('specificationType', $specificationType);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function show(Type $type)\n {\n //\n }",
"public function show(Type $type)\n {\n //\n }",
"public function show(Type $type)\n {\n //\n }",
"public function showType($type = true)\n {\n $this->showType = $type;\n }",
"function display($type, $qualit... | [
"0.6621573",
"0.6621573",
"0.6621573",
"0.6559636",
"0.6553296",
"0.6357064",
"0.624014",
"0.6219991",
"0.61806995",
"0.6094615",
"0.6093914",
"0.6031929",
"0.594848",
"0.594848",
"0.594848",
"0.59464043",
"0.5915264",
"0.59119326",
"0.59119326",
"0.5840419",
"0.5812693",
"... | 0.55965984 | 29 |
Show the form for editing the specified Specification_type. | public function edit($id)
{
$specificationType = $this->specificationTypeRepository->find($id);
if (empty($specificationType)) {
Flash::error('Specification Type not found');
return redirect(route('specificationTypes.index'));
}
$specification = Specification::all();
$data =[
'specification' => $specification,
'specificationType' => $specificationType
];
return view('specification_types.edit')->with($data);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function edit(Type $type)\n {\n //\n }",
"public function edit(Type $type)\n {\n //\n }",
"public function edit(Type $type)\n {\n //\n }",
"public function getEdit($type)\n {\n // Title\n $title = Lang::get('admin/types/title.type_update');\n\n ... | [
"0.68237865",
"0.68237865",
"0.68237865",
"0.6719413",
"0.6660235",
"0.6604879",
"0.6359982",
"0.6317093",
"0.6273309",
"0.62707806",
"0.6260954",
"0.6246086",
"0.623583",
"0.6216477",
"0.6207442",
"0.6175922",
"0.6148457",
"0.61346316",
"0.60801107",
"0.6068831",
"0.60631335... | 0.6558751 | 6 |
Update the specified Specification_type in storage. | public function update($id, UpdateSpecification_typeRequest $request)
{
$specificationType = $this->specificationTypeRepository->find($id);
if (empty($specificationType)) {
Flash::error('Specification Type not found');
return redirect(route('specificationTypes.index'));
}
$specificationType = $this->specificationTypeRepository->update($request->all(), $id);
Flash::success('Specification Type updated successfully.');
return redirect(route('specificationTypes.index'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function update_type($new_type) { \n\n\t\tif ($this->_update_item('type',$new_type,'50')) { \n\t\t\t$this->type = $new_type;\n\t\t}\n\n\t}",
"public function update($data, $type = '')\n {\n }",
"public function update(Request $request, Type $type)\n {\n //\n }",
"public function up... | [
"0.6288913",
"0.6018423",
"0.59911406",
"0.59911406",
"0.588655",
"0.58472097",
"0.5689344",
"0.5671953",
"0.56371284",
"0.56031495",
"0.5590668",
"0.5552451",
"0.54424405",
"0.5436249",
"0.5380119",
"0.5378809",
"0.5376139",
"0.5363912",
"0.53624606",
"0.5334468",
"0.5261503... | 0.620051 | 1 |
Remove the specified Specification_type from storage. | public function destroy($id)
{
$specificationType = $this->specificationTypeRepository->find($id);
if (empty($specificationType)) {
Flash::error('Specification Type not found');
return redirect(route('specificationTypes.index'));
}
$this->specificationTypeRepository->delete($id);
Flash::success('Specification Type deleted successfully.');
return redirect(route('specificationTypes.index'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function remove($typeId);",
"public function destroy(Type $type)\n {\n //\n }",
"public function destroy(Type $type)\n {\n //\n }",
"protected function remove($type)\n {\n unset($this->alerts[$type]);\n }",
"public function removeConditionByType($type)\n {\n... | [
"0.60756814",
"0.58918566",
"0.58918566",
"0.58310276",
"0.5779239",
"0.57006854",
"0.56732434",
"0.567184",
"0.5611747",
"0.561007",
"0.55900204",
"0.5521843",
"0.54639184",
"0.54513294",
"0.54227537",
"0.541718",
"0.5410807",
"0.54031",
"0.5375461",
"0.53292793",
"0.5328341... | 0.48786578 | 57 |
$all_role = M('role')>where('user_id 0')>select(); | function getSubRoleId4($self = true, $role_id=0){
$role_id = session('role_id');
$below_role = getSubRole4($role_id, $all_role);
if ($self) {
$below_ids[] = $role_id;
}
foreach ($below_role as $key=>$value) {
$below_ids[] = $value['role_id'];
}
//dump($below_ids);exit;
return array_unique($below_ids);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAllRoles() {\n // connexion à la BDD\n $db = connect();\n // requête\n $query = $db -> prepare('SELECT DISTINCT role FROM users');\n // exécution\n $query -> execute();\n // renvoie un tableau associatif\n return $query -> fetchAll();\n}",
"public function get_all_roles(){\n\t... | [
"0.71899444",
"0.716844",
"0.7125367",
"0.7072232",
"0.6991448",
"0.698676",
"0.69687694",
"0.69639075",
"0.6926662",
"0.6888963",
"0.68565255",
"0.68565255",
"0.68399596",
"0.68283665",
"0.68247694",
"0.6803391",
"0.6792577",
"0.6760366",
"0.67563844",
"0.67539054",
"0.66625... | 0.0 | -1 |
$all_role = M('role')>where('user_id 0')>select(); | function getSubRoleId3($self = true, $role_id=0){
//echo M('role')->getLastSql();
//dump($all_role);
$role_id = session('role_id');
$below_role = getSubRole3($role_id, $all_role);
//dump($below_role);
if ($self) {
$below_ids[] = $role_id;
}
foreach ($below_role as $key=>$value) {
$below_ids[] = $value['role_id'];
}
//dump($below_ids);exit;
return array_unique($below_ids);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAllRoles() {\n // connexion à la BDD\n $db = connect();\n // requête\n $query = $db -> prepare('SELECT DISTINCT role FROM users');\n // exécution\n $query -> execute();\n // renvoie un tableau associatif\n return $query -> fetchAll();\n}",
"public function get_all_roles(){\n\t... | [
"0.71899444",
"0.716844",
"0.7125367",
"0.7072232",
"0.6991448",
"0.698676",
"0.69687694",
"0.69639075",
"0.6926662",
"0.6888963",
"0.68565255",
"0.68565255",
"0.68399596",
"0.68283665",
"0.68247694",
"0.6803391",
"0.6792577",
"0.6760366",
"0.67563844",
"0.67539054",
"0.66625... | 0.0 | -1 |
endif if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6) | function sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, int $memlimit): bool {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function birdseye_component_checkversion()\n{\n if (!function_exists('get_product_release'))\n return false;\n if (get_product_release() < 207)\n return false;\n\n return true;\n}",
"public function compatVersionConditionMatchesOlderRelease() {}",
"public function compatVersionConditionM... | [
"0.547371",
"0.5401517",
"0.5400816",
"0.5395058",
"0.5249138",
"0.5248671",
"0.5239694",
"0.5206099",
"0.5184621",
"0.5157504",
"0.51514",
"0.5150201",
"0.51059",
"0.5060673",
"0.5039128",
"0.49627578",
"0.4958531",
"0.4942118",
"0.49242577",
"0.48297217",
"0.48185757",
"0... | 0.0 | -1 |
Helper method to quickly create a form with given fields and requirements. | protected function createForm(array $fields, array $requiredFields = []): Form
{
$fieldList = FieldList::create();
foreach ($fields as $name => $value) {
$fieldList->add(TextField::create($name, $name, $value));
}
$validator = new DependentRequiredFields($requiredFields);
return Form::create(null, 'test', $fieldList, null, $validator);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function createFormFields() {\n\t}",
"abstract public function createForm();",
"abstract public function createForm();",
"public function createForm();",
"public function createForm();",
"protected function form()\n {\n $form = new Form(new Purchase());\n if ($form->isCreating(... | [
"0.7197657",
"0.71927226",
"0.71927226",
"0.7121654",
"0.7121654",
"0.6883486",
"0.6753936",
"0.67229515",
"0.66542315",
"0.6616685",
"0.6465313",
"0.64645696",
"0.64194053",
"0.64187574",
"0.63703305",
"0.63674444",
"0.6357836",
"0.63466984",
"0.6311902",
"0.6310263",
"0.628... | 0.720951 | 0 |
Get an associative array of field name to message type from a ValidationResult. | protected function getFlatValidationResult(ValidationResult $result)
{
$flatResults = array();
foreach ($result->getMessages() as $key => $metadata) {
$flatResults[$metadata['fieldName']] = $metadata['messageType'];
}
return $flatResults;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function validationErrors() {\n\t\t$return = array();\n\n\t\t$models = ClassRegistry::keys();\n\t\tforeach ($models as $currentModel) {\n\t\t\t$currentObject = ClassRegistry::getObject($currentModel);\n\t\t\tif ($currentObject instanceof Model) {\n\t\t\t\t$return[$currentObject->alias] = $currentObject->val... | [
"0.64899147",
"0.63041604",
"0.62535137",
"0.62530774",
"0.62438506",
"0.61968607",
"0.6152149",
"0.60276747",
"0.6023718",
"0.60085267",
"0.60082537",
"0.6002118",
"0.5929467",
"0.5928846",
"0.5918402",
"0.5910823",
"0.5874207",
"0.5874207",
"0.5849684",
"0.584697",
"0.58379... | 0.6721982 | 0 |
Constructor dari Class Login | public function __construct()
{
parent::__construct();
$this->load->model('Admin_m', 'admin');
if ($this->session->userdata('is_login_in') !== TRUE) {
redirect('login');
}
$this->idUser = $this->session->userdata('id_admin');
$this->tokenSession = $this->session->userdata('token');
$this->tokenServer = $this->admin->get_token_byId($this->idUser)->row()->token;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function __construct($idusuario, $idlogin, $passwordlogin) {//constructor de la clase login\n $this->idusuario = $idusuario;\n $this->idlogin = $idlogin;\n $this->passwordlogin = $passwordlogin;\n }",
"function __construct($login, $password) {\n $this->login = $login;\n $this->passw... | [
"0.8175606",
"0.79748845",
"0.7925571",
"0.79131943",
"0.783991",
"0.78380173",
"0.7837088",
"0.7827169",
"0.7826186",
"0.77535915",
"0.7724941",
"0.7724941",
"0.77187896",
"0.7697178",
"0.7697178",
"0.7671428",
"0.76630163",
"0.7573856",
"0.7518318",
"0.7508757",
"0.7459786"... | 0.0 | -1 |
Template untuk memanggil view | private function _template($data, $view)
{
$this->load->view('view/' . $view, $data);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function view(){\n\t\t$this->buildListing();\n\t}",
"public function view() {\r\n\r\n\t}",
"public function view()\n\t{\n\t\t// TODO Implement\t\n\t}",
"function index()\n {\n //call some deafaults not to spoil template\n $data=$this->default_data();\n $this->template($data);\n... | [
"0.7077953",
"0.6921887",
"0.689397",
"0.6887042",
"0.6821142",
"0.6781073",
"0.6745812",
"0.6717446",
"0.6700678",
"0.6674981",
"0.6673555",
"0.6673555",
"0.6637804",
"0.6594652",
"0.658458",
"0.6551606",
"0.65441585",
"0.6537521",
"0.6536385",
"0.65351367",
"0.6534413",
"... | 0.0 | -1 |
Menampilkan halaman index photo | public function index()
{
if($this->tokenSession != $this->tokenServer){
_unlogin();
} else {
$data['title'] = "Dashboard | FaceVoting Versi 1.0";
$data['dataPhoto']= $this->admin->get_data_photo()->result_array();
$view ='v_photo';
$this->_template($data,$view);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function do_index() {\n $this->vars['title'] = \"Fotos\";\n \n $sql = 'SELECT COUNT(*) FROM photos';\n $count = $this->photo->count($sql);\n \n $page = $this->paginate(PHOTO_PAGE_SIZE, $count, '/photo/index');\n \n $sql = 'SELECT p.created as p_created, p.id AS p_id, u.id AS u_id, t... | [
"0.71024686",
"0.70821553",
"0.6991138",
"0.6759952",
"0.6751405",
"0.67511326",
"0.6738191",
"0.6694762",
"0.6671351",
"0.66514313",
"0.65401185",
"0.65365094",
"0.6515426",
"0.6474187",
"0.6447109",
"0.63769865",
"0.63694143",
"0.6368314",
"0.6359997",
"0.63290954",
"0.6316... | 0.63785094 | 15 |
Menampilkan detail Album yang diperoleh dari Lambda | public function rebuild()
{
$id=3;
$dataAlbum = $this->admin->data_album($id);
$namaAlbum = $dataAlbum->row()->nama_album;
$albumKey = $dataAlbum->row()->kode_album;
$data['title'] = "Dashboard | FaceVoting Versi 1.0";
$data['getRebuild']= $this->_prosesRebuild($namaAlbum,$albumKey);
$view ='v_rebuildalbum';
$this->_template($data,$view);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function show(Album $album)\n {\n //\n }",
"function getViewAlbumDetail($album_uid) {\n\t\t// Get Smarty Instance\n \t$smartyInstance = tx_cwtcommunity_lib_common::getSmartyInstance();\n $conf = tx_cwtcommunity_lib_common::getConfArray();\n $tplPath = tx_cwtcommunity_lib_comm... | [
"0.6476811",
"0.6228056",
"0.62186646",
"0.6129683",
"0.6128875",
"0.6073477",
"0.60687965",
"0.60586727",
"0.6049826",
"0.6034131",
"0.59840953",
"0.59683067",
"0.5873357",
"0.58716583",
"0.58709997",
"0.5848816",
"0.5836596",
"0.5801215",
"0.57915664",
"0.57728875",
"0.5761... | 0.0 | -1 |
Load configuration from file alone. | public function testConfigFromSingleFile()
{
$cfg = new Configuration();
$cfg->setBaseDirectories($this->dirs);
$config = $cfg->load("view");
$this->assertInternalType("array", $config);
$this->assertArrayHasKey("file", $config);
$this->assertArrayHasKey("config", $config);
$this->assertArrayNotHasKey("items", $config);
$this->assertContains("a view", $config["config"]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public abstract function loadConfig($fileName);",
"private function load()\n {\n if (!file_exists($this->file)) {\n throw new Exception('config file not found');\n }\n // read contents of wordpress config\n // we can not require the configuration because it requires a sh... | [
"0.7967239",
"0.7258674",
"0.72584146",
"0.724199",
"0.71637255",
"0.7133132",
"0.71095824",
"0.71044827",
"0.7064568",
"0.70368165",
"0.6991416",
"0.6988359",
"0.69405836",
"0.69369537",
"0.6916084",
"0.68552476",
"0.68195087",
"0.67923695",
"0.6750407",
"0.67273474",
"0.672... | 0.64748627 | 38 |
Load configuration from directory alone. | public function testConfigFromDirectory()
{
$cfg = new Configuration();
$cfg->setBaseDirectories($this->dirs);
$config = $cfg->load("response");
$this->assertInternalType("array", $config);
$this->assertArrayNotHasKey("file", $config);
$this->assertArrayNotHasKey("config", $config);
$this->assertArrayHasKey("items", $config);
$this->assertContains("part1", $config["items"][0]["config"]);
$this->assertContains("part2", $config["items"][1]["config"]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function loadConfig()\n {\n $files = scandir($this->configPath());\n $configs = [];\n\n foreach ($files as $file) {\n $filePath = $this->configPath() . DIRECTORY_SEPARATOR . $file;\n\n if (is_file($filePath)) {\n $config = [basename($file, '.php'... | [
"0.7491405",
"0.7293052",
"0.70488036",
"0.70140076",
"0.6827473",
"0.6826427",
"0.6819068",
"0.6813193",
"0.67902654",
"0.6734792",
"0.67178357",
"0.66837424",
"0.66582924",
"0.6617847",
"0.65621334",
"0.65088016",
"0.6489431",
"0.64774245",
"0.64361143",
"0.64026636",
"0.63... | 0.6770147 | 9 |
Load configuration from file and directory. | public function testConfigFromFileAndDirectory()
{
$cfg = new Configuration();
$cfg->setBaseDirectories($this->dirs);
$config = $cfg->load("route");
$this->assertInternalType("array", $config);
$this->assertArrayHasKey("file", $config);
$this->assertArrayHasKey("config", $config);
$this->assertContains("a route", $config["config"]);
$this->assertArrayHasKey("items", $config);
$this->assertContains("a 404 route", $config["items"][0]["config"]);
$this->assertContains("an internal route", $config["items"][1]["config"]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function loadConfig()\n {\n $files = scandir($this->configPath());\n $configs = [];\n\n foreach ($files as $file) {\n $filePath = $this->configPath() . DIRECTORY_SEPARATOR . $file;\n\n if (is_file($filePath)) {\n $config = [basename($file, '.php'... | [
"0.76238066",
"0.75923675",
"0.7495463",
"0.7228489",
"0.7221532",
"0.7208892",
"0.70912826",
"0.69257027",
"0.6921208",
"0.68888867",
"0.68343294",
"0.6818689",
"0.6799044",
"0.6752239",
"0.6751264",
"0.67224234",
"0.66852796",
"0.66703916",
"0.6600766",
"0.6572733",
"0.6541... | 0.6397723 | 30 |
Use mapping to load specific file for a configuration item. | public function testUseMapping()
{
$cfg = new Configuration();
$cfg->setBaseDirectories($this->dirs);
$cfg->setMapping("item", ANAX_INSTALL_PATH . "/test/config/test1.php");
$config = $cfg->load("item");
$this->assertInternalType("array", $config);
$this->assertArrayHasKey("file", $config);
$this->assertArrayHasKey("config", $config);
$this->assertArrayHasKey("key1", $config["config"]);
$this->assertContains("value1", $config["config"]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abstract protected function _loadMappingFile($file);",
"abstract protected function _loadMappingFile($file);",
"public static function load($mapName)\n {\n\n foreach (Conf::$confPath as $path) {\n\n if (!$this->source)\n $menuPath = $path.'/menu/'.$this->name.'/';\n else\n $menuPath... | [
"0.715688",
"0.715688",
"0.674381",
"0.66927046",
"0.59624374",
"0.58681685",
"0.577434",
"0.56895036",
"0.5648088",
"0.547104",
"0.54583377",
"0.54583377",
"0.5452885",
"0.535551",
"0.5302228",
"0.53017014",
"0.5297954",
"0.5230354",
"0.5229483",
"0.51966995",
"0.51557714",
... | 0.69689333 | 2 |
' hash_call: Function to perform the API call to PayPal using API signature | protected function hash_call($methodName, $nvpStr) {
$API_Endpoint = Config::get('paypal.api_endpoint');
//'------------------------------------
//' PayPal API Credentials
//' Replace <API_USERNAME> with your API Username
//' Replace <API_PASSWORD> with your API Password
//' Replace <API_SIGNATURE> with your Signature
//'------------------------------------
$API_UserName = Config::get('paypal.api_username');
$API_Password = Config::get('paypal.api_password');
$API_Signature = Config::get('paypal.api_signature');
// BN Code is only applicable for partners
$sBNCode = "PP-ECWizard";
$PROXY_HOST = '127.0.0.1';
$PROXY_PORT = '808';
$USE_PROXY = false;
$version = "93";
//setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
//turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
//if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
//Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php
if ($USE_PROXY)
curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST . ":" . $PROXY_PORT);
//NVPRequest for submitting to server
$nvpreq = "METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
//setting the nvpreq as POST FIELD to curl
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
//getting response from server
$response = curl_exec($ch);
//convrting NVPResponse to an Associative Array
$nvpResArray = $this->deformatNVP($response);
$nvpReqArray = $this->deformatNVP($nvpreq);
$_SESSION['nvpReqArray'] = $nvpReqArray;
if (curl_errno($ch)) {
// moving to display page to display curl errors
$_SESSION['curl_error_no'] = curl_errno($ch);
$_SESSION['curl_error_msg'] = curl_error($ch);
//Execute the Error handling module to display errors.
} else {
//closing the curl
curl_close($ch);
}
return $nvpResArray;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function hash_call($methodName, $nvpStr)\r\n {\r\n \r\n //declaring of global variables\r\n //global $API_Endpoint, $API_UserName, $API_Password, $API_Signature, $API_AppID;\r\n //global $USE_PROXY, $PROXY_HOST, $PROXY_PORT;\r\n \r\n ... | [
"0.7089446",
"0.67854375",
"0.67441547",
"0.6549068",
"0.6495124",
"0.62567896",
"0.6118522",
"0.60313505",
"0.5941127",
"0.59124017",
"0.5868389",
"0.5843795",
"0.58194005",
"0.57683253",
"0.57567775",
"0.5699855",
"0.56623477",
"0.5654446",
"0.5630786",
"0.5586937",
"0.5578... | 0.6967719 | 1 |
/' This function will take NVPString and convert it to an Associative Array and it will decode the response. It is usefull to search for a particular key and displaying arrays. | private function deformatNVP($nvpstr)
{
$intial=0;
$nvpArray = array();
while(strlen($nvpstr))
{
//postion of Key
$keypos= strpos($nvpstr,'=');
//position of value
$valuepos = strpos($nvpstr,'&') ? strpos($nvpstr,'&'): strlen($nvpstr);
/*getting the Key and Value values and storing in a Associative Array*/
$keyval=substr($nvpstr,$intial,$keypos);
$valval=substr($nvpstr,$keypos+1,$valuepos-$keypos-1);
//decoding the respose
$nvpArray[urldecode($keyval)] =urldecode( $valval);
$nvpstr=substr($nvpstr,$valuepos+1,strlen($nvpstr));
}
return $nvpArray;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function deformatNVP($nvpstr){\r\n \r\n $intial=0;\r\n $nvpArray = array(); \r\n \r\n while(strlen($nvpstr)){\r\n //postion of Key\r\n $keypos= strpos($nvpstr,'=');\r\n //position of value\r\n $valuepos = strpos($nvpstr,'&') ? strpos($... | [
"0.67974657",
"0.6726708",
"0.6707824",
"0.6676692",
"0.66165745",
"0.66136616",
"0.6536397",
"0.62488645",
"0.5874914",
"0.5635918",
"0.558448",
"0.5502825",
"0.5114392",
"0.50820124",
"0.50568646",
"0.5027101",
"0.5020332",
"0.49985197",
"0.49813187",
"0.49770144",
"0.49689... | 0.65382123 | 6 |
Description This function will return the list of modules available in the system, and which modules the requested station has access to. Arguments api_key: auth_token: station_id: The ID of the station to get the module list for. | function qruqsp_core_stationModuleList($q) {
//
// Find all the required and optional arguments
//
qruqsp_core_loadMethod($q, 'qruqsp', 'core', 'private', 'prepareArgs');
$rc = qruqsp_core_prepareArgs($q, 'no', array(
'station_id'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Station'),
'plans'=>array('required'=>'no', 'blank'=>'yes', 'name'=>'Plans'),
));
if( $rc['stat'] != 'ok' ) {
return $rc;
}
$args = $rc['args'];
//
// Check access to station_id as owner, or sys admin.
//
qruqsp_core_loadMethod($q, 'qruqsp', 'core', 'private', 'checkAccess');
$rc = qruqsp_core_checkAccess($q, $args['station_id'], 'qruqsp.core.stationModuleList');
if( $rc['stat'] != 'ok' ) {
return $rc;
}
qruqsp_core_loadMethod($q, 'qruqsp', 'core', 'private', 'dbHashIDQuery');
$strsql = "SELECT CONCAT_WS('.', package, module) AS name, package, module, status "
. "FROM qruqsp_core_station_modules "
. "WHERE station_id = '" . qruqsp_core_dbQuote($q, $args['station_id']) . "' "
. "ORDER BY name "
. "";
$rc = qruqsp_core_dbHashIDQuery($q, $strsql, 'qruqsp.core', 'modules', 'name');
if( $rc['stat'] != 'ok' ) {
return $rc;
}
if( !isset($rc['modules']) ) {
return array('stat'=>'fail', 'err'=>array('code'=>'qruqsp.core.139', 'msg'=>'No station found'));
}
$station_modules = $rc['modules'];
//
// Get the list of available modules
//
qruqsp_core_loadMethod($q, 'qruqsp', 'core', 'private', 'getModuleList');
$rc = qruqsp_core_getModuleList($q);
if( $rc['stat'] != 'ok' ) {
return $rc;
}
$mod_list = $rc['modules'];
$modules = array();
$count = 0;
foreach($mod_list as $module) {
if( $module['label'] != '' && $module['installed'] == 'Yes' && (!isset($module['optional']) || $module['optional'] == 'yes') ) {
$modules[$count] = array('label'=>$module['label'], 'package'=>$module['package'], 'name'=>$module['name'], 'status'=>'0');
if( isset($station_modules[$module['package'] . '.' . $module['name']])
&& $station_modules[$module['package'] . '.' . $module['name']]['status'] == 1 ) {
$modules[$count]['status'] = '1';
}
$count++;
}
}
$rsp = array('stat'=>'ok', 'modules'=>$modules);
/* //
// Get the list of available plans for the station
//
if( isset($args['plans']) && $args['plans'] == 'yes' ) {
if( $args['station_id'] == '0' ) {
$args['station_id'] = $q['config']['qruqsp.core']['master_station_id'];
}
//
// Query the database for the plan
//
$strsql = "SELECT id, name, monthly, trial_days "
. "FROM qruqsp_core_station_plans "
. "WHERE station_id = '" . qruqsp_core_dbQuote($q, $args['station_id']) . "' "
. "ORDER BY sequence "
. "";
qruqsp_core_loadMethod($q, 'qruqsp', 'core', 'private', 'dbHashQueryTree');
$rc = qruqsp_core_dbHashQueryTree($q, $strsql, 'qruqsp.stations', array(
array('container'=>'plans', 'fname'=>'id', 'name'=>'plan', 'fields'=>array('id', 'name', 'monthly')),
));
if( $rc['stat'] != 'ok' ) {
return $rc;
}
if( isset($rc['plans']) ) {
$rsp['plans'] = $rc['plans'];
}
} */
return $rsp;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getModulesList();",
"public static function getModules(){ \n $db = new db();\n $db->connect();\n $modules = $db->selectAll('modules');\n return self::getModulesInfo($modules);\n }",
"public function getModules()\n {\n\n if ($this->_modules !== null)... | [
"0.6519723",
"0.64090395",
"0.6387625",
"0.6264763",
"0.6264763",
"0.6182842",
"0.6080295",
"0.6033333",
"0.60101736",
"0.60081464",
"0.59897685",
"0.5976847",
"0.5955909",
"0.59485173",
"0.5936262",
"0.58714646",
"0.58619255",
"0.5831128",
"0.58197904",
"0.58183616",
"0.5800... | 0.74659175 | 0 |
Check if feed api in use. | public function isFeedChecked() {
$base_config = $this->config_factory->getEditable('ap_newsroom.base_config');
if($base_config->get('use_feed')) {
return TRUE;
} else {
return FALSE;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function can_create_feed() {\n\n\t\treturn $this->initialize_api();\n\n\t}",
"function wpcom_vip_is_feedservice_ua() {\n\tif ( function_exists( 'wpcom_feed_cache_headers' ) ) {\n\t\t// Workaround so that no feed request served from nginx wpcom-feed-cache\n\t\t// If you are checking you must already know i... | [
"0.73219836",
"0.6992901",
"0.6945008",
"0.68728346",
"0.6842441",
"0.6797434",
"0.670532",
"0.6701433",
"0.6661849",
"0.66510284",
"0.64179325",
"0.641213",
"0.6411932",
"0.63662285",
"0.6359877",
"0.6289321",
"0.62438464",
"0.6224127",
"0.6219437",
"0.62183994",
"0.6185424"... | 0.72887605 | 1 |
Prepare node entity for cloning | public function prepareNodeForClone($entity_type) {
$item_id = $this->getItemId();
if($item_id) {
$singleContentResponse = $this->apNewsroomContent->getContentById($item_id);
return $this->mapAPDataToNode($entity_type,$singleContentResponse);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function node_object_prepare(&$node) {\n $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));\n // If this is a new node, fill in the default values.\n if (!isset($node->nid)) {\n foreach (array('status', 'promote', 'sticky') as $key) {\n $node->$key = in_array($key, $... | [
"0.64748895",
"0.64306897",
"0.6331925",
"0.616428",
"0.6071687",
"0.6031265",
"0.59198064",
"0.58280045",
"0.58152056",
"0.57362133",
"0.56623363",
"0.56195015",
"0.5575454",
"0.5532027",
"0.55180246",
"0.550112",
"0.5494381",
"0.54736334",
"0.54394907",
"0.54049236",
"0.540... | 0.66675603 | 0 |
Get itemID from url. | public function getItemId() {
$item_id = $this->request_stack->getCurrentRequest()->query->get('item_id');
if(!$item_id) {
throw new InvalidArgumentException('Item id is not valid.');
}
return $this->request_stack->getCurrentRequest()->query->get('item_id');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static public function getIdFromUrl($url) {\n $cleanedUrl = substr($url, 0, -1); // Remove last / from url.\n $explodedUrl = explode('/', $cleanedUrl);\n return (int) end($explodedUrl); // Get id from url\n }",
"private static function get_id_from_url(string $url): string {\n\n gl... | [
"0.6916571",
"0.68542975",
"0.68120944",
"0.66871554",
"0.6649469",
"0.6591656",
"0.654832",
"0.6510976",
"0.64997524",
"0.6490539",
"0.6462986",
"0.6458779",
"0.6442195",
"0.6413571",
"0.6375115",
"0.6361082",
"0.63535327",
"0.6341373",
"0.63255036",
"0.62724036",
"0.6266652... | 0.65060896 | 8 |
Map text type field. | public function mapTextTypeField(&$entity, $field, $item_data) {
$field_name = $field['id'];
$mapping_index = explode('.',$field['path']);
// Loop for value.
$field_value = $item_data['data'];
for ($i = 0; $i < count($mapping_index); $i++) {
if(isset($field_value[$mapping_index[$i]])) {
$field_value = $field_value[$mapping_index[$i]];
}
}
if(is_string($field_value) && $entity->hasField($field_name)) {
$entity->$field_name->appendItem($field_value);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function convert_text_field() {\n\n\t\t// Create a new Text field.\n\t\tself::$field = new GF_Field_Text();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t}",
"public function getTYPE_TEXT()\n {\n return self::TYPE_TEXT;\n }",
"public function getType()\n {\... | [
"0.6864198",
"0.6534051",
"0.6453625",
"0.62800676",
"0.6169659",
"0.59466153",
"0.59465766",
"0.5925325",
"0.59144026",
"0.59144026",
"0.58567095",
"0.58124936",
"0.5793117",
"0.5789615",
"0.57548696",
"0.5707303",
"0.5688153",
"0.5676421",
"0.5653418",
"0.56323534",
"0.5606... | 0.69684404 | 0 |
Map image type field | public function mapImageField(&$entity, $field, $item_data) {
$field_name = $field['id'];
$is_multiple = $field['multiple'];
if(isset($item_data['data']['item']['associations'])) {
$media_index = $item_data['data']['item']['associations'];
foreach ($media_index as $index => $media) {
if($media['type'] == 'picture') {
$media_id = $media['altids']['itemid'];
$media_data = $this->apNewsroomContent->getContentById($media_id);
$file_data = $this->saveFile($media_data, $this->apNewsroomContent->getApNewsroomApi()->getApiKey());
if(!empty($file_data) && $entity->hasField($field_name)) {
$entity->$field_name->appendItem($file_data);
if(!$is_multiple) {
break;
}
}
}
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getImageType() \n { \n return $this->_type; \n }",
"private function get_type_img()\n {\n $this->multi_byte_string_to_array();\n foreach($this->strings as $char)\n {\n $this->init_img();\n $this->create_img($char);\n }\n }",
"public ... | [
"0.67992747",
"0.67736816",
"0.66332746",
"0.6491411",
"0.6258314",
"0.61537004",
"0.61391544",
"0.6115127",
"0.60603297",
"0.60329527",
"0.6019482",
"0.5985831",
"0.5926729",
"0.58506",
"0.5839317",
"0.57877916",
"0.5745399",
"0.5724725",
"0.571769",
"0.5709774",
"0.5685355"... | 0.6164357 | 5 |
Save file for image type. | public function saveFile($media_data, $api_key) {
if(isset($media_data['data']['item']['renditions']['main'])) {
$title = $media_data['data']['item']['title'];
$alt_text = $media_data['data']['item']['headline'];
if(isset($media_data['data']['item']['altids']['itemid'])) {
$item_id = $media_data['data']['item']['altids']['itemid'];
$uri = $media_data['data']['item']['renditions']['main']['href'];
$image_url = $uri . '&apikey=' . $api_key;
$actual_uri = NULL;
// Get redirected url.
$response = $this->http_client_factory->fromOptions([
'allow_redirects' => [
'on_redirect' => function (RequestInterface $request, ResponseInterface $response, \Psr\Http\Message\UriInterface $uri) use (&$actual_uri) {
$actual_uri = (string) $uri;
}
],
])->get($image_url);
$redirected_url = $actual_uri . '&apikey=' . $api_key;
$data = file_get_contents($redirected_url);
$file = file_save_data($data, "public://$item_id.jpeg", FileSystemInterface::EXISTS_REPLACE);
return [
'target_id' => $file->id(),
'alt' => $alt_text,
'title' => $title,
];
}
}
return [];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function saveImage()\n\t{\n\n\t\tif (!$this->ImageStream) {\n\t\t\t$this->printError('image not loaded');\n\t\t}\n\n\t\tswitch ($this->type) {\n\t\t\tcase 1:\n\t\t\t\t/* store a interlaced gif image */\n\t\t\t\tif ($this->interlace === true) {\n\t\t\t\t\timageinterlace($this->ImageStream, 1);\n\t\t\t\t}\n\n\t\t\t\... | [
"0.8050701",
"0.79795957",
"0.7854442",
"0.7358189",
"0.7263262",
"0.720171",
"0.7134128",
"0.71107423",
"0.70981276",
"0.7076092",
"0.7073501",
"0.6989685",
"0.68368596",
"0.6827663",
"0.6791453",
"0.6783745",
"0.67787135",
"0.67497045",
"0.6679937",
"0.66725683",
"0.6664818... | 0.0 | -1 |
Map Body from XML ap newsroom | public function mapNitfField(&$entity, $field, $item_data) {
$field_name = $field['id'];
if(isset($item_data['data']['item']['renditions']['nitf'])) {
$href = $item_data['data']['item']['renditions']['nitf']['href'];
$xml_data = $this->apNewsroomContent->getNitfByUrl($href);
// parse xml string
$xml_data = simplexml_load_string($xml_data);
$body = $xml_data->body->{'body.content'}->asXML();
if($body && $entity->hasField($field_name)) {
$entity->$field_name->appendItem($body);
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getBodyContent() {}",
"public function getBody() {\n return $this->get('body', 'news');\n }",
"abstract public function getBody();",
"public function getBody();",
"public function getBody();",
"public function getBody();",
"public function getBody();",
"public function getBo... | [
"0.5839852",
"0.5822978",
"0.5806103",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5671267",
"0.5538214",
"0.54985",
"0.5326871",
"0.5302773",
"0.52695423",
"0.52340686",
"... | 0.0 | -1 |
Map paragraphs type field. | public function mapParagraphsType(&$entity, $field, $item_data) {
$field_name = $field['id'];
foreach ($field['paragraph_list'] as $para_type => $para_fields) {
$paragraph = $this->entityTypeManager
->getStorage('paragraph')
->create(['type' => $para_type]);
foreach ($para_fields['fields'] as $key => $para_field) {
$this->resolveFieldTypeMapping($paragraph, $para_field, $item_data);
}
if(!empty($paragraph) && $entity->hasField($field_name)) {
$entity->$field_name->appendItem($paragraph);
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function AssignPageTypeFields() {\n $this->AddField('showmap', self::DT_BOOLEAN, true);\n $this->AddField('mapaddress', self::DT_STRING);\n }",
"function get_parade_parallax_paragraphs_type_data() {\n $fields = [\n ['Anchor', 'parade_anchor', 'Text (plain)'],\n ['Background', 'parade_back... | [
"0.65844107",
"0.642111",
"0.6331055",
"0.6232043",
"0.61252964",
"0.6047966",
"0.6020479",
"0.60180247",
"0.5920896",
"0.5803017",
"0.5786175",
"0.57659286",
"0.57164115",
"0.5693756",
"0.5614692",
"0.5495104",
"0.54725546",
"0.5463364",
"0.5426758",
"0.5426067",
"0.5420295"... | 0.7100973 | 0 |
Generate table structure for listing. | public function getTable($decodedJsonFeedData) {
$header = [
'headline' => t('Headline'),
'item_id' => t('Item Id'),
'version_created' => t('Version Created'),
'clone' => t('Clone'),
];
$rows = [];
if(isset($decodedJsonFeedData['data']['items'])) {
$items = $decodedJsonFeedData['data']['items'];
foreach ($items as $key => $item) {
$item = $item['item'];
$clone_buttons = $this->getCloneButton($item['altids']['itemid']);
$rows[$key] = [
'headline' => [
'data' => isset($item['headline']) ? $item['headline'] : ''
],
'item_id' => [
'data' => isset($item['altids']['itemid']) ? $item['headline'] : ''
],
'version_created' => [
'data' => isset($item['versioncreated']) ?
$this->dateFormatter->format(strtotime($item['versioncreated']), 'custom', 'm/d/Y h:ia') : ''
],
'clone' => [
'data' => !empty($clone_buttons) ? $clone_buttons : ''
],
];
}
}
return [
'#type' => 'table',
'#prefix' => '<div id="ap-news-table-list" class="table-feed-list">',
'#suffix' => '</div>',
'#header' => $header,
'#rows' => $rows,
'#footer' =>$this->getFooter($decodedJsonFeedData),
'#empty' => t('No result found.'),
];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function prepare_table()\n {\n global $g_dirs;\n\n $l_dao = new isys_cmdb_dao($this->database);\n $l_quicky = new isys_ajax_handler_quick_info();\n\n $l_table = \"<table width=\\\"100%\\\" class=\\\"report_listing\\\">\";\n\n foreach ($this->m_its_arr as $l_obj_id => $... | [
"0.7007589",
"0.678785",
"0.6782046",
"0.6740639",
"0.6514125",
"0.6513527",
"0.64687353",
"0.6380533",
"0.63751704",
"0.6288956",
"0.6286187",
"0.6282498",
"0.62622255",
"0.62552774",
"0.61742663",
"0.6172575",
"0.617086",
"0.61614126",
"0.614921",
"0.6133383",
"0.61222965",... | 0.0 | -1 |
Get footer for table. | public function getFooter($decodedJsonFeedData) {
$footer = [];
if(isset($decodedJsonFeedData['data']['previous_page'])) {
$parsed_url_previous_page = UrlHelper::parse($decodedJsonFeedData['data']['previous_page']);
$footer['data'][] = $this->getPagerLinks($parsed_url_previous_page, '‹ Previous');
}
if(!$this->isFeedChecked()) {
$footer['data'][] = t('Page: ') . $decodedJsonFeedData['data']['current_page'];
}
if(isset($decodedJsonFeedData['data']['next_page'])) {
if($this->isFeedChecked()) {
$parsed_url_next_page = UrlHelper::parse($decodedJsonFeedData['data']['next_page']);
$footer['data'][] = $this->getPagerLinks($parsed_url_next_page, 'More ›');
return $footer;
}
$parsed_url_next_page = UrlHelper::parse($decodedJsonFeedData['data']['next_page']);
$footer['data'][] = $this->getPagerLinks($parsed_url_next_page, 'Next ›');
}
return $footer;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getFooter();",
"public function getFooter();",
"public static function getFooter()\n {\n return self::$_footer;\n }",
"private function createTableFooter() {\n\t\treturn \"</table>\\n\";\n\t}",
"public function getFooter()\n {\n $this->smarty->assign(array(\n ... | [
"0.78271747",
"0.78271747",
"0.76918465",
"0.7611681",
"0.7367222",
"0.72682035",
"0.7236785",
"0.7233251",
"0.7140567",
"0.7131904",
"0.69366235",
"0.6858771",
"0.6844632",
"0.6843202",
"0.67691493",
"0.6750055",
"0.67487174",
"0.67283213",
"0.6727102",
"0.6710324",
"0.67014... | 0.0 | -1 |
Generate pager for listing. | public function getPagerLinks($param, $label) {
$qt = $param['query']['qt'];
if($this->isFeedChecked()) {
$seq = $param['query']['seq'];
$pager_link = Link::createFromRoute($label,'ap_newsroom_clone.pager',[
'qt' => $qt,
'page_num' => $seq
],[
'attributes' => ['class' => 'use-ajax']
]);
} else {
$page = $param['query']['page'];
$pager_link = Link::createFromRoute($label,'ap_newsroom_clone.pager',[
'qt' => $qt,
'page_num' => $page
],[
'attributes' => ['class' => 'use-ajax']
]);
}
return $pager_link;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function generatePages()\n {\n $all_pages = self::getPages($this->records, $this->recordsInPage);\n $total = 0;\n $start = 1;\n while ($total < $all_pages) {\n $shift = $this->getShift();\n $paging_start = $total < $this->getLeftShift() ? true : false;\n... | [
"0.7457535",
"0.731643",
"0.69026375",
"0.6886421",
"0.6886421",
"0.679177",
"0.6775701",
"0.67440784",
"0.6713334",
"0.66876215",
"0.65640026",
"0.65474916",
"0.64812887",
"0.6462723",
"0.6413442",
"0.6350926",
"0.63221353",
"0.63139397",
"0.6313218",
"0.630388",
"0.6288795"... | 0.0 | -1 |
Display a listing of the resource. | public function index(Request $request)
{
if($request->isMethod("get")){
$pivotStatus = PivotStatus::with("user")->paginate(5);
$response = array(
"pivotStatus" => $pivotStatus,
"request" => $request->all(),
);
return response()->json($response);
}
} | {
"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)
{
$validation = Validator::make(
$request->all(),
[
"user_id" => 'required|integer|numeric',
'name' => 'required|max:255',
]
);
$errors = $validation->errors();
if($validation->fails()){
$response = array(
"message" => "Failed",
"errors" => $errors,
);
return response()->json($response);
}
else{
if($request->isMethod("post")){
$pivotStatus = new PivotStatus;
$pivotStatus->name = $request->name;
$pivotStatus->user_id = $request->name;
$this->authorize('create', $pivotStatus);
$pivotStatus->save();
$response = array(
"message" => "bravo",
"request" => $request->all(),
);
return response()->json($response);
}
}
} | {
"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(Request $request)
{
$user_id = $request->user_id;
$validation = Validator::make(
$request->all(),
[
'status_id' => 'required|integer|numeric',
]
);
$errors = $validation->errors();
if($validation->fails()){
$response = array(
"message" => "Failed",
"errors" => $errors,
);
return response()->json($response);
}
else{
if($request->isMethod("get")){
$pivotStatus = PivotStatus::find($request->status_id);
$response = array(
"pivotStatus" => $pivotStatus,
"request" => $request->all(),
);
return response()->json($response);
}
}
} | {
"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($id)
{
//
} | {
"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)
{
$validation = Validator::make(
$request->all(),
[
"status_id" => 'required|integer',
'name' => 'required|max:255',
]
);
$errors = $validation->errors();
if($validation->fails()){
$response = array(
"message" => "Failed",
"errors" => $errors,
);
return response()->json($response);
}
else{
if($request->isMethod("patch")){
$pivotStatus = PivotStatus::find($request->status_id);
$pivotStatus->name = $request->name;
$this->authorize('update', $pivotStatus);
$pivotStatus->save();
$response = array(
"message" => "bravo",
"request" => $request->all(),
);
return response()->json($response);
}
}
} | {
"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(Request $request)
{
$validation = Validator::make(
$request->all(),
[
'status_id' => 'required|integer|numeric',
]
);
$errors = $validation->errors();
if($validation->fails()){
$response = array(
"message" => "Failed",
"errors" => $errors,
);
return response()->json($response);
}
else{
if($request->isMethod("delete")){
$pivotStatus = PivotStatus::find($request->status_id);
$this->authorize('delete', $pivotStatus);
$pivotStatus->delete();
$response = array(
"message" => "Deleted",
"request" => $request->all(),
);
return response()->json($response);
}
}
} | {
"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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.