Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #1

Merged
merged 1 commit into from
Oct 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion resources/views/body.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php if ($enabled === false) return; ?>
<?php if ($enabled === false) {
return;
} ?>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<?php echo $id; ?>"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Expand Down
4 changes: 3 additions & 1 deletion resources/views/head.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php if ($enabled === false) return; ?>
<?php if ($enabled === false) {
return;
} ?>
<!-- Google Tag Manager -->
<script>
window.dataLayer = window.dataLayer || [];
Expand Down
2 changes: 1 addition & 1 deletion src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ class Config
use Traits\CanInitFromEnviromentTrait;
use Traits\CanInitFromConfigTrait;
use Traits\HasConfigurationTrait;
}
}
6 changes: 3 additions & 3 deletions src/Config/ConfigEnv.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
interface ConfigEnv
{
const ENABLED = 'GOOGLE_TAGMANAGER_ENABLED';
public const ENABLED = 'GOOGLE_TAGMANAGER_ENABLED';

const ID = 'GOOGLE_TAGMANAGER_ID';
}
public const ID = 'GOOGLE_TAGMANAGER_ID';
}
2 changes: 1 addition & 1 deletion src/Config/Traits/AutoInitTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public static function autoInit()
}
return new static();
}
}
}
1 change: 0 additions & 1 deletion src/Config/Traits/CanInitFromEnviromentTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
trait CanInitFromEnviromentTrait
{

/**
* @return static|Config
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Config/Traits/HasConfigurationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ public function disable()
{
$this->enabled = false;
}
}
}
2 changes: 1 addition & 1 deletion src/Data/DataLayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ public function toJson()
{
return json_encode($this->data, JSON_UNESCAPED_UNICODE);
}
}
}
2 changes: 1 addition & 1 deletion src/GTManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public function __construct()
{
$this->initData();
}
}
}
3 changes: 1 addition & 2 deletions src/GoogleTagManagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
class GoogleTagManagerServiceProvider extends AbstractServiceProvider
{

/**
* Returns a boolean if checking whether this provider provides a specific
* service or returns an array of provided services if no argument passed.
Expand All @@ -42,4 +41,4 @@ function () {
}
);
}
}
}
2 changes: 1 addition & 1 deletion src/Manager/Traits/CanRenderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ protected function viewsPaths(): string
{
return dirname(dirname(dirname(__DIR__))) . '/resources/views';
}
}
}
2 changes: 1 addition & 1 deletion src/Manager/Traits/HasConfigTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ protected function populateFromConfig()
$this->setEnabled($this->config->isEnabled());
$this->setId($this->config->getId());
}
}
}
2 changes: 1 addition & 1 deletion src/Manager/Traits/HasDataTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ protected function initData()
$this->flashDataLayer = new FlashDataLayer();
$this->dataLayer = new DataLayer($this->flashDataLayer->all());
}
}
}
8 changes: 4 additions & 4 deletions tests/src/Manager/Traits/CanRenderTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function test_head()
$manager = new GTManager();
$manager->enable();
$manager->setId('GT-999');
$manager->dataSet('pageCategory','signup');
$manager->dataSet('pageCategory', 'signup');
self::assertSame("<!-- Google Tag Manager -->
<script>
window.dataLayer = window.dataLayer || [];
Expand All @@ -33,7 +33,7 @@ public function test_head()
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GT-999');</script>
<!-- End Google Tag Manager -->",$manager->head());
<!-- End Google Tag Manager -->", $manager->head());
}

public function test_body_returns_empty_not_enabled()
Expand All @@ -50,6 +50,6 @@ public function test_body()
self::assertSame('<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GT-999"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->',$manager->body());
<!-- End Google Tag Manager (noscript) -->', $manager->body());
}
}
}
2 changes: 1 addition & 1 deletion tests/src/Manager/Traits/HasConfigurationTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public function data_setEnabled(): array
[true, true],
];
}
}
}
2 changes: 1 addition & 1 deletion tests/src/Manager/Traits/HasDataTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public function test_flash()
$data = $manager->getDataLayer();
self::assertSame(['pageCategory' => 'signup'], $data->toArray());
}
}
}
1 change: 0 additions & 1 deletion tests/src/Utility/GoogleTagManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
class GoogleTagManagerTest extends AbstractTest
{

public function test_initFromEnviroment()
{
$dotenv = \Dotenv\Dotenv::createImmutable(TEST_FIXTURE_PATH, '.env.generic');
Expand Down