當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Arrays::getValue方法代碼示例

本文整理匯總了PHP中Ouzo\Utilities\Arrays::getValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP Arrays::getValue方法的具體用法?PHP Arrays::getValue怎麽用?PHP Arrays::getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Ouzo\Utilities\Arrays的用法示例。


在下文中一共展示了Arrays::getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: newInstance

 public static function newInstance($options)
 {
     if (Arrays::getValue($options, Options::EMULATE_PREPARES)) {
         return new EmulatedPDOPreparedStatementExecutor();
     }
     return new PDOPreparedStatementExecutor();
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:7,代碼來源:PDOExecutor.php

示例2: get

 /**
  * Returns object from cache.
  * If there's no object for the given key and $functions is passed, $function result will be stored in cache under the given key.
  *
  * Example:
  * <code>
  * $countries = Cache::get("countries", function() {{
  *    //expensive computation that returns a list of countries
  *    return Country:all();
  * })
  * </code>
  *
  * @param $key
  * @param null $function
  * @return mixed|null
  */
 public static function get($key, $function = null)
 {
     if (!self::contains($key) && $function) {
         self::put($key, call_user_func($function));
     }
     return Arrays::getValue(self::$_cache, $key);
 }
開發者ID:phogl,項目名稱:autoloader,代碼行數:23,代碼來源:Cache.php

示例3: _parseUrlParams

 private function _parseUrlParams($url)
 {
     $urlComponents = parse_url($url);
     $query = Arrays::getValue($urlComponents, 'query', '');
     parse_str($query, $array);
     return $array;
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:7,代碼來源:ControllerTestCase.php

示例4: newRelation

 private static function newRelation($name, $localKey, $foreignKey, $collection, $params)
 {
     $class = $params['class'];
     $condition = Arrays::getValue($params, 'conditions', '');
     $order = Arrays::getValue($params, 'order', '');
     return new Relation($name, $class, $localKey, $foreignKey, $collection, $condition, $order);
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:7,代碼來源:RelationFactory.php

示例5: _prepareParameters

 private function _prepareParameters($uri)
 {
     preg_match_all('#:(\\w+)#', $uri, $matches);
     $parameters = Arrays::getValue($matches, 1, array());
     return Arrays::map($parameters, function ($parameter) {
         return '$' . $parameter;
     });
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:8,代碼來源:UriHelperGenerator.php

示例6: getRelation

 public function getRelation($name)
 {
     $value = Arrays::getValue($this->relations, $name);
     if (is_null($value)) {
         throw new Exception("Relation not found");
     }
     return $value;
 }
開發者ID:neogenro,項目名稱:sugarcrm-rest-client,代碼行數:8,代碼來源:Relations.php

示例7: _getPrimaryKey

 private function _getPrimaryKey($tableName)
 {
     $primaryKey = Db::getInstance()->query("SHOW KEYS FROM {$tableName} WHERE Key_name = 'PRIMARY'")->fetch();
     if ($primaryKey) {
         return Arrays::getValue($primaryKey, 'Column_name');
     } else {
         return '';
     }
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:9,代碼來源:MySqlDialect.php

示例8: getViewPostfix

 private static function getViewPostfix($responseType)
 {
     $availableViewsMap = array('text/xml' => '.xml.phtml', 'application/json' => '.json.phtml', 'text/json' => '.json.phtml');
     $viewForType = Arrays::getValue($availableViewsMap, $responseType, false);
     if ($viewForType) {
         return $viewForType;
     }
     return Uri::isAjax() ? '.ajax.phtml' : '.phtml';
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:9,代碼來源:ViewPathResolver.php

示例9: getPath

 public function getPath()
 {
     $uri = Arrays::getValue($_SERVER, 'REDIRECT_URL');
     if (!$uri) {
         return Arrays::getValue($_SERVER, 'REQUEST_URI', '/');
     }
     $queryString = Arrays::getValue($_SERVER, 'REDIRECT_QUERY_STRING');
     return $queryString ? $uri . '?' . $queryString : $uri;
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:9,代碼來源:PathProvider.php

示例10: _getPrimaryKey

 private function _getPrimaryKey($tableName)
 {
     $primaryKey = Db::getInstance()->query("SELECT pg_attribute.attname\n         FROM pg_index, pg_class, pg_attribute\n         WHERE\n            pg_class.oid = '{$tableName}'::REGCLASS AND\n            indrelid = pg_class.oid AND\n            pg_attribute.attrelid = pg_class.oid AND\n            pg_attribute.attnum = ANY(pg_index.indkey)\n            AND indisprimary;\n        ")->fetch();
     if ($primaryKey) {
         return Arrays::getValue($primaryKey, 'attname');
     } else {
         return '';
     }
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:9,代碼來源:PostgresDialect.php

示例11: resolve

 public static function resolve()
 {
     $accept = array_keys(RequestHeaders::accept()) ?: array('*/*');
     $supported = array('application/json' => 'application/json', 'application/xml' => 'application/xml', 'application/*' => 'application/json', 'text/html' => 'text/html', 'text/*' => 'text/html');
     $intersection = array_intersect($accept, array_keys($supported));
     if ($intersection) {
         return $supported[Arrays::first($intersection)];
     }
     return Arrays::getValue($supported, ContentType::value(), 'text/html');
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:10,代碼來源:ResponseTypeResolve.php

示例12: ip

 public static function ip()
 {
     $ip = Arrays::getValue($_SERVER, 'HTTP_CLIENT_IP');
     if (!$ip) {
         $ip = Arrays::getValue($_SERVER, 'HTTP_X_FORWARDED_FOR');
     }
     if (!$ip) {
         $ip = Arrays::getValue($_SERVER, 'REMOTE_ADDR');
     }
     return $ip;
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:11,代碼來源:RequestHeaders.php

示例13: _checkCredentials

 public static function _checkCredentials($authUser, $authPassword, $realm)
 {
     $login = Arrays::getValue($_SERVER, 'PHP_AUTH_USER');
     $pass = Arrays::getValue($_SERVER, 'PHP_AUTH_PW');
     if ($authUser != $login || $authPassword != $pass) {
         $code = defined('UNAUTHORIZED') ? UNAUTHORIZED : 0;
         $error = new Error($code, I18n::t('exception.unauthorized'));
         throw new UnauthorizedException($error, array('WWW-Authenticate: Basic realm="' . $realm . '"'));
     }
     return true;
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:11,代碼來源:AuthBasicExtension.php

示例14: log

 protected function log($writeToLogFunction, $level, $levelName, $message, $params)
 {
     $minimalLevel = $this->_minimalLevels ? Arrays::getValue($this->_minimalLevels, $this->_name, LOG_DEBUG) : LOG_DEBUG;
     if ($level <= $minimalLevel) {
         $message = $this->_messageFormatter->format($this->_name, $levelName, $message);
         if (!empty($params)) {
             $message = call_user_func_array('sprintf', array_merge(array($message), $params));
         }
         $writeToLogFunction($message);
     }
 }
開發者ID:letsdrink,項目名稱:ouzo,代碼行數:11,代碼來源:AbstractLogger.php

示例15: postButton

function postButton($label, $url, $options = [])
{
    $class = Arrays::getValue($options, 'class', '');
    $id = Arrays::getValue($options, 'id', '');
    $idHtml = $id ? " id=\"{$id}\" " : "";
    return <<<TAG
<form action="{$url}" {$idHtml} method="post" class="post-button {$class}">
    <button type="submit" class="btn btn-primary">{$label}</button>
</form>
TAG;
}
開發者ID:thuliumcc,項目名稱:dartboard,代碼行數:11,代碼來源:UrlHelper.php


注:本文中的Ouzo\Utilities\Arrays::getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。