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


PHP Arrays::filter方法代码示例

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


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

示例1: getClassMethods

 private static function getClassMethods($class)
 {
     $methods = $class->getMethods();
     return Arrays::filter($methods, function (ReflectionMethod $method) {
         return !$method->isConstructor() && !$method->isStatic();
     });
 }
开发者ID:nomantufail,项目名称:virik_updating,代码行数:7,代码来源:DynamicProxy.php

示例2: getMatchingStubbedCalls

 private function getMatchingStubbedCalls($methodCall)
 {
     $matching = Arrays::filter($this->_stubbed_calls, function ($stubbed_call) use($methodCall) {
         return $stubbed_call->matches($methodCall);
     });
     return $matching;
 }
开发者ID:phogl,项目名称:autoloader,代码行数:7,代码来源:SimpleMock.php

示例3: _getColumnsWithoutPrimary

 private function _getColumnsWithoutPrimary(Dialect $dialect)
 {
     $primaryKeyName = $this->primaryKeyName;
     $columns = $dialect->columns();
     if ($primaryKeyName != 'id') {
         return Arrays::filter($columns, function (DatabaseColumn $column) use($primaryKeyName) {
             return $column->name != $primaryKeyName;
         });
     }
     return $columns;
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:11,代码来源:TableInfo.php

示例4: shouldFilterValues

 /**
  * @test
  */
 public function shouldFilterValues()
 {
     //given
     $array = array(1, 2, 3, 4);
     //when
     $result = Arrays::filter($array, function ($value) {
         return $value > 2;
     });
     //then
     $this->assertEquals(array(2 => 3, 3 => 4), $result);
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:14,代码来源:ArraysTest.php

示例5: process

 public function process()
 {
     $post = $this->post;
     $filterLogin = Arrays::filter($this->getElements(), function ($element) use($post) {
         if ($element->user_name == $post->user_auth->user_name && $element->password == $post->user_auth->password) {
             return $element;
         }
         return null;
     });
     if (!$filterLogin) {
         $response = new stdClass();
         $response->name = 'Invalid Login';
         $response->number = '10';
         $response->description = 'Login attempt failed please check the username and password';
         $this->response = $response;
     } else {
         $user = Arrays::first($filterLogin);
         $response = new stdClass();
         $response->id = $user->id;
         $this->response = $response;
     }
     return $this;
 }
开发者ID:neogenro,项目名称:sugarcrm-rest-client,代码行数:23,代码来源:Login.php

示例6: filter

 public function filter($function)
 {
     $this->_array = Arrays::filter($this->_array, $function);
     return $this;
 }
开发者ID:phogl,项目名称:autoloader,代码行数:5,代码来源:FluentArray.php

示例7: _removeMessages

 private function _removeMessages()
 {
     if (!$this->_keepMessage && Session::has('messages')) {
         $messages = Arrays::filter(Session::get('messages'), function (Notice $notice) {
             return !$notice->requestUrlMatches();
         });
         $this->saveMessagesWithEmptyCheck($messages);
     }
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:9,代码来源:Controller.php

示例8: getNoHeaderParameters

 /**
  * @return Parameter[]|array
  */
 public function getNoHeaderParameters()
 {
     return Arrays::filter($this->parameters, function (Parameter $parameter) {
         return !$parameter->isHeader();
     });
 }
开发者ID:piotrooo,项目名称:wsdl-creator,代码行数:9,代码来源:Method.php

示例9: inspect

 /**
  * Returns model object as a nicely formatted string.
  */
 public function inspect()
 {
     return get_called_class() . Objects::toString(Arrays::filter($this->_attributes, Functions::notNull()));
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:7,代码来源:Model.php

示例10: getRoutesForController

 public static function getRoutesForController($controller)
 {
     return Arrays::filter(self::getRoutes(), function (RouteRule $route) use($controller) {
         return Strings::equalsIgnoreCase($route->getController(), $controller);
     });
 }
开发者ID:letsdrink,项目名称:ouzo,代码行数:6,代码来源:Route.php


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