浏览代码

Use `+` instead of isset checks.

Mark Story 10 年之前
父节点
当前提交
d610c92c7a
共有 1 个文件被更改,包括 6 次插入8 次删除
  1. 6 8
      src/Controller/Component/RequestHandlerComponent.php

+ 6 - 8
src/Controller/Component/RequestHandlerComponent.php

@@ -96,19 +96,17 @@ class RequestHandlerComponent extends Component
      */
     public function __construct(ComponentRegistry $registry, array $config = [])
     {
-        if (!isset($config['viewClassMap'])) {
-            $config['viewClassMap'] = [
+        $config += [
+            'viewClassMap' => [
                 'json' => 'Json',
                 'xml' => 'Xml',
                 'ajax' => 'Ajax'
-            ];
-        }
-        if (!isset($config['inputTypeMap'])) {
-            $config['inputTypeMap'] = [
+            ],
+            'inputTypeMap' => [
                 'json' => ['json_decode', true],
                 'xml' => [[$this, 'convertXml']],
-            ];
-        }
+            ]
+        ];
         parent::__construct($registry, $config);
     }