You are here

public function AcsfVariableStorageMock::getMatch in Acquia Cloud Site Factory Connector 8.2

Same name and namespace in other branches
  1. 8 tests/AcsfVariableStorageMock.php \AcsfVariableStorageMock::getMatch()

Retrieves variables whose names match a substring.

Parameters

string $match: A substring that must occur in the variable name.

Return value

array An associative array holding the values of the variables, keyed by the variable names.

File

tests/AcsfVariableStorageMock.php, line 87

Class

AcsfVariableStorageMock
Mock AcsfVariableStorage class used for testing.

Code

public function getMatch($match) {
  $return = [];
  $result = $this->connection
    ->select('acsf_variables', 'v')
    ->fields('v', [
    'name',
    'value',
  ])
    ->condition('name', '%' . $match . '%', 'LIKE')
    ->execute();
  while ($record = $result
    ->fetchAssoc()) {
    $return[$record['name']] = unserialize($record['value']);
  }
  return $return;
}