public static function create($street, $number, $county, $country, $city, $state, $zipCode) { $instance = new self(); $instance->setStreet($street); $instance->setNumber($number); $instance->setCounty($county); $instance->setCountry($country); $instance->setCity($city); $instance->setState($state); $instance->setZipCode($zipCode); return $instance; }
/** * Read from a file * * @deprecated Use img.io.MetaDataReader instead * @param io.File file * @param var default default void what should be returned in case no data is found * @return img.util.IptcData * @throws lang.FormatException in case malformed meta data is encountered * @throws lang.ElementNotFoundException in case no meta data is available * @throws img.ImagingException in case reading meta data fails */ public static function fromFile(File $file) { if (FALSE === getimagesize($file->getURI(), $info)) { $e = new ImagingException('Cannot read image information from ' . $file->getURI()); xp::gc(__FILE__); throw $e; } if (!isset($info['APP13'])) { if (func_num_args() > 1) { return func_get_arg(1); } throw new ElementNotFoundException('Cannot get IPTC information from ' . $file->getURI() . ' (no APP13 marker)'); } if (!($iptc = iptcparse($info['APP13']))) { throw new FormatException('Cannot parse IPTC information from ' . $file->getURI()); } // Parse creation date if (3 == sscanf(@$iptc['2#055'][0], '%4d%2d%d', $year, $month, $day)) { $created = Date::create($year, $month, $day, 0, 0, 0); } else { $created = NULL; } with($i = new self()); $i->setTitle(@$iptc['2#005'][0]); $i->setUrgency(@$iptc['2#010'][0]); $i->setCategory(@$iptc['2#015'][0]); $i->setSupplementalCategories(@$iptc['2#020']); $i->setKeywords(@$iptc['2#025']); $i->setSpecialInstructions(@$iptc['2#040'][0]); $i->setDateCreated($created); $i->setAuthor(@$iptc['2#080'][0]); $i->setAuthorPosition(@$iptc['2#085'][0]); $i->setCity(@$iptc['2#090'][0]); $i->setState(@$iptc['2#095'][0]); $i->setCountry(@$iptc['2#101'][0]); $i->setOriginalTransmissionReference(@$iptc['2#103'][0]); $i->setHeadline(@$iptc['2#105'][0]); $i->setCredit(@$iptc['2#110'][0]); $i->setSource(@$iptc['2#115'][0]); $i->setCopyrightNotice(@$iptc['2#116'][0]); $i->setCaption(@$iptc['2#120'][0]); $i->setWriter(@$iptc['2#122'][0]); return $i; }
/** * @param array $data * * @return Name */ public static function factory(array $data) { $name = new self(); $name->setName($data['name']); $name->setGender($data['gender']); if (isset($data['probability'])) { $name->setProbability(floatval($data['probability'])); } if (isset($data['count'])) { $name->setCount($data['count']); } if (isset($data['country_id'])) { $name->setCountry($data['country_id']); } if (isset($data['language_id'])) { $name->setLanguage($data['language_id']); } return $name; }
/** * {@inheritdoc} */ public static function fromArray(array $values) { $message = new self(); $values = array_merge(['country' => null, 'language' => null, 'timezone' => null], $values); $message->setCountry($values['country']); $message->setLanguage($values['language']); $message->setTimezone($values['timezone']); return $message; }
public static function create(array $data) { $add = new self(); if (isset($data['street'])) { $add->setStreet($data['street']); } if (isset($data['city'])) { $add->setCity($data['city']); } if (isset($data['state'])) { $add->setState($data['state']); } if (isset($data['country'])) { $add->setCountry($data['country']); } if (isset($data['neighborhood'])) { $add->setNeighborhood($data['neighborhood']); } if (isset($data['number'])) { $add->setNumber((int) $data['number']); } if (isset($data['zipcode'])) { $add->setZipcode($data['zipcode']); } return $add; }