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
        }
123
124
        return new Agent($inverseFunctionalIdentifier, $this->name);
125
    }
126
}
127

src/Mapping/StatementObject.php 1 location

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