<commit_before><?php

/**
 * @file
 * Print all our sites as JSON.
 */

define('THUMBNAIL_LOCATION', '/etc/kalastack/images/');
define('THUMBNAIL_BASE_URL', 'http://images.kala/');

/**
 * Converts a raw alias to a JSON-friendly, trimmed down version.
 *
 * @param string $name
 *   Name of the alias.
 * @param array $alias
 *   Entire alias array from Drush.
 *
 * @return array
 *   Optimized alias array.
 */
function convertAlias($name, $alias) {
  $converted = array(
    'aliasName' => $name,
    'webRoot' => $alias['root'],
    'uri' => $alias['uri']
  );
  if (isset($alias['built-from'])) {
    $converted['builtFrom'] = $alias['built-from'];
  }
  if (isset($alias['read-name'])) {
    $converted['name'] = $alias['read-name'];
  }
  if (isset($alias['uuid'])) {
    $converted['pantheonId'] = $alias['uuid'];
  }<commit_msg>Issue #77: Undefined root breaks aliases retrieve on Kalabox<commit_after><?php

/**
 * @file
 * Print all our sites as JSON.
 */

define('THUMBNAIL_LOCATION', '/etc/kalastack/images/');
define('THUMBNAIL_BASE_URL', 'http://images.kala/');

/**
 * Converts a raw alias to a JSON-friendly, trimmed down version.
 *
 * @param string $name
 *   Name of the alias.
 * @param array $alias
 *   Entire alias array from Drush.
 *
 * @return array
 *   Optimized alias array.
 */
function convertAlias($name, $alias) {
  $converted = array(
    'aliasName' => $name,
    'uri' => $alias['uri']
  );
  if (isset($alias['root'])) {
    $converted['webRoot'] = $alias['root'];
  }
  if (isset($alias['built-from'])) {
    $converted['builtFrom'] = $alias['built-from'];
  }
  if (isset($alias['read-name'])) {
    $converted['name'] = $alias['read-name'];
  }
  if (isset($alias['uuid'])) {
    $converted['pantheonId'] = $alias['uuid'];
  }
{'fraction_non_alphanumeric': 0.20430107526881722, 'fraction_numerical': 0.0011318619128466328, 'mean_word_length': 3.739946380697051, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4871501', 'n_tokens_mistral': 628, 'n_tokens_neox': 626, 'n_words': 140}