Skip to content

Commit

Permalink
Module init
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin-Magmodules committed Nov 3, 2021
0 parents commit 1737111
Show file tree
Hide file tree
Showing 102 changed files with 7,387 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/codesniffer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Codesniffer with the Magento Coding standard
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Run codesniffer
run: docker run --rm --volume $(pwd)/:/app/data michielgerritsen/magento-coding-standard:latest
31 changes: 31 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Lint PHP files
on: [push, pull_request]

jobs:
php-71:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'

php-72:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'

php-73:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'

php-74:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'
24 changes: 24 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: phpstan
on: pull_request

jobs:
build:
strategy:
matrix:
PHP_VERSION: [php74-fpm]
MAGENTO_VERSION: [2.4.2]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Start Docker
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }}

- name: Upload our code into the docker container
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/

- name: Install the extensions in Magento
run: docker exec magento-project-community-edition composer require magmodules/magento2-messagebird:@dev fooman/phpstan-magento2-magic-methods:^0.7

- name: Run PHPStan
run: docker exec magento-project-community-edition /bin/bash -c "./vendor/bin/phpstan analyse -c /data/extensions/*/phpstan.neon /data/extensions"
29 changes: 29 additions & 0 deletions .github/workflows/setup-di-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: setup:di:compile
on: pull_request

jobs:
build:
strategy:
matrix:
include:
- PHP_VERSION: php71-fpm
MAGENTO_VERSION: 2.3.3
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.6-p1
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Start Docker
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }}

- name: Upload our code into the docker container
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/

- name: Install the extension in Magento
run: docker exec magento-project-community-edition composer require magmodules/magento2-messagebird:@dev

- name: Run setup:di:compile
run: docker exec magento-project-community-edition php bin/magento setup:di:compile
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/*
176 changes: 176 additions & 0 deletions Api/CommunicationLog/DataInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?php
/**
* Copyright © Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magmodules\MessageBird\Api\CommunicationLog;

use Magento\Framework\Api\ExtensibleDataInterface;

/**
* Interface for communication log data model
*/
interface DataInterface extends ExtensibleDataInterface
{

/**
* ID of entity
*/
const ENTITY_ID = 'entity_id';

/**
* Increment ID of related entity
*/
const INCREMENT_ID = 'increment_id';

/**
* Customer's firstname
*/
const FIRSTNAME = 'firstname';

/**
* Customer's lastname
*/
const LASTNAME = 'lastname';

/**
* Customer's email
*/
const EMAIL = 'email';

/**
* Entity's status
*/
const STATUS = 'status';

/**
* Type of communication event
*/
const TYPE = 'type';

/**
* Entity's creation time
*/
const CREATED_AT = 'created_at';

/**
* Getter for entity_id
* @return int
*/
public function getEntityId(): int;

/**
* Setter for entity_id
* @param int $entityId
*
* @return $this
*/
public function setEntityId($entityId): self;

/**
* Getter for increment ID
*
* @return string
*/
public function getIncrementId(): string;

/**
* Setter for increment ID
* @param string $incrementId
*
* @return $this
*/
public function setIncrementId(string $incrementId): self;

/**
* Getter for firstname
*
* @return string
*/
public function getFirstname(): string;

/**
* Setter for firstname
* @param string $firstname
*
* @return $this
*/
public function setFirstname(string $firstname): self;

/**
* Getter for lastname
*
* @return string
*/
public function getLastname(): string;

/**
* Setter for lastname
* @param string $lastname
*
* @return $this
*/
public function setLastname(string $lastname): self;

/**
* Getter for email
*
* @return string
*/
public function getEmail(): string;

/**
* Setter for email
* @param string $email
*
* @return $this
*/
public function setEmail(string $email): self;

/**
* Getter for status
*
* @return int
*/
public function getStatus(): int;

/**
* Setter for status
* @param int $status
*
* @return $this
*/
public function setStatus(int $status): self;

/**
* Getter for type
*
* @return int
*/
public function getType(): int;

/**
* Setter for type
* @param int $type
*
* @return $this
*/
public function setType(int $type): self;

/**
* Getter for created_at
*
* @return string
*/
public function getCreatedAt(): string;

/**
* Setter for created_at
* @param string $createdAt
*
* @return $this
*/
public function setCreatedAt(string $createdAt): self;
}
114 changes: 114 additions & 0 deletions Api/CommunicationLog/RepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php
/**
* Copyright © Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magmodules\MessageBird\Api\CommunicationLog;

use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Interface Repository
*
*/
interface RepositoryInterface
{

/**
* Input exception text
*/
const INPUT_EXCEPTION = 'An ID is needed. Set the ID and try again.';

/**
* "No such entity" exception text
*/
const NO_SUCH_ENTITY_EXCEPTION = 'The entity with id "%1" does not exist.';
/**
* "Could not delete" exception text
*/
const COULD_NOT_DELETE_EXCEPTION = 'Could not delete the entity: %1';

/**
* "Could not save" exception text
*/
const COULD_NOT_SAVE_EXCEPTION = 'Could not save the entity: %1';

/**
* Loads a specified entity
*
* @param int $entityId
*
* @return DataInterface
* @throws LocalizedException
*/
public function get(int $entityId): DataInterface;

/**
* Return new entity object
*
* @return DataInterface
*/
public function create();

/**
* Retrieves an entities matching the specified criteria.
*
* @param SearchCriteriaInterface $searchCriteria
*
* @return SearchResultsInterface
* @throws LocalizedException
*/
public function getList($searchCriteria): SearchResultsInterface;

/**
* Register entity to delete
*
* @param DataInterface $entity
*
* @return bool true on success
* @throws LocalizedException
*/
public function delete(
DataInterface $entity
): bool;

/**
* Deletes an entity by ID
*
* @param int $entityId
*
* @return bool true on success
* @throws NoSuchEntityException
* @throws LocalizedException
*/
public function deleteById($entityId): bool;

/**
* Perform persist operations for one entity
*
* @param DataInterface $entity
*
* @return DataInterface
* @throws LocalizedException
*/
public function save(
DataInterface $entity
): DataInterface;

/**
* Check is record exists
*
* @param string $incrementId
* @param int $type
*
* @return bool
*/
public function isExists(
string $incrementId,
int $type
): bool;
}
Loading

0 comments on commit 1737111

Please sign in to comment.