🎨 Replace "else if" with "elseif" (#3195)

* 🎨 Replace "else if" with "elseif"

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>

* 🎨 Fix indention
This commit is contained in:
Daniel Kesselberg 2018-07-04 18:12:26 +02:00 committed by GitHub
parent a5a24b2ee6
commit 2ca60b6047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 72 additions and 73 deletions

View File

@ -213,7 +213,7 @@ abstract class SocialActivity extends \yii\base\BaseObject implements rendering\
{
if ($this->source instanceof ContentContainerActiveRecord) {
return $this->source;
} else if ($this->hasContent()) {
} elseif ($this->hasContent()) {
return $this->getContent()->getContainer();
}
@ -309,7 +309,7 @@ abstract class SocialActivity extends \yii\base\BaseObject implements rendering\
{
if (!$this->hasContent() && !$content) {
return null;
} else if (!$content) {
} elseif (!$content) {
$content = $this->source;
}
@ -336,7 +336,7 @@ abstract class SocialActivity extends \yii\base\BaseObject implements rendering\
{
if (!$this->hasContent() && !$content) {
return null;
} else if (!$content) {
} elseif (!$content) {
$content = $this->source;
}
@ -356,7 +356,7 @@ abstract class SocialActivity extends \yii\base\BaseObject implements rendering\
{
if (!$this->hasContent() && !$content) {
return null;
} else if (!$content) {
} elseif (!$content) {
$content = $this->source;
}

View File

@ -19,7 +19,7 @@ class Sort
if ($sortA == $sortB) {
return 0;
} else if ($sortA < $sortB) {
} elseif ($sortA < $sortB) {
return -1;
} else {
return 1;

View File

@ -14,7 +14,7 @@ class Stream extends ActivityStreamViewer
{
if($this->streamAction == '/dashboard/dashboard/stream') {
$this->streamAction = '/dashboard/dashboard/activity-stream';
} else if($this->streamAction === '/space/space/stream') {
} elseif($this->streamAction === '/space/space/stream') {
$this->streamAction = '/activity/stream/stream';
}
parent::init();

View File

@ -101,7 +101,7 @@ class NewComment extends \humhub\modules\notification\components\BaseNotificatio
'displayName' => Html::encode($this->originator->displayName),
'contentTitle' => Helpers::truncateText($contentRecord->getContentDescription(), 25),
]);
} else if ($space) {
} elseif ($space) {
return Yii::t('CommentModule.notification', "{displayName} commented {contentTitle} in space {space}", [
'displayName' => Html::encode($this->originator->displayName),
'contentTitle' => $contentInfo,
@ -135,7 +135,7 @@ class NewComment extends \humhub\modules\notification\components\BaseNotificatio
'displayNames' => $this->getGroupUserDisplayNames(),
'contentTitle' => $contentInfo,
]);
} else if ($space) {
} elseif ($space) {
return Yii::t('CommentModule.notification', "{displayNames} commented {contentTitle} in space {space}", [
'displayNames' => $this->getGroupUserDisplayNames(),
'contentTitle' => $contentInfo,

View File

@ -129,7 +129,7 @@ class ActiveQueryContent extends \yii\db\ActiveQuery
$contentTagClass = null;
if($contentTag instanceof ContentTag) {
$contentTagClass = get_class($contentTag);
} else if(is_string($contentTag)) {
} elseif(is_string($contentTag)) {
$contentTagClass = $contentTag;
}

View File

@ -145,11 +145,11 @@ class ContentActiveRecord extends ActiveRecord implements ContentOwner, Movable
{
if(is_array($contentContainer)) {
parent::__construct($contentContainer);
} else if($contentContainer instanceof ContentContainerActiveRecord) {
} elseif($contentContainer instanceof ContentContainerActiveRecord) {
$this->content->setContainer($contentContainer);
if(is_array($visibility)) {
$config = $visibility;
} else if($visibility !== null) {
} elseif($visibility !== null) {
$this->content->visibility = $visibility;
}
parent::__construct($config);
@ -278,18 +278,18 @@ class ContentActiveRecord extends ActiveRecord implements ContentOwner, Movable
{
if(!$this->hasManagePermission()) {
return null;
} else if(is_string($this->managePermission)) { // Simple Permission class specification
} elseif(is_string($this->managePermission)) { // Simple Permission class specification
return $this->managePermission;
} else if(is_array($this->managePermission)) {
} elseif(is_array($this->managePermission)) {
if(isset($this->managePermission['class'])) { // ['class' => '...', 'callback' => '...']
$handler = $this->managePermission['class'].'::'.$this->managePermission['callback'];
return call_user_func($handler, $this);
} else { // Simple Permission array specification
return $this->managePermission;
}
} else if(is_callable($this->managePermission)) { // anonymous function
} elseif(is_callable($this->managePermission)) { // anonymous function
return $this->managePermission($this);
} else if($this->managePermission instanceof BasePermission) {
} elseif($this->managePermission instanceof BasePermission) {
return $this->managePermission;
} else {
return null;
@ -336,7 +336,7 @@ class ContentActiveRecord extends ActiveRecord implements ContentOwner, Movable
$widget = new $class;
$widget->contentObject = $this;
return $widget;
} else if(!empty($this->wallEntryClass)) {
} elseif(!empty($this->wallEntryClass)) {
$class = $this->wallEntryClass;
$widget = new $class;
return $widget;
@ -419,7 +419,7 @@ class ContentActiveRecord extends ActiveRecord implements ContentOwner, Movable
{
if (!$user && !Yii::$app->user->isGuest) {
$user = Yii::$app->user->getIdentity();
} else if (!$user) {
} elseif (!$user) {
return false;
}

View File

@ -188,7 +188,7 @@ class ContentContainerControllerAccess extends StrictAccess
if ($this->contentContainer instanceof Space) {
return $this->contentContainer->isAdmin($this->user);
} else if($this->contentContainer instanceof Space) {
} elseif($this->contentContainer instanceof Space) {
return $this->user && $this->user->is($this->contentContainer);
}

View File

@ -48,7 +48,7 @@ class PermaController extends Controller
if (method_exists($content->getPolymorphicRelation(), 'getUrl')) {
$url = $content->getPolymorphicRelation()->getUrl();
} else if($content->container !== null) {
} elseif($content->container !== null) {
$url = $content->container->createUrl(null, ['contentId' => $id]);
}

View File

@ -110,7 +110,7 @@ class ContentTag extends ActiveRecord
{
if (is_array($contentContainer)) {
parent::__construct($contentContainer);
} else if ($contentContainer instanceof ContentContainerActiveRecord) {
} elseif ($contentContainer instanceof ContentContainerActiveRecord) {
$this->contentcontainer_id = $contentContainer->contentcontainer_id;
parent::__construct($config);
} else {

View File

@ -46,7 +46,7 @@ class ContentTagRelation extends ActiveRecord
{
if(is_array($content)) {
parent::__construct($content);
} else if($content instanceof Content) {
} elseif($content instanceof Content) {
$this->setContent($content);
if($tag !== null && $tag->isNewRecord) {

View File

@ -36,7 +36,7 @@ class VisibilityLink extends \yii\base\Widget
// Prevent Make Public in private spaces
if(!$content->canEdit() || (!$content->visibility && !$contentContainer->visibility)) {
return;
} else if($content->isPrivate() && !$contentContainer->permissionManager->can(new CreatePublicContent())) {
} elseif($content->isPrivate() && !$contentContainer->permissionManager->can(new CreatePublicContent())) {
return;
}

View File

@ -148,7 +148,7 @@ class AbstractRichTextEditor extends InputWidget
$input = $this->form->field($this->model, $this->attribute)->textarea($inputOptions)->label(false);
$richText = Html::tag('div', $this->editOutput($this->getValue()), $this->getOptions());
$richText = $this->getLabel() . $richText;
} else if ($this->model != null) {
} elseif ($this->model != null) {
$input = Html::activeTextarea($this->model, $this->attribute, $inputOptions);
$richText = Html::tag('div', $this->editOutput($this->getValue()), $this->getOptions());
$richText = $this->getLabel() . $richText;

View File

@ -215,7 +215,7 @@ class ProsemirrorRichText extends AbstractRichText
return $container->isActive()
? '['.Html::encode($container->getDisplayName()).'](mention:'.$container->guid.' "'.$container->getUrl().'")'
: $notFoundResult;
} else if($container instanceof Space) {
} elseif($container instanceof Space) {
return '['.Html::encode($container->name).'](mention:'.$container->guid.' "'.$container->getUrl().'")';
}
});

View File

@ -76,7 +76,7 @@ class RichTextCompatibilityParser
return preg_replace_callback('@;(\w*?);@', function ($hit) use (&$emojis, &$emojiMapping) {
if (array_key_exists($hit[1], $emojiMapping)) {
return ':' . $emojiMapping[$hit[1]] . ':';
} else if (in_array($hit[1], $emojis)) {
} elseif (in_array($hit[1], $emojis)) {
return ':' . strtolower($hit[1]) . ':';
}
return $hit[0];

View File

@ -53,7 +53,7 @@ class PreviewImage extends BaseConverter
{
if ($file) {
return Html::encode($file->file_name);
} else if($this->file) {
} elseif($this->file) {
return Html::encode($this->file->file_name);
}
return '';

View File

@ -241,7 +241,7 @@ class ImageConverter
$dst_h = $sourceHeight;
$dst_w = $sourceWidth;
}
} else if ($options['mode'] == 'force') {
} elseif ($options['mode'] == 'force') {
// When ratio not fit, crop it - requires given width & height
if ($width != 0 && $height != 0) {

View File

@ -150,7 +150,7 @@ class File extends FileCompat
if ($object != null) {
if ($object instanceof ContentAddonActiveRecord) {
return $object->canWrite($userId);
} else if ($object instanceof ContentActiveRecord) {
} elseif ($object instanceof ContentActiveRecord) {
return $object->content->canWrite($userId);
}
}

View File

@ -50,7 +50,7 @@ class UploadButton extends UploadInput
{
if($this->label === true) {
$this->label = '&nbsp;'.Yii::t('base', 'Upload');
} else if($this->label === false) {
} elseif($this->label === false) {
$this->label = '';
} else {
$this->label = '&nbsp;'.$this->label;

View File

@ -53,9 +53,9 @@ class FriendshipNotificationCategory extends NotificationCategory
{
if ($target->id === MailTarget::getId()) {
return true;
} else if ($target->id === WebTarget::getId()) {
} elseif ($target->id === WebTarget::getId()) {
return true;
} else if ($target->id === MobileTarget::getId()) {
} elseif ($target->id === MobileTarget::getId()) {
return true;
}

View File

@ -198,7 +198,7 @@ class NotificationManager
// Add explicit follower and non explicit follower if $isDefault
$followers = $this->findFollowers($container, $isDefault)->all();
$result = array_merge($members, $followers);
} else if ($isDefault) {
} elseif ($isDefault) {
// Add all members without explicit following and no notification settings.
$followers = Membership::getSpaceMembersQuery($container, true, false)
->andWhere(['not exists', $this->findNotExistingSettingSubQuery()])->all();
@ -206,7 +206,7 @@ class NotificationManager
} else {
$result = $members;
}
} else if ($container instanceof User) {
} elseif ($container instanceof User) {
// Note the notification follow logic for users is currently not implemented.
// TODO: perhaps return only friends if public is false?
$result = (!$public) ? [] : Follow::getFollowersQuery($container, true)->all();

View File

@ -227,7 +227,7 @@ class NotificationSettings extends Model
{
if (Yii::$app->user->can(new ManageSettings())) {
return true;
} else if (!$this->user) {
} elseif (!$this->user) {
return false; // Only ManageSettings user can set global notification settings
} else {
return Yii::$app->user->id == $this->user->id;

View File

@ -21,7 +21,7 @@ class SpecialNotificationCategory extends \humhub\modules\notification\component
{
if ($target->id === MailTarget::getId()) {
return false;
} else if ($target->id === WebTarget::getId()) {
} elseif ($target->id === WebTarget::getId()) {
return false;
}

View File

@ -20,7 +20,7 @@ class TestNotificationCategory extends \humhub\modules\notification\components\N
{
if ($target->id === MailTarget::getId()) {
return false;
} else if ($target->id === webTarget::getId()) {
} elseif ($target->id === webTarget::getId()) {
return true;
}

View File

@ -37,7 +37,7 @@ class SpaceFollowTest extends HumHubDbTestCase
if($followers[0]->id == 2) {
$this->assertTrue(true);
} else if($followers[1]->id == 2) {
} elseif($followers[1]->id == 2) {
$this->assertTrue(true);
} else {
$this->assertTrue(false, 'User not in follower list.');

View File

@ -24,7 +24,7 @@ class StreamHelper
public static function createUrl(ContentContainerActiveRecord $container, $options = []) {
if($container instanceof Space) {
return $container->createUrl('/space/space/home', $options);
} else if($container instanceof User) {
} elseif($container instanceof User) {
return $container->createUrl('/user/profile/home', $options);
}
}

View File

@ -203,7 +203,7 @@ class StreamQuery extends Model
{
if (!is_string($filters)) {
$this->filters[] = $filters;
} else if (is_array($filters)) {
} elseif (is_array($filters)) {
$this->filters = ArrayHelper::merge($this->filters, $filters);
}
return $this;
@ -213,7 +213,7 @@ class StreamQuery extends Model
{
if (is_string($includes)) {
$this->includes = [$includes];
} else if (is_array($includes)) {
} elseif (is_array($includes)) {
$this->includes = $includes;
}
@ -224,7 +224,7 @@ class StreamQuery extends Model
{
if (is_string($types)) {
$this->excludes = [$types];
} else if (is_array($types)) {
} elseif (is_array($types)) {
$this->excludes = $types;
}

View File

@ -45,7 +45,7 @@ class ContentTypeStreamFilter extends StreamQueryFilter
if (count($this->includes) === 1) {
$this->query->andWhere(["content.object_model" => $this->includes[0]]);
} else if (!empty($this->includes)) {
} elseif (!empty($this->includes)) {
$this->query->andWhere(['IN', 'content.object_model', $this->includes]);
}
}
@ -57,7 +57,7 @@ class ContentTypeStreamFilter extends StreamQueryFilter
if (count($this->excludes) === 1) {
$this->query->andWhere(['!=', "content.object_model", $this->excludes[0]]);
} else if (!empty($this->excludes)) {
} elseif (!empty($this->excludes)) {
$this->query->andWhere(['NOT IN', 'content.object_model', $this->excludes]);
}
}

View File

@ -79,7 +79,7 @@ class DefaultStreamFilter extends StreamQueryFilter
// Visibility filters
if ($this->isFilterActive(self::FILTER_PRIVATE)) {
$this->filterPrivate();
} else if ($this->isFilterActive(self::FILTER_PUBLIC)) {
} elseif ($this->isFilterActive(self::FILTER_PUBLIC)) {
$this->filterPublic();
}
}

View File

@ -35,7 +35,7 @@ class OriginatorStreamFilter extends StreamQueryFilter
if($this->originators instanceof User) {
$this->originators = [$this->originators->id];
} else if(!is_array($this->originators)) {
} elseif(!is_array($this->originators)) {
$this->originators = [$this->originators];
}
@ -43,7 +43,7 @@ class OriginatorStreamFilter extends StreamQueryFilter
if (count($this->originators) === 1) {
$this->query->andWhere(["user.guid" => $this->originators[0]]);
} else if (!empty($this->originators)) {
} elseif (!empty($this->originators)) {
$this->query->andWhere(['IN', 'user.guid', $this->originators]);
}
}

View File

@ -83,12 +83,12 @@ class Topic extends ContentTag
$result[] = $newTopic;
}
} else if(is_numeric($topic)) {
} elseif(is_numeric($topic)) {
$topic = Topic::findOne((int) $topic);
if($topic) {
$result[] = $topic;
}
} else if($topic instanceof Topic) {
} elseif($topic instanceof Topic) {
$result[] = $topic;
}
}

View File

@ -30,9 +30,9 @@ abstract class Filter extends Model
if($this->autoLoad === static::AUTO_LOAD_ALL) {
$this->load(Yii::$app->request->get());
$this->load(Yii::$app->request->post());
} else if($this->autoLoad === static::AUTO_LOAD_GET) {
} elseif($this->autoLoad === static::AUTO_LOAD_GET) {
$this->load(Yii::$app->request->get());
} else if($this->autoLoad === static::AUTO_LOAD_POST) {
} elseif($this->autoLoad === static::AUTO_LOAD_POST) {
$this->load(Yii::$app->request->post());
}
}

View File

@ -251,7 +251,7 @@ abstract class BasePicker extends JsInputWidget
if ($this->form != null) {
return $this->form->field($this->model, $this->attribute)->dropDownList($selection, $options);
} else if ($this->model != null) {
} elseif ($this->model != null) {
return Html::activeDropDownList($this->model, $this->attribute, $selection, $options);
} else {
$name = (!$this->name) ? 'pickerField' : $this->name;

View File

@ -112,7 +112,7 @@ class Markdown extends JsInputWidget
if ($this->form != null) {
$textArea = $this->form->field($this->model, $this->attribute)->textarea($this->getOptions())->label($this->label);
} else if ($this->model != null) {
} elseif ($this->model != null) {
$textArea = Html::activeTextarea($this->model, $this->attribute, $this->getOptions());
} else {
$textArea = Html::textarea($this->name, $this->value, $this->getOptions());

View File

@ -66,7 +66,7 @@ class Followable extends Behavior
{
if($userId instanceof User) {
$userId = $userId->id;
} else if (!$userId || $userId == "") {
} elseif (!$userId || $userId == "") {
$userId = Yii::$app->user->id;
}
@ -100,7 +100,7 @@ class Followable extends Behavior
{
if($userId instanceof User) {
$userId = $userId->id;
} else if (!$userId || $userId == "") {
} elseif (!$userId || $userId == "") {
$userId = Yii::$app->user->id;
}
@ -130,7 +130,7 @@ class Followable extends Behavior
{
if($userId instanceof User) {
$userId = $userId->id;
} else if (!$userId || $userId == "") {
} elseif (!$userId || $userId == "") {
$userId = \Yii::$app->user->id;
}

View File

@ -166,7 +166,7 @@ class Follow extends \yii\db\ActiveRecord
if ($withNotifications === true) {
$subQuery->andWhere(['user_follow.send_notifications' => 1]);
} else if ($withNotifications === false) {
} elseif ($withNotifications === false) {
$subQuery->andWhere(['user_follow.send_notifications' => 0]);
}
@ -189,7 +189,7 @@ class Follow extends \yii\db\ActiveRecord
if ($withNotifications === true) {
$subQuery->andWhere(['user_follow.send_notifications' => 1]);
} else if ($withNotifications === false) {
} elseif ($withNotifications === false) {
$subQuery->andWhere(['user_follow.send_notifications' => 0]);
}

View File

@ -140,7 +140,7 @@ class UserPicker
if($permission != null && $permission instanceof \humhub\libs\BasePermission) {
$disabled = !$user->getPermissionManager()->can($permission);
} else if($permission != null) {
} elseif($permission != null) {
$disabled = $permission;
}

View File

@ -169,7 +169,7 @@ class Registration extends HForm
if ($defaultUserGroup != "") {
$groupFieldType = "hidden";
} else if (count($groupModels) == 1) {
} elseif (count($groupModels) == 1) {
$groupFieldType = "hidden";
$defaultUserGroup = $groupModels[0]->id;
}

View File

@ -262,7 +262,7 @@ class UserPicker extends \yii\base\Widget
if($permission != null && $permission instanceof \humhub\libs\BasePermission) {
$disabled = !$user->getPermissionManager()->can($permission);
} else if($permission != null) {
} elseif($permission != null) {
$disabled = $permission;
}

View File

@ -241,9 +241,9 @@ class HumHubDbTestCase extends Unit
{
if(is_int($user)) {
$user = User::findOne($user);
} else if (is_string($user)) {
} elseif (is_string($user)) {
$user = User::findOne(['username' => $user]);
} else if (!$user) {
} elseif (!$user) {
$user = Yii::$app->user->identity;
}

View File

@ -96,16 +96,15 @@ class Label extends BootstrapComponent
usort($labels, function ($a, $b) {
if ($a->_sortOrder == $b->_sortOrder) {
return 0;
} else
if ($a->_sortOrder < $b->_sortOrder) {
return - 1;
} else {
return 1;
}
} elseif ($a->_sortOrder < $b->_sortOrder) {
return - 1;
} else {
return 1;
}
});
return $labels;
}
}
?>
?>

View File

@ -35,7 +35,7 @@ class MailContentContainerInfoBox extends \yii\base\Widget
'description' => Helpers::trimText($this->container->description, 60)
]);
} else if ($this->container instanceof \humhub\modules\user\models\User) {
} elseif ($this->container instanceof \humhub\modules\user\models\User) {
return $this->render('mailContentContainerInfoBox', [
'container' => $this->container,
'url' => $this->container->createUrl('/user/profile', [], true),

View File

@ -58,14 +58,14 @@ class MailContentEntry extends \yii\base\Widget
if (is_string($this->content)) {
$content = $this->content;
} else if ($this->content instanceof Viewable) {
} elseif ($this->content instanceof Viewable) {
try {
$renderer = new ViewPathRenderer(['parent' => true, 'subPath' => 'mail']);
$content = $renderer->render($this->content);
} catch (\yii\base\ViewNotFoundException $e) {
Yii::error($e);
}
} else if ($this->content instanceof ContentOwner) {
} elseif ($this->content instanceof ContentOwner) {
$content = RichText::preview($this->content->getContentDescription());
if(!$this->originator) {
$this->originator = $this->content->content->createdBy;

View File

@ -27,7 +27,7 @@ if ($linkOutput == 'button') {
<?= $linkContent; ?>
</button>
<?php } else if ($linkOutput == 'a') { ?>
<?php } elseif ($linkOutput == 'a') { ?>
<!-- create normal link element -->
<a id="deleteLinkPost_<?= $uniqueID; ?>" <?= ($ariaLabel) ? ' aria-label="'.$ariaLabel.'"' : '' ?> class="<?= $class; ?> <?php if ($tooltip != '') : ?>tt<?php endif; ?>" style="<?= $style; ?>" href="#"