public function getString() { print_r($this->fs->listContents()); die; echo \TitaPHP\Helpers\DateFormatter::dateTime('2015-01-01 22:15:22') . '<br/>'; echo \TitaPHP\Helpers\DateFormatter::formatDate('2015-01-01 22:15:22', 'Y-m-d H:i') . '<br/>'; echo \TitaPHP\Helpers\NumberFormatter::currency(1652.534) . '<br/>'; echo \TitaPHP\Helpers\NumberFormatter::integer(1652.534) . '<br/>'; echo \TitaPHP\Helpers\NumberFormatter::decimal(1652.534) . '<br/>'; echo \TitaPHP\Helpers\NumberFormatter::percentage(0.26) . '<br/>'; echo '<br/>'; $this->logger->fatal("cenas e o camandro"); // print_r($this->fs->listContents()); // // // // get users from eloqoent model // foreach (User::all() as $user) { // echo "user: "******"<br/>"; // } // // // get users from db2 // $users = $app->get('Database', ['name' => 'db2'])->table('users')->get(); // foreach ($users as $user) { // echo "user: "******"<br/>"; // } return "egwewg"; }
/** * returns a string with percentage formatted accordingly to Yii dateFormatter * @param $value * @param $decimals * @return string */ public static function percentage($value, $decimals = 0) { $nf = new \NumberFormatter(\Locale::getDefault(), \NumberFormatter::PERCENT); $nf->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $decimals); return $value > 1 ? $nf->format($value) : $nf->format($value); }