original_string: public function getPackages()
      {
          $this->start();
          try {
              $this->getUserControl()->checkRateLimit();
              $this->getUserControl()->checkGenericAccess(__FUNCTION__);
              $repo = $this->app->make(PackageRepository::class);
              $packages = $repo->createQueryBuilder('p')
                  ->select('p.handle, p.name')
                  ->getQuery()->getArrayResult();
              $result = $this->buildJsonResponse($packages);
          } catch (Exception $x) {
              $result = $this->buildErrorResponse($x);
          } catch (Throwable $x) {
              $result = $this->buildErrorResponse($x);
          }
  
          return $this->finish($result);
      }
code: public function getPackages()
      {
          $this->start();
          try {
              $this->getUserControl()->checkRateLimit();
              $this->getUserControl()->checkGenericAccess(__FUNCTION__);
              $repo = $this->app->make(PackageRepository::class);
              $packages = $repo->createQueryBuilder('p')
                  ->select('p.handle, p.name')
                  ->getQuery()->getArrayResult();
              $result = $this->buildJsonResponse($packages);
          } catch (Exception $x) {
              $result = $this->buildErrorResponse($x);
          } catch (Throwable $x) {
              $result = $this->buildErrorResponse($x);
          }
  
          return $this->finish($result);
      }
code_tokens: public function getPackages ( ) { $ this -> start ( ) ; try { $ this -> getUserControl ( ) -> checkRateLimit ( ) ; $ this -> getUserControl ( ) -> checkGenericAccess ( __FUNCTION__ ) ; $ repo = $ this -> app -> make ( PackageRepository :: class ) ; $ packages = $ repo -> createQueryBuilder ( 'p' ) -> select ( 'p.handle, p.name' ) -> getQuery ( ) -> getArrayResult ( ) ; $ result = $ this -> buildJsonResponse ( $ packages ) ; } catch ( Exception $ x ) { $ result = $ this -> buildErrorResponse ( $ x ) ; } catch ( Throwable $ x ) { $ result = $ this -> buildErrorResponse ( $ x ) ; } return $ this -> finish ( $ result ) ; }
docstring: Get the list of packages.
  
  @return Response
  
  @example http://www.example.com/api/packages/
docstring_tokens: Get the list of packages .