mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
Remove old files
This commit is contained in:
parent
0a19ca5e19
commit
7040ad1344
|
@ -1,17 +0,0 @@
|
||||||
actor: Tester
|
|
||||||
paths:
|
|
||||||
tests: tests
|
|
||||||
log: tests/_output
|
|
||||||
data: tests/_data
|
|
||||||
helpers: tests/_support
|
|
||||||
settings:
|
|
||||||
bootstrap: _bootstrap.php
|
|
||||||
colors: true
|
|
||||||
memory_limit: 1024M
|
|
||||||
modules:
|
|
||||||
config:
|
|
||||||
Db:
|
|
||||||
dsn: ''
|
|
||||||
user: ''
|
|
||||||
password: ''
|
|
||||||
dump: tests/_data/dump.sql
|
|
|
@ -43,29 +43,9 @@ class ApiServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
$this->routes();
|
$this->routes();
|
||||||
|
|
||||||
$this->registerActivitySerializers();
|
|
||||||
$this->registerNotificationSerializers();
|
$this->registerNotificationSerializers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Register activity serializers.
|
|
||||||
*/
|
|
||||||
protected function registerActivitySerializers()
|
|
||||||
{
|
|
||||||
$blueprints = [];
|
|
||||||
$serializers = [
|
|
||||||
'posted' => 'Flarum\Api\Serializers\PostBasicSerializer',
|
|
||||||
'startedDiscussion' => 'Flarum\Api\Serializers\PostBasicSerializer',
|
|
||||||
'joined' => 'Flarum\Api\Serializers\UserSerializer'
|
|
||||||
];
|
|
||||||
|
|
||||||
event(new RegisterActivityTypes($blueprints, $serializers));
|
|
||||||
|
|
||||||
foreach ($serializers as $type => $serializer) {
|
|
||||||
ActivitySerializer::setSubjectSerializer($type, $serializer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register notification serializers.
|
* Register notification serializers.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
<?php namespace Flarum\Events;
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
use ReflectionClass;
|
|
||||||
|
|
||||||
class RegisterActivityTypes
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $blueprints;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $serializers;
|
|
||||||
|
|
||||||
public function __construct(array &$blueprints, array &$serializers = [])
|
|
||||||
{
|
|
||||||
$this->blueprints = &$blueprints;
|
|
||||||
$this->serializers = &$serializers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function register($blueprint, $serializer)
|
|
||||||
{
|
|
||||||
if (! (new ReflectionClass($blueprint))->implementsInterface('Flarum\Core\Activity\Blueprint')) {
|
|
||||||
throw new InvalidArgumentException('Activity blueprint ' . $blueprint
|
|
||||||
. ' must implement Flarum\Core\Activity\Blueprint');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->blueprints[] = $blueprint;
|
|
||||||
|
|
||||||
$this->serializers[$blueprint::getType()] = $serializer;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user