State.php in Advanced CSS/JS Aggregation 8.2
File
src/State/State.php
View source
<?php
namespace Drupal\advagg\State;
use Drupal\Core\State\State as CoreState;
abstract class State extends CoreState {
protected $pathColumn = NULL;
public function getAll() {
$values = $this->keyValueStore
->getAll();
return $values;
}
public function deleteAll() {
$this->keyValueStore
->deleteAll();
}
public function getRandomKey() {
$key = array_rand($this
->getAll());
return $key;
}
public function getRandom() {
return $this
->get($this
->getRandomKey());
}
public function clearMissingFiles() {
$removed = [];
$values = $this
->getAll();
if (empty($values)) {
return $removed;
}
if ($this->pathColumn) {
$values = array_column($values, NULL, $this->pathColumn);
}
foreach ($values as $path => $details) {
if (!file_exists($path)) {
$removed[$path] = $values[$path];
$this
->delete($path);
}
}
return $removed;
}
}
Classes
Name |
Description |
State |
Provides AdvAgg State interfaces with a few extra commands. |