original_string: public static function assoc($arr, $name, $type = null)
      {
          $ret = [];
          if (empty($arr)) {
              return $ret;
          }
          if ($type == self::GETTER) {
              $method = 'get' . $name;
              foreach ($arr as $elem) {
                  $ret[$elem->$method()] = $elem;
              }
          } elseif ($type == self::OBJ) {
              foreach ($arr as $elem) {
                  $ret[$elem->$name] = $elem;
              }
          } else {
              foreach ($arr as $elem) {
                  $ret[$elem[$name]] = $elem;
              }
          }
          return $ret;
      }
code: public static function assoc($arr, $name, $type = null)
      {
          $ret = [];
          if (empty($arr)) {
              return $ret;
          }
          if ($type == self::GETTER) {
              $method = 'get' . $name;
              foreach ($arr as $elem) {
                  $ret[$elem->$method()] = $elem;
              }
          } elseif ($type == self::OBJ) {
              foreach ($arr as $elem) {
                  $ret[$elem->$name] = $elem;
              }
          } else {
              foreach ($arr as $elem) {
                  $ret[$elem[$name]] = $elem;
              }
          }
          return $ret;
      }
code_tokens: public static function assoc ( $ arr , $ name , $ type = null ) { $ ret = [ ] ; if ( empty ( $ arr ) ) { return $ ret ; } if ( $ type == self :: GETTER ) { $ method = 'get' . $ name ; foreach ( $ arr as $ elem ) { $ ret [ $ elem -> $ method ( ) ] = $ elem ; } } elseif ( $ type == self :: OBJ ) { foreach ( $ arr as $ elem ) { $ ret [ $ elem -> $ name ] = $ elem ; } } else { foreach ( $ arr as $ elem ) { $ ret [ $ elem [ $ name ] ] = $ elem ; } } return $ ret ; }
docstring: Creates associated array
  
  @param array $array
  @param string $name
  @param string $type
  @return array
docstring_tokens: Creates associated array