Example #1
0
 public static function parse($isAddress = TRUE)
 {
     $SCA = new self($isAddress);
     $size = hexdec(PDU::getPduSubstr(2));
     if ($size) {
         // if is OA or DA size in digits
         if ($isAddress) {
             if ($size % 2 != 0) {
                 $size++;
             }
             // else size in octets
         } else {
             $size--;
             $size *= 2;
         }
         $SCA->setType(new SCA\Type(hexdec(PDU::getPduSubstr(2))));
         $hex = PDU::getPduSubstr($size);
         switch ($SCA->getType()->getType()) {
             case SCA\Type::TYPE_UNKNOWN:
             case SCA\Type::TYPE_INTERNATIONAL:
             case SCA\Type::TYPE_ACCEPTER_INTO_NET:
             case SCA\Type::TYPE_SUBSCRIBER_NET:
             case SCA\Type::TYPE_TRIMMED:
                 $SCA->setPhone(rtrim(implode("", array_map('strrev', array_map(array('self', '_map_filter_decode'), str_split($hex, 2)))), 'F'));
                 break;
             case SCA\Type::TYPE_ALPHANUMERICAL:
                 $SCA->setPhone(PDU\Helper::decode7bit($hex));
                 break;
         }
     }
     return $SCA;
 }
Example #2
0
 /**
  * Build a paymentMethod entity based on a json-decoded payment_method stdClass
  *
  * @param  stdClass $response The payment method data
  * @return Syspay_Merchant_Entity_PaymentMethod The payment method object
  */
 public static function buildFromResponse(stdClass $response)
 {
     $paymentMethod = new self();
     $paymentMethod->setType(isset($response->type) ? $response->type : null);
     $paymentMethod->setDisplay(isset($response->display) ? $response->display : null);
     return $paymentMethod;
 }
Example #3
0
 /**
  * setState (convert from array to object).
  *
  * @return string
  */
 public static function __set_state($array)
 {
     $businessPropery = new self();
     $businessPropery->setType($array['type']);
     $businessPropery->setEntityProperty($array['entityProperty']);
     return $businessPropery;
 }
Example #4
0
 public static function create($type, $ddd, $number)
 {
     $instance = new self();
     $instance->setType($type);
     $instance->setDDD($ddd);
     $instance->setNumber($number);
     return $instance;
 }
 /**
  * @param Schema   $schema
  * @param Property $property
  * @param string $operationType
  * @return Operation
  */
 public static function factory(Schema $schema, Property $property, $operationType)
 {
     $operation = new self();
     $operation->setType($operationType);
     $operation->setSchema($schema);
     $operation->setPath($property->getPath());
     $operation->setValue($property->getValue());
     return $operation;
 }
 public static function create($target = null, $method = null, array $args = null, $type = null)
 {
     $request = new self();
     $request->setTarget($target);
     $request->setMethod($method);
     $request->setArgs($args);
     $request->setType($type);
     return $request;
 }
Example #7
0
 public static function parse()
 {
     $byte = hexdec(PDU::getPduSubstr(2));
     $self = new self();
     $self->setPid($byte >> 6);
     $self->setIndicates($byte >> 5);
     $self->setType($byte);
     return $self;
 }
Example #8
0
 public static function create($type, $data = null)
 {
     $o = new self();
     $o->FIN = true;
     $o->payloadData = $data;
     $o->payloadLength = $data != null ? strlen($data) : 0;
     $o->setType($type);
     return $o;
 }
Example #9
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement
  *     $xmlElement)
  * @return CultureFeed_Cdb_Data_Category
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     $language = new self((string) $xmlElement);
     $attributes = $xmlElement->attributes();
     if (isset($attributes['type'])) {
         $language->setType((string) $attributes['type']);
     }
     return $language;
 }
Example #10
0
 /**
  * @param string      $title
  * @param string      $urn
  * @param string|null $theme
  * @param string|null $layout
  *
  * @return Node
  */
 public static function createPage($title, $urn, $theme = null, $layout = null)
 {
     $page = new self();
     $page->setType(self::TYPE_PAGE);
     $page->setTitle($title);
     $page->setUrn($urn);
     $page->setTheme($theme);
     $page->setLayout($layout);
     return $page;
 }
