Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jakublech committed Sep 14, 2022
1 parent 9def21a commit 00fbd6d
Show file tree
Hide file tree
Showing 26 changed files with 50 additions and 45 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ jobs:
name: Validate composer.json
run: composer validate --ansi --strict

-
name: Run PHPUnit
run: composer phpunit

-
name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/
run: composer phpstan

-
name: Run Psalm
run: vendor/bin/psalm
run: composer psalm

-
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always
- name: Run Code Style
run: composer check-style
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to `spinbits/baselinker-sdk` will be documented in this file.
All notable changes to `spinbits/google-analytics-4-events-dto-s` will be documented in this file.

Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) principles.

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/spinbits/baselinker-sdk).
We accept contributions via Pull Requests on [Github](https://github.com/spinbits/google-analytics-4-events-dto-s).


## Pull Requests
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $purchase = new Purchase($order->getNumber());
$purchase->setShipping($order->getShippingTotal());
$purchase->setTax($order->getTaxTotal());

$purchase->addItem(new Item('item_id', 'item_name'));
$purchase->addItem(new Item('item_id', 'item_name', 1.00, 'USD'));

//get event as array
$purchase->jsonSerialize();
Expand Down Expand Up @@ -65,17 +65,17 @@ If you discover any security related issues, please email office@spinbits.io ins

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-version]: https://img.shields.io/packagist/v/spinbits/baselinker-sdk.svg?style=flat-square
[ico-version]: https://img.shields.io/packagist/v/spinbits/google-analytics-4-events-dto-s.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/spinbits/baselinker-sdk/master.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/spinbits/baselinker-sdk.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/spinbits/baselinker-sdk.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/spinbits/baselinker-sdk.svg?style=flat-square

[link-packagist]: https://packagist.org/packages/spinbits/baselinker-sdk
[link-travis]: https://travis-ci.org/spinbits/baselinker-sdk
[link-scrutinizer]: https://scrutinizer-ci.com/g/spinbits/baselinker-sdk/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/spinbits/baselinker-sdk
[link-downloads]: https://packagist.org/packages/spinbits/baselinker-sdk
[ico-travis]: https://img.shields.io/travis/spinbits/google-analytics-4-events-dto-s/master.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/spinbits/google-analytics-4-events-dto-s.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/spinbits/google-analytics-4-events-dto-s.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/spinbits/google-analytics-4-events-dto-s.svg?style=flat-square

[link-packagist]: https://packagist.org/packages/spinbits/google-analytics-4-events-dto-s
[link-travis]: https://travis-ci.org/spinbits/google-analytics-4-events-dto-s
[link-scrutinizer]: https://scrutinizer-ci.com/g/spinbits/google-analytics-4-events-dto-s/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/spinbits/google-analytics-4-events-dto-s
[link-downloads]: https://packagist.org/packages/spinbits/google-analytics-4-events-dto-s
[link-author]: https://github.com/spinbits
[link-contributors]: ../../contributors
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
}
],
"require": {
"php": "~7.4 || ^8.0"
"php": "~7.4 || ^8.0 || ^8.1"
},
"require-dev": {
"phpunit/phpunit" : ">=8.0",
"squizlabs/php_codesniffer": "^3.0",
"squizlabs/php_codesniffer": "^3.7",
"phpstan/phpstan": "^1.8",
"vimeo/psalm": "^4.27"
},
Expand All @@ -25,12 +25,14 @@
},
"autoload-dev": {
"psr-4": {
"Spinbits\\BaselinkerSdk\\Tests\\": "tests"
"Spinbits\\GoogleAnalytics4EventsDtoS\\Tests\\": "tests"
}
},
"scripts": {
"test": "phpunit",
"check-style": "phpcs src tests",
"phpstan": "phpstan analyse -c phpstan.neon -l max src/",
"psalm": "psalm",
"test": "phpunit --colors=always",
"check-style": "phpcs src",
"fix-style": "phpcbf src tests"
}
}
4 changes: 2 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="spinbits/baselinker-sdk">
<description>The coding standard of spinbits/baselinker-sdk package</description>
<ruleset name="spinbits/google-analytics-4-events-dto-s">
<description>The coding standard of spinbits/google-analytics-4-events-dto-s package</description>
<arg value="p" />

