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


PHP Arrays::get方法代碼示例

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


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

示例1: loadHttpData

 /**
  * Loads HTTP data.
  * @return void
  */
 public function loadHttpData()
 {
     $path = $this->getHtmlName();
     // img_x or img['x']
     $path = explode('[', strtr(str_replace(']', '', strpos($path, '[') === FALSE ? $path . '.x' : substr($path, 0, -2)), '.', '_'));
     $this->setValue(Arrays::get($this->getForm()->getHttpData(), $path, NULL));
 }
開發者ID:riskatlas,項目名稱:micka,代碼行數:11,代碼來源:ImageButton.php

示例2: collectAssocs

 public static function collectAssocs($arrays, $indexes, $defaults = null)
 {
     $output = array();
     foreach ($arrays as $array) {
         foreach ($indexes as $index) {
             $output[] = Arrays::get($array, $index, $defaults[$index]);
         }
     }
     return $output;
 }
開發者ID:Nozemi,項目名稱:MyFramework,代碼行數:10,代碼來源:Arrays.class.php

示例3: Exception

 public static function &get($var, $name, $default = null)
 {
     if (is_array($var)) {
         return Arrays::get($var, $name, $default);
     }
     if (is_object($var)) {
         return Objects::get($var, $name, $default);
     }
     throw new Exception("\$var must be either an array or object");
 }
開發者ID:Nozemi,項目名稱:MyFramework,代碼行數:10,代碼來源:Generic.class.php

示例4: logError

 public static function logError($error_msg, $data)
 {
     $output = '<tr class="error"><td valign="top>' . time() . '</td><td valign="top">' . $error_msg . '</td><td valign="top" colspan="2">' . Debug::dump($data, 'Attached Data') . '</td></tr>';
     $output .= '<tr class="trace"><td colspan="3">';
     $trace = debug_backtrace();
     $lines = array();
     foreach ($trace as $index => $line) {
         $lines[] = '#' . (count($trace) - 1 - $index) . ' ' . $line['function'] . '(' . Debug::serializeArgs($line['args']) . ');';
     }
     $output .= join('<br>', $lines) . '</td><td>';
     $lines = array();
     foreach ($trace as $index => $line) {
         $lines[] = 'in ' . Arrays::get($line, 'file', '[Unknown]') . ':' . Arrays::get($line, 'line', '[Unknown]');
     }
     $output .= join('<br>', $lines) . '</td></tr>';
     file_put_contents(dirname(__FILE__) . '/../../internal_errors.inc', $output, FILE_APPEND);
 }
開發者ID:Nozemi,項目名稱:MyFramework,代碼行數:17,代碼來源:Debug.class.php

示例5: expand

 /**
  * Expands %placeholders%.
  * @param  mixed
  * @param  array
  * @param  bool
  * @return mixed
  * @throws InvalidArgumentException
  */
 public static function expand($var, array $params, $recursive = FALSE)
 {
     if (is_array($var)) {
         $res = array();
         foreach ($var as $key => $val) {
             $res[$key] = self::expand($val, $params, $recursive);
         }
         return $res;
     } elseif ($var instanceof DIStatement) {
         return new DIStatement(self::expand($var->entity, $params, $recursive), self::expand($var->arguments, $params, $recursive));
     } elseif (!is_string($var)) {
         return $var;
     }
     $parts = preg_split('#%([\\w.-]*)%#i', $var, -1, PREG_SPLIT_DELIM_CAPTURE);
     $res = '';
     foreach ($parts as $n => $part) {
         if ($n % 2 === 0) {
             $res .= $part;
         } elseif ($part === '') {
             $res .= '%';
         } elseif (isset($recursive[$part])) {
             throw new InvalidArgumentException('Circular reference detected for variables: ' . implode(', ', array_keys($recursive)) . '.');
         } else {
             $val = Arrays::get($params, explode('.', $part));
             if ($recursive) {
                 $val = self::expand($val, $params, (is_array($recursive) ? $recursive : array()) + array($part => 1));
             }
             if (strlen($part) + 2 === strlen($var)) {
                 return $val;
             }
             if (!is_scalar($val)) {
                 throw new InvalidArgumentException("Unable to concatenate non-scalar parameter '{$part}' into '{$var}'.");
             }
             $res .= $val;
         }
     }
     return $res;
 }
