Example #1
0
 /**
  * 更换phrase
  */
 public function refresh($phrase_size = 0)
 {
     if ($phrase_size) {
         $this->phrase_size = $phrase_size;
     }
     $phrase = Word::randString($this->phrase_size);
     $this->builder->setPhrase($phrase);
     return $this;
 }
Example #2
0
 public function speak($format = '%F %T')
 {
     $format = str_replace('%v', '{%w}', $format);
     $result = strftime($format, $this->getTimestamp());
     if (strpos($format, '{%w}') !== false) {
         static $weekdays = ['0' => '日', '1' => '一', '2' => '二', '3' => '三', '4' => '四', '5' => '五', '6' => '六'];
         $result = Word::replaceWith($result, $weekdays, '{', '}');
     }
     return $result;
 }
Example #3
0
 /**
  * 大写金额
  */
 public function toCapital()
 {
     if ($this->currency->getCode() !== 'CNY') {
         return;
     }
     $result = Word::spell($this->integral, true);
     $result .= '圆';
     $percent = intval($this->millesimal / 10);
     if ($percent > 0) {
         $dime = intval($percent / 10);
         $result .= Word::num2char($dime, true) . '角';
         if ($cent = intval($percent % 10)) {
             $result .= Word::num2char($caps, true) . '分';
         }
     } else {
         $result .= '整';
     }
     return $result;
 }
Example #4
0
 public static function generateSalt()
 {
     return Word::randHash(self::$salt_size);
 }
Example #5
0
 public function randString($length = 6)
 {
     $string = Word::randString($length);
     $this->app->writeln($string);
 }
Example #6
0
 function refresh()
 {
     $AB = Word::randString($this->phrase_size);
     $this->builder->setPhrase($AB);
     return $this;
 }
Example #7
0
 public static function format($message, array $context = [])
 {
     $content = is_null($message) ? '' : (string) $message;
     return Word::replaceWith($content, $context, '{', '}');
 }