HelperService
class HelperService
Service with some helpful methods that we use in different locations.
Properties
| protected DateFormatterInterface | $dateFormatter | Drupal\Core\Datetime\DateFormatterInterface definition. |
|
| protected ModuleHandlerInterface | $moduleHandler | The module handler. |
Methods
Constructs a new HelperService object.
Create a ISO8601 timestamp that Microsoft Graph API can use.
Format a ISO8601 date into something more readable.
Retrieve the API settings from the config.
Get the auth scopes string.
Generate a unix timestamp from a date.
Checks if a string contains a given substring.
Details
at line 36
__construct(DateFormatterInterface $date_formatter, ModuleHandlerInterface $moduleHandler)
Constructs a new HelperService object.
at line 50
string
createIsoDate(int $timestamp)
Create a ISO8601 timestamp that Microsoft Graph API can use.
at line 69
string
formatDate(string $date, string $timezone = 'UTC', string $format = 'd-m-Y H:i')
Format a ISO8601 date into something more readable.
at line 83
false|array
getApiConfig(string|null $config_id = 'default')
Retrieve the API settings from the config.
at line 99
string|array
getAuthScopes(O365ConnectorInterface|null $o365_connector, bool $asArray = FALSE)
Get the auth scopes string.
at line 143
string
getTsFromDate(string $date, string $timezone = 'UTC')
Generate a unix timestamp from a date.
at line 163
bool
strContains(string $haystack, string $needle)
Checks if a string contains a given substring.
PHP 8 has str_contains(), but we keep this compatible with < 8.