public function getModel() { $inverseFunctionalIdentifier = null; if (null !== $this->mbox) { $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withMbox(IRI::fromString($this->mbox)); } elseif (null !== $this->mboxSha1Sum) { $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withMboxSha1Sum($this->mboxSha1Sum); } elseif (null !== $this->openId) { $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withOpenId($this->openId); } elseif (null !== $this->accountName && null !== $this->accountHomePage) { $inverseFunctionalIdentifier = InverseFunctionalIdentifier::withAccount(new Account($this->accountName, IRL::fromString($this->accountHomePage))); } if ('group' === $this->type) { $members = array(); foreach ($this->members as $agent) { $members[] = $agent->getModel(); } return new Group($inverseFunctionalIdentifier, $this->name, $members); } else { return new Agent($inverseFunctionalIdentifier, $this->name); } }
public function it_returns_a_new_instance_with_actor() { $actor = new Agent(InverseFunctionalIdentifier::withOpenId('http://openid.tincanapi.com')); $subStatement = $this->withActor($actor); $subStatement->shouldNotBe($this); $subStatement->shouldBeAnInstanceOf('\\Xabbuh\\XApi\\Model\\SubStatement'); $subStatement->getActor()->shouldReturn($actor); }
function it_is_equal_when_open_ids_are_equal() { $this->beConstructedThrough('withOpenId', array('http://openid.tincanapi.com')); $this->equals(InverseFunctionalIdentifier::withOpenId('http://openid.tincanapi.com'))->shouldReturn(true); }
public static function getOpenIdAndMemberGroup() { return new Group(InverseFunctionalIdentifier::withOpenId('http://group.openid.tincanapi.com'), null, array(self::getTypicalAgent())); }
private function configureAllProperties() { $id = StatementId::fromString('39e24cc4-69af-4b01-a824-1fdc6ea8a3af'); $actor = new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:conformancetest@tincanapi.com'))); $verb = new Verb(IRI::fromString('http://tincanapi.com/conformancetest/verbid')); $object = new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid')); $result = new Result(); $context = new Context(); $created = new \DateTime('2014-07-23T12:34:02-05:00'); $stored = new \DateTime('2014-07-24T12:34:02-05:00'); $authority = new Agent(InverseFunctionalIdentifier::withOpenId('http://openid.tincanapi.com')); $this->withId($id); $this->withActor($actor); $this->withVerb($verb); $this->withObject($object); $this->withResult($result); $this->withContext($context); $this->withCreated($created); $this->withStored($stored); $this->withAuthority($authority); }