/** * Returns an array of this class' constant names which are defined * in this instance * @return string[] */ public function getNames() { $isSet = PHPArray::filter(static::getConstants(), function ($value) { return $this->hasFlag($value); }); return \array_keys($isSet); }
/** * Whether any item passes a predicate function * @param \Closure $predicate * @return bool */ public function some(\Closure $predicate) { return PHPArray::some($this->_Arr, $predicate); }
public function testSome() { $arr = array(3, 2, 1); $r = PHPArray::some($arr, function ($item) { return $item >= 2; }); $this->assertTrue($r); }