開發者ID:riskatlas,項目名稱:micka,代碼行數:46,代碼來源:Helpers.php

示例6: loadHttpData

 /**
  * Loads HTTP data.
  * @return void
  */
 public function loadHttpData()
 {
     $path = explode('[', strtr(str_replace(array('[]', ']'), '', $this->getHtmlName()), '.', '_'));
     $this->setValue(Arrays::get($this->getForm()->getHttpData(), $path, NULL));
 }
開發者ID:riskatlas,項目名稱:micka,代碼行數:9,代碼來源:BaseControl.php

示例7: getDistro

 static function getDistro()
 {
     preg_match('/distro: ([[:alpha:]]+)/', self::get(), $matches);
     return Arrays::get($matches, 1, null);
 }
開發者ID:kremsy,項目名稱:manialib,代碼行數:5,代碼來源:UserAgent.php

示例8: translate

 /**
  * Translates a string
  *
  * @param string $translation
  * @param string $fallback
  *
  * @return string
  */
 public static function translate($translation, $fallback = null)
 {
     $key = substr($translation, strpos($translation, '.'));
     $key = trim($key, '.');
     $file = str_replace('.' . $key, null, $translation);
     $file = trim($file, '.');
     $file = (include __DIR__ . '/../../lang/' . Lang::getLocale() . '/' . $file . '.php');
     return \Arrays::get($file, $key);
 }
開發者ID:SerdarSanri,項目名稱:babel,代碼行數:17,代碼來源:Babel.php

