/** * @param Country $country * @param int $width * * @return string */ public function __invoke(Country $country, $width = 20) { $flag = $country->getFlag(); if (is_null($flag)) { return ''; } /* * Reset the classes */ $this->setClasses([]); $this->setRouter('assets/country-flag'); $this->addRouterParam('iso3', strtolower($country->getIso3())); $this->addRouterParam('ext', 'png'); $this->setImageId('country_flag_' . $country->getIso3()); $this->setWidth($width); return $this->createImageUrl(); }
/** * Needed for the hydration of form elements * * @return array */ public function getArrayCopy() { return ['country' => $this->country->getIso3(), 'type' => $this->type, 'address' => $this->address, 'city' => $this->city, 'zipCode' => $this->zipCode]; }