Skip to content

Commit

Permalink
[TASK] Further cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer committed Sep 9, 2019
1 parent f107d79 commit 09e2c04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
11 changes: 5 additions & 6 deletions Classes/Domain/Repository/PageSpeedRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function getCacheIdentifier(string $url, string $strategy): string
* @param string $locale
* @return string
*/
protected function getResponseFromApi(string $identifier, string $strategy, string $locale = 'en')
protected function getResponseFromApi(string $identifier, string $strategy, string $locale = 'en'): string
{
$url = sprintf('https://www.googleapis.com/pagespeedonline/v4/runPagespeed?screenshot=true&url=%s&strategy=%s&locale=%s&key=%s',
rawurlencode($identifier),
Expand All @@ -108,14 +108,13 @@ protected function getResponseFromApi(string $identifier, string $strategy, stri
*/
protected function apiCall($url): string
{
// Initiate the Request Factory, which allows to run multiple requests
/** @var RequestFactory $requestFactory */
$requestFactory = GeneralUtility::makeInstance(RequestFactory::class);
$additionalOptions = [
// Additional options, see http://docs.guzzlephp.org/en/latest/request-options.html
'allow_redirects' => true,
'cookies' => false
'cookies' => false,
'force_ip_resolve' => 'v4'
];

$response = $requestFactory->request($url, 'GET', $additionalOptions);
if ($response->getStatusCode() === 200) {
$content = $response->getBody()->getContents();
Expand Down Expand Up @@ -146,7 +145,7 @@ protected function getLocale(): string
* @param string $identifier
* @return string|NULL
*/
protected function getFromCache($identifier)
protected function getFromCache($identifier): ?string
{
return $this->cache->get($identifier);
}
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Screenshot

Requirements
------------
- TYPO3 CMS 7.2+
- TYPO3 CMS 9.5+
- Google Account

Installation & Configuration
Expand Down
2 changes: 0 additions & 2 deletions Resources/Private/Templates/Main.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
{namespace core=Typo3\Cms\Core\ViewHelpers}

<div class="page-speed">
<script type="text/javascript" src="../typo3conf/ext/page_speed/Resources/Public/js/main.js"></script>

<div class="row">
<div class="col-sm-4">
<h1>{f:translate(key:'{lll}module.header')}</h1>
Expand Down

0 comments on commit 09e2c04

Please sign in to comment.