示例9: listBetween

 private function listBetween($offerIn, $model, $is_calendar = true)
 {
     $now = time();
     $collection = lib('collection');
     $quantity = $offerIn->quantity;
     $options = $offerIn->options;
     $language = $offerIn->language;
     $distance_maxB = $offerIn->distance_max;
     $start = $offerIn->start;
     $tolerance = $offerIn->tolerance;
     $oresellerid = $offerIn->reseller_id;
     $segment_id = $offerIn->segment_id;
     $start = is_null($start) ? $now + 4 * 3600 : $start;
     $tolerance = is_null($tolerance) ? 0 : $tolerance;
     $distance_maxB = is_null($distance_maxB) ? 0 : (double) $distance_maxB;
     $delai = $start - $now;
     $livraison = false;
     if (isset($options['shipping_costs'])) {
         if (isset($options['shipping_costs']['default'])) {
             $livraison = 'oui' == $options['shipping_costs']['default'] ? true : false;
         }
     }
     if ($delai <= 0) {
         return [];
     }
     $delai /= 3600;
     $list = Arrays::get($model, 'formulaire_achat.elements.quantity.values', []);
     $unite = Arrays::get($model, 'formulaire_achat.elements.quantity.unite', 'heure');
     $optionsPrice = Arrays::get($model, 'formulaire_achat.elements.quantity.options.price', []);
     $optionsDiscount = Arrays::get($model, 'formulaire_achat.elements.quantity.options.discount', []);
     $optionsFixedCosts = Arrays::get($model, 'formulaire_achat.elements.quantity.options.fixed_costs', []);
     $optionsTravelCosts = Arrays::get($model, 'formulaire_achat.elements.quantity.options.travel_costs', []);
     $optionsShippingCosts = Arrays::get($model, 'formulaire_achat.elements.quantity.options.shipping_costs', []);
     $locOfferIn = getLocation($offerIn);
     $queryproducts = Model::Product()->where(['segment_id', '=', $segment_id])->where(['sellzone_id', '=', $offerIn->sellzone_id]);
     if (!is_null($oresellerid)) {
         $queryproducts->where(['reseller_id', '=', (int) $oresellerid]);
     }
     $products = $queryproducts->exec(true);
     foreach ($products as $product) {
         $price = $product->price;
         $fixed_costs = $product->fixed_costs;
         $shipping_costs = $product->shipping_costs;
         $travel_costs = $product->travel_costs;
         $discount = $product->discount;
         $delai_presta = lib('option')->get('delai.intervention', $product, false);
         $montant_min = (double) lib('option')->get('montant.intervention', $product, 0);
         $distance_max = (double) lib('option')->get('zone.intervention', $product, 0);
         if (false !== $delai_presta) {
             if ($delai < $delai_presta) {
                 continue;
             }
         }
         $fixed_costs_free_from_price = 0;
         if (is_null($fixed_costs) || !is_array($fixed_costs)) {
             $fixed_costs = 0;
         } else {
             if (isset($fixed_costs['default'])) {
                 if (isset($fixed_costs['default']['value'])) {
                     $fixed_costs = (double) $fixed_costs['default']['value'];
                 }
                 if (isset($fixed_costs['default']['free_from_price'])) {
                     $fixed_costs_free_from_price = (double) $fixed_costs['default']['free_from_price'];
                 }
             } else {
                 $fixed_costs = 0;
             }
         }
         $travel_costs_free_from_price = 0;
         if (is_null($travel_costs) || !is_array($travel_costs)) {
             $travel_costs = 0;
         } else {
             if (isset($travel_costs['default'])) {
                 if (isset($travel_costs['default']['value'])) {
                     $travel_costs = (double) $travel_costs['default']['value'];
                 }
                 if (isset($travel_costs['default']['free_from_price'])) {
                     $travel_costs_free_from_price = (double) $travel_costs['default']['free_from_price'];
                 }
             } else {
                 $travel_costs = 0;
             }
         }
         if (true === $livraison) {
             $shipping_costs_free_from_price = 0;
             if (is_null($shipping_costs) || !is_array($shipping_costs)) {
                 $shipping_costs = 0;
             } else {
                 if (isset($shipping_costs['default'])) {
                     if (isset($shipping_costs['default']['value'])) {
                         $shipping_costs = (double) $shipping_costs['default']['value'];
                     }
                     if (isset($shipping_costs['default']['free_from_price'])) {
                         $shipping_costs_free_from_price = (double) $shipping_costs['default']['free_from_price'];
                     }
                 } else {
                     $shipping_costs = 0;
                 }
             }
         }
//.........這裏部分代碼省略.........
開發者ID:schpill,項目名稱:standalone,代碼行數:101,代碼來源:modelzl.php

示例10: getFile

 /**
  * Returns uploaded file.
  * @param  string key (or more keys)
  * @return HttpUploadedFile
  */
 public final function getFile($key)
 {
     $args = func_get_args();
     return Arrays::get($this->files, $args, NULL);
 }
開發者ID:riskatlas,項目名稱:micka,代碼行數:10,代碼來源:Request.php

示例11: getClassDocBlockTagValue

 /**
  * Gets SK ITCBundle Command Code Generator PHPUnit Abstract Generator Generator Class Doc Block Values By Name
  *
  * @param array $tags
  * @param string $name
  * @return array
  */
 public function getClassDocBlockTagValue(array $tags, $name)
 {
     $v = array_filter($tags, function ($value) use($name) {
         return Arrays::get($value, 'name', NULL) == $name ? $value : FALSE;
     });
     $values = array();
     foreach ($v as $value) {
         $values[] = Arrays::get($value, 'value', NULL);
     }
     return $values;
 }
開發者ID:slavomirkuzma,項目名稱:itc-bundle,代碼行數:18,代碼來源:PHPUnitGenerator.php


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