<config name="ignore_warnings_on_exit" value="1" />
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="spinbits/baselinker-sdk Test Suite">
<testsuite name="tests">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
1 change: 0 additions & 1 deletion src/Events/PostScore.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class PostScore implements \JsonSerializable, EventInterface
Expand Down
1 change: 1 addition & 0 deletions src/Events/Purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
declare(strict_types=1);

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;

use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class Purchase extends ItemsContainerEvent implements \JsonSerializable, EventInterface
Expand Down
1 change: 0 additions & 1 deletion src/Events/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class Refund implements EventInterface
Expand Down
1 change: 1 addition & 0 deletions src/Events/RemoveFromCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
declare(strict_types=1);

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;

use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class RemoveFromCart extends ItemsContainerEvent implements \JsonSerializable, EventInterface
Expand Down
1 change: 0 additions & 1 deletion src/Events/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class Search implements \JsonSerializable, EventInterface
Expand Down
1 change: 0 additions & 1 deletion src/Events/SelectContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class SelectContent implements \JsonSerializable, EventInterface
Expand Down
4 changes: 3 additions & 1 deletion src/Events/SelectItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ public function setItemListName(?string $item_list_name): SelectItem
/**
* {@inheritDoc}
*/
protected function calculate(ItemInterface $item): void{}
protected function calculate(ItemInterface $item): void
{
}
}
5 changes: 3 additions & 2 deletions src/Events/SelectPromotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\Item\Item;
use Spinbits\GoogleAnalytics4EventsDtoS\Item\ItemInterface;
use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;
Expand Down Expand Up @@ -84,5 +83,7 @@ public function setPromotionName(?string $promotion_name): SelectPromotion
/**
* @param PromotionItem|Item|ItemInterface $item
*/
protected function calculate(ItemInterface $item): void{}
protected function calculate(ItemInterface $item): void
{
}
}
1 change: 0 additions & 1 deletion src/Events/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class Share implements \JsonSerializable, EventInterface
Expand Down
1 change: 0 additions & 1 deletion src/Events/Signup.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class Signup implements \JsonSerializable, EventInterface
Expand Down
3 changes: 0 additions & 3 deletions src/Events/SpendVirtualCurrency.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class SpendVirtualCurrency implements \JsonSerializable, EventInterface
Expand Down Expand Up @@ -45,6 +44,4 @@ public function setItemName(string $item_name): SpendVirtualCurrency
$this->item_name = $item_name;
return $this;
}


}
1 change: 0 additions & 1 deletion src/Events/TutorialBegin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class TutorialBegin implements \JsonSerializable, EventInterface
Expand Down
1 change: 0 additions & 1 deletion src/Events/TutorialComplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class TutorialComplete implements \JsonSerializable, EventInterface
Expand Down
1 change: 0 additions & 1 deletion src/Events/UnlockAchievement.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;


use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class UnlockAchievement implements \JsonSerializable, EventInterface
Expand Down
1 change: 1 addition & 0 deletions src/Events/ViewCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
declare(strict_types=1);

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;

use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class ViewCart extends ItemsContainerEvent implements \JsonSerializable, EventInterface
Expand Down
1 change: 1 addition & 0 deletions src/Events/ViewItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
declare(strict_types=1);

namespace Spinbits\GoogleAnalytics4EventsDtoS\Events;

use Spinbits\GoogleAnalytics4EventsDtoS\JsonSerializeTrait;

class ViewItem extends ItemsContainerEvent implements \JsonSerializable, EventInterface
Expand Down
4 changes: 3 additions & 1 deletion src/Events/ViewItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ public function setItemListName(?string $item_list_name)
/**
* {@inheritDoc}
*/
protected function calculate(ItemInterface $item): void{}
protected function calculate(ItemInterface $item): void
{
}
}
4 changes: 3 additions & 1 deletion src/Events/ViewPromotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,7 @@ public function setPromotionName(string $promotion_name): ViewPromotion
/**
* @param PromotionItem|ItemInterface $item
*/
protected function calculate(ItemInterface $item): void{}
protected function calculate(ItemInterface $item): void
{
}
}
3 changes: 2 additions & 1 deletion src/Item/ItemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

namespace Spinbits\GoogleAnalytics4EventsDtoS\Item;

interface ItemInterface{
interface ItemInterface
{

public function getCurrency(): string;
public function getValue(): float;
Expand Down

0 comments on commit 00fbd6d

Please sign in to comment.