Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Jun 12, 2024
1 parent 5440ba9 commit c21449c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
if ($serializer->getActor()->isAdmin()) {
$attributes['fof-pretty-mail.extra-template-attrs'] = array_keys(resolve('fof-pretty-mail.additional-data'));
}

return $attributes;
}),
];
24 changes: 17 additions & 7 deletions src/Extend/PrettyMail.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<?php

/*
* This file is part of fof/pretty-mail.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

namespace FoF\PrettyMail\Extend;

use Flarum\Extend\ExtenderInterface;
Expand All @@ -9,29 +19,29 @@
class PrettyMail implements ExtenderInterface
{
protected $data = [];

/**
* @param string $key
* @param string $key
* @param callable|string $callback
*
*
* The callback can be a closure or an invokable class, and should accept:
* - \Flarum\Notification\Blueprint\BlueprintInterface $blueprint
*
* The callable should return a string value to assign to the key when the template is rendered.
* - string $value
*
*
* @return self
*/
public function addTemplateData(string $key, $callback): self
{
$this->data[$key] = $callback;

return $this;
}

public function extend(Container $container, Extension $extension = null)
{
$container->extend('fof-pretty-mail.additional-data', function($items) {
$container->extend('fof-pretty-mail.additional-data', function ($items) {
return array_merge($items, $this->data);
});
}
Expand Down

0 comments on commit c21449c

Please sign in to comment.