当前位置: 首页>>代码示例>>PHP>>正文


PHP Utilities\Arrays类代码示例

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


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

示例1: _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

示例2: isShittyRound

 /**
  * @return bool
  */
 public function isShittyRound()
 {
     $hitsInRound = Hit::where(['game_user_id' => $this->game->current_game_user_id, 'round' => $this->game->round])->fetchAll();
     return Arrays::all($hitsInRound, function ($hit) {
         return !$this->isScored($hit->field, $hit->multiplier);
     });
 }
开发者ID:thuliumcc,项目名称:dartboard,代码行数:10,代码来源:Cricket.php

示例3: 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

示例4: 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

示例5: 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

示例6: of

 public static function of(array $conditions)
 {
     if (Arrays::isAssociative($conditions)) {
         return new ArrayWhereClause($conditions, 'OR');
     }
     return new OrClause($conditions);
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:7,代码来源:Any.php

示例7: matches

 public function matches($argument)
 {
     if (get_class($this->expected) !== get_class($argument)) {
         return false;
     }
     $actualAttributes = Arrays::filterByAllowedKeys($argument->attributes(), $this->expected->getFields());
     return $this->expectedAttributes == $actualAttributes;
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:8,代码来源:ModelAttributesMatcher.php

示例8: 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

示例9: _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

示例10: whereWithUsing

 private function whereWithUsing()
 {
     $usingClauses = $this->_query->usingClauses;
     $whereClauses = Arrays::map($usingClauses, function (JoinClause $usingClause) {
         return WhereClause::create($usingClause->getJoinColumnWithTable() . ' = ' . $usingClause->getJoinedColumnWithTable());
     });
     return $this->_where(array_merge($whereClauses, $this->_query->whereClauses));
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:8,代码来源:Dialect.php

示例11: compareBy

 /**
  * Returns comparator which compares objects by using values computed using given expressions.
  * Expressions should comply with format accepted by <code>Functions::extractExpression</code>.
  * Comparator returns an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
  *
  * @param mixed ...
  * @return callable
  */
 public static function compareBy()
 {
     $expressions = func_get_args();
     $comparators = Arrays::map($expressions, function ($expression) {
         return new EvaluatingComparator(Functions::extractExpression($expression));
     });
     return sizeof($comparators) == 1 ? $comparators[0] : new CompoundComparator($comparators);
 }
开发者ID:phogl,项目名称:autoloader,代码行数:16,代码来源:Comparator.php

示例12: contents

 public function contents()
 {
     $this->_setupTablePlaceholderReplacements();
     $this->classStub->addPlaceholderReplacement('class', $this->className);
     $this->classStub->addPlaceholderReplacement('namespace', $this->classNamespace);
     Arrays::map($this->tableInfo->tableColumns, array($this->classStub, 'addColumn'));
     return $this->classStub->contents();
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:8,代码来源:ClassStubPlaceholderReplacer.php

示例13: __construct

 public function __construct($httpCode, $errors, $headers = array())
 {
     $this->_httpCode = $httpCode;
     $this->_errors = Arrays::toArray($errors);
     $this->_headers = $headers;
     $firstError = Arrays::first($this->_errors);
     parent::__construct($firstError->getMessage(), $firstError->getCode());
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:8,代码来源:OuzoException.php

示例14: 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

示例15: extractParams

 private static function extractParams($elements)
 {
     $params = array();
     foreach ($elements as $element) {
         list($name, $value) = Arrays::map(explode('=', $element), Functions::trim());
         $params[$name] = $value;
     }
     return $params;
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:9,代码来源:AcceptHeaderParser.php


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