cleanup module classes

This commit is contained in:
Carsten Brandt 2016-07-13 15:06:36 +02:00
parent a5362298de
commit 662e0b56b1
2 changed files with 15 additions and 17 deletions

View File

@ -11,6 +11,7 @@ namespace humhub\components;
use Yii;
use humhub\models\ModuleEnabled;
use yii\base\Exception;
use yii\helpers\Json;
/**
* Base Class for Modules / Extensions
@ -21,15 +22,13 @@ class Module extends \yii\base\Module
{
/**
* @var Array the loaded module.json info file
* @var array the loaded module.json info file
*/
private $_moduleInfo = null;
/**
* The path for module resources (images, javascripts)
* @var string The path for module resources (images, javascripts)
* Also module related assets like README.md and module_image.png should be placed here.
*
* @var type
*/
public $resourcesPath = 'assets';
@ -59,7 +58,7 @@ class Module extends \yii\base\Module
if ($info['name']) {
return $info['name'];
}
return $this->getId();
return $this->id;
}
/**
@ -115,8 +114,8 @@ class Module extends \yii\base\Module
* Returns the url of an asset file and publishes all module assets if
* the file is not published yet.
*
* @param type $relativePath relative file path e.g. /module_image.jpg
* @return type
* @param string $relativePath relative file path e.g. /module_image.jpg
* @return string
*/
public function getPublishedUrl($relativePath)
{
@ -135,8 +134,8 @@ class Module extends \yii\base\Module
/**
* Checks if a specific asset file has already been published
* @param type $relativePath
* @return type
* @param string $relativePath
* @return string
*/
private function isPublished($relativePath)
{
@ -149,7 +148,7 @@ class Module extends \yii\base\Module
/**
* Get Assets Url
*
* @return String Image Url
* @return string Image Url
*/
public function getAssetsUrl()
{
@ -160,7 +159,7 @@ class Module extends \yii\base\Module
/**
* Publishes the basePath/resourcesPath (assets) module directory if existing.
* @return type
* @return array
*/
public function publishAssets()
{
@ -171,7 +170,7 @@ class Module extends \yii\base\Module
/**
* Determines whether or not this module has an asset directory.
* @return type
* @return boolean
*/
private function hasAssets()
{
@ -271,10 +270,10 @@ class Module extends \yii\base\Module
}
/**
* Reads module.json which contains basic module informations and
* Reads module.json which contains basic module information and
* returns it as array
*
* @return Array module.json content
* @return array module.json content
*/
protected function getModuleInfo()
{
@ -283,7 +282,7 @@ class Module extends \yii\base\Module
}
$moduleJson = file_get_contents($this->getBasePath() . DIRECTORY_SEPARATOR . 'module.json');
return \yii\helpers\Json::decode($moduleJson);
return Json::decode($moduleJson);
}
/**

View File

@ -10,7 +10,6 @@ namespace humhub\modules\content\components;
use Yii;
use humhub\components\Module;
use humhub\modules\content\components\ContentContainerActiveRecord;
/**
* Base Module with ContentContainer support.
@ -48,7 +47,7 @@ class ContentContainerModule extends Module
* Checks whether the module is enabled the given content container class.
*
* @param string $class the class of content container
* @return bollean
* @return boolean
*/
public function hasContentContainerType($class)
{