Skip to content

Commit

Permalink
ECS fixes (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
HannahDeWachter authored Feb 15, 2024
2 parents d2f0334 + 8b477cb commit 3c8a2c9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/CarbonTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function init(): void
}

// Defer most setup tasks until Craft is fully initialized
Craft::$app->onInit(function () {
Craft::$app->onInit(function() {
$this->attachEventHandlers();
});
}
Expand All @@ -77,7 +77,7 @@ protected function settingsHtml(): ?string
private function attachEventHandlers(): void
{
Event::on(Entry::class, Entry::EVENT_AFTER_SAVE,
function (ModelEvent $event) {
function(ModelEvent $event) {
/** @var Entry $entry */
$entry = $event->sender;
if (!ElementHelper::isDraftOrRevision($entry) && $entry->getUrl()) {
Expand All @@ -92,7 +92,7 @@ function (ModelEvent $event) {
Event::on(
Entry::class,
Entry::EVENT_DEFINE_SIDEBAR_HTML,
function (DefineHtmlEvent $event) {
function(DefineHtmlEvent $event) {
/** @var Entry $entry */
$entry = $event->sender;
try {
Expand Down
2 changes: 0 additions & 2 deletions src/console/controllers/TestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ public function actionIndex(int $id): void
$data = CarbonTracker::getInstance()->api->getSite($entry);
dd($data);
}


}
4 changes: 2 additions & 2 deletions src/jobs/CarbonStatsJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ protected function defaultDescription(): string
*/
public function execute($queue): void
{
$entry = Entry::findOne(['id' => $this->entryId,'siteId' => $this->siteId]);
if($entry) {
$entry = Entry::findOne(['id' => $this->entryId, 'siteId' => $this->siteId]);
if ($entry) {
CarbonTracker::getInstance()->stats->upsertDataForEntry($entry);
}
}
Expand Down

0 comments on commit 3c8a2c9

Please sign in to comment.