for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPKitchen\Platform\Helper\Collection;
/**
* Represents
*
* @author Dmitry Kolodko <[email protected]>
* @since 1.0
*/
class Intersect {
protected $collections;
// @todo support of collection
public function byValues(): array {
return array_intersect(...$this->collections);
}
public function byKeysComparedBy(callable $compare): array {
$arguments = $this->collections;
$arguments[] = $compare;
return array_intersect_ukey(...$arguments);
public function byKeys(): array {
return array_intersect_key(...$this->collections);
public function byValuesAndKeys(): array {
return array_intersect_assoc(...$this->collections);
public function byValuesAndKeysComparedBy(callable $compare): array {
return array_intersect_uassoc(...$arguments);