Skip to content

Commit

Permalink
quick phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianodias8 committed Mar 31, 2020
1 parent 43ce59e commit eeacbf5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected function getRelatedEntity(ContentEntityInterface $entity) {
if (isset($this->pluginDefinition['credit_related'])) {
if ($this->pluginDefinition['credit_related'] == 'group') {
$node = $entity->getCommentedEntity();
if (empty($node)){
if (empty($node)) {
return FALSE;
}
$group_contents = $this->entityTypeManager->getStorage('group_content')->loadByEntity($node);
Expand All @@ -84,7 +84,7 @@ protected function getRelatedEntity(ContentEntityInterface $entity) {
}
if ($this->pluginDefinition['credit_related'] == 'group_content') {
$node = $entity->getCommentedEntity();
if (empty($node)){
if (empty($node)) {
return FALSE;
}
$group_contents = $this->entityTypeManager->getStorage('group_content')->loadByEntity($node);
Expand Down Expand Up @@ -123,8 +123,8 @@ protected function getGroup(GroupContentInterface $group_content) {
$group = $group_content->getGroup();

// Prevent further execution if no group was found.
if (empty($group)){
\Drupal::logger('entity_activity_tracker')->error($this->t('Couldn\'t find Group!'));
if (empty($group)) {
\Drupal::logger('entity_activity_tracker')->error($this->t("Couldn't find Group!"));
return FALSE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ protected function getRelatedEntity(ContentEntityInterface $entity) {
$group = $this->getGroup($group_content_related_entity);

// Prevent further execution if no group was found.
if (empty($group)){
if (empty($group)) {

\Drupal::logger('entity_activity_tracker')->error($this->t('Couldn\'t find Group!'));
\Drupal::logger('entity_activity_tracker')->error($this->t("Couldn't find Group!"));
return FALSE;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/ActivityProcessor/EntityCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function canProcess(Event $event) {
// load it again.
$entity = $event->getEntity();
$exists = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->load($entity->id());
if (empty($exists) && $event->getDispatcherType() == ActivityEventInterface::ENTITY_INSERT){
if (empty($exists) && $event->getDispatcherType() == ActivityEventInterface::ENTITY_INSERT) {
return ActivityProcessorInterface::SKIP;
}
return ActivityProcessorInterface::PROCESS;
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/ActivityProcessor/EntityEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function canProcess(Event $event) {
// load it again.
$entity = $event->getEntity();
$exists = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->load($entity->id());
if (empty($exists)){
if (empty($exists)) {
return ActivityProcessorInterface::SKIP;
}
return ActivityProcessorInterface::PROCESS;
Expand Down
11 changes: 1 addition & 10 deletions src/Plugin/ActivityProcessorCreditRelatedBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Drupal\entity_activity_tracker\Plugin;

use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\entity_activity_tracker\ActivityRecord;
use Drupal\entity_activity_tracker\Event\ActivityEventInterface;
use Drupal\entity_activity_tracker\Event\EntityActivityInsertEvent;
use Symfony\Component\EventDispatcher\Event;
Expand Down Expand Up @@ -50,13 +49,6 @@ public function processActivity(Event $event) {
}
break;

// Do nothing for related entities regarding the delete operation.
// case ActivityEventInterface::ENTITY_DELETE:
// /** @var \Drupal\entity_activity_tracker\ActivityRecord $activity_record */
// $activity_record = $this->activityRecordStorage->getActivityRecordByEntity($event->getEntity());
// $this->activityRecordStorage->deleteActivityRecord($activity_record);
// break;

case ActivityEventInterface::TRACKER_DELETE:
$tracker = $event->getTracker();
// Get ActivityRecords from this tracker.
Expand Down Expand Up @@ -125,7 +117,6 @@ public function canProcess(Event $event) {

default:
return ActivityProcessorInterface::PROCESS;
break;
}
}

Expand All @@ -145,7 +136,7 @@ protected function getRelatedEntity(ContentEntityInterface $entity) {
}
if ($this->pluginDefinition['credit_related'] == 'user') {
$user = $entity->getOwner();
// prevent schedule for anonymous users.
// Prevent schedule for anonymous users.
return $user->id() != 0 ? $user : FALSE;
}
}
Expand Down

0 comments on commit eeacbf5

Please sign in to comment.