Example #11
0
 /**
  * @param $queryStr
  * @param $params
  * @return Query
  */
 public static function sql($queryStr, $params = null)
 {
     $query = new self();
     if ($params) {
         $query->params = $params;
     }
     $query->setType(self::TYPE_QUERY);
     $query->query = $queryStr;
     return $query;
 }
Example #12
0
 public static function initWithArray($array)
 {
     $instance = new self(NULL, NULL, NULL, NULL, NULL);
     $instance->setName($array[Location::LOCATION_NAME]);
     $instance->setId($array[Location::LOCATION_ID]);
     $instance->setLattitude($array[Location::LOCATION_LATTITUDE]);
     $instance->setLongitude($array[Location::LOCATION_LONGITUDE]);
     $instance->setType($array[Location::LOCATION_TYPE]);
     return $instance;
 }
 /**
  * @param string $id
  * @param string $type
  * @param string $legalDocument
  * @param string $name
  * @param Address $address
  * @param Phone $phone
  * @return Customer
  */
 public static function create($id, $type, $legalDocument, $name, Address $address, $phone)
 {
     $instance = new self();
     $instance->setId($id);
     $instance->setType($type);
     $instance->setLegalDocument1($legalDocument);
     $instance->setName($name);
     $instance->setAddress($address);
     $instance->addPhone($phone);
     return $instance;
 }
Example #14
0
 /**
  * @param string $key     Input field key
  * @param string $type    Input field type
  * @param array  $options
  */
 public function add($key, $type = self::TYPE_STRING, $options = [])
 {
     $node = new self();
     $node->setType($type);
     if (isset($options['required'])) {
         $node->setRequired($options['required']);
     }
     if (isset($options['constraints'])) {
         $node->setConstraints($options['constraints']);
     }
     $this->offsetSet($key, $node);
     return $node;
 }
Example #15
0
 /**
  * @param array $array
  * @return $this
  */
 public static function fromArray(array $array)
 {
     if (isset($array["type"]) === false || isset($array["id"]) === false) {
         return null;
     }
     $resourceIdentifier = new self();
     $resourceIdentifier->setType($array["type"]);
     $resourceIdentifier->setId($array["id"]);
     if (isset($array["meta"]) === true) {
         $resourceIdentifier->setMeta($array["meta"]);
     }
     return $resourceIdentifier;
 }
 /**
  * @param array $data
  * @return Property
  */
 public static function factory(array $data = array())
 {
     $property = new self();
     $property->setName(self::stockProperty($data, SchemaEnum::NAME));
     $property->setDescription(self::stockProperty($data, SchemaEnum::DESCRIPTION));
     $property->setType(self::stockProperty($data, SchemaEnum::TYPE));
     $property->setEnum(self::stockProperty($data, SchemaEnum::ENUM));
     $property->setPattern(self::stockProperty($data, SchemaEnum::PATTERN));
     if (isset($data[SchemaEnum::ITEMS])) {
         // handle sub-schemas
         $property->setItems($data[SchemaEnum::ITEMS]);
     }
     return $property;
 }
Example #17
0
 public static function createFromBase(Zf2ColumnObject $base)
 {
     $column = new self($base->name, $base->tableName, $base->schemaName);
     $column->ordinalPosition = $base->ordinalPosition;
     $column->columnDefault = $base->columnDefault;
     $column->isNullable = $base->isNullable;
     $column->characterMaximumLength = $base->characterMaximumLength;
     $column->characterOctetLength = $base->characterOctetLength;
     $column->numericPrecision = $base->numericPrecision;
     $column->numericScale = $base->numericScale;
     $column->numericUnsigned = $base->numericUnsigned;
     $column->errata = $base->errata;
     $column->setType($column->simplifiedDataType($base->dataType));
     return $column;
 }
