Code Duplication    Length = 26-26 lines in 2 locations

src/Mapping/Actor.php 1 location

@@ 100-125 (lines=26) @@
97
        return $actor;
98
    }
99
100
    public function getModel()
101
    {
102
        $inverseFunctionalIdentifier = null;
103
104
        if (null !== $this->mbox) {
105
            $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withMbox(IRI::fromString($this->mbox));
106
        } elseif (null !== $this->mboxSha1Sum) {
107
            $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withMboxSha1Sum($this->mboxSha1Sum);
108
        } elseif (null !== $this->openId) {
109
            $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withOpenId($this->openId);
110
        } elseif (null !== $this->accountName && null !== $this->accountHomePage) {
111
            $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withAccount(new Account($this->accountName, IRL::fromString($this->accountHomePage)));
112
        }
113
114
        if ('group' === $this->type) {
115
            $members = array();
116
117
            foreach ($this->members as $agent) {
118
                $members[] = $agent->getModel();
119
            }
120
121
            return new Group($inverseFunctionalIdentifier, $this->name, $members);
122
        } else {
123
            return new Agent($inverseFunctionalIdentifier, $this->name);
124
        }
125
    }
126
}
127

src/Mapping/Object.php 1 location

@@ 347-372 (lines=26) @@
344
        return new Activity(IRI::fromString($this->activityId), $definition);
345
    }
346
347
    private function getActorModel()
348
    {
349
        $inverseFunctionalIdentifier = null;
350
351
        if (null !== $this->mbox) {
352
            $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withMbox(IRI::fromString($this->mbox));
353
        } elseif (null !== $this->mboxSha1Sum) {
354
            $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withMboxSha1Sum($this->mboxSha1Sum);
355
        } elseif (null !== $this->openId) {
356
            $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withOpenId($this->openId);
357
        } elseif (null !== $this->accountName && null !== $this->accountHomePage) {
358
            $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withAccount(new Account($this->accountName, IRL::fromString($this->accountHomePage)));
359
        }
360
361
        if (self::TYPE_GROUP === $this->type) {
362
            $members = array();
363
364
            foreach ($this->members as $agent) {
365
                $members[] = $agent->getModel();
366
            }
367
368
            return new Group($inverseFunctionalIdentifier, $this->name, $members);
369
        } else {
370
            return new Agent($inverseFunctionalIdentifier, $this->name);
371
        }
372
    }
373
374
    private function getSubStatementModel()
375
    {