Merge pull request #3030 from acs-ferreira/patch-16

Declare visibility after abstraction
This commit is contained in:
Lucas Bartholemy 2018-02-25 21:24:04 +01:00 committed by GitHub
commit 619c1660fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,8 @@
namespace humhub\modules\notification\targets; namespace humhub\modules\notification\targets;
use Yii; use Yii;
use yii\base\Object;
use yii\di\Instance;
use humhub\modules\user\models\User; use humhub\modules\user\models\User;
use humhub\components\rendering\Renderer; use humhub\components\rendering\Renderer;
use humhub\modules\notification\components\BaseNotification; use humhub\modules\notification\components\BaseNotification;
@ -21,7 +23,7 @@ use humhub\modules\notification\components\NotificationCategory;
* *
* @author buddha * @author buddha
*/ */
abstract class BaseTarget extends \yii\base\Object abstract class BaseTarget extends Object
{ {
/** /**
@ -71,14 +73,14 @@ abstract class BaseTarget extends \yii\base\Object
/** /**
* @return string Human readable title for views. * @return string Human readable title for views.
*/ */
public abstract function getTitle(); abstract public function getTitle();
/** /**
* @return \humhub\components\rendering\Renderer default renderer for this target. * @return \humhub\components\rendering\Renderer default renderer for this target.
*/ */
public function getRenderer() public function getRenderer()
{ {
return \yii\di\Instance::ensure($this->renderer, Renderer::class); return Instance::ensure($this->renderer, Renderer::class);
} }
/** /**
@ -89,7 +91,7 @@ abstract class BaseTarget extends \yii\base\Object
* *
* @param BaseNotification $notification * @param BaseNotification $notification
*/ */
public abstract function handle(BaseNotification $notification, User $user); abstract public function handle(BaseNotification $notification, User $user);
/** /**
* Used to acknowledge the seding/processing of the given $notification. * Used to acknowledge the seding/processing of the given $notification.
@ -113,6 +115,7 @@ abstract class BaseTarget extends \yii\base\Object
if ($this->acknowledgeFlag && $notification->record->hasAttribute($this->acknowledgeFlag)) { if ($this->acknowledgeFlag && $notification->record->hasAttribute($this->acknowledgeFlag)) {
return $notification->record->getAttribute($this->acknowledgeFlag); return $notification->record->getAttribute($this->acknowledgeFlag);
} }
return false; return false;
} }
@ -215,6 +218,7 @@ abstract class BaseTarget extends \yii\base\Object
} }
$category = $notification->getCategory(); $category = $notification->getCategory();
return ($category) ? $this->isCategoryEnabled($category, $user) : $this->defaultSetting; return ($category) ? $this->isCategoryEnabled($category, $user) : $this->defaultSetting;
} }