_relayConfiguration === NULL) { $this->_relayConfiguration = \Configuration::get('ANT_CARRIERS_OOH'); } return $this->_relayConfiguration; } public function isRelay() { $relayConfiguration = $this->getRelayConfiguration(); return in_array($this->id, explode(',', $relayConfiguration)); } public function getType() { if ($this->isRelay() === false) { return self::NORMAL; } else { if (strpos($this->name, 'Colissimo') !== false) { if (strpos($this->name, 'PickUp') !== false) { return self::COLSSIMO_PICKUP; } else { return self::COLSSIMO_OFFICE; } } elseif (strpos($this->name, 'Mondial Relay') !== false) { return self::MONDIALRELAY; } } return self::NORMAL; } protected function getUrlToGetRelays() { $url = null; $type = $this->getType(); if ($type === self::MONDIALRELAY) { $url = '/relays/mondialrelay'; } elseif ($type === self::COLSSIMO_OFFICE) { $url = '/relays/socolissimo/office'; } elseif ($type === self::COLSSIMO_PICKUP) { $url = '/relays/socolissimo/pickup'; } return $url; } /** * {@inheritdoc} */ public function toArray() { $relayConfiguration = $this->getRelayConfiguration(); $isRelay = in_array($this->id, explode(',', $relayConfiguration)); $urlToCall = $isRelay === false ? null : $this->getUrlToGetRelays($this->name); return array_merge(parent::toArray(), array( 'is_relay' => $isRelay, 'url_to_call' => $urlToCall, )); } }