select() public method

Returns the values mapped by the supplied function.
public select ( callable $function ) : pinq\ITraversable
$function callable The function returning the data to select
return pinq\ITraversable
コード例 #1
0
ファイル: SelectTest.php プロジェクト: timetoogo/pinq
 /**
  * @dataProvider padStrings
  */
 public function testThatSelectUsesDefaultToValuesForUnsuppliedArgumentsToInternalFunctions(\Pinq\ITraversable $values, array $data)
 {
     //Signature: str_pad($input, $pad_length, $pad_string = " ", $pad_type = STR_PAD_RIGHT)
     $paddedValues = $values->select('str_pad');
     //So the string should be $input and the key should be $pad_length and the rest is default values.
     $this->assertMatches($paddedValues, [5 => 'abc  ', 10 => 'hello     ', 20 => 'foo-bar-baz         ']);
 }
コード例 #2
0
ファイル: ScopeEvaluator.php プロジェクト: timetoogo/pinq
 public function visitSelect(Segments\Select $query)
 {
     $this->traversable = $this->traversable->select($this->resolvedParameters[$query->getProjectionFunction()->getCallableId()]);
 }