You are here

static function Environment::AttributeName in Realistic Dummy Content 8

Returns the attribute of a filename if one exists

If >2 periods are present in the file name, then what is between the last and next to last period is kept, for example:

a.b.c => b a.b.c.d => c a.b => NULL a => NULL

Parameters

$filename: A filename string, for example 'a.b.txt'

Return value

Null if there is attribute to extract; otherwise the attribute name, for example "b".

Throws

\Exception

File

api/src/environments/Environment.php, line 312
Define autoload class.

Class

Environment
The abstract base environment.

Namespace

Drupal\realistic_dummy_content_api\environments

Code

static function AttributeName($filename) {
  $replaced = self::Replace($filename, '\\2');
  if ($replaced != $filename) {
    return $replaced;
  }
  else {
    return NULL;
  }
}