Example #18
0
 /**
  * @param array $array
  * @param ExceptionFactoryInterface $exceptionFactory
  * @return $this
  * @throw \Exception
  */
 public static function fromArray(array $array, ExceptionFactoryInterface $exceptionFactory)
 {
     if (isset($array["type"]) === false) {
         throw $exceptionFactory->createResourceIdentifierTypeMissing($array);
     }
     if (isset($array["id"]) === false) {
         throw $exceptionFactory->createResourceIdentifierIdMissing($array);
     }
     $resourceIdentifier = new self();
     $resourceIdentifier->setType($array["type"]);
     $resourceIdentifier->setId($array["id"]);
     if (isset($array["meta"]) === true) {
         $resourceIdentifier->setMeta($array["meta"]);
     }
     return $resourceIdentifier;
 }
Example #19
0
 public static function byPath($_pathfile)
 {
     if (!file_exists($_pathfile)) {
         throw new Exception('Chemin jusqu\'au widget non trouvé : ' . $_pathfile);
     }
     $path_parts = pathinfo($_pathfile);
     $informations = explode('.', $path_parts['basename']);
     $widget = new self();
     $widget->setType($informations[1]);
     $widget->setSubtype($informations[2]);
     $widget->setName($informations[3]);
     $folder = explode('/', $path_parts['dirname']);
     $widget->setVersion($folder[count($folder) - 1]);
     $widget->setContent(file_get_contents($_pathfile));
     $widget->setPath($_pathfile);
     return $widget;
 }
Example #20
0
 public static function construct($_arrayMarket)
 {
     $market = new self();
     if (!isset($_arrayMarket['id'])) {
         return;
     }
     $market->setId($_arrayMarket['id']);
     $market->setName($_arrayMarket['name']);
     $market->setType($_arrayMarket['type']);
     $market->datetime = json_encode($_arrayMarket['datetime'], JSON_UNESCAPED_UNICODE);
     $market->setDescription($_arrayMarket['description']);
     $market->setDownloaded($_arrayMarket['downloaded']);
     $market->setUser_id($_arrayMarket['user_id']);
     $market->setVersion($_arrayMarket['version']);
     $market->setCategorie($_arrayMarket['categorie']);
     $market->status = json_encode($_arrayMarket['status'], JSON_UNESCAPED_UNICODE);
     $market->setAuthor($_arrayMarket['author']);
     $market->setChangelog($_arrayMarket['changelog']);
     $market->setLogicalId($_arrayMarket['logicalId']);
     $market->setUtilization($_arrayMarket['utilization']);
     $market->setCertification($_arrayMarket['certification']);
     $market->setPurchase($_arrayMarket['purchase']);
     $market->setCost($_arrayMarket['cost']);
     $market->rating = $_arrayMarket['rating'];
     $market->setBuyer($_arrayMarket['buyer']);
     $market->setUpdateBy($_arrayMarket['updateBy']);
     $market->setPrivate($_arrayMarket['private']);
     $market->img = json_encode($_arrayMarket['img'], JSON_UNESCAPED_UNICODE);
     $market->link = json_encode($_arrayMarket['link'], JSON_UNESCAPED_UNICODE);
     $market->language = json_encode($_arrayMarket['language'], JSON_UNESCAPED_UNICODE);
     if (isset($_arrayMarket['hardwareCompatibility'])) {
         $market->hardwareCompatibility = json_encode($_arrayMarket['hardwareCompatibility'], JSON_UNESCAPED_UNICODE);
     }
     $market->change = '';
     $market->setRealcost($_arrayMarket['realCost']);
     if (!isset($_arrayMarket['isAuthor'])) {
         $_arrayMarket['isAuthor'] = true;
     }
     $market->setIsAuthor($_arrayMarket['isAuthor']);
     return $market;
 }
Example #21
0
 static function fromArray(array $a_def)
 {
     // The array must have a name and class. Or else...
     if (!isset($a_def['name'])) {
         throw new exceptions\HttpInternalServerError("Name undefined in dependency definition");
     }
     if (!isset($a_def['class'])) {
         throw new exceptions\HttpInternalServerError("Class name undefined in dependency definition '" . $a_def['name'] . "'");
     }
     $def = new self();
     $def->setName($a_def['name']);
     $def->setClass($a_def['class']);
     if (isset($a_def['dependencies'])) {
         $def->setDependencies($a_def['dependencies']);
     }
     if (isset($a_def['mother'])) {
         $def->setMother($a_def['mother']);
     }
     if (isset($a_def['type'])) {
         $def->setType($a_def['type']);
     }
     return $def;
 }
