public function equals(Entitlement $that) { $thisEntitlement = $this->toArray(); $thatEntitlement = $that->toArray(); foreach ($thisEntitlement as $s) { if (!in_array($s, $thatEntitlement)) { return false; } } foreach ($thatEntitlement as $s) { if (!in_array($s, $thisEntitlement)) { return false; } } return true; }
public function testSerialize() { $s = new Entitlement(array("foo", "bar", "baz")); $t = new Entitlement($s->toArray()); $this->assertTrue($t->equals($s)); }
/** * OPTIONAL|NON-STANDARD. A space-separated list of strings representing * the entitlements associated with this token, in the format described in * Section 3.3 of OAuth 2.0 [RFC6749]. * * @return fkooman\OAuth\Common\Entitlement */ public function getEntitlement() { if (null === $this->getKeyValue('x-entitlement')) { return new Entitlement(); } return Entitlement::fromString($this->getKeyValue('x-entitlement')); }