public static function RealisticDummyContentEnvironment::attributeName in Realistic Dummy Content 7.2
Same name and namespace in other branches
- 8.2 api/src/includes/RealisticDummyContentEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment::attributeName()
- 3.x api/src/includes/RealisticDummyContentEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment::attributeName()
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
string $filename: A filename string, for example 'a.b.txt'.
Return value
null|string Null if there is attribute to extract; otherwise the attribute name, for example "b".
Throws
\Exception
File
- api/
src/ includes/ RealisticDummyContentEnvironment.php, line 335
Class
- RealisticDummyContentEnvironment
- The abstract base environment.
Namespace
Drupal\realistic_dummy_content_api\includesCode
public static function attributeName($filename) {
$replaced = self::replace($filename, '\\2');
if ($replaced != $filename) {
return $replaced;
}
else {
return NULL;
}
}