Changeset View
Changeset View
Standalone View
Standalone View
src/applications/multimeter/controller/MultimeterSampleController.php
<?php | <?php | ||||
final class MultimeterSampleController extends MultimeterController { | final class MultimeterSampleController extends MultimeterController { | ||||
public function shouldAllowPublic() { | public function shouldAllowPublic() { | ||||
return true; | return true; | ||||
} | } | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$group_map = $this->getColumnMap(); | $group_map = $this->getColumnMap(); | ||||
$group = explode('.', $request->getStr('group')); | $group = explode('.', $request->getStr('group', '')); | ||||
valerio.bozzolan: Maybe the minimal and safer approach is to use the `getStr($something, $default)` with… | |||||
$group = array_intersect($group, array_keys($group_map)); | $group = array_intersect($group, array_keys($group_map)); | ||||
$group = array_fuse($group); | $group = array_fuse($group); | ||||
if (empty($group['type'])) { | if (empty($group['type'])) { | ||||
$group['type'] = 'type'; | $group['type'] = 'type'; | ||||
} | } | ||||
$now = PhabricatorTime::getNow(); | $now = PhabricatorTime::getNow(); | ||||
▲ Show 20 Lines • Show All 329 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
Maybe the minimal and safer approach is to use the getStr($something, $default) with $default expressed