original_string: public function groupBy($list, $property, $meta=null)
      {
          if (!$list) {
              return [];
          }
          if (!$meta) {
              if (!($first = current($list))) {
                  throw new \UnexpectedValueException();
              }
              $meta = $this->mapper->getMeta(get_class($first));
          }
  
          $groups = [];
  
          $props = $meta->getProperties();
          foreach ($list as $object) {
              $propDef = !isset($props[$property]) ? null : $props[$property];
              $value = !$propDef || !isset($propDef['getter']) 
                  ? $object->{$property} 
                  : call_user_func(array($object, $propDef['getter']));
  
              $groups[$value][] = $object;
          }
          return $groups;
      }
code: public function groupBy($list, $property, $meta=null)
      {
          if (!$list) {
              return [];
          }
          if (!$meta) {
              if (!($first = current($list))) {
                  throw new \UnexpectedValueException();
              }
              $meta = $this->mapper->getMeta(get_class($first));
          }
  
          $groups = [];
  
          $props = $meta->getProperties();
          foreach ($list as $object) {
              $propDef = !isset($props[$property]) ? null : $props[$property];
              $value = !$propDef || !isset($propDef['getter']) 
                  ? $object->{$property} 
                  : call_user_func(array($object, $propDef['getter']));
  
              $groups[$value][] = $object;
          }
          return $groups;
      }
code_tokens: public function groupBy ( $ list , $ property , $ meta = null ) { if ( ! $ list ) { return [ ] ; } if ( ! $ meta ) { if ( ! ( $ first = current ( $ list ) ) ) { throw new \ UnexpectedValueException ( ) ; } $ meta = $ this -> mapper -> getMeta ( get_class ( $ first ) ) ; } $ groups = [ ] ; $ props = $ meta -> getProperties ( ) ; foreach ( $ list as $ object ) { $ propDef = ! isset ( $ props [ $ property ] ) ? null : $ props [ $ property ] ; $ value = ! $ propDef || ! isset ( $ propDef [ 'getter' ] ) ? $ object -> { $ property } : call_user_func ( array ( $ object , $ propDef [ 'getter' ] ) ) ; $ groups [ $ value ] [ ] = $ object ; } return $ groups ; }
docstring: Iterate over an array of objects and group them by the value of a property
  
  @return array[group] = class[]
docstring_tokens: Iterate over an array of objects and group them by the value of a property