X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FNotice.php;h=6314ff534a0a23846e2a11f06e716826b618c299;hb=9c99082a46bb12fc592cb6c0582c509c1e9a0b1f;hp=20374e0e2e06233ed03c9298aedb58d51f0ff27f;hpb=d3a8896b2a10ca74fb265c603d50d175b49b50b4;p=quix0rs-gnu-social.git diff --git a/classes/Notice.php b/classes/Notice.php index 20374e0e2e..6314ff534a 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -330,7 +330,7 @@ class Notice extends Managed_DataObject * Record the given set of hash tags in the db for this notice. * Given tag strings will be normalized and checked for dupes. */ - function saveKnownTags($hashtags) + function saveKnownTags(array $hashtags) { //turn each into their canonical tag //this is needed to remove dupes before saving e.g. #hash.tag = #hashtag @@ -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; }