当前位置: 首页>>代码示例>>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;未经允许,请勿转载。