示例#1
0
 public function format($string, $char = null)
 {
     static $tokens = null;
     $item = $this->item();
     if (!$tokens) {
         $tokens = array('canonical_filled_slot_name' => function ($char) use($item) {
             switch ($item->filled_slots) {
                 default:
                     return 'default';
                 case item::SLOT_BOTH_HANDS:
                     return 'both_hands';
                 case item::SLOT_LEFT_HAND:
                     return 'slot_left_hand';
                 case item::SLOT_RIGHT_HAND:
                     return 'slot_right_hand';
             }
         });
     }
     text::format_tokens($tokens);
     return text::format($string, $char);
 }
 public function formatted($char = null)
 {
     return text::format($this->text, $char);
 }