/** * {@inheritDoc} */ public function add(ObjectInterface $object) { if (!$object->getParentId() && $this->container) { $object->setParentId($this->container->getId()); } $this->objects[] = $object; }
/** * Publish an event by calling all listeners that have registered to receive it. * * @param string|EventInterface $event The event name or a EventInterface object * @param array|Traversable $attributes An associative array or a Traversable object * @param ObjectInterface $target The event target * @return null|EventInterface Returns the event object. If the chain is not enabled will return NULL. */ public function publishEvent($event, $attributes = array(), $target = null) { if ($this->isEnabled()) { //Make sure we have an event object if (!$event instanceof EventInterface) { $event = new Event($event, $attributes, $target); } //Notify the listeners $listeners = $this->getListeners($event->getName()); foreach ($listeners as $listener) { $start = microtime(true); call_user_func($listener, $event, $this); $this->__profiles[] = array('message' => $event->getName(), 'period' => microtime(true) - $start, 'time' => microtime(true), 'memory' => $this->getMemoryUsage(), 'target' => $target instanceof ObjectInterface ? $target->getIdentifier() : $target, 'listener' => $listener); if (!$event->canPropagate()) { break; } } return $event; } else { $this->getDelegate()->publishEvent($event, $attributes, $target); } return null; }
/** * Convert the RPSL objects into its JSON representation. * * @param ObjectInterface $object RPSL object. * @return string */ public function createJSON(ObjectInterface $object) { $source = $object->getAttribute('source'); if (!$source->isDefined()) { $source->addValue($this->getSource(\CASE_UPPER)); } // otherwise the intended exception won’t make it through return json_encode($object->toArray()); }
public function __toString() { return $this->file->getContent(); }
/** * Check if the user is equal * * @param UserInterface $user * @return Boolean */ public function equals(ObjectInterface $user) { if ($user instanceof UserInterface) { if ($user->getEmail() == $this->getEmail()) { if ($user->getPassword() == $this->getPassword()) { return true; } } } return false; }
/** * @inheritDoc */ public function isEqual(ObjectInterface $obj) { return $obj->getId() == $this->getId() && $this->type() == $obj->type(); }