Example #1
0
 /**
  * {@inheritdoc}
  */
 public function equals(Object $statement)
 {
     if ('Xabbuh\\XApi\\Model\\SubStatement' !== get_class($statement)) {
         return false;
     }
     /** @var SubStatement $statement */
     if ($this->id !== $statement->id) {
         return false;
     }
     if (!$this->actor->equals($statement->actor)) {
         return false;
     }
     if (!$this->verb->equals($statement->verb)) {
         return false;
     }
     if (!$this->object->equals($statement->object)) {
         return false;
     }
     if (null === $this->result && null !== $statement->result) {
         return false;
     }
     if (null !== $this->result && null === $statement->result) {
         return false;
     }
     if (null !== $this->result && !$this->result->equals($statement->result)) {
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Checks if another statement is equal.
  *
  * Two statements are equal if and only if all of their properties are equal.
  *
  * @param Statement $statement The statement to compare with
  *
  * @return bool True if the statements are equal, false otherwise
  */
 public function equals(Statement $statement)
 {
     if ($this->id !== $statement->id) {
         return false;
     }
     if (!$this->actor->equals($statement->actor)) {
         return false;
     }
     if (!$this->verb->equals($statement->verb)) {
         return false;
     }
     if (!$this->object->equals($statement->object)) {
         return false;
     }
     if (null === $this->result && null !== $statement->result) {
         return false;
     }
     if (null !== $this->result && null === $statement->result) {
         return false;
     }
     if (null !== $this->result && !$this->result->equals($statement->result)) {
         return false;
     }
     if (null === $this->authority && null !== $statement->authority) {
         return false;
     }
     if (null !== $this->authority && null === $statement->authority) {
         return false;
     }
     if (null !== $this->authority && !$this->authority->equals($statement->authority)) {
         return false;
     }
     return true;
 }
Example #3
0
 /**
  * Checks if another statement is equal.
  *
  * Two statements are equal if and only if all of their properties are equal.
  *
  * @param Statement $statement The statement to compare with
  *
  * @return bool True if the statements are equal, false otherwise
  */
 public function equals(Statement $statement)
 {
     if (null !== $this->id xor null !== $statement->id) {
         return false;
     }
     if (null !== $this->id && null !== $statement->id && !$this->id->equals($statement->id)) {
         return false;
     }
     if (!$this->actor->equals($statement->actor)) {
         return false;
     }
     if (!$this->verb->equals($statement->verb)) {
         return false;
     }
     if (!$this->object->equals($statement->object)) {
         return false;
     }
     if (null === $this->result && null !== $statement->result) {
         return false;
     }
     if (null !== $this->result && null === $statement->result) {
         return false;
     }
     if (null !== $this->result && !$this->result->equals($statement->result)) {
         return false;
     }
     if (null === $this->authority && null !== $statement->authority) {
         return false;
     }
     if (null !== $this->authority && null === $statement->authority) {
         return false;
     }
     if (null !== $this->authority && !$this->authority->equals($statement->authority)) {
         return false;
     }
     if ($this->created != $statement->created) {
         return false;
     }
     if (null !== $this->context xor null !== $statement->context) {
         return false;
     }
     if (null !== $this->context && null !== $statement->context && !$this->context->equals($statement->context)) {
         return false;
     }
     if (null !== $this->attachments xor null !== $statement->attachments) {
         return false;
     }
     if (null !== $this->attachments && null !== $statement->attachments) {
         if (count($this->attachments) !== count($statement->attachments)) {
             return false;
         }
         foreach ($this->attachments as $key => $attachment) {
             if (!$attachment->equals($statement->attachments[$key])) {
                 return false;
             }
         }
     }
     return true;
 }
Example #4
0
 /**
  * Checks if another verb is equal.
  *
  * Two verbs are equal if and only if all of their properties are equal.
  *
  * @param Verb $verb The verb to compare with
  *
  * @return bool True if the verbs are equal, false otherwise
  */
 public function equals(Verb $verb)
 {
     if ($this->id !== $verb->getId()) {
         return false;
     }
     if (count($this->display) !== count($verb->getDisplay())) {
         return false;
     }
     foreach ($this->display as $language => $value) {
         if (!isset($verb->display[$language])) {
             return false;
         }
         if ($value !== $verb->display[$language]) {
             return false;
         }
     }
     return true;
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public function equals(Object $statement)
 {
     if ('Xabbuh\\XApi\\Model\\SubStatement' !== get_class($statement)) {
         return false;
     }
     /** @var SubStatement $statement */
     if (!$this->actor->equals($statement->actor)) {
         return false;
     }
     if (!$this->verb->equals($statement->verb)) {
         return false;
     }
     if (!$this->object->equals($statement->object)) {
         return false;
     }
     if (null === $this->result && null !== $statement->result) {
         return false;
     }
     if (null !== $this->result && null === $statement->result) {
         return false;
     }
     if (null !== $this->result && !$this->result->equals($statement->result)) {
         return false;
     }
     if ($this->timestamp != $statement->timestamp) {
         return false;
     }
     if (null !== $this->context xor null !== $statement->context) {
         return false;
     }
     if (null !== $this->context && null !== $statement->context && !$this->context->equals($statement->context)) {
         return false;
     }
     if (null !== $this->attachments xor null !== $statement->attachments) {
         return false;
     }
     if (null !== $this->attachments && null !== $statement->attachments) {
         if (count($this->attachments) !== count($statement->attachments)) {
             return false;
         }
         foreach ($this->attachments as $key => $attachment) {
             if (!$attachment->equals($statement->attachments[$key])) {
                 return false;
             }
         }
     }
     return true;
 }
Example #6
0
 function __construct($attr = array())
 {
     parent::__construct(NULL, $attr);
 }
Example #7
0
 /**
  * Creates a Verb that can be used to void a {@link StatementInterface Statement}.
  *
  * @return Verb
  */
 public static function createVoidVerb()
 {
     $verb = new Verb();
     $verb->setId('http://adlnet.gov/expapi/verbs/voided');
     return $verb;
 }
Example #8
0
 /**
  * SMS Constructor
  * 
  * Instatiates a new SMS object with room and optional attributes.
  * Possible attributes are:
  * 	"to"	=> phone #
  * 	"from"	=> sms capable phone #
  * 	"action"	=> true|false (default: true)
  * 	"method"	=> 'GET'|'POST', (default: POST)
  * 	"statusCallback"	=> relative or absolute URL
  *
  * @param string $message SMS message to send
  * @param array $attr Optional attributes
  * @return SMS
  */
 function __construct($message = '', $attr = array())
 {
     parent::__construct($message, $attr);
 }
Example #9
0
 /**
  * {@inheritDoc}
  */
 public function getVoidStatement(ActorInterface $actor)
 {
     $voidStatement = new Statement();
     $voidStatement->setActor($actor);
     $voidStatement->setVerb(Verb::createVoidVerb());
     $statementReference = new StatementReference();
     $statementReference->setStatementId($this->id);
     $voidStatement->setObject($statementReference);
     return $voidStatement;
 }
Example #10
0
 /**
  * Filters by a verb.
  *
  * @param Verb $verb The Verb to filter by
  *
  * @return self The statements filter
  */
 public function byVerb(Verb $verb)
 {
     $this->filter['verb'] = $verb->getId();
     return $this;
 }