Same name in other branches
- 5.0.x advagg_mod/src/Asset/RemoveConsoleLog.php \Drupal\advagg_mod\Asset\RemoveConsoleLog
- 8.x-3.x advagg_mod/src/Asset/RemoveConsoleLog.php \Drupal\advagg_mod\Asset\RemoveConsoleLog
- 8.x-4.x advagg_mod/src/Asset/RemoveConsoleLog.php \Drupal\advagg_mod\Asset\RemoveConsoleLog
Remove console.log() calls from JavaScript Files.
Hierarchy
- class \Drupal\advagg_mod\Asset\RemoveConsoleLog
Expanded class hierarchy of RemoveConsoleLog
1 file declares its use of RemoveConsoleLog
- InitSubscriber.php dans advagg_mod/
src/ EventSubscriber/ InitSubscriber.php
2 string references to 'RemoveConsoleLog'
- advagg_mod.services.yml dans advagg_mod/
advagg_mod.services.yml - advagg_mod/advagg_mod.services.yml
- InitSubscriber::getSubscribedEvents dans advagg_mod/
src/ EventSubscriber/ InitSubscriber.php
1 service uses RemoveConsoleLog
Fichier
-
advagg_mod/
src/ Asset/ RemoveConsoleLog.php, line 8
Namespace
Drupal\advagg_mod\AssetView source
class RemoveConsoleLog {
/**
* Scan asset contents for console.log() calls and remove them.
*
* @param string $contents
* The asset contents.
*
* @return string
* The updated contents.
*/
public function optimize($contents) {
$pattern = "/ console.log(.*)/";
return preg_replace_callback($pattern, [
$this,
'removeCallback',
], $contents);
}
/**
* Remove the console.log() call.
*
* @param array $matches
* Array of matches from preg_replace_callback().
*
* @return string
* Replaced string.
*/
protected function removeCallback(array $matches) {
return '';
}
}
Members
Titre Trier par ordre décroissant | Modifiers | Object type | Résumé |
---|---|---|---|
RemoveConsoleLog::optimize | public | function | Scan asset contents for console.log() calls and remove them. |
RemoveConsoleLog::removeCallback | protected | function | Remove the console.log() call. |