Added some checked (I checked them) type-hints to improve type-safety (typing mistakes).
authorRoland Haeder <roland@mxchange.org>
Sun, 1 Mar 2015 17:34:46 +0000 (18:34 +0100)
committerRoland Haeder <roland@mxchange.org>
Sun, 1 Mar 2015 17:35:48 +0000 (18:35 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
plugins/Blacklist/BlacklistPlugin.php
plugins/BlogspamNet/BlogspamNetPlugin.php
plugins/DirectionDetector/DirectionDetectorPlugin.php
plugins/Mollom/MollomPlugin.php
plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php
plugins/Spotify/SpotifyPlugin.php

index bad89f2457239a7f2fabbf3bbe24e4d0e51a9de2..4491c273294d5c0d9bd133bad02e12e6031f27d6 100644 (file)
@@ -122,7 +122,7 @@ class BlacklistPlugin extends Plugin
      *
      * @return boolean hook value
      */
-    function onStartRegisterUser(&$user, &$profile)
+    function onStartRegisterUser(User &$user, Profile &$profile)
     {
         $homepage = strtolower($profile->homepage);
 
index 2cab69be30e03672b33dd1aab8926baf0d69fdb7..3df1e29f2e4cd3e5f87b8043bdedc9bd3de86c48 100644 (file)
@@ -65,7 +65,7 @@ class BlogspamNetPlugin extends Plugin
         }
     }
 
-    function onStartNoticeSave($notice)
+    function onStartNoticeSave(Notice $notice)
     {
         $args = $this->testArgs($notice);
         common_debug("Blogspamnet args = " . print_r($args, TRUE));
index 289196b4a9627a6d60e5176895b2bfae73a79ae7..73ea99940804e800b3d304c44725483937e22edc 100644 (file)
@@ -36,7 +36,7 @@ class DirectionDetectorPlugin extends Plugin {
      *
      * @param object $notice notice is going to be saved
      */
-    public function onStartNoticeSave($notice){
+    public function onStartNoticeSave(Notice $notice) {
         if(!preg_match('/<span class="rtl">/', $notice->rendered) && self::isRTL($notice->content))
             $notice->rendered = '<span class="rtl">'.$notice->rendered.'</span>';
         return true;
@@ -48,7 +48,7 @@ class DirectionDetectorPlugin extends Plugin {
      * @param string $content
      * @return boolean
      */
-    public static function isRTL($content){
+    public static function isRTL($content) {
         $content = self::getClearText($content);
         $words = explode(' ', $content);
         $rtl = 0;
@@ -71,7 +71,7 @@ class DirectionDetectorPlugin extends Plugin {
      * @param string $str
      * @return boolean
      */
-    public static function startsWithRTLCharacter($str){
+    public static function startsWithRTLCharacter($str ){
         if (strlen($str) < 1) {
             return false;
         }
@@ -106,7 +106,7 @@ class DirectionDetectorPlugin extends Plugin {
      * @param string $str
      * @return string
      */
-    private static function getClearText($str){
+    private static function getClearText($str) {
         $str = preg_replace('/@[^ ]+|![^ ]+|#[^ ]+/u', '', $str); // reply, tag, group
         $str = preg_replace('/^RT[: ]{1}| RT | RT: |^RD[: ]{1}| RD | RD: |[♺♻:]/u', '', $str); // redent, retweet
         $str = preg_replace("/[ \r\t\n]+/", ' ', trim($str)); // remove spaces
index 382ce2ee5bb782b2aa327004cd98952a618f0f85..b4c9c1cf69620357a90117ef1879284c6b593b5b 100644 (file)
@@ -70,7 +70,7 @@ class MollomPlugin extends Plugin
     public $private_key;
     public $servers;
 
-    function onStartNoticeSave($notice)
+    function onStartNoticeSave(Notice $notice)
     {
       if ( $this->public_key ) {
         //Check spam
index 99f61dcf02ce5e97d019f9f9cbb54640ee4e5967..f6b3c4ef7c689dc779749aacd8658d5cc98952c0 100644 (file)
@@ -95,7 +95,7 @@ class RequireValidatedEmailPlugin extends Plugin
      *
      * @return bool hook result code
      */
-    function onStartNoticeSave($notice)
+    function onStartNoticeSave(Notice $notice)
     {
         $user = User::getKV('id', $notice->profile_id);
         if (!empty($user)) { // it's a remote notice
@@ -116,7 +116,7 @@ class RequireValidatedEmailPlugin extends Plugin
      *
      * @return bool hook result code
      */
-    function onStartRegisterUser(&$user, &$profile)
+    function onStartRegisterUser(User &$user, Profile &$profile)
     {
         $email = $user->email;
 
index f001fc39092c200369c7f41e3805eb8ac2459e5a..2754d180218683c0e96fad4ae2ba8ef7f0bcfa59 100644 (file)
@@ -54,7 +54,7 @@ class SpotifyPlugin extends Plugin
         parent::__construct();
     }
 
-    function onStartNoticeSave($notice)
+    function onStartNoticeSave(Notice $notice)
     {
         $notice->rendered = preg_replace_callback('/spotify:[a-z]{5,6}:[a-z0-9]{22}/i',
                                                   "renderSpotifyURILink",