Add getStrList() to AphrontRequest

Summary:
  - We have a few places where we do some kind of ad-hoc comma list tokenizing,
and I'm adding another one in D1290. Add a helper to the request object.
  - Add some unit tests.

Test Plan:
  - Ran unit tests.
  - Used PHID manager, Maniphest custom view, and Repository project editor.

Reviewers: btrahan, fratrik, jungejason

Reviewed By: btrahan

CC: aran, btrahan, epriestley

Differential Revision: https://secure.phabricator.com/D1302
This commit is contained in:
epriestley
2012-01-03 21:57:45 -08:00
parent 7831b92427
commit ec1df21bef
8 changed files with 165 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,10 +47,8 @@ class PhabricatorRepositoryArcanistProjectEditController
if ($request->isFormPost()) {
$indexed = $request->getStr('symbolIndexLanguages');
$indexed = strtolower($indexed);
$indexed = preg_split('/[ ,]+/', $indexed);
$indexed = array_filter($indexed);
$indexed = $request->getStrList('symbolIndexLanguages');
$indexed = array_map('strtolower', $indexed);
$project->setSymbolIndexLanguages($indexed);
$project->setSymbolIndexProjects($request->getArr('symbolIndexProjects'));