Skip to content

Commit ccae9f4

Browse files
committed
Removed ReadMe badges and configs of dead services (Travis, SensioLabs Insight, VersionEye).
Updated ReadMe with info on arrow functions.
1 parent f837af6 commit ccae9f4

File tree

3 files changed

+22
-38
lines changed

3 files changed

+22
-38
lines changed

.sensiolabs.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

readme.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# *YaLinqo: Yet Another LINQ to Objects for PHP*
22

3-
[![Travis CI Status](https://img.shields.io/travis/Athari/YaLinqo.svg)](https://travis-ci.org/Athari/YaLinqo)
43
[![Coveralls Coverage](https://img.shields.io/coveralls/Athari/YaLinqo/master.svg)](https://coveralls.io/r/Athari/YaLinqo)
54
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/Athari/YaLinqo.svg)](https://scrutinizer-ci.com/g/Athari/YaLinqo)
6-
[![SensioLabs Insight Check](https://img.shields.io/sensiolabs/i/d1273f86-85e3-4076-a037-a40062906329.svg)](https://insight.sensiolabs.com/projects/d1273f86-85e3-4076-a037-a40062906329)
7-
[![VersionEye Dependencies](https://www.versioneye.com/php/athari:yalinqo/badge.svg)](https://www.versioneye.com/php/athari:yalinqo)<br>
85
[![Packagist Downloads](https://img.shields.io/packagist/dt/athari/yalinqo.svg)](https://packagist.org/packages/athari/yalinqo)
9-
[![VersionEye References](https://www.versioneye.com/php/athari:yalinqo/reference_badge.svg)](https://www.versioneye.com/php/athari:yalinqo/references)
106
[![Packagist Version](https://img.shields.io/packagist/v/athari/yalinqo.svg)](https://packagist.org/packages/athari/yalinqo)
117
[![GitHub License](https://img.shields.io/github/license/Athari/YaLinqo.svg)](license.md)
128

@@ -21,7 +17,7 @@ Features
2117
* [Detailed PHPDoc and online reference](http://athari.github.io/YaLinqo) based on PHPDoc for all methods. Articles are adapted from original LINQ documentation from MSDN.
2218
* 100% unit test coverage.
2319
* Best performance among full-featured LINQ ports (YaLinqo, Ginq, Pinq), at least 2x faster than the closest competitor, see [performance tests](https://github.com/Athari/YaLinqoPerf).
24-
* Callback functions can be specified as closures (like `function ($v) { return $v; }`), PHP "function pointers" (either strings like `'strnatcmp'` or arrays like `array($object, 'methodName')`), string "lambdas" using various syntaxes (`'"$k = $v"'`, `'$v ==> $v+1'`, `'($v, $k) ==> $v + $k'`, `'($v, $k) ==> { return $v + $k; }'`).
20+
* Callback functions can be specified as arrow functions (like `fn($v) => $v`) closures (like `function ($v) { return $v; }`), PHP "function pointers" (either strings like `'strnatcmp'` or arrays like `array($object, 'methodName')`), string "lambdas" using various syntaxes (`'"$k = $v"'`, `'$v ==> $v+1'`, `'($v, $k) ==> $v + $k'`, `'($v, $k) ==> { return $v + $k; }'`).
2521
* Keys are as important as values. Most callback functions receive both values and the keys; transformations can be applied to both values and the keys; keys are never lost during transformations, if possible.
2622
* SPL interfaces `Iterator`, `IteratorAggregate` etc. are used throughout the code and can be used interchangeably with Enumerable.
2723
* Redundant collection classes are avoided, native PHP arrays are used everywhere.
@@ -71,6 +67,24 @@ $categories = array(
7167
// Put products with non-zero quantity into matching categories;
7268
// sort categories by name;
7369
// sort products within categories by quantity descending, then by name.
70+
71+
// Arrow function syntax
72+
$result3 = from($categories)
73+
->orderBy(fn($cat) => $cat['name'])
74+
->groupJoin(
75+
from($products)
76+
->where(fn($prod) => $prod["quantity"] > 0)
77+
->orderByDescending(fn($prod) => $prod["quantity"])
78+
->thenBy(fn => $prod["name"]),
79+
fn($cat) => $cat["id"],
80+
fn($prod) => $prod["catId"],
81+
fn($cat, $prods) => [
82+
"name" => $cat["name"],
83+
"products" => $prods
84+
]
85+
);
86+
87+
// String lambda syntax
7488
$result = from($categories)
7589
->orderBy('$cat ==> $cat["name"]')
7690
->groupJoin(
@@ -85,7 +99,7 @@ $result = from($categories)
8599
)'
86100
);
87101

88-
// Alternative shorter syntax using default variable names
102+
// String lambda syntax with default variable names
89103
$result2 = from($categories)
90104
->orderBy('$v["name"]')
91105
->groupJoin(
@@ -100,7 +114,7 @@ $result2 = from($categories)
100114
)'
101115
);
102116

103-
// Closure syntax, maximum support in IDEs, but verbose and hard to read
117+
// Closure syntax
104118
$result3 = from($categories)
105119
->orderBy(function ($cat) { return $cat['name']; })
106120
->groupJoin(
@@ -181,7 +195,7 @@ License
181195

182196
#### Simplified BSD License
183197

184-
Copyright © 2012–2016, Alexander Prokhorov
198+
Copyright © 2012–2023, Alexander Prokhorov
185199
All rights reserved.
186200

187201
Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)