]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
Added a lot more type-hints where they will happen. Please note that I found
[quix0rs-gnu-social.git] / classes / Notice.php
index 37765ce38c533bda143256b840820261d13acf5c..6314ff534a0a23846e2a11f06e716826b618c299 100644 (file)
@@ -414,7 +414,7 @@ class Notice extends Managed_DataObject
      * @return Notice
      * @throws ClientException
      */
-    static function saveNew($profile_id, $content, $source, array $options=null) {
+    static function saveNew($profile_id, $content, $source, array $options=array()) {
         $defaults = array('uri' => null,
                           'url' => null,
                           'conversation' => null,   // URI of conversation
@@ -425,13 +425,16 @@ class Notice extends Managed_DataObject
                           'object_type' => null,
                           'verb' => null);
 
-        if (!empty($options) && is_array($options)) {
+        /*
+         * Above type-hint is already array, so simply count it, this saves
+         * "some" CPU cycles.
+         */
+        if (count($options) > 0) {
             $options = array_merge($defaults, $options);
-            extract($options);
-        } else {
-            extract($defaults);
         }
 
+        extract($options);
+
         if (!isset($is_local)) {
             $is_local = Notice::LOCAL_PUBLIC;
         }