Example #22
0
 public static function createAndExec($_type, $_cmd, $_options)
 {
     $scenarioExpression = new self();
     $scenarioExpression->setType($_type);
     $scenarioExpression->setExpression($_cmd);
     if (is_array($_options)) {
         foreach ($_options as $key => $value) {
             $scenarioExpression->setOptions($key, $value);
         }
     }
     return $scenarioExpression->execute();
 }
 public static function factory($constructedChartData, $loadFromDB = true)
 {
     $chartObj = new self();
     if (isset($constructedChartData['chart_id'])) {
         $chartObj->setId((int) $constructedChartData['chart_id']);
         if ($loadFromDB) {
             $chartObj->loadFromDB();
             $chartObj->prepareData();
             $chartObj->shiftStringColumnUp();
         }
     }
     // Main data (steps 1-3 of chart constructor)
     $chartObj->setwpDataTableId($constructedChartData['wpdatatable_id']);
     $chartObj->setTitle($constructedChartData['chart_title']);
     $chartObj->setEngine($constructedChartData['chart_engine']);
     $chartObj->setType($constructedChartData['chart_type']);
     $chartObj->setSelectedColumns($constructedChartData['selected_columns']);
     $chartObj->setRangeType($constructedChartData['range_type']);
     if (isset($constructedChartData['range_data'])) {
         $chartObj->setRowRange($constructedChartData['range_data']);
     }
     $chartObj->setFollowFiltering((bool) $constructedChartData['follow_filtering']);
     // Render data (step 4 or chart constructor)
     $chartObj->setShowTitle(WDTTools::defineDefaultValue($constructedChartData, 'show_title', ''));
     $chartObj->setWidth(WDTTools::defineDefaultValue($constructedChartData, 'width', 400));
     $chartObj->setHeight(WDTTools::defineDefaultValue($constructedChartData, 'height', 400));
     $chartObj->setShowGrid(WDTTools::defineDefaultValue($constructedChartData, 'show_grid', true));
     $chartObj->setShowLegend(WDTTools::defineDefaultValue($constructedChartData, 'show_legend', true));
     $chartObj->setMajorAxisLabel(WDTTools::defineDefaultValue($constructedChartData, 'horizontal_axis_label', ''));
     $chartObj->setMinorAxisLabel(WDTTools::defineDefaultValue($constructedChartData, 'vertical_axis_label', ''));
     if (!empty($constructedChartData['series_data'])) {
         $chartObj->setUserDefinedSeriesData($constructedChartData['series_data']);
     }
     $chartObj->loadChildWPDataTable();
     return $chartObj;
 }
Example #24
0
 /**
  * Sets the type of elements to returns.
  *
  * @param  string $name  directory or file or any (for both file and directory)
  * @return sfFinder new sfFinder object
  */
 public static function type($name)
 {
     $finder = new self();
     return $finder->setType($name);
 }
 /**
  * {@inheritdoc}
  */
 public static function fromArray(array $values)
 {
     $message = new self();
     $values = array_merge(['fort_id' => null, 'team_color' => null, 'pokemon_data' => null, 'name' => null, 'image_urls' => [], 'fp' => null, 'stamina' => null, 'max_stamina' => null, 'type' => null, 'latitude' => null, 'longitude' => null, 'description' => null, 'modifiers' => []], $values);
     $message->setFortId($values['fort_id']);
     $message->setTeamColor($values['team_color']);
     $message->setPokemonData($values['pokemon_data']);
     $message->setName($values['name']);
     $message->setFp($values['fp']);
     $message->setStamina($values['stamina']);
     $message->setMaxStamina($values['max_stamina']);
     $message->setType($values['type']);
     $message->setLatitude($values['latitude']);
     $message->setLongitude($values['longitude']);
     $message->setDescription($values['description']);
     foreach ($values['image_urls'] as $item) {
         $message->addImageUrls($item);
     }
     foreach ($values['modifiers'] as $item) {
         $message->addModifiers($item);
     }
     return $message;
 }
