blob: fefa1227073322eecb3e0640f82d384ca387110c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<?php
namespace Digitigrade\Job;
use Digitigrade\Job;
use Digitigrade\Logger;
use Digitigrade\Model\Actor;
use Digitigrade\Model\Interaction;
use Digitigrade\Model\Note;
class ProcessIncomingPush extends Job {
public \stdClass $object;
public function __construct(\stdClass $object) {
$this->object = $object;
$this->remainingTries = 3;
}
public function run() {
assert(isset($this->object->type));
$log = Logger::getInstance();
switch ($this->object->type) {
case 'actor':
$log->info('importing actor with uri ' . $this->object->self);
Actor::importFromReceivedObject($this->object);
break;
case 'note':
$log->info('importing note with uri ' . $this->object->self);
Note::importFromReceivedObject($this->object);
break;
case 'interaction':
$log->info('importing interaction with uri ' . $this->object->self);
Interaction::importFromReceivedObject($this->object);
break;
case 'extension':
case 'tombstone':
throw new \RuntimeException('object type ' . $this->object->type . ' not yet implemented :(');
default:
throw new \RuntimeException('invalid object type: ' . $this->object->type);
}
}
}
|