Esempio n. 1
0
 /**
  * Gets the HTML for a file
  * @param zibo\library\filesystem\File $file The file to get the HTML for
  * @return string The HTML of the file
  */
 private function getFileHtml(File $file)
 {
     $html = $this->getNameHtml($file->getName(), self::CLASS_FILE, $this->fileAction);
     $html .= '<div class="info">';
     $html .= '<span class="size">' . $this->translator->translate(self::TRANSLATION_SIZE) . ': ' . $this->formatter->formatSize($this->fileBrowser->getSize($file)) . '</span>';
     $html .= '</div>';
     return $html;
 }
Esempio n. 2
0
 /**
  * @dataProvider provideArgumentsForTestFormatSize
  */
 public function testFormatSize($value, $expected)
 {
     $result = Formatter::formatSize($value);
     $this->assertEquals($expected, $result, $value);
 }
Esempio n. 3
0
 public function logResponsePost()
 {
     $zibo = Zibo::getInstance();
     $zibo->runEvent(Zibo::EVENT_LOG, 'Response sent', '', LogItem::INFORMATION, self::LOG_NAME);
     $memoryUsage = Formatter::formatSize(memory_get_peak_usage());
     $zibo->runEvent(Zibo::EVENT_LOG, 'Maximum memory usage was ' . $memoryUsage, '', LogItem::INFORMATION, self::LOG_NAME);
 }
function smarty_modifier_formatSize($string)
{
    return Formatter::formatSize($string);
}
Esempio n. 5
0
 /**
  * Get the output string of a log item
  * @param LogItem
  */
 protected function getLogItemOutput(LogItem $item)
 {
     $output = '';
     $output = date($this->getDateFormat(), $item->getDate());
     $output .= self::FIELD_SEPARATOR . substr($item->getMicroTime(), 0, 5);
     $output .= self::FIELD_SEPARATOR . $item->getIP();
     $output .= self::FIELD_SEPARATOR . str_pad($item->getName(), 9);
     $output .= self::FIELD_SEPARATOR . str_pad(Formatter::formatSize(memory_get_usage()), 9, ' ', STR_PAD_LEFT);
     $output .= self::FIELD_SEPARATOR . $item->getType();
     $output .= self::FIELD_SEPARATOR . $item->getTitle();
     $message = $item->getMessage();
     if (!empty($message)) {
         $output .= self::FIELD_SEPARATOR . $message;
     }
     $output .= "\n";
     return $output;
 }