Example #26
0
 /**
  * {@inheritdoc}
  */
 public static function fromArray(array $values)
 {
     $message = new self();
     $values = array_merge(['type' => null, 'action_start_ms' => null, 'duration_ms' => null, 'energy_delta' => null, 'attacker_index' => null, 'target_index' => null, 'active_pokemon_id' => null, 'player_joined' => null, 'battle_results' => null, 'damage_windows_start_timestamp_ms' => null, 'damage_windows_end_timestamp_ms' => null, 'player_left' => null, 'target_pokemon_id' => null], $values);
     $message->setType($values['type']);
     $message->setActionStartMs($values['action_start_ms']);
     $message->setDurationMs($values['duration_ms']);
     $message->setEnergyDelta($values['energy_delta']);
     $message->setAttackerIndex($values['attacker_index']);
     $message->setTargetIndex($values['target_index']);
     $message->setActivePokemonId($values['active_pokemon_id']);
     $message->setPlayerJoined($values['player_joined']);
     $message->setBattleResults($values['battle_results']);
     $message->setDamageWindowsStartTimestampMs($values['damage_windows_start_timestamp_ms']);
     $message->setDamageWindowsEndTimestampMs($values['damage_windows_end_timestamp_ms']);
     $message->setPlayerLeft($values['player_left']);
     $message->setTargetPokemonId($values['target_pokemon_id']);
     return $message;
 }
 /**
  * {@inheritdoc}
  */
 public static function fromArray(array $values)
 {
     $message = new self();
     $values = array_merge(['name' => null, 'number' => null, 'label' => null, 'type' => null, 'type_name' => null, 'extendee' => null, 'default_value' => null, 'oneof_index' => null, 'json_name' => null, 'options' => null], $values);
     $message->setName($values['name']);
     $message->setNumber($values['number']);
     $message->setLabel($values['label']);
     $message->setType($values['type']);
     $message->setTypeName($values['type_name']);
     $message->setExtendee($values['extendee']);
     $message->setDefaultValue($values['default_value']);
     $message->setOneofIndex($values['oneof_index']);
     $message->setJsonName($values['json_name']);
     $message->setOptions($values['options']);
     return $message;
 }
 /**
  * @param $index
  * @param $title
  * @param $image
  * @param string $type
  * @param string $submitTitle
  * @param string $submitClass
  *
  * @return Panel
  *
  * @author Panagiotis Vagenas <*****@*****.**>
  * @since ${VERSION}
  */
 public function factory($index, $title, $image, $type = 'main', $submitTitle = 'Save', $submitClass = 'button pull-right')
 {
     $panel = new self($this->moduleInstance);
     $panel->setTab($index);
     $panel->setTitle($title);
     $this->title = $title;
     if ($image) {
         $panel->setImage($image);
     }
     $panel->setSubmit(array('title' => $submitTitle, 'class' => $submitClass));
     $panel->setType($type);
     return $panel;
 }
Example #29
0
 public static function create($type, DateTime $date, $amount)
 {
     $instance = new self();
     $instance->setType($type)->setDate($date)->setAmount($amount);
     return $instance;
 }
Example #30
0
 public static function create(array $data, $place = null)
 {
     if ($place == null) {
         $place = new self();
     }
     if (isset($data['name'])) {
         $place->setName($data['name']);
     }
     if (isset($data['type'])) {
         $place->setType($data['type']);
     }
     if (isset($data['active'])) {
         $place->setActive($data['active']);
     }
     if (isset($data['can_buy'])) {
         $place->setCanBuy($data['can_buy']);
     }
     if (isset($data['position']) && isset($data['position']['latitude']) && isset($data['position']['longitude'])) {
         $position = new Position($data['position']['latitude'], $data['position']['longitude']);
         $place->setPosition($position);
     }
     if (isset($data['address'])) {
         $place->setAddress(Address::create($data['address']));
     }
     if (isset($data['contact'])) {
         $contact = ContactData::create($data['contact']);
         if ($contact !== null) {
             $place->setContact($contact);
         }
     }
     if (isset($data['materials'])) {
         $place->materials = $data['materials'];
     }
     $place->date = new \DateTime();
     return $place;
 }