You are here

private function AdminSettingsForm::cleanUrl in Acquia Lift Connector 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::cleanUrl()

Clean up URL. Remove the: 1) Protocol "http://" and "http://". 2) Leading and trailing slashes and space characters.

Parameters

string $url: URL.

Return value

string URL, but cleaned up.

2 calls to AdminSettingsForm::cleanUrl()
AdminSettingsForm::buildCredentialForm in src/Form/AdminSettingsForm.php
Build credential form.
AdminSettingsForm::setCredentialValues in src/Form/AdminSettingsForm.php
Set credential values.

File

src/Form/AdminSettingsForm.php, line 549

Class

AdminSettingsForm
Defines a form that configures settings.

Namespace

Drupal\acquia_lift\Form

Code

private function cleanUrl($url) {
  $searchFor = [
    '~^[ \\t\\r\\n\\/]+~',
    '~[ \\t\\r\\n\\/]+$~',
    '~^https?://~',
  ];
  return preg_replace($searchFor, '', $url);
}