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


PHP Arrays::map方法代码示例

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


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

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

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

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

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

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

示例6: parse

 public function parse()
 {
     if (preg_match('/^findBy([a-zA-Z]\\w*)$/', $this->method, $names)) {
         $names = explode('And', $names[1]);
         $this->names = Arrays::map($names, function ($name) {
             return Strings::camelCaseToUnderscore($name);
         });
     }
 }
开发者ID:neogenro,项目名称:sugarcrm-rest-client,代码行数:9,代码来源:DynamicFinder.php

示例7: getFieldsAsString

 public function getFieldsAsString()
 {
     $fields = array_keys($this->_attributes);
     $escapedFields = Arrays::map($fields, Functions::compose(Functions::append("'"), Functions::prepend("'")));
     for ($index = self::FIELDS_COUNT_IN_LINE; $index < sizeof($escapedFields); $index += self::FIELDS_COUNT_IN_LINE) {
         $escapedFields[$index] = "\n\t\t\t" . $escapedFields[$index];
     }
     return implode(', ', $escapedFields);
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:9,代码来源:ClassStub.php

示例8: createCheckParameters

 private function createCheckParameters($parameters)
 {
     if ($parameters) {
         $indent = self::INDENT;
         $checkFunctionParameters = Arrays::map($parameters, function ($element) use($indent) {
             return $indent . "checkParameter({$element});";
         });
         return implode("\n", $checkFunctionParameters) . "\n" . $indent;
     }
     return self::INDENT;
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:11,代码来源:JsUriHelperGenerator.php

示例9: _fetchRelations

 private function _fetchRelations($results, $joinsToStore)
 {
     $joinedRelations = Arrays::map($joinsToStore, Functions::extract()->destinationField());
     foreach ($this->relationsToFetch as $relationToFetch) {
         if (!in_array($relationToFetch->destinationField, $joinedRelations)) {
             $relationFetcher = new RelationFetcher($relationToFetch->relation);
             $fieldTransformer = new FieldTransformer($relationToFetch->field, $relationFetcher);
             $fieldTransformer->transform($results);
         }
     }
     return $results;
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:12,代码来源:ModelResultSetConverter.php

示例10: _parseArgs

 private function _parseArgs($args, $parameters)
 {
     $args = Arrays::getValue($args, 0, new stdClass());
     $newArgs = array();
     $parameterNames = Arrays::map($parameters, Functions::extract()->getName());
     foreach ($parameterNames as $name) {
         if (isset($args->{$name})) {
             $newArgs[] = $args->{$name};
         }
     }
     return $newArgs;
 }
开发者ID:georgo,项目名称:wsdl-creator,代码行数:12,代码来源:DocumentLiteralWrapper.php

示例11: getParameterDeclaration

 private static function getParameterDeclaration(ReflectionFunctionAbstract $method)
 {
     return Joiner::on(', ')->join(Arrays::map($method->getParameters(), function (ReflectionParameter $param) {
         $result = '';
         if ($param->getClass()) {
             $result .= $param->getClass()->getName() . ' ';
         }
         if ($param->isArray()) {
             $result .= 'array ';
         }
         if ($param->isPassedByReference()) {
             $result .= '&';
         }
         $result .= '$' . $param->name;
         if ($param->isDefaultValueAvailable()) {
             $result .= " = null";
             // methodHandler gets only the passed arguments so anything would work here
         }
         return $result;
     }));
 }
开发者ID:nomantufail,项目名称:virik_updating,代码行数:21,代码来源:DynamicProxy.php

示例12: poll

 public function poll()
 {
     Stats::reset();
     session_write_close();
     $stop = Clock::now()->plusSeconds(self::TIMEOUT);
     while (true) {
         if (!$stop->isAfter(Clock::now()) || connection_aborted()) {
             $this->layout->renderAjax("[]");
             return;
         }
         session_start();
         $events = Event::loadNew();
         session_write_close();
         if ($events) {
             $this->layout->renderAjax(Json::encode(Arrays::map($events, function (Event $event) {
                 return $event->toJsonArray();
             })));
             return;
         }
         Stats::reset();
         usleep(100 * 1000);
     }
 }
开发者ID:thuliumcc,项目名称:dartboard,代码行数:23,代码来源:EventsController.php

示例13: shouldExtractRecursivelyArrayColumn

 /**
  * @test
  */
 public function shouldExtractRecursivelyArrayColumn()
 {
     //given
     $array = array(array('id' => 123, 'name' => 'value1', 'test' => array('number' => 90)), array('id' => 123, 'name' => 'value1', 'test' => array('number' => 100)));
     //when
     $numbers = Arrays::map($array, Functions::extract()->test->number);
     //then
     Assert::thatArray($numbers)->hasSize(2)->containsOnly(90, 100);
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:12,代码来源:ArraysTest.php

示例14: arrayToString

 public static function arrayToString($calls)
 {
     return Joiner::on(', ')->join(Arrays::map($calls, Functions::toString()));
 }
开发者ID:phogl,项目名称:autoloader,代码行数:4,代码来源:MethodCall.php

示例15: _printExceptIfExists

 private function _printExceptIfExists(RouteRule $rule, $table)
 {
     $except = $rule->getExcept();
     if ($except) {
         $table->addRow(array('', '', '  <info>except:</info>', ''));
         Arrays::map($except, function ($except) use($table) {
             $table->addRow(array('', '', '    ' . $except, ''));
             return $except;
         });
     }
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:11,代码来源:RoutesCommand.php


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