Example #1
0
 /**
  * Find the first matching context in the collection
  * @param  string $re
  * @param  callable $filter
  * @return Context
  */
 public function find($re, $filter = null)
 {
     $result = null;
     $this->each(function ($context) use($re, $filter, &$result) {
         $r = $context->find($re, $filter);
         if (!$r->isEmpty()) {
             $result = $r;
             return false;
         }
     });
     return $result ?: Context::getEmptyContext();
 }