• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP key函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中key函数的典型用法代码示例。如果您正苦于以下问题:PHP key函数的具体用法?PHP key怎么用?PHP key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了key函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: calculateGFRResult

 function calculateGFRResult()
 {
     $tmpArr = array();
     $tmpArr[] = date('Y-m-d H:i:s');
     //observation time
     $tmpArr[] = 'GFR (CALC)';
     //desc
     $gender = NSDR::populate($this->_patientId . "::com.clearhealth.person.displayGender");
     $crea = NSDR::populate($this->_patientId . "::com.clearhealth.labResults[populate(@description=CREA)]");
     $genderFactor = null;
     $creaValue = null;
     $personAge = null;
     $raceFactor = 1;
     switch ($gender[key($gender)]) {
         case 'M':
             $genderFactor = 1;
             break;
         case 'F':
             $genderFactor = 0.742;
             break;
     }
     if ((int) strtotime($crea['observation_time']) >= strtotime('now - 60 days') && strtolower($crea[key($crea)]['units']) == 'mg/dl') {
         $creaValue = $crea[key($crea)]['value'];
     }
     $person = new Person();
     $person->personId = $this->_patientId;
     $person->populate();
     if ($person->age > 0) {
         $personAge = $person->age;
     }
     $personStat = new PatientStatistics();
     $personStat->personId = $this->_patientId;
     $personStat->populate();
     if ($personStat->race == "AFAM") {
         $raceFactor = 1.21;
     }
     $gfrValue = "INC";
     if ($personAge > 0 && $creaValue > 0) {
         $gfrValue = "" . (int) round(pow($creaValue, -1.154) * pow($personAge, -0.203) * $genderFactor * $raceFactor * 186);
     }
     trigger_error("gfr:: " . $gfrValue, E_USER_NOTICE);
     $tmpArr[] = $gfrValue;
     // lab value
     $tmpArr[] = 'mL/min/1.73 m2';
     //units
     $tmpArr[] = '';
     //ref range
     $tmpArr[] = '';
     //abnormal
     $tmpArr[] = 'F';
     //status
     $tmpArr[] = date('Y-m-d H:i:s') . '::' . '0';
     // observationTime::(boolean)normal; 0 = abnormal, 1 = normal
     $tmpArr[] = '0';
     //sign
     //$this->_calcLabResults[uniqid()] = $tmpArr;
     $this->_calcLabResults[1] = $tmpArr;
     // temporarily set index to one(1) to be able to include in selected lab results
     return $tmpArr;
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:60,代码来源:CalcLabs.php


示例2: prepare_form

 /**
  * {@inheritdoc}
  */
 public function prepare_form($request, $template, $user, $row, &$error)
 {
     $avatar_list = $this->get_avatar_list($user);
     $category = $request->variable('avatar_local_cat', key($avatar_list));
     foreach ($avatar_list as $cat => $null) {
         if (!empty($avatar_list[$cat])) {
             $template->assign_block_vars('avatar_local_cats', array('NAME' => $cat, 'SELECTED' => $cat == $category));
         }
         if ($cat != $category) {
             unset($avatar_list[$cat]);
         }
     }
     if (!empty($avatar_list[$category])) {
         $template->assign_vars(array('AVATAR_LOCAL_SHOW' => true));
         $table_cols = isset($row['avatar_gallery_cols']) ? $row['avatar_gallery_cols'] : 4;
         $row_count = $col_count = $avatar_pos = 0;
         $avatar_count = sizeof($avatar_list[$category]);
         reset($avatar_list[$category]);
         while ($avatar_pos < $avatar_count) {
             $img = current($avatar_list[$category]);
             next($avatar_list[$category]);
             if ($col_count == 0) {
                 ++$row_count;
                 $template->assign_block_vars('avatar_local_row', array());
             }
             $template->assign_block_vars('avatar_local_row.avatar_local_col', array('AVATAR_IMAGE' => $this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $img['file'], 'AVATAR_NAME' => $img['name'], 'AVATAR_FILE' => $img['filename'], 'CHECKED' => $img['file'] === $row['avatar']));
             $template->assign_block_vars('avatar_local_row.avatar_local_option', array('AVATAR_FILE' => $img['filename'], 'S_OPTIONS_AVATAR' => $img['filename'], 'CHECKED' => $img['file'] === $row['avatar']));
             $col_count = ($col_count + 1) % $table_cols;
             ++$avatar_pos;
         }
     }
     return true;
 }
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:36,代码来源:local.php


示例3: validatePartial

 /**
  * Validates a partial array. Some data may be missing from the given $array, then it will be taken from the
  * full array.
  *
  * Since the array can be incomplete, this method does not validate required parameters.
  *
  * @param array $array
  * @param array $fullArray
  *
  * @return bool
  */
 public function validatePartial(array $array, array $fullArray)
 {
     $unvalidatedFields = array_flip(array_keys($array));
     // field validators
     foreach ($this->validators as $field => $validator) {
         unset($unvalidatedFields[$field]);
         // if the value is present
         if (isset($array[$field])) {
             // validate it if a validator is given, skip it otherwise
             if ($validator && !$validator->validate($array[$field])) {
                 $this->setError($validator->getError());
                 return false;
             }
         }
     }
     // check if any unsupported fields remain
     if ($unvalidatedFields) {
         reset($unvalidatedFields);
         $field = key($unvalidatedFields);
         $this->error($this->messageUnsupported, $field);
         return false;
     }
     // post validators
     foreach ($this->postValidators as $validator) {
         if (!$validator->validatePartial($array, $fullArray)) {
             $this->setError($validator->getError());
             return false;
         }
     }
     return true;
 }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:42,代码来源:CPartialSchemaValidator.php


示例4: foo

function foo(&$state)
{
    $contentDict = end($state);
    for ($contentDict = end($state); $contentDict !== false; $contentDict = prev($state)) {
        echo key($state) . " => " . current($state) . "\n";
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:bug35022.php


示例5: projectImport

 public function projectImport($api, $args)
 {
     $this->checkACL($api, $args);
     $this->requireArgs($args, array('module'));
     $bean = BeanFactory::getBean($args['module']);
     if (!$bean->ACLAccess('save') || !$bean->ACLAccess('import')) {
         throw new SugarApiExceptionNotAuthorized('EXCEPTION_NOT_AUTHORIZED');
     }
     if (isset($_FILES) && count($_FILES) === 1) {
         reset($_FILES);
         $first_key = key($_FILES);
         if (isset($_FILES[$first_key]['tmp_name']) && $this->isUploadedFile($_FILES[$first_key]['tmp_name']) && isset($_FILES[$first_key]['size']) && isset($_FILES[$first_key]['size']) > 0) {
             try {
                 $importerObject = new PMSEProjectImporter();
                 $name = $_FILES[$first_key]['name'];
                 $extension = pathinfo($name, PATHINFO_EXTENSION);
                 if ($extension == $importerObject->getExtension()) {
                     $data = $importerObject->importProject($_FILES[$first_key]['tmp_name']);
                     $results = array('project_import' => $data);
                 } else {
                     throw new SugarApiExceptionRequestMethodFailure('ERROR_UPLOAD_FAILED');
                 }
             } catch (SugarApiExceptionNotAuthorized $e) {
                 throw new SugarApiExceptionNotAuthorized('ERROR_UPLOAD_ACCESS_PD');
             } catch (Exception $e) {
                 throw new SugarApiExceptionRequestMethodFailure('ERROR_UPLOAD_FAILED');
             }
             return $results;
         }
     } else {
         throw new SugarApiExceptionMissingParameter('ERROR_UPLOAD_FAILED');
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:33,代码来源:PMSEProjectImportExportApi.php


示例6: getFilteredWords

function getFilteredWords()
{
    global $Weblogs;
    if (file_exists('db/search/filtered_words.txt')) {
        $filtered_file = file('db/search/filtered_words.txt');
        foreach ($filtered_file as $val) {
            if (substr($val, 0, 2) !== "//") {
                $filtered_words[] = trim($val);
            }
        }
    } else {
        $filtered_words = array();
    }
    @reset($Weblogs);
    @($Current_weblog = key($Weblogs));
    $theLang = $Weblogs[$Current_weblog]['language'];
    if ('' != $theLang && file_exists('db/search/filtered_words_' . $theLang . '.txt')) {
        // echo '*' ;
        $filtered_file = file('db/search/filtered_words_' . $theLang . '.txt');
        foreach ($filtered_file as $val) {
            $filtered_words[] = trim($val);
        }
    }
    return $filtered_words;
}
开发者ID:wborbajr,项目名称:TecnodataApp,代码行数:25,代码来源:module_lang.php


示例7: setUserEntityTheme

 public function setUserEntityTheme($file, $dataarr)
 {
     $getpersonalcount = DB::table('tbl_bankaccounts')->leftjoin('tbl_bankbranches', 'bankaccount_branch', '=', 'branch_id')->leftjoin('tbl_banks', 'branch_bankid', '=', 'bank_id')->where('bank_isproduct', '0')->where('bankaccount_userentity', 'Personal')->where('bankaccount_createdby', Auth::user()->id)->count();
     $getbusinesscount = DB::table('tbl_bankaccounts')->leftjoin('tbl_bankbranches', 'bankaccount_branch', '=', 'branch_id')->leftjoin('tbl_banks', 'branch_bankid', '=', 'bank_id')->where('bank_isproduct', '0')->where('bankaccount_userentity', 'Business')->where('bankaccount_createdby', Auth::user()->id)->count();
     $resultbViewAcctype = DB::table('tbl_bankaccounttypes')->get();
     $resultbViewAcctypearr = array();
     foreach ($resultbViewAcctype as $data) {
         $resultbViewAcctypearr[$data->accounttype_id] = $data->accounttype_name;
     }
     $resultbViewBanks = DB::table('tbl_banks')->where('bank_isproduct', 0)->where('bank_status', '1')->orderBy('bank_name', 'ASC')->get();
     $resultbViewBanksarr = array();
     foreach ($resultbViewBanks as $data) {
         $resultbViewBanksarr[$data->bank_id] = $data->bank_name;
     }
     $resultbViewBankbranchs = DB::table('tbl_bankbranches')->where("branch_bankid", key($resultbViewBanksarr))->where("branch_status", "1")->get();
     $resultbViewBankBrancharr = array();
     foreach ($resultbViewBankbranchs as $data) {
         $resultbViewBankBrancharr[$data->branch_id] = $data->branch_name;
     }
     if ($getpersonalcount <= 0 and $getbusinesscount <= 0) {
         $data = array('bankaccttype' => $resultbViewAcctypearr, 'bankname' => $resultbViewBanksarr, 'bankbranch' => $resultbViewBankBrancharr);
         $MyTheme = Theme::uses('fonebayad')->layout('ezibills_9_0');
         return $MyTheme->of('registration.firstloginaddbankacct', $data)->render();
     } else {
         //            $MyTheme = Theme::uses('fonebayad')->layout('ezibills_9_0');
         $MyTheme = Theme::uses('fonebayad')->layout('newDefault_myBills');
         return $MyTheme->of($file, $dataarr)->render();
     }
 }
开发者ID:bokbok123,项目名称:ORS,代码行数:29,代码来源:GlobalController.php


示例8: render

 /**
  * Executes parent method parent::render(), creates deliveryset category tree,
  * passes data to Smarty engine and returns name of template file "deliveryset_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     $myConfig = $this->getConfig();
     parent::render();
     $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
     if ($soxId != "-1" && isset($soxId)) {
         // load object
         $odeliveryset = oxNew("oxdeliveryset");
         $odeliveryset->loadInLang($this->_iEditLang, $soxId);
         $oOtherLang = $odeliveryset->getAvailableInLangs();
         if (!isset($oOtherLang[$this->_iEditLang])) {
             // echo "language entry doesn't exist! using: ".key($oOtherLang);
             $odeliveryset->loadInLang(key($oOtherLang), $soxId);
         }
         $this->_aViewData["edit"] = $odeliveryset;
         // remove already created languages
         $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang);
         if (count($aLang)) {
             $this->_aViewData["posslang"] = $aLang;
         }
         foreach ($oOtherLang as $id => $language) {
             $oLang = new oxStdClass();
             $oLang->sLangDesc = $language;
             $oLang->selected = $id == $this->_iEditLang;
             $this->_aViewData["otherlang"][$id] = clone $oLang;
         }
     }
     if (oxConfig::getParameter("aoc")) {
         $aColumns = array();
         include_once 'inc/' . strtolower(__CLASS__) . '.inc.php';
         $this->_aViewData['oxajax'] = $aColumns;
         return "popups/deliveryset_main.tpl";
     }
     return "deliveryset_main.tpl";
 }
开发者ID:JulianaSchuster,项目名称:oxid-frontend,代码行数:41,代码来源:deliveryset_main.php


示例9: getTypeName

function getTypeName($val, $argument = null)
{
    $type = gettype($val);
    global $detectDateMode;
    switch ($type) {
        case "string":
            if ($detectDateMode == 1 && isDate($val)) {
                return "Date";
            } else {
                if ($detectDateMode == 2 && (bool) strtotime($val)) {
                    return "Date";
                } else {
                    return "String";
                }
            }
        case "integer":
            return "int";
        case "double":
            return "float";
        case "boolean":
            return "boolean";
        case "array":
            if (is_numeric(key($val))) {
                return "RealmList<" . $argument . ">";
            } else {
                return $argument;
            }
    }
    return null;
}
开发者ID:tomasz-m,项目名称:realmGenerator,代码行数:30,代码来源:processor.php


示例10: edit

 /**
  * Edit a blog.
  *
  * @param string $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $blog = Blog::find($id);
     $file_size = key(config('image.image_sizes'));
     $files = $this->getFiles('images/blogs/' . $blog->id . '/' . $file_size);
     return view('admin/blog/edit', ['blog' => $blog, 'files' => $files, 'file_size' => $file_size]);
 }
开发者ID:kudosagency,项目名称:kudos-php,代码行数:14,代码来源:BlogController.php


示例11: printShort

 /**
  * Print a concise, human readable representation of a value.
  *
  * @param wild Any value.
  * @return string Human-readable short representation of the value.
  * @task print
  */
 public static function printShort($value)
 {
     if (is_object($value)) {
         return 'Object ' . get_class($value);
     } else {
         if (is_array($value)) {
             $str = 'Array ';
             if ($value) {
                 if (count($value) > 1) {
                     $str .= 'of size ' . count($value) . ' starting with: ';
                 }
                 reset($value);
                 // Prevent key() from giving warning message in HPHP.
                 $str .= '{ ' . self::printShort(key($value)) . ' => ' . self::printShort(head($value)) . ' }';
             }
             return $str;
         } else {
             // NOTE: Avoid PhutilUTF8StringTruncator here since the data may not be
             // UTF8 anyway, it's slow for large inputs, and it might not be loaded
             // yet.
             $limit = 1024;
             $str = self::printableValue($value);
             if (strlen($str) > $limit) {
                 if (is_string($value)) {
                     $str = "'" . substr($str, 1, $limit) . "...'";
                 } else {
                     $str = substr($str, 0, $limit) . '...';
                 }
             }
             return $str;
         }
     }
 }
开发者ID:barcelonascience,项目名称:libphutil,代码行数:40,代码来源:PhutilReadableSerializer.php


示例12: finalize

 function finalize()
 {
     // get parent's output
     parent::finalize();
     $output = parent::getOutput();
     $tex_output = '';
     foreach ($output as $token) {
         if ($this->_enumerated) {
             $class = $token[0];
             $content = $token[1];
         } else {
             $key = key($token);
             $class = $key;
             $content = $token[$key];
         }
         $iswhitespace = ctype_space($content);
         if (!$iswhitespace) {
             if ($class === 'special') {
                 $class = 'code';
             }
             $tex_output .= sprintf('\\textcolor{%s}{%s}', $class, $this->escape($content));
         } else {
             $tex_output .= $content;
         }
     }
     $this->_output = "\\begin{alltt}\n" . $tex_output . "\\end{alltt}";
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:27,代码来源:MarkdownHtml2Tex.php


示例13: convert

 /**
  * @param mixed $item
  * @return mixed
  * @throws \Exception
  */
 public function convert($item)
 {
     foreach ($this->processors as $field => $actions) {
         // If field doesn't exist:
         // - Create new column with null value
         // - Add new route to this column
         if (!array_key_exists($field, $item)) {
             $item[$field] = null;
             $this->route[$field] = $field;
         }
         // An array of actions has been given
         if (is_array($actions) && count($actions) > 0) {
             foreach ($actions as $action) {
                 // Get action name and options
                 $name = is_array($action) ? key($action) : $action;
                 $options = is_array($action) ? current($action) : null;
                 // Set processor name in CamelCase
                 $name = implode('', array_map('ucwords', explode('_', $name)));
                 // Get processor class from action name
                 $class = 'Stratis\\Component\\Migrator\\Processor\\' . $name . 'Processor';
                 // Check if class exists
                 if (!class_exists($class)) {
                     throw new \Exception($class . ' does not exists');
                 }
                 // Use processor exec function
                 $item[$field] = $class::exec($item[$field], $options, $item);
             }
         }
     }
     return $item;
 }
开发者ID:AgenceStratis,项目名称:migrator,代码行数:36,代码来源:Processor.php


示例14: saveArrayToXml

 /**
  * Generates Xml of Array
  * @param string $rootName [optional] default 'root'
  * @return String xml string if available otherwise false
  */
 public function saveArrayToXml($rootName = "")
 {
     $this->document = new Uni_Data_XDOMDocument();
     $arr = array();
     if (count($this->_xmlArray) > 1) {
         if ($rootName != "") {
             $root = $this->document->createElement($rootName);
         } else {
             $root = $this->document->createElement("root");
         }
         $arr = $this->_xmlArray;
     } else {
         $key = key($this->_xmlArray);
         if (!is_int($key)) {
             $root = $this->document->createElement($key);
         } else {
             if ($rootName != "") {
                 $root = $this->document->createElement($rootName);
             } else {
                 $root = $this->document->createElement("root");
             }
         }
         $arr = $this->_xmlArray[$key];
     }
     $root = $this->document->appendchild($root);
     $this->addArray($arr, $root);
     if ($xmlString = $this->document->saveXML()) {
         return $xmlString;
     } else {
         return false;
     }
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:37,代码来源:ConvertArrayToXml.php


示例15: processView

 function processView()
 {
     $params = array();
     if (!empty($_REQUEST['name'])) {
         $GLOBALS['system']->includeDBClass('person');
         $this->_person_data = Person::getPersonsByName($_REQUEST['name']);
     } else {
         foreach ($this->_search_terms as $term) {
             if (!empty($_REQUEST[$term])) {
                 $params[$term] = $_REQUEST[$term];
             }
         }
         if (!empty($params)) {
             $this->_person_data = $GLOBALS['system']->getDBObjectData('person', $params, 'AND', 'last_name');
         }
     }
     if (count($this->_person_data) == 1) {
         add_message('One matching person found');
         redirect('persons', array('name' => NULL, 'personid' => key($this->_person_data)));
     }
     $archiveds = array();
     foreach ($this->_person_data as $k => $v) {
         if ($v['status'] == 'archived') {
             $archiveds[$k] = $v;
             unset($this->_person_data[$k]);
         }
     }
     foreach ($archiveds as $k => $v) {
         $this->_person_data[$k] = $v;
     }
 }
开发者ID:vanoudt,项目名称:jethro-pmm,代码行数:31,代码来源:view_3_persons__2_search.class.php


示例16: addItem

 /**
  * Add an item of type BaseField to the field collection
  *
  * @param BaseField $objItem
  */
 public function addItem(BaseField $objItem)
 {
     $this->items[] = $objItem;
     end($this->items);
     $key = key($this->items);
     $this->index[$key] = $objItem->get('colName');
 }
开发者ID:hh-com,项目名称:contao-mm-frontendInput,代码行数:12,代码来源:FieldCollection.php


示例17: dol_json_encode

/**
 * Implement json_encode for PHP that does not support it
 *
 * @param	mixed	$elements		PHP Object to json encode
 * @return 	string					Json encoded string
 * @deprecated PHP >= 5.3 supports native json_encode
 * @see json_encode()
 */
function dol_json_encode($elements)
{
    dol_syslog('dol_json_encode() is deprecated. Please update your code to use native json_encode().', LOG_WARNING);
    $num = count($elements);
    if (is_object($elements)) {
        $num = 0;
        foreach ($elements as $key => $value) {
            $num++;
        }
    }
    //var_dump($num);
    // determine type
    if (is_numeric(key($elements)) && key($elements) == 0) {
        // indexed (list)
        $keysofelements = array_keys($elements);
        // Elements array mus have key that does not start with 0 and end with num-1, so we will use this later.
        $output = '[';
        for ($i = 0, $last = $num - 1; $i < $num; $i++) {
            if (!isset($elements[$keysofelements[$i]])) {
                continue;
            }
            if (is_array($elements[$keysofelements[$i]]) || is_object($elements[$keysofelements[$i]])) {
                $output .= json_encode($elements[$keysofelements[$i]]);
            } else {
                $output .= _val($elements[$keysofelements[$i]]);
            }
            if ($i !== $last) {
                $output .= ',';
            }
        }
        $output .= ']';
    } else {
        // associative (object)
        $output = '{';
        $last = $num - 1;
        $i = 0;
        $tmpelements = array();
        if (is_array($elements)) {
            $tmpelements = $elements;
        }
        if (is_object($elements)) {
            $tmpelements = get_object_vars($elements);
        }
        foreach ($tmpelements as $key => $value) {
            $output .= '"' . $key . '":';
            if (is_array($value)) {
                $output .= json_encode($value);
            } else {
                $output .= _val($value);
            }
            if ($i !== $last) {
                $output .= ',';
            }
            ++$i;
        }
        $output .= '}';
    }
    // return
    return $output;
}
开发者ID:Samara94,项目名称:dolibarr,代码行数:68,代码来源:json.lib.php


示例18: buildRows

 public static function buildRows($filename)
 {
     $data = self::getCsv($filename);
     $header = array();
     $sid1 = array();
     $sid_sec = array();
     foreach ($data as $id => $d) {
         $header[$d[self::COL_DESC]] = $d[self::COL_DESC];
         $sid1[$d[self::COL_SID]] = $d[self::COL_SID];
         $sid_sec[$d[self::COL_SID]][][$d[self::COL_DESC]] = $d[self::COL_SEC];
     }
     $c = count($header);
     $sid_sec_2 = array();
     foreach ($sid_sec as $sid => $sec) {
         for ($i = 0; $i < count($sec); $i += $c) {
             for ($j = 0; $j < $c; $j++) {
                 $key = key($sec[$i + $j]);
                 $value = reset($sec[$i + $j]);
                 $sid_sec_2[$sid][$i][$key] = $value;
             }
         }
     }
     $i = 0;
     $rows = array();
     foreach ($sid_sec_2 as $sid => $tab) {
         foreach ($tab as $id => $m) {
             $i++;
             $rows[$i] = array('SID' => $sid);
             foreach ($header as $h) {
                 $rows[$i][$h] = $m[$h];
             }
         }
     }
     return $rows;
 }
开发者ID:WeMoveEU,项目名称:speakcivi,代码行数:35,代码来源:Stat.php


示例19: execute

 /**
  * Action for AJAX request
  *
  * @return void
  */
 public function execute()
 {
     $bookmark = $this->bookmarkFactory->create();
     $jsonData = $this->_request->getParam('data');
     if (!$jsonData) {
         throw new \InvalidArgumentException('Invalid parameter "data"');
     }
     $data = $this->jsonDecoder->decode($jsonData);
     $action = key($data);
     switch ($action) {
         case self::ACTIVE_IDENTIFIER:
             $this->updateCurrentBookmark($data[$action]);
             break;
         case self::CURRENT_IDENTIFIER:
             $this->updateBookmark($bookmark, $action, $bookmark->getTitle(), $jsonData);
             break;
         case self::VIEWS_IDENTIFIER:
             foreach ($data[$action] as $identifier => $data) {
                 $this->updateBookmark($bookmark, $identifier, isset($data['label']) ? $data['label'] : '', $jsonData);
                 $this->updateCurrentBookmark($identifier);
             }
             break;
         default:
             throw new \LogicException(__('Unsupported bookmark action.'));
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:31,代码来源:Save.php


示例20: __construct

 public function __construct($lang = "")
 {
     if (\file_exists(\pocketmine\PATH . "src/pocketmine/lang/Installer/" . $lang . ".ini")) {
         $this->lang = $lang;
         $this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/" . $lang . ".ini";
     } else {
         $files = [];
         foreach (new \DirectoryIterator(\pocketmine\PATH . "src/pocketmine/lang/Installer/") as $file) {
             if ($file->getExtension() === "ini" and \substr($file->getFilename(), 0, 2) === $lang) {
                 $files[$file->getFilename()] = $file->getSize();
             }
         }
         if (\count($files) > 0) {
             \arsort($files);
             \reset($files);
             $l = \key($files);
             $l = \substr($l, 0, -4);
             $this->lang = isset(self::$languages[$l]) ? $l : $lang;
             $this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/" . $l . ".ini";
         } else {
             $this->lang = "en";
             $this->langfile = \pocketmine\PATH . "src/pocketmine/lang/Installer/en.ini";
         }
     }
     $this->loadLang(\pocketmine\PATH . "src/pocketmine/lang/Installer/en.ini", "en");
     if ($this->lang !== "en") {
         $this->loadLang($this->langfile, $this->lang);
     }
 }
开发者ID:xpyctum,项目名称:PocketMinePlusPlus,代码行数:29,代码来源:InstallerLang.php



注:本文中的key函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP key_check函数代码示例发布时间:2022-05-15
下一篇:
PHP ketnoi_MC函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap