You are here

public function Statistics::__construct in Filebrowser 8.2

Same name and namespace in other branches
  1. 3.x src/Statistics.php \Drupal\filebrowser\Statistics::__construct()

Statistics constructor.

Parameters

array $listing:

File

src/Statistics.php, line 16

Class

Statistics

Namespace

Drupal\filebrowser

Code

public function __construct($listing) {
  $stats = $listing['data']['stats'];
  if ($stats['folders'] > 0) {
    $this->statistics['folders'] = \Drupal::translation()
      ->formatPlural($stats['folders'], '1 folder', '@count folders');
  }
  if ($stats['files'] > 0) {
    $this->statistics['files'] = \Drupal::translation()
      ->formatPlural($stats['files'], '1 file', '@count files');
    $this->statistics['size'] = format_size($stats['size']);
  }
}