public function run() { DB::table('website_description')->truncate(); $des = new Description(); $des->description = "For nearly a decade, Flight Club has been the most trusted source for buying and selling the\nrarest and most coveted sneakers, worldwide. You'll find the deepest and most versatile\nselection of kicks here -- from Air Jordan to Nike to adidas to New Balance -- available to ship\nworldwide, and ready to buy at both Flight Club shops between New York and Los Angeles."; $des->save(); }
/** * @param Description $description */ public function addDescription($description) { if (!$description instanceof Description) { throw new \InvalidArgumentException("DescriptionCollection can contain only Description instances"); } $this->descriptions[$description->getLanguageId()] = $description; $this->keys[] = $description->getLanguageId(); }
public function testGeneral() { $description = new Description(); $this->assertNotEmpty($description->getGlue()); $description->clear(); $this->assertEmpty($description->getVars()); $description->add('test'); $this->assertNotEmpty($description->getVars()); $description->render(); $description->setVars(['abc', 'zyz']); $this->assertNotEmpty($description->getVars()); $this->assertNotEmpty($description->render()); }
public static function add($id, $meta) { $desc = Description::create(['id' => $id, 'name' => $meta->name, 'market_name' => $meta->market_name ?: $meta->name, 'icon_url' => $meta->icon_url, 'icon_url_large' => isset($meta->icon_url_large) ? $meta->icon_url_large : '', 'name_color' => $meta->name_color ?: '000000']); if (!empty($meta->actions)) { foreach ($meta->actions as $idx => $action) { if ($action->name == 'Inspect in Game...') { $desc->inspect_url_template = $action->link; $desc->save(); break; } } } foreach ($meta->tags as $idx => $tag_data) { $tag = Tag::find('all', array('conditions' => array('category = ? AND category_name = ? AND internal_name = ? AND name = ?', $tag_data->category, $tag_data->category_name, $tag_data->internal_name, $tag_data->name))); if (empty($tag)) { $tag = new Tag(['category' => $tag_data->category, 'category_name' => $tag_data->category_name, 'internal_name' => $tag_data->internal_name, 'name' => $tag_data->name]); if (!$tag->is_valid()) { $desc->delete(); return null; } else { $tag->save(); } } else { $tag = $tag[0]; } if ($tag_data->category == 'Rarity') { $desc->name_color = $tag_data->color; $desc->save(); } Descriptiontag::create(['description_id' => $desc->id, 'tag_id' => $tag->id]); } return $desc; }
public function itemsJSON($app) { $items = Description::find('all'); $items = array_unique(array_map(function ($desc) { return $desc->name; }, $items)); $app->output->json($items); }
public function addDescription(Description $description) { if (!$description instanceof ThingDescription) { if ($description instanceof Conjunction) { // absorb sub-conjunctions foreach ($description->getDescriptions() as $subdesc) { $this->m_descriptions[] = $subdesc; } } else { $this->m_descriptions[] = $description; } // move print descriptions downwards ///TODO: This may not be a good solution, since it does modify $description and since it does not react to future changes $this->m_printreqs = array_merge($this->m_printreqs, $description->getPrintRequests()); $description->setPrintRequests(array()); } }
function test_run_ageIsThere() { Initial::addData(); $character = Finalize::run(); $id = $character->getDescriptionId(); $description = Description::find($id); $age = $description->getAge(); $result = "21"; $this->assertEquals($age, $result); }
public function set($name, $val) { switch ($name) { case 'actions': case 'market_actions': $val = Action::fromResponseItems($val); break; case 'descriptions': $val = Description::fromResponseItems($val); } return parent::set($name, $val); }
public function __construct(Branch $branch, Category $category, Product $product, Images $image, Brand $brand, Order $order, Order_Detail $order_detail, Coupon $coupon, Users $user, Discount $discount, Banner $banner, Description $description) { $this->branch = $branch; $this->category = $category; $this->product = $product; $this->image = $image; $this->brand = $brand; $this->order = $order; $this->order_detail = $order_detail; $this->coupon = $coupon; $this->user = $user; $this->discount = $discount; $this->banner = $banner; $this->beforeFilter(function () { $this->banner_list = $this->banner->GetAllBanner(50); $this->website_description = Description::find(1); $branch_list = $this->branch->GetAllBranch(); $result = array(); foreach ($branch_list as $list) { $result[$list->name] = $this->category->GetAllCatLev1FromBranchID($list->id); } $this->result = $result; $this->listBrand = $this->brand->GetAllBrand(); $this->user_info = Session::get('user_info'); //cart $this->cart = Session::get('giay.cart'); $this->total = 0; for ($i = 0; $i < count($this->cart); $i++) { $this->total += $this->cart[$i]['total']; } //coupon $this->coupon_percentage = Session::get('giay.coupon'); if ($this->coupon_percentage != '') { $this->total_final = $this->total - $this->coupon_percentage * $this->total / 100; } else { $this->total_final = $this->total; } //coupon_code $this->coupon_code = Session::get('giay.coupon_code'); }); }
static function run() { // DESCRIPTION : $description = new Description($_SESSION['name'], $_SESSION['gender'], $_SESSION['age'], $_SESSION['alignment'], $_SESSION['height'], $_SESSION['eye_color'], $_SESSION['hair_color'], $_SESSION['skin_tone'], $_SESSION['other'], null); $description->save(); $description_id = $description->getId(); // STAT VARIABLES : $dex = $_SESSION['dex']; $dex_mod = Stat::getModifier($dex); $con = $_SESSION['con']; $con_mod = Stat::getModifier($con); $str = $_SESSION['str']; $str_mod = Stat::getModifier($str); $wis = $_SESSION['wis']; $wis_mod = Stat::getModifier($wis); $int = $_SESSION['int']; $int_mod = Stat::getModifier($int); $cha = $_SESSION['cha']; $cha_mod = Stat::getModifier($cha); $initiative = $dex_mod; // MAKES A CLASS VARIABLE, MAXHP, AC, BACKGROUND ID : if ($_SESSION['class'] == 1) { $class = "cleric"; $class_hp = 8; $class_id = 1; } elseif ($_SESSION['class'] == 2) { $class = "fighter"; $class_hp = 10; $class_id = 2; } elseif ($_SESSION['class'] == 3) { $class = "rogue"; $class_hp = 8; $class_id = 3; } elseif ($_SESSION['class'] == 4) { $class = "wizard"; $class_hp = 6; $class_id = 4; } $max_hp = $con_mod + $class_hp; $ac = 10 + $dex_mod; $proficiency_array = $_SESSION['skill']; $background_id = $_SESSION['background']; $proficiency_array = $_SESSION['skill']; $skill_ids = array(); foreach ($proficiency_array as $proficiency) { if ($proficiency == "Acrobatics") { $skill_id = 1; } elseif ($proficiency == "Animal Handling") { $skill_id = 2; } elseif ($proficiency == "Arcana") { $skill_id = 3; } elseif ($proficiency == "Athletics") { $skill_id = 4; } elseif ($proficiency == "Deception") { $skill_id = 5; } elseif ($proficiency == "History") { $skill_id = 6; } elseif ($proficiency == "Insight") { $skill_id = 7; } elseif ($proficiency == "Intimidation") { $skill_id = 8; } elseif ($proficiency == "Investigation") { $skill_id = 9; } elseif ($proficiency == "Medicine") { $skill_id = 10; } elseif ($proficiency == "Nature") { $skill_id = 11; } elseif ($proficiency == "Perception") { $skill_id = 12; } elseif ($proficiency == "Performance") { $skill_id = 13; } elseif ($proficiency == "Persuasion") { $skill_id = 14; } elseif ($proficiency == "Religion") { $skill_id = 15; } elseif ($proficiency == "Sleight of Hand") { $skill_id = 16; } elseif ($proficiency == "Stealth") { $skill_id = 17; } elseif ($proficiency == "Survival") { $skill_id = 18; } array_push($skill_ids, $skill_id); } // MAKES A RACE VARIABLE, SPEED : if ($_SESSION['race'] == 1) { $race = "human"; $speed = 30; $race_id = 1; } elseif ($_SESSION['race'] == 2) { $race = "hill dwarf"; $speed = 25; $race_id = 2; } elseif ($_SESSION['race'] == 3) { $race = "mountain dwarf"; $speed = 25; $race_id = 3; } elseif ($_SESSION['race'] == 4) { $race = "high elf"; $speed = 30; $race_id = 4; } elseif ($_SESSION['race'] == 5) { $race = "wood elf"; $speed = 35; $race_id = 5; } elseif ($_SESSION['race'] == 6) { $race = "lightfoot halfling"; $speed = 25; $race_id = 6; } elseif ($_SESSION['race'] == 7) { $race = "stout halfling"; $speed = 25; $race_id = 7; } // MAKE STAT CLASS : $stat = new Stat($ac, 1, 1, 1, 1, $cha, $con, 1, $dex, 1, $initiative, 1, $int, 1, 1, $max_hp, 1, 1, 1, 1, 1, 1, 1, $speed, 1, 1, $str, 1, $wis); $stat->save(); $stat->updateAcrobatics($proficiency_array); $stat->updateAnimalHandling($proficiency_array); $stat->updateArcana($proficiency_array); $stat->updateAthletics($proficiency_array); $stat->updateDeception($proficiency_array); $stat->updateHistory($proficiency_array); $stat->updateInsight($proficiency_array); $stat->updateIntimidation($proficiency_array); $stat->updateInvestigation($proficiency_array); $stat->updateMedicine($proficiency_array); $stat->updateNature($proficiency_array); $stat->updatePerception($proficiency_array); $stat->updatePerformance($proficiency_array); $stat->updatePersuasion($proficiency_array); $stat->updateReligion($proficiency_array); $stat->updateSleightOfHand($proficiency_array); $stat->updateStealth($proficiency_array); $stat->updateSurvival($proficiency_array); $stat_id = $stat->getId(); // CREATE CHARACTER, ADD JOINS : $character = new Character($description_id, $race_id, $stat_id); $character->save(); $character->addCharClass($class_id); $character->addBackground($background_id); foreach ($skill_ids as $id) { $character->addSkill($id); } return $character; }
function getOther() { $id = $this->getDescriptionId(); $description = Description::find($id); $other = $description->getOther(); return $other; }
static function find($search_id) { $found_description = null; $all_descriptions = Description::getAll(); foreach ($all_descriptions as $description) { $possible_id = $description->getId(); if ($possible_id == $search_id) { $found_description = $description; } } return $found_description; }
public function testNestedInlineTagEscapingSequence() { $fixture = <<<LONGDESC This is text for a description with an {@internal inline tag with literal {{@}link{} in it}. LONGDESC; $object = new Description($fixture); $this->assertSame($fixture, $object->getContents()); $parsedContents = $object->getParsedContents(); $this->assertCount(3, $parsedContents); $this->assertSame('This is text for a description with an ', $parsedContents[0]); $this->assertInstanceOf(__NAMESPACE__ . '\\Tag', $parsedContents[1]); $this->assertSame('.', $parsedContents[2]); $this->assertSame(array('inline tag with literal {@link} in it'), $parsedContents[1]->getParsedDescription()); }
/** * Describe entity * * @param Description $description * @return void */ public function describe(Description $description) { if (!$this->description->equal($description)) { $this->description = $description; } }
public final function describeTo(Description $description) { $description->appendText($this->_featureDescription)->appendText(' ')->appendDescriptionOf($this->_subMatcher); }
/** * bool update(string $tableName, Description $des) * * Update a row in a domain table. * * @param string $tableName table name of domain table to query * @param Description $des row to update * @return boolean returns false, if error occurs * @access public */ function update($tableName, $des) { if (!$des instanceof Description) { $this->_error = "Argument is an inappropriate object."; return false; } $sql = "UPDATE " . $tableName . " SET "; $sql .= "description='" . urlencode($des->getDescription()) . "' "; if ($tableName == "profile_tbl") { $sql .= "WHERE id_profile=" . $des->getCode(); } return $this->exec($sql); }
<li><a href="#detail" data-toggle="tab">Детали</a></li> <?php } ?> </ul> <!-- Tab panes --> <div class="tab-content"> <div class="tab-pane active" id="desc"> <div class="well"> <p><?php echo $meta[0]['text']; ?> </p> <p><?php echo Description::textDesc(Product::selectNameMenu($_GET['id']), $meta[0]['name'], $meta[0]['viscous']); ?> </p> </div> </div> <?php if (isset($meta[0]["attr"]) and $meta[0]["attr"]) { ?> <div class="tab-pane" id="detail"> <div class="well"> <table class="table table-bordered"> <tbody> <?php $array = unserialize($meta[0]["attr"]); foreach ($array as $key => $value) { ?>
public function describeMismatch($item, Description $description) { $description->appendText('was ')->appendValue($item); }
$starCount--; } else { echo '<img src="assets/img/star-off.png" alt="star"/>'; } } ?> </div> </footer> <div class="clear"></div> </div> </div> </div> <?php $obj2 = new Description(); //$data2 = $obj2->getDescriptionAll(); $data2 = $obj2->getDescription($_GET['id']); //print_r($data2); ?> <div class="sixcol column"> <div class="course-description widget"> <div class="widget-title"><h4 class="nomargin">Description</h4></div> <div class="widget-content"> <h4>Course Overview</h4> <p><?php echo $data2[0]->course_text; ?> </p> <h4>About the Author</h4> <p><?php
private function formatInventory($inventory, $descriptions) { $inventory_items = $inventory; $inventory_descs = $descriptions ?: null; $inventory = array(); foreach ($inventory_items as $item_id => &$item) { try { // Search for item description in DB $desc_id = $item->classid . '_' . $item->instanceid; // Remap item ids for items with multiple potential ids if (!empty(self::$ITEM_MAP[$desc_id])) { $desc_id = self::$ITEM_MAP[$desc_id]; } $desc = Description::find($desc_id); } catch (ActiveRecord\RecordNotFound $e) { // If there isn't any item information for this item and no existing // information exists, ignore this item if (empty($inventory_descs)) { $desc = null; } else { $desc = Description::add($desc_id, $inventory_descs->{$desc_id}); } } // If a tag isn't allowed, the item will not show up in the inventory if (empty($desc)) { continue; } $item->desc = $desc; $inventory[$item->id] = $item; } return $inventory; }
public function testAllowsNewLines() { $testString = "New String \n New Line"; $description = new Description($testString); $this->assertEquals(str_replace("\n", "\\n", $testString), $description->getEscapedValue()); }
<?php if (isset($_GET['id'])) { $desc = Description::textDescHead(Product::selectNameMenu($_GET['id']), $meta[0]['name'], $meta[0]['viscous']); $keyw = Description::textKeywHead(Product::selectNameMenu($_GET['id']), $meta[0]['viscous']); $title = Description::textTitleHead(Product::selectNameMenu($_GET['id']), $meta[0]['name']); } else { $desc = ""; $keyw = ""; $title = $meta[0]["title"]; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="<?php echo (isset($meta[0]["description"]) and $meta[0]["description"]) ? $meta[0]["description"] . '. ' . $desc : $desc; ?> "> <meta name="keywords" content="<?php echo (isset($meta[0]["keywords"]) and $meta[0]["keywords"]) ? $meta[0]["keywords"] . ', ' . $keyw : $keyw; ?> "> <title><?php echo $title; ?> </title> <link href="<?php echo Config::$prefix;
function test_find() { //Arrange $name = "Mike"; $gender = "male"; $age = "25"; $alignment = "LG"; $height = "6ft 1in"; $eye_color = "hazel"; $hair_color = "brown"; $skin_tone = "dark"; $other = "stuff"; $test_description = new Description($name, $gender, $age, $alignment, $height, $eye_color, $hair_color, $skin_tone, $other); $test_description->save(); $name2 = "Michael"; $gender2 = "female"; $age2 = "30"; $alignment2 = "CG"; $height2 = "6ft 1in"; $eye_color2 = "brown"; $hair_color2 = "black"; $skin_tone2 = "copper"; $other2 = "more stuff"; $test_description2 = new Description($name2, $gender2, $age2, $alignment2, $height2, $eye_color2, $hair_color2, $skin_tone2, $other2); $test_description2->save(); //Act $result = Description::find($test_description->getId()); //Assert $this->assertEquals($test_description, $result); }